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 the details of MIGO num/MIGO Doc year and Ref MIGO Doc item num

Former Member
0 Kudos
695

Hi,

Currently I am working on a requirement to post an Incoming Invoice and using the BAPI 'BAPI_INCOMINGINVOICE_CREATE' to upload the data into SAP.

In the Input file(to be uploaded to SAP) I was not getting details like REF_DOC(Document No. of a Reference Document), REF_DOC_YEAR(Document No. of a Reference Document) and REF_DOC_IT(Item of a Reference Document) and so I need to derive these 3 fields and feed into the interface parameter 'ITEMDATA' of the BAPI.

If I do not give any input values to these 3 fields, BAPI was throwing a message saying that, the mandatory fields were missing in the structure 'ITEMDATA'. So I need to pass these 3 fields mandatorily.

I have in the input fields PO Number and PO item( only from these 2 fields ) and I need to get the above fields.

So please provide me inputs as how I can get these 3 fields from the PO number and PO item.

Thanks for the help in advance.

Regards,

Vishnu.

1 ACCEPTED SOLUTION

birendra_chatterjee
Active Participant
0 Kudos
216

Hi Vishnu,

The code mentioned by Vinod is OK, but You will also have to check whether the GR has not been cancelled. For this you need to add selection criteria of

  • Fetch the latest GR date (movement type will be 101)

select max( budat )

into w_budat

from ekbe

where ebeln = <Po number>

and ebelp = <po Line Item>

and vgabe = '1'

and bwart = '101'.

  • Fetch the latest material document

Select gjahr "(Reference document year)

belnr "(Reference document No)

buzei "(Reference document item)

from ekbe

where ebeln = <Po number>

and ebelp = <po Line Item>

and vgabe = '1'

and budat = w_budat .

Regards,

Birendra

4 REPLIES 4

kesavadas_thekkillath
Active Contributor
0 Kudos
216

Im not sure about this,

Can you check the table EKBE , it holds the reference document no and item no.

Later refer it with BSEG.

Former Member
0 Kudos
216

Hi,

As mentioned by Keshav, Extract the Reference document (MIGO) information from table EKBE

Select gjahr  "(Reference document year)
           belnr  "(Reference document No)
           buzei "(Reference document item)
from ekbe
where ebeln = <Po number>
and      ebelp = <po Line Item>
and      vgabe = '1'.

Regards

Vinod

birendra_chatterjee
Active Participant
0 Kudos
217

Hi Vishnu,

The code mentioned by Vinod is OK, but You will also have to check whether the GR has not been cancelled. For this you need to add selection criteria of

  • Fetch the latest GR date (movement type will be 101)

select max( budat )

into w_budat

from ekbe

where ebeln = <Po number>

and ebelp = <po Line Item>

and vgabe = '1'

and bwart = '101'.

  • Fetch the latest material document

Select gjahr "(Reference document year)

belnr "(Reference document No)

buzei "(Reference document item)

from ekbe

where ebeln = <Po number>

and ebelp = <po Line Item>

and vgabe = '1'

and budat = w_budat .

Regards,

Birendra

Former Member
0 Kudos
216

Hi,

Put Po number and Item in MSEG Table. You will get all required data.

Please refer MSEG Table for MIGO data.

Thanks

Eswar