Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
"Create view
"Change view
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.
* 2. Get Material type and maintenance statuses
select single matnr mtart vpsta from mara
into (w_matnr, w_mtart, w_vpsta)
where matnr = material.
if sy-subrc <> 0.
write: 'Material', material, 'not in material master'.
exit.
endif.
select single pstat from t134 into w_pstat
where mtart = w_mtart.
if sy-subrc <> 0.
write: 'Material type', w_mtart, 'not found'.
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.
if not mm01 is initial.
perform bdc_mm01.
else.
perform bdc_mm02.
endif.
*******************
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
" bdc_mm02
*&---------------------------------------------------------------------*
*&
Form bdc_mm01
*&---------------------------------------------------------------------*
form bdc_mm01.
* for example, Accounting View 1 (21)
perform dynpro using:
*goto MM01 - Create Mateial (Initial screen)
'X' 'SAPLMGMM'
'0060',
' ' 'RMMG1-MATNR' w_matnr,
' ' 'RMMG1-MBRSH' 'H',
"for example
' ' 'RMMG1-MTART' w_mtart,
*goto Select View(s) screen
' ' 'BDC_OKCODE' '=AUSW'.
* 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
"for example
" bdc_mm01
*---------------------------------------------------------------------*
*
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
http://erpgenie.com/abaptips