‎2015 Aug 26 12:52 PM
Hi All,
I am trying to clear accounting documents in F-30 using BDC. But it only clears the first document and the other documents do not get cleared. It does not give any error but when I check the log, it has this message along with the first cleared document-Screen is not required.
Can anyone help me with this??
‎2015 Aug 26 2:40 PM
Have you tried run transaction with mode 'A', step by step and see what is going on?
‎2015 Aug 26 2:43 PM
Yes. I did. It just performs the first posting and comes out of the session.
‎2015 Aug 26 2:45 PM
Not sure if I have coded the right way.. Here's the part of my code..
LOOP AT git_bsid INTO gwa_bsid.
PERFORM bdc_dynpro USING 'SAPMF05A' '0122'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'BKPF-BLDAT' gv_docdate.
PERFORM bdc_field USING 'BKPF-BLART' 'DA'.
PERFORM bdc_field USING 'BKPF-BUKRS' gwa_bsid-bukrs.
PERFORM bdc_field USING 'BKPF-BUDAT' gv_docdate.
PERFORM bdc_field USING 'BKPF-MONAT' gv_period.
PERFORM bdc_field USING 'BKPF-WAERS' gwa_bsid-waers.
PERFORM bdc_field USING 'BKPF-BKTXT' gwa_bsid-zuonr.
if gwa_bsid-shkzg = 'S'.
PERFORM bdc_field USING 'RF05A-NEWBS' '40'.
elseif gwa_bsid-shkzg = 'H'.
PERFORM bdc_field USING 'RF05A-NEWBS' '50'.
endif.
PERFORM bdc_field USING 'RF05A-NEWKO' '563510'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-SGTXT'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PA'.
PERFORM bdc_field USING 'BSEG-WRBTR' gwa_bsid-wrbtr.
PERFORM bdc_field USING 'BDC_SUBSCR' 'SAPLKACB'.
PERFORM bdc_field USING 'DKACB-FMORE' 'X'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR' 'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.
PERFORM bdc_field USING 'COBL-KOSTL' '15415'.
PERFORM bdc_field USING 'BDC_SUBSCR' 'SAPLKACB'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0710'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-XPOS1(03)'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'RF05A-AGBUK' '900'.
PERFORM bdc_field USING 'RF05A-AGKON' gwa_bsid-kunnr.
PERFORM bdc_field USING 'RF05A-AGKOA' 'D'.
PERFORM bdc_field USING 'RF05A-XNOPS' 'X'.
PERFORM bdc_field USING 'RF05A-XPOS1(01)' ''.
PERFORM bdc_field USING 'RF05A-XPOS1(03)' 'X'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0731'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-SEL01(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PA'.
PERFORM bdc_field USING 'RF05A-SEL01(01)' gwa_bsid-zuonr.
PERFORM bdc_dynpro USING 'SAPDF05X' '3100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
PERFORM bdc_field USING 'BDC_SUBSCR' 'SAPDF05X'.
PERFORM bdc_field USING 'BDC_CURSOR' 'DF05B-PSSKT(01)'.
PERFORM bdc_field USING 'RF05A-ABPOS' '1'.
ENDLOOP.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = tcode
TABLES
dynprotab = git_bdcdata.
IF sy-subrc <> 0.
ENDIF.
‎2015 Aug 26 2:50 PM
I do not have any information how is your program designed.
So I can only guess that there is LOOP AT internal table with documents and each loop fills BDC table and calls transaction? Check if you properly clear and fill data for each loop.
EDIT: I was writing this, while you posted your code 🙂 Well I am not sure about BDC_INSERT function (never used it), but it seems you need change design how I wrote.
Something like:
LOOP
CLEAR BDC DATA
FILL BDC DATA for one document
CALL TRANSACTION
GET MESSAGES TABLE FROM CALL...
ENDLOOP
‎2015 Aug 26 3:05 PM
Tomas,thanks for the reply.. There's one difference in my code. I am calling the Transaction after the loop. Calling transaction inside the loop will be creating many sessions right?? Isn't it possible to do multiple postings using single session??
‎2015 Aug 26 10:30 PM
Can you try calling BDC_INSERT function module inside LOOP..ENDLOOP.
Richa
‎2015 Aug 26 3:13 PM
‎2015 Aug 27 5:07 PM
Hi Nithin,
Have you tried calling FM BDC_INSERT inside loop. Open the BDC session before processing the loop on internal table git_bsid and then populate bdcdata inside loop and call BDC_INSERT in loop. As you have opened only one session, it will create one session only. After inserting all the records in BDC session, close the session.
Please let me know if you are still facing any difficulty.
Regards,
Manish