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

Typical Problem

Former Member
0 Likes
519

I am fetching the data from EKKO,EKPO,EKET tables.

I am using the control break statements to calculate the quantity for every PO Number.

But i want a list such that before diaplying a PO Details, i want the Total Quantity for that PO and then to display that PO details.

Please help me out.

Ex:

PO: 4500000012 has total quantity of 13 EA

PO No Item Material Qty Wht

-


4500000012 000010 MAT1 3 4500

000020 MAT2 10 150000

1 ACCEPTED SOLUTION
Read only

valter_oliveira
Active Contributor
0 Likes
495

Hello there!,

For that use two internal tables,

ITAB1

PO_NUMBER

QUANTITY

ITAB2

PO_NUMBER

ITEM

ITEM_QUANTITY

When fetching tables, use append to ITAB2 (I suppose that is what you are doing) and COLLECT into ITAB1.

Then, LOOP at ITAB1, and inside it LOOP AT ITAB2 WHERE po_number = ITAB1-PO_NUMBER.

Best regards.

Valter Oliveira.

3 REPLIES 3
Read only

valter_oliveira
Active Contributor
0 Likes
496

Hello there!,

For that use two internal tables,

ITAB1

PO_NUMBER

QUANTITY

ITAB2

PO_NUMBER

ITEM

ITEM_QUANTITY

When fetching tables, use append to ITAB2 (I suppose that is what you are doing) and COLLECT into ITAB1.

Then, LOOP at ITAB1, and inside it LOOP AT ITAB2 WHERE po_number = ITAB1-PO_NUMBER.

Best regards.

Valter Oliveira.

Read only

0 Likes
495

Can you write the sample code .......... pleaseeeee. .. ..

Read only

0 Likes
495

Hello again.

Reward if usefull.


REPORT zpo_list.

TYPES:
       BEGIN OF ty_po_head,
         ebeln TYPE ekko-ebeln,
         menge TYPE ekpo-menge,
       END OF ty_po_head,
       BEGIN OF ty_po_item,
         ebeln TYPE ekko-ebeln,
         ebelp TYPE ekpo-ebelp,
         menge TYPE ekpo-menge,
       END OF ty_po_item.

DATA: ti_head TYPE STANDARD TABLE OF ty_po_head,
      wa_head TYPE ty_po_head,
      ti_item TYPE STANDARD TABLE OF ty_po_item,
      wa_item TYPE ty_po_item.

SELECT b~ebeln b~ebelp b~menge
  INTO (wa_item-ebeln, wa_item-ebelp, wa_item-menge)
  FROM ekko as a INNER JOIN ekpo as b
    on a~ebeln = b~ebeln
 WHERE a~ebeln EQ '0000000001'.


  APPEND wa_item TO ti_item.

  CLEAR wa_head.
  wa_head-ebeln = wa_item-ebeln.
  wa_head-menge = wa_item-menge.
  COLLECT wa_head INTO ti_head.

ENDSELECT.

LOOP AT TI_head INTO wa_head.
  WRITE: /1 'PO:', wa_head-ebeln, wa_head-menge.
  LOOP at ti_item INTO wa_item WHERE ebeln = wa_head-ebeln.
    WRITE: /1 'ITEM:', wa_item-ebelp, wa_item-menge.
  ENDLOOP.
ENDLOOP.

Best regards.

Valter Oliveira.