Skip to Content

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

BDC for ME32k giving error no bach input for 'SAPLMEKO' '0501'

Hi All there ,

I am writing BDC for ME32k transaction below code is working for one aggrement number but for second number it is giving

error no bach input for 'SAPLMEKO' '0501' pl see the following code

&----


*& Report ZMMCONTRACT1BDC *

*& *

&----


*& *

*& *

&----


REPORT ZMMCONTRACT1BDC .

DATA: BEGIN OF ITAB OCCURS 0,

EVRTN LIKE A016-EVRTN,

EVRTP LIKE A016-EVRTP,

DATAB(10), " LIKE RV13A-DATAB,

DATBI(10), " LIKE RV13A-DATBI,

KSCHL LIKE KONP-KSCHL,

KBETR LIKE KONP-KBETR,

END OF ITAB.

DATA: BEGIN OF JTAB OCCURS 0,

EVRTN LIKE A016-EVRTN,

EVRTP LIKE A016-EVRTP,

END OF JTAB.

DATA: BEGIN OF KTAB OCCURS 0,

EVRTN LIKE A016-EVRTN,

DATAB(10), " LIKE RV13A-DATAB,

DATBI(10), "LIKE RV13A-DATBI,

END OF KTAB.

DATA :BEGIN OF STAB OCCURS 0,

EVRTN LIKE A016-EVRTN,

KSCHL LIKE KONP-KSCHL,

KBETR1(14)," LIKE KONP-KBETR,

END OF STAB.

DATA: T_BDC_TAB LIKE STANDARD TABLE OF BDCDATA

INITIAL SIZE 0 WITH HEADER LINE,

SESSION LIKE APQI-GROUPID

VALUE 'CONTRACT'.

PARAMETERS : P_FILE LIKE RLGRAP-FILENAME .

DATA : P_FILE1 TYPE STRING ."LIKE RLGRAP-FILENAME .

DATA: P_FILE2 LIKE IBIPPARMS-PATH.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = 'ZMMCONTRACT1BDC'

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'P_FILE'

IMPORTING

FILE_NAME = P_FILE2.

MOVE P_FILE2 TO P_FILE.

MOVE P_FILE TO P_FILE1.

START-OF-SELECTION.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_FILE1

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = ITAB

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = SESSION

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = SY-UNAME

  • RECORD = FILLER1

  • PROG = SY-CPROG

  • IMPORTING

  • QID =

EXCEPTIONS

CLIENT_INVALID = 1

DESTINATION_INVALID = 2

GROUP_INVALID = 3

GROUP_IS_LOCKED = 4

HOLDDATE_INVALID = 5

INTERNAL_ERROR = 6

QUEUE_ERROR = 7

RUNNING = 8

SYSTEM_LOCK_ERROR = 9

USER_INVALID = 10

OTHERS = 11

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*CLEAR ITAB.

LOOP AT ITAB.

MOVE ITAB-EVRTN TO JTAB-EVRTN.

MOVE ITAB-EVRTP TO JTAB-EVRTP.

APPEND JTAB.

MOVE ITAB-EVRTN TO STAB-EVRTN.

MOVE ITAB-KSCHL TO STAB-KSCHL.

MOVE ITAB-KBETR TO STAB-KBETR1.

APPEND STAB.

MOVE ITAB-EVRTN TO KTAB-EVRTN.

MOVE ITAB-DATAB TO KTAB-DATAB.

MOVE ITAB-DATBI TO KTAB-DATBI.

APPEND KTAB.

ENDLOOP.

LOOP AT KTAB.

CLEAR T_BDC_TAB.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPMM06E' '0205',

' ' 'BDC_CURSOR' 'RM06E-EVRTN',

' ' 'RM06E-EVRTN' KTAB-EVRTN,

' ' 'BDC_OKCODE' '/00'.

LOOP AT JTAB WHERE EVRTN = KTAB-EVRTN.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPMM06E' '0220',

' ' 'RM06E-EBELP' JTAB-EVRTP,

' ' 'BDC_OKCODE' '/00'.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPMM06E' '0220',

' ' 'RM06E-TCSELFLAG(01)' 'X',

' ' 'BDC_OKCODE' '=KO'.

ENDLOOP.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPLMEKO' '0501',

' ' 'BDC_CURSOR' 'T685-KSCHL(01)',

