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

problem in BDC mm01

Former Member
0 Likes
785

Am creating bdc program for mm01 using call transaction method.. when i give 'A' mode the data will not populate into the corresponding screen... only first screen and view only working after that plant and corresponding screens field not populate data.....

while i debug that program the data from flat file is populate to internal table and corresponding data also populate to BDCDATA internal table......

only the problem beging in while transferring of data to corresponding fields......

Edited by: partha sarathi on Jun 26, 2008 2:34 PM

Am creating bdc program for mm01 using call transaction method.. when i give 'A' mode the data will not populate into the corresponding screen... only first screen and view only working after that plant and corresponding screens field not populate data.....

while i debug that program the data from flat file is populate to internal table and corresponding data also populate to BDCDATA internal table......

only the problem beging in while transferring of data to corresponding fields......

Edited by: partha sarathi on Jun 26, 2008 2:34 PM

5 REPLIES 5
Read only

Former Member
0 Likes
755

Hi parthu,

i think. are you transfering or copying the data .

if your case is copying its better to go with bapi

see this url

http://www.sap-img.com/abap/bapi-to-copy-materials-from-one-plant-to-another.htm

happy solving.

thanks

karthik

reply me if ur problem not solved.

Read only

0 Likes
755

Hi karthick...

Am not copying just am uploading material master data into sap system..

Read only

0 Likes
755

Hi parthu,

tell exactly what you want. so that i can give you exact solution..

thanks

karthik

Read only

0 Likes
755

&----


*& Report ZFERT_DUMMY *

*& *

&----


*& *

*& *

&----


report ZFERT_DUMMY

no standard page heading line-size 255.

*include bdcrecx1.

TYPES: BEGIN OF ST_MM01,

MATNR(20) TYPE C,

MBRSH(10) TYPE C,

MTART(10) TYPE C,

WERKS(10) TYPE C,

LGORT(10) TYPE C,

VKORG(10) TYPE C,

VTWEG(10) TYPE C,

MAKTX(30) TYPE C,

MEINS(10) TYPE C,

MATKL(10) TYPE C,

SPART(10) TYPE C,

KOSCH(10) TYPE C,

PRDHA(10) TYPE C,

MTPOS_MARA(10) TYPE C,

BRGEW(10) TYPE C,

GEWEI(10) TYPE C,

NTGEW(10) TYPE C,

DWERK(10) TYPE C,

SKTOF(10) TYPE C,

TAXKM_01(10) TYPE C,

TAXKM_02(10) TYPE C,

SCMNG(10) TYPE C,

KTGRM(10) TYPE C,

TRAGR(10) TYPE C,

LADGR(10) TYPE C,

DISPO(10) TYPE C,

DISLS(10) TYPE C,

RGEKZ(10) TYPE C,

DZEIT(10) TYPE C,

FHORI(10) TYPE C,

STRGR(10) TYPE C,

SBDKZ(10) TYPE C,

LGPRO(10) TYPE C,

SFCPF(10) TYPE C,

BKLAS(10) TYPE C,

VPRSV(10) TYPE C,

PEINH(10) TYPE C,

EKALR(10) TYPE C,

HKMAT(10) TYPE C,

AWSLS(10) TYPE C,

LOSGR(10) TYPE C,

END OF ST_MM01.

TYPES : BEGIN OF st_error,

field(40) TYPE c,

discp(255) TYPE c,

END OF st_error.

DATA : it_MM01 TYPE TABLE OF st_MM01,

wa_MM01 TYPE st_MM01,

it_e_MM01 TYPE TABLE OF st_MM01,

wa_e_MM01 TYPE st_MM01,

it_error TYPE TABLE OF st_error,

wa_error TYPE st_error.

DATA : bdcdata1 LIKE bdcdata OCCURS 0 WITH HEADER LINE,

it_msgs LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,

txt(100) TYPE c,

fstring1 TYPE string,

fstring2 TYPE string,

fstring3 TYPE string.

PARAMETERS : filename TYPE rlgrap-filename,

errfile TYPE rlgrap-filename

DEFAULT 'D:\BPTL_ABAP\MM01_ERRFILE.TXT',

errdisc TYPE rlgrap-filename

DEFAULT 'D:\BPTL_ABAP\MM01_ERRDISC.TXT',

dismode1 LIKE ctu_params-dismode DEFAULT 'A',

updmode1 LIKE ctu_params-updmode DEFAULT 'S'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR errfile.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = errfile.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR errdisc.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

file_name = errdisc.

start-of-selection.

fstring1 = filename.

fstring2 = errfile.

fstring3 = errdisc.

PERFORM get_flatfile.

start-of-selection.

*perform open_group.

LOOP AT it_MM01 INTO wa_MM01.

REFRESH bdcdata1.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MTART'.

perform bdc_field using 'BDC_OKCODE'

'=AUSW'.

perform bdc_field using 'RMMG1-MATNR' WA_MM01-MATNR .

  • 'FERT_DUMMY'.

perform bdc_field using 'RMMG1-MBRSH' WA_MM01-MBRSH.

  • 'M'.

