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

Finding Document number created after BDC execution

Former Member
0 Likes
2,204

Hi All,

I am working on a BDC development.

After CALL TRANSACTION KB15 syntax, i would like to capture the document number which has been created in the call trasaction step. How to capture the document number in such scenario???

Regards

Pavan

5 REPLIES 5
Read only

Former Member
0 Likes
1,292

Hi,

Did you check if the bdcmessgecoll table is returning the docuent number or not. if it is returning to get that messge use FORMAT_MESSAGE FM to read the success message returned from the transaction.

Read only

Former Member
0 Likes
1,292

Hi Pavan Sanganal ,

Using the System Message in Message Tab which you will capture in your message tab. For example :



      CALL TRANSACTION 'F-43' USING IT_BDCDATA
      OPTIONS FROM WA_CTU_PARAMS
      MESSAGES INTO IT_MESSTAB.
"Here all messages will be stored in IT_MESSTAB
"If message type  IT_MESSTAB-MSGTYP = 'S' then it should be the message you are looking for
"Note : There may be many Success(S) messages

    LOOP AT IT_MESSTAB.

      DATA : L_F_TEXT(150).
      CLEAR L_F_TEXT.

      CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          ID        = IT_MESSTAB-MSGID
          LANG      = SY-LANGU
          NO        = IT_MESSTAB-MSGNR
          V1        = IT_MESSTAB-MSGV1
          V2        = IT_MESSTAB-MSGV2
          V3        = IT_MESSTAB-MSGV3
          V4        = IT_MESSTAB-MSGV4
        IMPORTING
          MSG       = L_F_TEXT
        EXCEPTIONS
          NOT_FOUND = 1
          OTHERS    = 2.

      IF SY-SUBRC = 0.

        WA_FINAL-TYPE = IT_MESSTAB-MSGTYP.
        WA_FINAL-LIFNR = WA_RECORD-LIFNR.
        WA_FINAL-WRBTR = WA_RECORD-WRBTR.
        WA_FINAL-TEXT = L_F_TEXT.

        APPEND WA_FINAL TO IT_FINAL.
        CLEAR : WA_FINAL.

      ENDIF.

Thanks & Regards,

Rock.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,292

Generally from the success message

We've the message like, "Document 12345678 has been posted successfully". You can get the DocNum from the message itself.

BR,

Suhas

Read only

pranav_him
Explorer
0 Likes
1,292

hi,

Check your Document Number in BDCMSGCOLL or after call transaction call FM "FORMAT_MESSAGE" so that all the Error and Success message get stored in an internal table.

Thanks,

Pranav Saxena

Read only

Former Member
0 Likes
1,292

Moderator message - Please search before asking - post locked Rob