01-16-2006 3:13 AM
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
01-16-2006 3:28 AM
I'm not familiar with QA14, but isn't the document number in MESSTAB?
Rob
01-16-2006 3:41 AM
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
01-16-2006 3:46 AM
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
01-16-2006 3:56 AM
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
01-16-2006 3:59 AM
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
01-16-2006 4:09 AM
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
01-16-2006 4:28 AM
Kaki - if your question is answered, please close the thread; otherwise, get back to us.
Rob
01-16-2006 4:36 AM
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
01-16-2006 5:01 AM
01-16-2006 5:27 AM
01-16-2006 6:31 AM
Go to EKBE table with the PO and you will get all the material documents there. Filter the list by your criteria.
Srinivas
01-17-2006 4:33 AM
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
01-17-2006 4:46 AM
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.