Application Development 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: 

how to get from MSEG

Former Member
0 Kudos

Hi,

I have developed a BDC program for QA14 transaction.When the data was posted, 2 documents(MBLNR) are getting created in MSEG table.Now, i want to pickup the single document(MBLNR) for the particular PO(EBELN) for each post.Can any one tell me how to pick up the particular document for each post?

(if i have 3 POs in my itab, i need to get 3 different MBLNRs where <b>BWART = '321'</b>).

In the loop after

CALL TRANSACTION 'QA14' USING BDCDATA

MODE 'E' UPDATE 'S' MESSAGES INTO MESSTAB.

i have written select statement.But iam not getting proper data.

Reward guaranteed

cheers

kaki

13 REPLIES 13

Former Member
0 Kudos

I'm not familiar with QA14, but isn't the document number in MESSTAB?

Rob

0 Kudos

Hi Rob,

No need to think about QA14.Just i want to select the single record (from MSEG-MBLNR) when new record was getting created(when BDC done).

kaki

0 Kudos

OK - presumably the database commit hasn't completed by the time you do the select. You could let all the transactions post, keeping track of which documents are posted. When all transactions are complete, then go back and select each document from MSEG.

Rob

0 Kudos

Hi Rob,

You are right.Can you tell me how to keep track of all the documents are posted into MSEG?So that i can capture that documents and put into internal table.

Kaki

0 Kudos

As I said, the document number should be in MESSTAB. After each document is posted, loop through MESSTAB, looking for a particular message ID and type (You have to determine this from running the transaction online). When you get the document number, save it in a separate internal table.

Rob

0 Kudos

Here's how I get the document number in FB01:


* Now, actually display the messages
  LOOP AT messtab.
    sy-msgid = messtab-msgid.
    sy-msgty = messtab-msgtyp.
    sy-msgno = messtab-msgnr.
    sy-msgv1 = messtab-msgv1.
    sy-msgv2 = messtab-msgv2.
    sy-msgv3 = messtab-msgv3.
    sy-msgv4 = messtab-msgv4.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    IF sy-msgid = 'F5' AND sy-msgno = '312'.
* Document number is in sy-msgv2
      PERFORM clear_screen.
    ENDIF.
    DELETE messtab.
  ENDLOOP.

Rob

0 Kudos

Kaki - if your question is answered, please close the thread; otherwise, get back to us.

Rob

0 Kudos

Hi Rob,

In msgv2 iam getting the doc no(ex:inpection lot) which iam passing.I do not want that.When the new docment was created in MSEG table, i want to get that document.Is there any function module existing to capture new document?

Thanks

Kaki

Former Member
0 Kudos

Hi,

Which id You have given in MSGID

Regards,

Nandha

0 Kudos

msgno 116.

Former Member
0 Kudos

Go to EKBE table with the PO and you will get all the material documents there. Filter the list by your criteria.

Srinivas

Former Member
0 Kudos

Hi Kaki - I see that you marked this as 'solved on your own'. Didn't any of the suggestions we gave help out at all? If not, I'd be interested in seeing your solution.

Rob

0 Kudos

Hi Rob,

I have got some solution by this code to get the latest record.But iam not sure.


    SELECT MBLNR FROM MSEG INTO TABLE T_MSG
                        WHERE EBELN = T_CAT-EBELN AND
                              BWART = '321'.

    SORT T_MSG.

    LOOP AT T_MSG.
      M_COUNT = M_COUNT + 1.
    ENDLOOP.

    READ TABLE T_MSG INDEX M_COUNT.