Application Development and Automation 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: 
Read only

Problem while selecting data from table

Former Member
0 Likes
1,070

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

8 REPLIES 8
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,006

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

Read only

Former Member
0 Likes
1,006

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

Read only

Former Member
0 Likes
1,006

Check the where condition for EKPO select. Hope "WERKS" is the parameter in selection screen.

Regards

Vinod

Read only

Former Member
0 Likes
1,006

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

Read only

Former Member
0 Likes
1,006

Had your problem with selecting data to IT_EKBE has been resolved?

Regards

Vinod

Read only

Former Member
0 Likes
1,006

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

Read only

Former Member
0 Likes
1,006

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

Read only

Former Member
0 Likes
1,006

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?