Skip to Content
0
Former Member
Apr 21, 2008 at 09:52 PM

Material Master BDC recording

90 Views

hi gurus,

i am trying to do a material master creation using BDC recording,

i am new i dont know how to modify the code,

the following is the code, please let me know how to make changes.

report ZTEST95

no standard page heading line-size 255.

include bdcrecx1.

parameters: dataset(132) lower case default

'C:\Documents and Settings\Deskt'

& 'op\test95.txt'.

  • DO NOT CHANGE - the generated data section - DO NOT CHANGE ***

*

  • If it is nessesary to change the data section use the rules:

  • 1.) Each definition of a field exists of two lines

  • 2.) The first line shows exactly the comment

  • '* data element: ' followed with the data element

  • which describes the field.

  • If you don't have a data element use the

  • comment without a data element name

  • 3.) The second line shows the fieldname of the

  • structure, the fieldname must consist of

  • a fieldname and optional the character '_' and

  • three numbers and the field length in brackets

  • 4.) Each field must be type C.

*

  • Generated data section with specific formatting - DO NOT CHANGE ***

data: begin of record,

  • data element: MATNR

MATNR_001(040),

  • data element: MBRSH

MBRSH_002(001),

  • data element: MTART

MTART_003(004),

  • data element: REF_MATNR

MATNR_004(040),

  • data element: XFELD

KZSEL_01_005(001),

  • data element: MAKTX

MAKTX_006(040),

  • data element: MEINS

MEINS_007(003),

  • data element: MATKL

MATKL_008(009),

  • data element: SPART

SPART_009(002),

  • data element: MTPOS_MARA

MTPOS_MARA_010(004),

  • data element: BRGEW

BRGEW_011(017),

  • data element: GEWEI

GEWEI_012(003),

  • data element: NTGEW

NTGEW_013(017),

end of record.

  • End generated data section ***

start-of-selection.

perform open_dataset using dataset.

perform open_group.

do.

read dataset dataset into record.

if sy-subrc <> 0. exit. endif.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'RMMG1-MATNR'

record-MATNR_001.

perform bdc_field using 'RMMG1-MBRSH'

record-MBRSH_002.

perform bdc_field using 'RMMG1-MTART'

record-MTART_003.

perform bdc_field using 'RMMG1_REF-MATNR'

record-MATNR_004.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

record-KZSEL_01_005.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

record-MAKTX_006.

perform bdc_field using 'MARA-MEINS'

record-MEINS_007.

perform bdc_field using 'MARA-MATKL'

record-MATKL_008.

perform bdc_field using 'MARA-SPART'

record-SPART_009.

perform bdc_field using 'MARA-MTPOS_MARA'

record-MTPOS_MARA_010.

perform bdc_field using 'BDC_CURSOR'

'MARA-BRGEW'.

perform bdc_field using 'MARA-BRGEW'

record-BRGEW_011.

perform bdc_field using 'MARA-GEWEI'

record-GEWEI_012.

perform bdc_field using 'MARA-NTGEW'

record-NTGEW_013.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction using 'MM01'.

enddo.

perform close_group.

perform close_dataset using dataset.

thanks.