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: 

Reg: Material document and account document

Former Member
0 Kudos

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

7 REPLIES 7

PollyGan
Advisor
Advisor
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

h