' ' 'BDC_OKCODE' '=PICK'.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPLV14A' '0102',

' ' 'BDC_CURSOR' 'VAKE-DATAB(01)',

' ' 'BDC_OKCODE' '=PICK',

'1' 'SAPMV13A' '0201',

' ' 'RV13A-DATAB' KTAB-DATAB, "'RV13A-DATAB',

' ' 'RV13A-DATBI' KTAB-DATBI. "'RV13A-DATBI,

LOOP AT STAB WHERE EVRTN = KTAB-EVRTN.

IF STAB-KSCHL = 'PB00'.

PERFORM POPULATE_BDC_TAB USING:

' ' 'BDC_CURSOR' 'KONP-KBETR(01)',

' ' 'KONP-KBETR(01)' STAB-KBETR1.

ELSEIF STAB-KSCHL = 'ZFRC'.

PERFORM POPULATE_BDC_TAB USING:

' ' 'BDC_CURSOR' 'KONP-KBETR(02)',

' ' 'KONP-KBETR(02)' STAB-KBETR1.

ELSEIF STAB-KSCHL = 'ZFRD'.

PERFORM POPULATE_BDC_TAB USING:

' ' 'BDC_CURSOR' 'KONP-KBETR(03)',

' ' 'KONP-KBETR(03)' STAB-KBETR1.

ENDIF.

ENDLOOP.

PERFORM POPULATE_BDC_TAB USING:

' ' 'BDC_OKCODE' '/00'.

PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPMV13A' '0201',

' ' 'BDC_CURSOR' 'RV13A-DATAB',

' ' 'BDC_OKCODE' '=SICH',

*ENDLOOP.

*PERFORM POPULATE_BDC_TAB USING:

'1' 'SAPLSPO1' '0300',

' ' 'BDC_OKCODE' '=YES'.

*ENDLOOP.

*LOOP AT T_BDC_TAB.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'ME32K'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

DYNPROTAB = T_BDC_TAB

  • EXCEPTIONS

  • INTERNAL_ERROR = 1

  • NOT_OPEN = 2

  • QUEUE_ERROR = 3

  • TCODE_INVALID = 4

  • PRINTING_INVALID = 5

  • POSTING_INVALID = 6

  • OTHERS = 7

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

REFRESH:T_BDC_TAB.

ENDLOOP.

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.

  • messages into messtab.

IF SY-SUBRC = 0.

WRITE : / 'File Uploaded'.

ELSE.

WRITE : / 'Error in Upload'.

ENDIF.

&----


*& Form POPULATE_BDC_TAB

&----


  • text

----


  • -->VALUE(FLAG)text

  • -->VALUE(VAR1)text

  • -->VALUE(VAR2)text

----


FORM POPULATE_BDC_TAB USING VALUE(FLAG)

VALUE(VAR1)

VALUE(VAR2).

CLEAR T_BDC_TAB.

IF FLAG = '1'.

T_BDC_TAB-PROGRAM = VAR1. " Program Name

T_BDC_TAB-DYNPRO = VAR2. " Screen Number

T_BDC_TAB-DYNBEGIN = 'X'. " Starting of new screen

  • APPEND

ELSE.

T_BDC_TAB-FNAM = VAR1. " Field Name

T_BDC_TAB-FVAL = VAR2. " Field Value

ENDIF.

APPEND T_BDC_TAB.

ENDFORM. "POPULATE_BDC_TAB

Points assured

Regards

Sagar

Former Member
Former Member replied

Hi

This is where it is not picking up the second number right??::

PERFORM POPULATE_BDC_TAB USING:
'1' 'SAPLMEKO' '0501',
' ' 'BDC_CURSOR' 'T685-KSCHL(01)',
' ' 'BDC_OKCODE' '=PICK'.

PERFORM POPULATE_BDC_TAB USING:
'1' 'SAPLV14A' '0102',
' ' 'BDC_CURSOR' 'VAKE-DATAB(01)',
' ' 'BDC_OKCODE' '=PICK',

I think here you have to use the Table Control concept in BDC to get it working.

[Sample Code for BDC Table Control|http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm]

Also, with the search term Table Control..you would get lot of results in ABAP general forum.

Regards,

Vishwa.

Edited by: vishwa sri hari on Sep 29, 2008 10:49 AM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question