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

BDC Session method

Former Member
0 Likes
666

Hi Experts,

I have created bdc program for xk01, it is executing fine when the flat file containing 5 records

if i modified to 10 records ..it is not uploading..whta are the fields after the abnk details are not uploading

please give me some advises...

Thanks...

4 REPLIES 4
Read only

Sm1tje
Active Contributor
0 Likes
616

really not enough info to help you out. Seems that something is wrong with your input file. Did you manipulate the data manually from 5 to 10 records? Added a carriage return or something which causes the file opening error? Tell in more detail what the problem is, when it is caused, what the program 'says' (error message) etc.

Read only

Former Member
0 Likes
616

HI,

First Check the Internal Table in the Debugging mode, whether it contains all the records which you have passed in the flatfile.

Check the FM which you are using to convert the Flatfile to Internal Table.

Regards,

Sathish.

Read only

Former Member
0 Likes
616

Hey as suggested by Satish, you can check how many entries are coming through from the flat file into the internal table by the function module you are using.

Then you can check the loop on this internal table where you are trying to create the vendors through BDC and have the okcode for BACK after the endloop on the internal table.

Let me know if this helps.

Thanks

Subha

Read only

Former Member
0 Likes
616
  • Update Source List by Material Group

  • Blocking / Unblocking the Vendor

  • The Vendor code is retrieve from the Purchasing Info Record

***********************************************************************

REPORT ZSOURCE.

TABLES: EORD,

EINA,

MARC.

  • Batch Input Name

PARAMETERS P-BTCHSN(12) DEFAULT 'ME01'.

  • Vendor Code

PARAMETERS P-LIFNR LIKE LFA1-LIFNR DEFAULT 'XXXXX'.

  • Material Group

PARAMETERS P-MATKL LIKE MARA-MATKL DEFAULT 'XXXXXXX'.

  • Plants

PARAMETERS P-WERKS LIKE EORD-WERKS DEFAULT 'XX'.

  • Tick Block/Untick Unblock

PARAMETERS P-NOTKZ LIKE EORD-NOTKZ DEFAULT 'X'.

  • Auto / Manual run the Batch Input Program

PARAMETERS P-RUN AS CHECKBOX DEFAULT 'X'.

  • INTERNAL TABLE FOR DATA

DATA: BEGIN OF ULTAB OCCURS 50,

MATNR LIKE EORD-MATNR, "Material No.

WERKS LIKE EORD-WERKS, "Plants

ZEORD LIKE EORD-ZEORD, "NO

LIFNR LIKE EINA-LIFNR, "Vendor Code

END OF ULTAB.

  • INTERNAL TABLE FOR BATCH INPUT DATA

DATA: BEGIN OF IPUTTAB OCCURS 50.

INCLUDE STRUCTURE BDCDATA.

DATA: END OF IPUTTAB.

  • INTERNAL TABLE FOR BATCH INPUT ERROR MESSAGE.

DATA: BEGIN OF MESSTAB OCCURS 50.

INCLUDE STRUCTURE BDCMSGCOLL.

DATA: END OF MESSTAB.

DATA: C_TAXKM LIKE MG03STEUER-TAXKM VALUE '1',

W-LINE-NO TYPE I.

REFRESH ULTAB.

SELECT * FROM EINA WHERE LIFNR = P-LIFNR

AND LOEKZ = SPACE.

SELECT SINGLE * FROM MARC WHERE MATNR = EINA-MATNR

AND WERKS = P-WERKS.

CHECK MARC-LVORM = SPACE.

CLEAR ULTAB.

SELECT * FROM EORD WHERE MATNR = EINA-MATNR

AND WERKS = P-WERKS

AND LIFNR = P-LIFNR.

ULTAB-MATNR = EORD-MATNR.

ULTAB-WERKS = EORD-WERKS.

ULTAB-ZEORD = EORD-ZEORD.

ULTAB-LIFNR = EORD-LIFNR.

APPEND ULTAB.

ENDSELECT.

IF SY-SUBRC = 4.

ULTAB-MATNR = EINA-MATNR.