perform bdc_field using 'RMMG1-MTART' WA_MM01-MTART.

  • 'FERT'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(15)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(02)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(04)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(05)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(06)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(12)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(13)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(14)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(15)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(07)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(07)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(13)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(14)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(16)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '0080'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-VTWEG'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'RMMG1-WERKS' WA_MM01-WERKS.

  • '1000'.

perform bdc_field using 'RMMG1-LGORT' WA_MM01-LGORT.

  • '0001'.

perform bdc_field using 'RMMG1-VKORG' WA_MM01-VKORG.

  • '1000'.

perform bdc_field using 'RMMG1-VTWEG' WA_MM01-VTWEG.

  • '10'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX' WA_MM01-MAKTX.

  • 'DEMO'.

perform bdc_field using 'MARA-MEINS' WA_MM01-MEINS.

  • 'EA'.

perform bdc_field using 'MARA-MATKL' WA_MM01-MATKL.

  • '001'.

perform bdc_field using 'MARA-SPART' WA_MM01-SPART.

  • '10'.

perform bdc_field using 'MARA-KOSCH' WA_MM01-KOSCH.

  • 'BULBS'.

perform bdc_field using 'MARA-PRDHA' WA_MM01-PRDHA.

  • '00100'.

perform bdc_field using 'MARA-MTPOS_MARA' WA_MM01-MTPOS_MARA.

  • 'NORM'.

perform bdc_field using 'BDC_CURSOR'

'MARA-NTGEW'.

perform bdc_field using 'MARA-BRGEW' WA_MM01-BRGEW.

  • '100'.

perform bdc_field using 'MARA-GEWEI' WA_MM01-GEWEI.

  • 'kg'.

perform bdc_field using 'MARA-NTGEW' WA_MM01-NTGEW.

  • '80'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_field using 'MARA-SPART'

'10'.

perform bdc_field using 'MVKE-DWERK' WA_MM01-DWERK.

  • '1000'.

perform bdc_field using 'MARA-MATKL'

'001'.

perform bdc_field using 'MVKE-SKTOF' WA_MM01-SKTOF.

  • 'X'.

perform bdc_field using 'BDC_CURSOR'

'MG03STEUER-TAXKM(02)'.

perform bdc_field using 'MG03STEUER-TAXKM(01)' WA_MM01-TAXKM_01.

  • '0'.

perform bdc_field using 'MG03STEUER-TAXKM(02)' WA_MM01-TAXKM_02.

  • '0'.

perform bdc_dynpro using 'SAPLMGMM' '4200'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_field using 'MARA-SPART'

'10'.

perform bdc_field using 'MVKE-DWERK'

'1000'.

perform bdc_field using 'MARA-MATKL'

'001'.

perform bdc_field using 'MVKE-SKTOF'

'X'.

perform bdc_field using 'BDC_CURSOR'

'MVKE-SCMNG'.

perform bdc_field using 'MVKE-SCMNG' WA_MM01-SCMNG.

  • '1'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'BDC_CURSOR'

'MVKE-KTGRM'.

perform bdc_field using 'MVKE-KTGRM' WA_MM01-KTGRM.

  • '01'.

perform bdc_field using 'MARA-MTPOS_MARA'

'NORM'.

perform bdc_field using 'MVKE-MTPOS'

'NORM'.

perform bdc_field using 'MVKE-PRODH'

'00100'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_field using 'MARA-BRGEW'

'100'.

perform bdc_field using 'MARA-GEWEI'

'KG'.

perform bdc_field using 'MARA-NTGEW'

'80'.

perform bdc_field using 'MARC-MTVFP'

'01'.

perform bdc_field using 'BDC_CURSOR'

'MARC-LADGR'.

perform bdc_field using 'MARA-TRAGR' WA_MM01-TRAGR.

  • '0001'.

perform bdc_field using 'MARC-LADGR' WA_MM01-LADGR.

  • '0001'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_field using 'MARC-DISGR'

'0031'.

perform bdc_field using 'MARC-DISMM'

'pd'.

perform bdc_field using 'MARC-DISPO' WA_MM01-DISPO.

  • '000'.

perform bdc_field using 'BDC_CURSOR'

'MARC-DISLS'.

perform bdc_field using 'MARC-DISLS' WA_MM01-DISLS.

  • 'ex'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARC-BESKZ'

'X'.

perform bdc_field using 'MARC-RGEKZ' WA_MM01-RGEKZ.

  • '1'.

perform bdc_field using 'BDC_CURSOR'

'MARC-FHORI'.

perform bdc_field using 'MARC-DZEIT' WA_MM01-DZEIT.

  • '10'.

perform bdc_field using 'MARC-FHORI' WA_MM01-FHORI.

  • '000'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARC-PERKZ'

'M'.

perform bdc_field using 'BDC_CURSOR'

'MARC-STRGR'.

perform bdc_field using 'MARC-STRGR' WA_MM01-STRGR.

  • '20'.

perform bdc_field using 'MARC-MTVFP'

'01'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'BDC_CURSOR'

'MARC-SBDKZ'.

