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

Problem during BDC Session execution

Former Member
0 Likes
1,219

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??

8 REPLIES 8
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
1,144

Have you tried run transaction with mode 'A', step by step and see what is going on?

-- Tomas --
Read only

0 Likes
1,144

Yes. I did. It just performs the first posting and comes out of the session.

Read only

0 Likes
1,144

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.

Read only

0 Likes
1,144

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

-- Tomas --
Read only

0 Likes
1,144

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??

Read only

0 Likes
1,144

Can you try calling BDC_INSERT function module inside LOOP..ENDLOOP.

Richa

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,144

Could you perform some search on FM POSTING_INTERFACE_CLEARING, This tool creates a BDC very similar to the one that you build yourself.


Else try to records another process with SHDB and multiple selection.


Regards,

Raymond

Read only

Former Member
0 Likes
1,144

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