Skip to Content
0
Former Member
Mar 30, 2009 at 08:33 AM

Multiple records not displaying

74 Views

Hi Experts,

I am doing a report on material tracking and as per my requirment I am taking matnr , tarcking no

(BEDNR) and purchase requisition no: (BANFN) from eban now I want the corresponding

ebeln and po quantity from ekpo. If one matnr have multiple ebeln how do I get it?

as I am getting only single ebeln.

I have copied my coding 4 ur reference.

SELECT EBAN~MATNR EBAN~WERKS EBAN~BANFN EBAN~BNFPO  EBAN~EBELN MARA~MTART EBAN~BEDNR FROM EBAN INNER JOIN MARA ON EBAN~MATNR EQ MARA~MATNR INTO CORRESPONDING FIELDS OF TABLE IT_EBAN
 WHERE MARA~MTART IN MTART AND EBAN~MATNR IN MATNR AND EBAN~WERKS IN WERKS
 AND EBAN~BEDNR IN BEDNR.

LOOP AT IT_EBAN INTO WA_EBAN.
    MOVE-CORRESPONDING WA_EBAN TO WA_FINAL.
    APPEND WA_FINAL TO IT_FINAL.
    CLEAR: WA_EBAN.
  ENDLOOP.

IF IT_FINAL[] IS NOT INITIAL.
SELECT EBELN EBELP MATNR BUKRS WERKS BEDNR FROM EKPO INTO TABLE IT_EKPO
 FOR ALL ENTRIES IN IT_FINAL  WHERE MATNR EQ IT_FINAL-MATNR AND WERKS EQ IT_FINAL-WERKS  AND BEDNR EQ IT_FINAL-BEDNR.
 AND BEDNR EQ IT_FINAL-BEDNR.
  ENDIF.

LOOP AT IT_FINAL INTO WA_FINAL.
    READ TABLE IT_EKPO INTO WA_EKPO WITH KEY MATNR = WA_FINAL-MATNR
                                             WERKS = WA_FINAL-WERKS
                                             BEDNR = WA_FINAL-BEDNR
                                             BINARY SEARCH.
    IF SY-SUBRC = 0.
      MOVE WA_EKPO-EBELN TO WA_FINAL-EBELN.
    ENDIF.
    MODIFY IT_FINAL FROM WA_FINAL.
    CLEAR: WA_EKPO.
  ENDLOOP.

Please advice

Karthik