perform bdc_field using 'MARC-SBDKZ' WA_MM01-SBDKZ.

  • '1'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'BDC_CURSOR'

'MARC-SFCPF'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_field using 'MARC-LGPRO' WA_MM01-LGPRO.

  • '0001'.

perform bdc_field using 'MARC-SFCPF' WA_MM01-SFCPF.

  • '000001'.

perform bdc_field using 'MARC-DZEIT'

'10'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_field using 'MARA-SPART'

'10'.

perform bdc_field using 'BDC_CURSOR'

'MBEW-PEINH'.

perform bdc_field using 'MBEW-BKLAS' WA_MM01-BKLAS.

  • '7920'.

perform bdc_field using 'MBEW-VPRSV' WA_MM01-VPRSV.

  • 'S'.

perform bdc_field using 'MBEW-PEINH' WA_MM01-PEINH.

  • '1'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX'

'DEMO'.

perform bdc_field using 'MARA-MEINS'

'EA'.

perform bdc_field using 'MBEW-EKALR' WA_MM01-EKALR.

  • 'X'.

perform bdc_field using 'MBEW-HKMAT' WA_MM01-HKMAT.

  • 'X'.

perform bdc_field using 'MARC-AWSLS' WA_MM01-AWSLS.

  • '000001'.

perform bdc_field using 'BDC_CURSOR'

'MARC-LOSGR'.

perform bdc_field using 'MARC-LOSGR' WA_MM01-LOSGR.

  • '1'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

*perform bdc_transaction using 'MM01'.

CALL TRANSACTION 'MM01' USING bdcdata1

MODE dismode1

UPDATE updmode1

MESSAGES INTO it_msgs.

PERFORM error_messages.

endloop.

PERFORM download_messages.

*perform close_group.

&----


*& Form get_flatfile

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_flatfile .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = fstring1

filetype = 'ASC'

has_field_separator = '#'

TABLES

data_tab = it_MM01

EXCEPTIONS

file_open_error = 1

file_read_error = 2

OTHERS = 3.

IF sy-subrc = 1.

MESSAGE e001(zbkmsg).

ELSEIF sy-subrc = 2.

MESSAGE e002(zbkmsg).

ELSEIF sy-subrc = 1.

MESSAGE e003(zbkmsg).

ENDIF.

endform. " get_flatfile

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0346 text

  • -->P_0347 text

----


form bdc_dynpro using program dynpro.

CLEAR bdcdata1.

bdcdata1-program = program.

bdcdata1-dynpro = dynpro.

bdcdata1-dynbegin = 'X'.

APPEND bdcdata1.

endform. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0351 text

  • -->P_0352 text

----


form bdc_field using fnam fval.

CLEAR bdcdata1.

bdcdata1-fnam = fnam.

bdcdata1-fval = fval.

APPEND bdcdata1.

endform. " bdc_field

&----


*& Form error_messages

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form error_messages .

READ TABLE it_msgs.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = it_msgs-msgid

lang = it_msgs-msgspra

no = it_msgs-msgnr

v1 = it_msgs-msgv1

v2 = it_msgs-msgv2

v3 = it_msgs-msgv3

v4 = it_msgs-msgv4

IMPORTING

msg = txt.

IF it_msgs-msgtyp = 'E'

OR it_msgs-msgtyp = 'I'

OR it_msgs-msgtyp = 'W'.

wa_e_MM01-MATNR = wa_MM01-MATNR.

wa_e_MM01-MBRSH = wa_MM01-MBRSH.

wa_e_MM01-MTART = wa_MM01-MTART.

wa_e_MM01-MAKTX = wa_MM01-MAKTX.

wa_e_MM01-MEINS = wa_MM01-MEINS.

APPEND wa_e_MM01 TO it_e_MM01 .

wa_error-field = wa_MM01-MATNR.

wa_error-discp = txt.

APPEND wa_error TO it_error.

ENDIF.

REFRESH it_msgs.

CLEAR it_msgs.

endform. " error_messages

&----


*& Form download_messages

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form download_messages .

LOOP AT it_error INTO wa_error.

WRITE : / wa_error-field,wa_error-discp.

ENDLOOP.

LOOP AT it_E_MM01 INTO wa_e_MM01.

WRITE:/ wa_e_MM01-MATNR,

wa_e_MM01-MBRSH,

wa_e_MM01-MTART,

wa_e_MM01-MAKTX,

wa_e_MM01-MEINS.

ENDLOOP.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = fstring2

filetype = 'ASC'

  • APPEND = ' '

write_field_separator = '#'

TABLES

data_tab = it_e_MM01.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = fstring3

filetype = 'ASC'

  • APPEND = ' '

write_field_separator = '#'

TABLES

data_tab = it_error.

endform. " download_messages

Read only

0 Likes
755

This is my coding .. when i give 'A' mode the data will not populate into the corresponding screen... only first screen and view only working after that plant and corresponding screens field not populate data.....

while i debug that program the data from flat file is populate to internal table and corresponding data also populate to BDCDATA internal table......

only the problem beging in while transferring of data to corresponding fields......