ULTAB-WERKS = P-WERKS.

ULTAB-ZEORD = ''.

ULTAB-LIFNR = EINA-LIFNR.

APPEND ULTAB.

ENDIF.

ENDSELECT.

  • CHECK WHETHER TABLE IS EMPTY

IF ULTAB[] is initial.

WRITE: / 'TABLE EMPTY'.

ENDIF.

  • Create Batch session

PERFORM CRE-BATCH-SESS.

    • LOOP TABLE TO CREATE SCREEN INPUT

SORT.

LOOP AT ULTAB.

REFRESH IPUTTAB.

PERFORM SCREEN1.

PERFORM SCREEN2.

PERFORM PRN_ULTAB.

PERFORM CLOSE-SESS.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

  • END OF MAIN PROGRAM

FORM SCREEN1.

  • SCREEN #1: INITAL SCREEN FOR MAINTAINING SOURCE LIST

CLEAR IPUTTAB.

IPUTTAB-PROGRAM = 'SAPLMEOR'.

IPUTTAB-DYNPRO = '200'.

IPUTTAB-DYNBEGIN = 'X'.

APPEND IPUTTAB.

  • Source List : Material No.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-MATNR'.

IPUTTAB-FVAL = ULTAB-MATNR.

APPEND IPUTTAB.

  • Source List : Plants.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-WERKS'.

IPUTTAB-FVAL = ULTAB-WERKS.

APPEND IPUTTAB.

ENDFORM.

  • FORM : SCREEN1 *

FORM SCREEN2.

  • Modify screen for SOURCE LIST

CLEAR IPUTTAB.

IPUTTAB-PROGRAM = 'SAPLMEOR'.

IPUTTAB-DYNPRO = '205'.

IPUTTAB-DYNBEGIN = 'X'.

APPEND IPUTTAB.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-VDATU(1)'.

IPUTTAB-FVAL = '01.01.2001'.

APPEND IPUTTAB.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-BDATU(1)'.

IPUTTAB-FVAL = '31.12.9999'.

APPEND IPUTTAB.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-LIFNR(1)'.

IPUTTAB-FVAL = P-LIFNR.

APPEND IPUTTAB.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-EKORG(1)'.

IPUTTAB-FVAL = 'ALL'.

APPEND IPUTTAB.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-NOTKZ(1)'.

IPUTTAB-FVAL = P-NOTKZ.

APPEND IPUTTAB.

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'EORD-AUTET(1)'.

IPUTTAB-FVAL = '1'.

APPEND IPUTTAB.

  • Specify that we are now done with this screen (Save it with F11)

CLEAR IPUTTAB.

IPUTTAB-FNAM = 'BDC_OKCODE'.

IPUTTAB-FVAL = '/11'.

APPEND IPUTTAB.

ENDFORM.

  • FORM : CLOSE-SESS *

  • DESCRIPTION : CLOSE THE SESSION *

FORM CLOSE-SESS.

  • closing the session.

IF P-RUN = 'X'.

  • Auto run the Batch Input Program

CALL TRANSACTION 'ME01'

USING IPUTTAB

MODE 'E'

UPDATE 'S'

MESSAGES INTO MESSTAB.

ELSE.

  • Maual run the Batch Input Program

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'ME01'

TABLES

DYNPROTAB = IPUTTAB.

ENDIF.

ENDFORM.

  • FORM : PRN-ULTAB *

  • DESCRIPTION : PRINT OK TABLE *

FORM PRN_ULTAB.

WRITE: / ULTAB-MATNR, ULTAB-WERKS, ULTAB-ZEORD, ULTAB-LIFNR.

W-LINE-NO = W-LINE-NO + 1.

WRITE: ' RECORD# ', W-LINE-NO.

ENDFORM.

  • FORM : CRE-BATCH-SESS *

  • DESCRIPTION : CREATE BATCH SESSION *

FORM CRE-BATCH-SESS.

    • Create BTCI session **

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = P-BTCHSN

USER = SY-UNAME

KEEP = 'X'.

ENDFORM.

check this example.

Regards and Best wishes.