report zmm_batch_bdc_002 .
parameters:
t_matnr like mcha-matnr,
t_werks like mcha-werks,
t_charg like mcha-charg,
t_class like klah-class default ''.
data:begin of bdctab occurs 100 .
include structure bdcdata .
data:end of bdctab.
data:begin of messtab occurs 0.
include structure bdcmsgcoll.
data:end of messtab.
perform. bdc_dynpro using 'SAPMM03S' '0105'.
perform. bdc_field using 'BDC_OKCODE'
'/00'.
perform. bdc_field using 'BDC_CURSOR'
'RM03S-MATNR'.
perform. bdc_field using 'RM03S-MATNR'
t_matnr.
perform. bdc_field using 'RM03S-WERKS'
t_werks.
perform. bdc_field using 'RM03S-CHARG'
t_charg.
perform. bdc_dynpro using 'SAPMM03S' '0200'.
perform. bdc_field using 'BDC_CURSOR'
'MCHA-VERAB'.
perform. bdc_field using 'BDC_OKCODE'
'=CLAS'.
perform. bdc_dynpro using 'SAPLCLFM' '0500'.
perform. bdc_field using 'BDC_CURSOR'
'RMCLF-CLASS(01)'.
perform. bdc_field using 'BDC_OKCODE'
'/00'.
perform. bdc_field using 'RMCLF-CLASS(01)'
t_class.
perform. bdc_dynpro using 'SAPLCTMS' '0109'.
perform. bdc_field using 'BDC_CURSOR'
'RCTMS-MNAME(01)'.
perform. bdc_field using 'BDC_OKCODE'
'=BACK'.
perform. bdc_dynpro using 'SAPLCLFM' '0500'.
perform. bdc_field using 'BDC_CURSOR'
'RMCLF-CLASS(01)'.
perform. bdc_field using 'BDC_OKCODE'
'=ENDE'.
perform. bdc_dynpro using 'SAPMM03S' '0200'.
perform. bdc_field using 'BDC_CURSOR'
'MCHA-VERAB'.
perform. bdc_field using 'BDC_OKCODE'
'=BU'.
call transaction 'MSC2' using bdctab
mode 'N' update 'S'
messages into messtab.
*---------------------------------------------------------------------*
* FORM. bdc_dynpro *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> PROGRAM *
* --> DYNPRO *
*---------------------------------------------------------------------*
form. bdc_dynpro using program dynpro.
clear bdctab.
bdctab-program = program.
bdctab-dynpro = dynpro.
bdctab-dynbegin = 'X'.
append bdctab.
endform.
*---------------------------------------------------------------------*
* FORM. bdc_field *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> FNAM *
* --> FVAL *
*---------------------------------------------------------------------*
form. bdc_field using fnam fval.
clear bdctab.
bdctab-fnam = fnam.
bdctab-fval = fval.
append bdctab.
endform.