Professional Documents
Culture Documents
parameters:
material like mara-matnr obligatory memory id mat,
view like t133a-auswg obligatory default '21',
mm01 radiobutton group radi,
mm02 radiobutton group radi,
show_bdc as checkbox,
showview as checkbox.
*******************
start-of-selection.
*******************
if not mm01 is initial.
w_tcode = 'MM01'. "Create view
else.
w_tcode = 'MM02'. "Change view
endif.
aktyp_tcode_mismatch =5
tcode_not_found =6
material_article_mismatch =7
others = 8.
if sy-subrc <> 0.
write: 'MATERIAL_INIT error code =', sy-subrc.
exit.
endif.
exceptions
call_wrong =1
empty_selection =2
others = 3.
if sy-subrc <> 0.
write: 'SELECTION_VIEWS_FIND error code =', sy-subrc.
exit.
endif.
* 5. Get view #:
read table it_views with key auswg = view.
if sy-subrc = 0.
w_linex = sy-tabix.
else.
write: 'View', view, 'not found'.
exit.
endif.
* 6. Prepare BDC:
if w_linex gt c_rows.
w_line = w_linex - c_rows.
f_pgdn = 'X'.
endif.
w_alnum = c_linen.
w_alnum+17(2) = w_line.
*******************
end-of-selection.
*******************
select single dytxt into w_dytxt from t133b
where spras = sy-langu
and bilds = w_bilds
and auswg = view.
if sy-subrc <> 0.
clear w_dytxt.
endif.
describe table it_views lines w_num.
write: / 'Screen sequence =', w_bilds,
/ 'Selection view', view, w_dytxt,
/ 'View Number = ', w_linex,
/ 'Selection views:', w_num.
if not showview is initial.
write: / '********* Table of views: *********'.
loop at it_views.
write / it_views.
endloop.
endif.
if not show_bdc is initial.
write: / '********* Table of BDC: *********'.
loop at i_bdc.
write / i_bdc.
endloop.
endif.
*&---------------------------------------------------------------------*
*& Form bdc_mm02
*&---------------------------------------------------------------------*
form bdc_mm02.
http://erpgenie.com/abaptips Powered by Joomla for ERPGenie.COM! Generated: 6 January, 2011, 21:20
ERPGenie.COM ABAP Tips and Tricks Database
if f_pgdn = 'X'.
perform dynpro using:
*goto Select View(s) screen
'X' 'SAPLMGMM' '0070',
*scroll down
' ' 'BDC_OKCODE' '=P+'.
endif.
*&---------------------------------------------------------------------*
*& Form bdc_mm01
*&---------------------------------------------------------------------*
form bdc_mm01.
* for example, Accounting View 1 (21)
* Selection of views
perform dynpro using:
'X' 'SAPLMGMM' '70',
' ' 'BDC_OKCODE' '=RESA', "Deselect all
'X' 'SAPLMGMM' '70'. "continue selection screen
if f_pgdn = 'X'.
http://erpgenie.com/abaptips Powered by Joomla for ERPGenie.COM! Generated: 6 January, 2011, 21:20
ERPGenie.COM ABAP Tips and Tricks Database
*---------------------------------------------------------------------*
* FORM DYNPRO *
*---------------------------------------------------------------------*
* Fills BDC data table *
*---------------------------------------------------------------------*
* --> PI_DYNBEGIN Screen start flag in *
* --> PI_NAME Field name in *
* --> PI_VALUE Field value in *
*---------------------------------------------------------------------*
form dynpro using pi_dynbegin
pi_name
pi_value.
clear i_bdc.
if pi_dynbegin = 'X'.
move: pi_name to i_bdc-program,
pi_value to i_bdc-dynpro,
'X' to i_bdc-dynbegin.
else.
move: pi_name to i_bdc-fnam,
pi_value to i_bdc-fval.
endif. "pi_dynbegin
append i_bdc.
endform. "dynpro