09-16-2010 12:45 PM
Hi,
My Report is to find Production Order from Sale Order.
Flow of tables -
(VBAK- VBAP- LIPS - SER01 - OBJK - SER05 - CAUFV)
Report is working accurate in normal scenario. But -
Here, In Batch split with multiple items -->
FOR ALL ENTRIES IN - is not taking values.
one case for Ex-->
sale order so item obdelivery obd item serial no
39782 10 1234 900001 12
39782 10 1234 900002 13
39782 20 3456 10 14
Here,
only one OBD 1234 (sr no 12 & 13 ) is get entered in ITAB and not 3456.
(i.e. in gi_objkso all 3 entries are there, but in gi_objkpo only two entries are transferred)
Where, Production order is there for all three Sr. No.
My code is -->
IF NOT gi_ser01 IS INITIAL.
SELECT obknr equnr sernr matnr
FROM objk
INTO TABLE gi_objkso
FOR ALL ENTRIES IN gi_ser01
WHERE obknr EQ gi_ser01-obknr
AND equnr IN so_equnr
AND sernr IN so_sernr
AND matnr IN so_matnr
AND taser EQ 'SER01'.
IF NOT gi_objkso IS INITIAL.
SELECT obknr equnr sernr matnr
FROM objk
INTO TABLE gi_objkpo
FOR ALL ENTRIES IN gi_objkso
WHERE sernr EQ gi_objkso-sernr
AND equnr EQ gi_objkso-equnr
AND matnr EQ gi_objkso-matnr
AND taser EQ 'SER05'.
09-16-2010 1:00 PM
Hi,
While using for all entries, you have to select all the primary keys. In this case you have to select OBKNR and OBZAE.
Hope it helps.
Sujay
09-16-2010 5:47 PM
Hi,
Do you create more than one production order per sales order line? If not, you could change the match to look at table AFPO for fields KDAUF = sales order number) and KDPOS = salse item number.
If you are going down to serial number level, after this select (fields are indexed in index AFPO~3, by default I think), then you could use your additional serial number field match after getting the list of production order numbers for the sales order/item.
Regards, Andy