‎2010 Apr 13 10:24 AM
Hi,
As per below code I want to select all open po for material from EKPO and then first from EKBE i want to select enries with movement type 101 and then 102 from EKPO i got One PO number aginst that in EKPO with movement type 101 there are three entries in table with qty. 6 , 24, 24 on same day and there are two enteis with 102 qty, 24 24 but while selecting with movement type 101 it is taking only two entry for 6 and 24 and while selecting with 102 it is taking only one entry qty 24
I want that all entry should come in intyenal table as present in table for that PO
so what correction is required in my beolo wcode
*****************************************************
IF NOT IT_MAT[] IS INITIAL.
SELECT ebeln ebelp matnr werks lgort menge FROM ekpo
INTO TABLE it_ekpo FOR ALL ENTRIES IN IT_MAT
for all entries in it_mard
WHERE loekz NE 'L'
AND loekz NE 'S'
AND matnr = IT_MAT-matnr
AND werks = WERKS
AND elikz = ' '
AND pstyp NE '5'.
IF NOT IT_EKPO[] IS INITIAL.
DELETE IT_EKPO WHERE MENGE = 0.
SORT IT_EKPO ASCENDING BY MATNR EBELN.
******Recd qty.
SELECT ebeln ebelp menge MATNR werks FROM EKBE
INTO TABLE it_ekbe FOR ALL ENTRIES IN IT_ekpo
where BEWTP = 'E'
AND BWART = '101'
AND EBELN = IT_EKPO-EBELN
AND EBELP = IT_EKPO-EBELP
AND MATNR = IT_EKPO-MATNR.
*****RETURN QTY.
SELECT ebeln ebelp menge matnr werks FROM EKBE
INTO TABLE it_ekber FOR ALL ENTRIES IN IT_ekpo
where BEWTP = 'E'
AND BWART = '102'
AND SHKZG = 'H'
AND EBELN = IT_EKPO-EBELN
AND EBELP = IT_EKPO-EBELP
AND MATNR = IT_EKPO-MATNR.
ENDIF.
**********************************************
regards,
zafar
‎2010 Apr 13 10:28 AM
This is a common mistake made while using FOR ALL ENTRIES. You should select all the key fields from the source table because FAE deletes duplicates before populating the target internal table.
BR,
Suhas
‎2010 Apr 13 10:33 AM
Hi,
In the first table EKPO in that PO one same material is repeated two times in two diffeent line items but in internal table i am getting only one record from EKPO here there are only two key fileds in EKPO for selecting record and both i have mention in code.
regards,
zafar
‎2010 Apr 13 10:37 AM
Check the where condition for EKPO select. Hope "WERKS" is the parameter in selection screen.
Regards
Vinod
‎2010 Apr 13 10:40 AM
Hi,
I have found a diff. problem according to the PO number have receieved total qty. as per PO but still in EKBE delivery complete indicator is not set for that material in EKBE table filed elikz.
REGARDS,
ZAFAR
‎2010 Apr 13 11:10 AM
Had your problem with selecting data to IT_EKBE has been resolved?
Regards
Vinod
‎2010 Apr 14 6:39 AM
Hi,
Thanks all for your reply As my aim was to read pending po qty. of material for insted of table i have use bapi " BAPI_MATERIAL_STOCK_REQ_LIST" and read the qty where mrp elemnt is OI-SL and i want the required qty. easily .
regards,
zafar
‎2010 Apr 13 10:32 AM
Add the columns BELNR & BUZEI in IT_EKBE Type declaration. The new column combination will be distinct for all the entries selected from EKBE
Regards
Vinod
‎2010 Apr 13 10:33 AM
hmmm your code looks as if it should work. Did you check that really all selection criterias of those 2 records you are missing get matched?