Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

MM02 - MRP1 view

Hi,

I have written a BDC to change DISMM, MINBE, DISLS, MABST fields of MRP view with the transaction MM02.

My flatfile is having 4 records to upload, When I process the session, loop is running for the first record for 4 times.

After the completion of the session, When I cross verify in the MM03 transaction,

only first record got changed, not the remaining 3 records in the flat file!

data: begin of it_mrp occurs 0,

MATNR like RMMG1-MATNR,

WERKS like RMMG1-WERKS,

MAKTX like MAKT-MAKTX,

DISMM like MARC-DISMM,

MINBE(13) type c,

DISLS like MARC-DISLS,

MABST(13) type c,

end of it_mrp.

data bdctab like bdcdata occurs 0 with header line.

*include bdcrecx1.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:\MRP7.TXT'

FILETYPE = 'DAT'

TABLES

data_tab = it_mrp.

start-of-selection.

perform open_group.

loop at it_mrp.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'=AUSW'.

perform bdc_field using 'RMMG1-MATNR' it_mrp-matnr.

  • '1087'.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(06)'.

perform bdc_field using 'BDC_OKCODE'

'=SCHL'.

perform bdc_field using 'MSICHTAUSW-KZSEL(06)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '0080'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-WERKS'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'RMMG1-WERKS' it_mrp-werks.

  • '1000'.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'MAKT-MAKTX' it_mrp-maktx.

  • 'Connecting Rod'.

*perform bdc_field using 'MARA-MEINS'

  • 'PC'.

*perform bdc_field using 'MARC-DISGR'

  • 'PP01'.

perform bdc_field using 'MARC-DISMM' it_mrp-dismm.

  • 'V1'.

perform bdc_field using 'MARC-MINBE' it_mrp-minbe.

  • '1'.

*perform bdc_field using 'MARC-DISPO'

  • '000'.

perform bdc_field using 'BDC_CURSOR'

'MARC-MABST'.

perform bdc_field using 'MARC-DISLS' it_mrp-disls.

  • 'HB'.

perform bdc_field using 'MARC-MABST' it_mrp-mabst.

  • '5'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

perform bdc_transaction.

endloop.

perform close_group.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCTAB.

BDCTAB-PROGRAM = PROGRAM.

BDCTAB-DYNPRO = DYNPRO.

BDCTAB-DYNBEGIN = 'X'.

APPEND BDCTAB.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

  • IF FVAL <> NODATA.

CLEAR BDCTAB.

BDCTAB-FNAM = FNAM.

BDCTAB-FVAL = FVAL.

APPEND BDCTAB.

  • ENDIF.

ENDFORM.

&----


*& Form open_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form open_group .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

GROUP = 'MRPTYPE'

HOLDDATE = sy-datum

KEEP = 'X'

USER = sy-uname.

endform. " open_group

&----


*& Form bdc_transaction

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form bdc_transaction .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'MM02'

TABLES

dynprotab = BDCTAB.

endform. " bdc_transaction

&----


*& Form close_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form close_group .

CALL FUNCTION 'BDC_CLOSE_GROUP'.

IF SY-SUBRC = 0.

MESSAGE S101(ZKC_MSGCLS).

ENDIF.

endform. " close_group

Thanks in advance,

KC

Former Member
replied

Hi,

Please try this.

...

loop at it_mrp.
   clear bdctab.         "Add here
   refresh bdctab.       "Add here

   ...
endloop.

Regards,

Ferry Lianto

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question