Skip to Content
0
Former Member
Jul 15, 2013 at 07:46 AM

some problems in my bdc program for mm02

192 Views

records are not changing in mm02 after successfull execution of my following program-->

report ZBDCNEWMM02

no standard page heading line-size 255.

DATA: BEGIN OF it_data OCCURS 0,

MATNR TYPE MARA-MATNR,

DESC TYPE MAKT-MAKTX,

END OF IT_DATA.

DATA IT_BDCDATA TYPE STANDARD TABLE OF BDCDATA WITH HEADER LINE.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'D:\BDC.TXT'

HAS_FIELD_SEPARATOR = 'X'

TABLES

data_tab = IT_DATA[].

IF sy-subrc <> 0.

ENDIF.

perform open_group.

LOOP AT IT_DATA.

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'

IT_DATA-MATNR.

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)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BDC_CURSOR'

'MAKT-MAKTX'.

perform bdc_field using 'MAKT-MAKTX'

IT_DATA-DESC.

perform bdc_transaction using 'MM02'.

ENDLOOP.

perform close_group.

*&---------------------------------------------------------------------*

*& Form OPEN_GROUP

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM OPEN_GROUP .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'SESSION'

KEEP = 'X'

USER = SY-UNAME.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " ZOPEN_GROUP

*&---------------------------------------------------------------------*

*& Form BDC_DYNPRO

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_0057 text

* -->P_0058 text

*----------------------------------------------------------------------*

FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR IT_BDCDATA.

IT_BDCDATA-PROGRAM = PROGRAM.

IT_BDCDATA-DYNPRO = DYNPRO.

IT_BDCDATA-DYNBEGIN = 'X'.

APPEND IT_BDCDATA.

ENDFORM. " BDC_DYNPRO

*&---------------------------------------------------------------------*

*& Form BDC_FIELD

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_0062 text

* -->P_0063 text

*----------------------------------------------------------------------*

FORM BDC_FIELD USING FLDNAM FLDVAL.

CLEAR IT_BDCDATA.

IT_BDCDATA-FNAM = FLDNAM.

IT_BDCDATA-FVAL = FLDVAL.

APPEND IT_BDCDATA.

ENDFORM. " BDC_FIELD

*&---------------------------------------------------------------------*

*& Form BDC_TRANSACTION

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_0117 text

*----------------------------------------------------------------------*

FORM BDC_TRANSACTION USING TCOD.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'MM02'

TABLES

DYNPROTAB = IT_BDCDATA[].

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " BDC_TRANSACTION

*&---------------------------------------------------------------------*

*& Form CLOSE_GROUP

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM CLOSE_GROUP .

CALL FUNCTION 'BDC_CLOSE_GROUP'

* EXCEPTIONS

* NOT_OPEN = 1

* QUEUE_ERROR = 2

* OTHERS = 3

.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " CLOSE_GROUP