Skip to Content
0
Former Member
Apr 13, 2010 at 09:24 AM

Problem while selecting data from table

64 Views

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