Skip to Content
0
Former Member
Jul 15, 2008 at 06:19 PM

Regarding PO reports

18 Views

Hi Guru's

I have written a report which display output.and the output fields are 1-Plant, 2-Purchase oragnization , 3- Purchase Order and 4-Purchase item.

Plz check this program where i can mistake to write this program..

TABLES : EKKO,

EKPO.

DATA: BEGIN OF IT_EKKO OCCURS 1,

EBELN LIKE EKKO-EBELN,

EKORG LIKE EKKO-EKORG,

BEDAT LIKE EKKO-BEDAT,

END OF IT_EKKO.

DATA : BEGIN OF IT_EKPO OCCURS 1,

EBELN LIKE EKPO-EBELN,

EBELP LIKE EKPO-EBELP,

ELIKZ LIKE EKPO-ELIKZ,

WERKS LIKE EKPO-WERKS,

MENGE LIKE EKPO-MENGE,

END OF IT_EKPO.

DATA : BEGIN OF IT_FINAL OCCURS 1,

EBELN LIKE EKKO-EBELN,

EKORG LIKE EKKO-EKORG,

BEDAT LIKE EKKO-BEDAT,

WERKS LIKE EKPO-WERKS,

END OF IT_FINAL.

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME.

SELECT-OPTIONS : S_WERKS FOR EKPO-WERKS,

S_EKORG FOR EKKO-EKORG,

S_BEDAT FOR EKKO-BEDAT.

SELECTION-SCREEN : END OF BLOCK B1.

START-OF-SELECTION.

SELECT EBELN EKORG BEDAT FROM EKKO INTO TABLE IT_EKKO

WHERE EKORG IN S_EKORG AND

BEDAT IN S_BEDAT.

IF NOT IT_EKKO[] IS INITIAL.

SELECT EBELN EBELP ELIKZ WERKS MENGE FROM EKPO INTO TABLE IT_EKPO

FOR ALL ENTRIES IN IT_EKKO

WHERE EBELN = IT_EKKO-EBELN.

ENDIF.

LOOP AT IT_EKPO.

READ TABLE IT_EKKO WITH KEY EBELN = IT_EKPO-EBELN.

IF SY-SUBRC = 0.

IT_FINAL-EBELN = IT_EKKO-EBELN.

IT_FINAL-EKORG = IT_EKKO-EKORG.

IT_FINAL-BEDAT = IT_EKKO-BEDAT.

ENDIF.

MOVE-CORRESPONDING IT_EKPO TO IT_FINAL

APPEND IT_FINAL.

CLEAR IT_FINAL.

ENDLOOP.

LOOP AT IT_FINAL.

WRITE : / IT_FINAL-WERKS,

IT_FINAL-EKORG,

IT_FINAL-EBELN,

IT_FINAL-EBELP.

ENDLOOP.

THANKS

GOLU.