Skip to Content
Former Member
Jul 27, 2009 at 02:38 PM

GR and GI document Linkage


Hi All,

I'm an Abaper i've got strange requirment with a strange report.The requirement is as follows:

The report needs to show up the difference of GR Date and current date...........What i mean is lets take this example......

With sales order and without sales order...........a internal purchase order for some items is create to get the stock of material from vendor.....Once the GR is done through MIGO the material documents is posted......this as we know is considered as GR document and document posted as GR date........No lets say that the GR document has 50 quantiry of material XYX in the item.On the same day i did Delivery of 20 quantiry of materials and GI document got posted after PGI

Next day i'll be doing Delivery against this agian for 10 quantiry with and yet another new GI document will be posted after PGI ...........After this lets say GR is done for the same material next day with qunatiy 10.Now the current stock through MB5B it shows up 30.

Now on the selection screen i've got Material number and Plant as my select options in the report which i need to develop.Take the current date as 13/10/2009.

Summary of the above transaction would this in MB5B.......



current stock: 30.

Doc Number Date Quantity

Gr document 123456 10/10/2009 50

GI document 456799 10/10/2009 20-

GI Document 456800 11/10/2009 10-

Gr Document 123457 12/10/2009 10

Now i need to show up for how manys days the material has been there in the inventory till date.As there is no linkage between the GR and GI ........i mean for what document the GI has been issued if i could get this linkage then it would be pretty easy for me to calcuate the difference of date............In the above case i could'nt get any how to calcuate that the stock has been in there for how many days from the current date.......The current stock needs to be considered again is 30.

Let me be more clear and specific........the stock which has come on 10/10/2009 is 50 if i take this quantiy as 50 and then calculate and minus this from the current date(13/10/2009) it would be 3 days and quantiy as 50......but taking the current stock its 30(so the logic would be wrong).........and another twist is........if i calculate like this.......i mean if i take up stock 20 as on 11/10/2009 it would be 20 kind of worried how to show this up......Please go through this and get back......with some solution