adding up of quantity with the same item code problem

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
japyness
Posts: 2
Joined: Mon Jun 16, 2008 8:34 pm

adding up of quantity with the same item code problem

Post by japyness » Mon Jul 14, 2008 12:49 am

Code: Select all

CALL FUNCTION 'OPEN_FORM'
  EXPORTING
    form = 'ZSCC_02_POSAMPLE'.

LOOP AT struc.
  wa_po = struc.
  AT NEW ebeln.
    total = 0.
    totalpo = 0.

    CALL FUNCTION 'START_FORM'
      EXPORTING
        form = 'ZSCC_02_POSAMPLE'.
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        window = 'COHEADER'.
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        window = 'POHEAD'.
  ENDAT.

total = wa_po-netpr * wa_po-menge.
totalpo = totalpo + ( wa_po-netpr * wa_po-menge ).

CALL FUNCTION 'WRITE_FORM'
    EXPORTING
      element  = 'ITEMLINE'
      function = 'APPEND'
      type     = 'BODY'
      window   = 'MAIN'.

  AT END OF ebeln.
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        window = 'TOTAL'.
    CALL FUNCTION 'END_FORM'.

  ENDAT.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'.



my problem is it only list items one by one.. i need to add the quantity of item with the same item code... thanks for the help guys!

wilhitern1
Posts: 135
Joined: Thu May 15, 2008 4:25 pm
Location: Butterball LLC., Goldsboro, NC, USA
Contact:

Re: adding up of quantity with the same item code problem

Post by wilhitern1 » Mon Jul 14, 2008 8:00 am

This really belongs in the sapscript forum doesn't it?
Neal Wilhite (WilhiteRN1)Image

abap_doctor
Posts: 6955
Joined: Thu Mar 25, 2004 11:29 am
Location: Airstrip One

Re: adding up of quantity with the same item code problem

Post by abap_doctor » Mon Jul 14, 2008 8:19 am

I think the problem lies in the ABAP code AT END OF...

The SAPScript reference is incidental...

I think we need to see the structure of struc....
The Doc
Tuly Idiot Magna Grand Docot Image

japyness
Posts: 2
Joined: Mon Jun 16, 2008 8:34 pm

Re: adding up of quantity with the same item code problem

Post by japyness » Tue Jul 15, 2008 8:43 pm

Code: Select all

TABLES: ekko, ekpo, lfa1, makt, t880, eket, t001.

DATA: BEGIN OF struc OCCURS 0,
       name1 LIKE t880-name1,
       stret LIKE t880-stret,
       ebeln LIKE ekko-ebeln,
       lifnr LIKE lfa1-lifnr,
       supp LIKE lfa1-name1,
       bedat LIKE ekko-bedat,
       zterm LIKE ekko-zterm,
       matnr LIKE ekpo-matnr,
       menge LIKE ekpo-menge,
       meins LIKE ekpo-meins,
       netpr LIKE ekpo-netpr,
       eindt LIKE eket-eindt,
       city LIKE t880-city,
       maktx LIKE makt-maktx,
 END OF struc.
heres the struc.. thanks

its an abap-sapscript topic.. thanks doc.. thanks wil for the reply

Post Reply