04-12-2010 6:31 AM
Hi All,
Business Scenario:
I have a Purchase order with one line item, quantity 10. I have created the partial delivery for this material which inturn created a Material document with line items say 1,2 and 3 followed by Accounting document .
Technical requirement:
I want to pick the BATCH value populated in the line item of the Material document.
In the custom code I only have the accounting document and the line item available.
Please suggest how do I get the value of the material document and the Material document line item from Accounting documet and Account document line item available in code.
Regards
Vijay
04-12-2010 6:36 AM
Hi Vijay,
You may refer to the table field BKPF-AWKEY(reference key), here the material document number and
material document year is saved, and then you can read table MSEG, for the item information of
material document.
Thanks and regards,
Polly
04-12-2010 6:40 AM
Hi Polly,
Thanks for the prompt response.
BKPF-AWKEY will contain the concatenated value of material document and material document year.
I need material document and the line item linked to the accounting document.
Regards,
Vijay
04-12-2010 6:56 AM
Why do you have 3 line items for the Material Document ?
If i am correct you are interested in the line where Batch Number is not empty. Select the particular line from MSEG for the material document where batch is not empty.
04-12-2010 6:59 AM
Hi Vijay,
Try Below Logic
Select awkey from BKPF
where belnr = <accounting doc>
awkey = (docno + Fiscal Year)
Select <ebeln (PO Number)>, <ebelp(po line item)>
from BSEG where belnr = <bkpf-belnr>
select <required fields> from mseg
where mblnr = <first ten characters of bkpf-awkey>
and ebeln = <bseg-ebeln>
and ebelp = <bseg-eblep>
Regards
Vinod
04-12-2010 7:14 AM
Hi Vijay,
The way system generates FI document item, is to LOOP AT material document item table, and
for each item, create corresponding FI document item. For example for 1 material document item,
2 FI items(with BSX and WRX) can be generated. Thus you can read FI document items by sequence
to find out corresponding material document item.
Thanks and regards,
Polly
04-12-2010 7:16 AM
HI All,
I dont want all the line items of the material document. I only want those line items likned with the line items of the Accounting document.
05-05-2010 6:14 AM