Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Material Master BDC recording

Former Member
0 Likes
1,433

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.

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.

2 REPLIES 2
Read only

Former Member
0 Likes
878

Hi,

Please go through the below link.Here there is step by step procedure to upload material master data.

http://www.saptechnical.com/Tutorials/LSMW/MMRecording/Page1.htm

Reward if useful.

Regards,

Swetha.

Read only

Former Member
0 Likes
878

Hi,

It is better if the Material Master creation step is done by LSMW - Direct Input method with the following object:

Object               0020   Material master
Method               0000                  
Program name         RMDATIND              
Program type         D   Direct input

Check the program documentation for more details.

For a sample data file generation ( Sequential file ), check the program RMDATGEN

If the reqmt., is for a repetetive loading of Material Master you could schedule / execute the LSMW by following program: /SAPDMC/SAP_LSMW_INTERFACE.

Hope this helps.

Best Regards, Murugesh