Application Development 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: 

reg summing

former_member192432
Participant
0 Kudos

hi experts,

in the below code we want to display belowfields.

1)matno

2)material description

3)no.of porders for tht material

4)sum of order quantity for each material

5)no.of planeed orders

6)sum of planned order quantity

&----


*& Report ZMM_MAT

*&

&----


*&

*&

&----


REPORT ZMM_MAT.

TABLES : MARA , MAKT , EKPO , PLAF , AFPO.

DATA : BEGIN OF IT_MARA OCCURS 0,

MATNR LIKE MARA-MATNR, "MATERIAL NOR...

END OF IT_MARA.

DATA : BEGIN OF IT_MAKT OCCURS 0,

MAKTX LIKE MAKT-MAKTX, " MATERIAL DESCRIPTION

MATNR LIKE MAKT-MATNR,

END OF IT_MAKT.

DATA : BEGIN OF IT_EKPO OCCURS 0,

EBELN LIKE EKPO-EBELN, " PURCH. DOC NOR.

MENGE LIKE EKPO-MENGE, " PURCH. ORDER QTY

EBELP LIKE EKPO-EBELP, "PURCH. ORDER LINE ITEM

matnr like ekpo-matnr,

werks like ekpo-werks,

END OF IT_EKPO.

DATA : BEGIN OF IT_PLAF OCCURS 0,

PLNUM LIKE PLAF-PLNUM, " PLANNED ORDEER NOR

GSMNG LIKE PLAF-GSMNG, "TOTAL PLANNED ORDER QTY

DISPO LIKE PLAF-DISPO, " MRP CONTROLLER

AUFNR LIKE PLAF-AUFNR,

MATNR LIKE PLAF-MATNR,

END OF IT_PLAF.

DATA : BEGIN OF IT_AFPO OCCURS 0,

AUFNR LIKE AFPO-AUFNR , " ORDER NOR

PGMNG LIKE AFPO-PGMNG , "TOTAL PLANNED ORDER QTY

PLNUM LIKE AFPO-PLNUM,

END OF IT_AFPO.

DATA : BEGIN OF IT_OUTPUT OCCURS 0,

MATNR LIKE MARA-MATNR,

MAKTX LIKE MAKT-MAKTX,

EBELN LIKE EKPO-EBELN,

MENGE LIKE EKPO-MENGE,

PLNUM LIKE PLAF-PLNUM,

GSMNG LIKE PLAF-GSMNG,

AUFNR LIKE AFPO-AUFNR,

PGMNG LIKE AFPO-PGMNG,

ekpo_o like sy-dbcnt,

END OF IT_OUTPUT.

data : cnt1 type i value 0,

cnt2 type i value 0.

********************selection screen****************************

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS : PLANT FOR EKPO-WERKS,

MRP_C FOR PLAF-DISPO,

MATERIAL FOR MARA-MATNR.

SELECTION-SCREEN : END OF BLOCK B1.

********************start-of-selection*****************************

select ebeln ebelp matnr werks menge from ekpo into corresponding

fields of table it_ekpo where werks in plant and matnr in material.

if it_ekpo[] is not initial .

select plnum gsmng dispo matnr from plaf into corresponding fields of

table it_plaf for all entries in it_ekpo where matnr = it_ekpo-matnr and

dispo in mrp_c. " and matnr in material .

if sy-subrc = 0.

endif.

endif.

loop at it_ekpo.

it_output-menge = it_ekpo-menge.

read table it_plaf with key matnr = it_ekpo-matnr.

it_output-gsmng = it_plaf-gsmng.

append it_output.

endloop.

*cnt2 = sy-tabix.

write : sy-dbcnt.

loop at it_output.

*

at end of matnr.

at last.

sum.

write : / it_output-menge , it_output-gsmng.

endat.

endat.

endloop.

*write : cnt2.

*read table it_plaf with key matnr = it_ekpo-matnr .

**it_output-gsmng = it_plaf-gsmng.

*

*at end of matnr.

  • at last.

  • sum.

    • write : / it_output-gsmng.

  • it_output-gsmng = it_plaf-gsmng.

  • endat.

  • endat.

  • cnt = cnt + 1.

*

*

**cnt = cnt.

*append it_output.

  • endloop.

*write : / sy-dbcnt , it_output-menge ,cnt,it_output-gsmng.

**it_output-ekpo_o = sy-dbcnt.

*

*

**loop at it_output.

*

*

*

**endloop.

5 REPLIES 5

Former Member
0 Kudos

Hi,

and what is your answer now? :O)

0 Kudos

my problem is , i m unable to print no.of porders for tht material and

no.of planeed orders.

regards..

Former Member
0 Kudos

So Whats the problem????

0 Kudos

my problem is , i m unable to print no.of porders for tht material and

no.of planeed orders.

regards..

former_member192432
Participant
0 Kudos

thanks