Skip to Content
author's profile photo Former Member
Former Member

SUB TOTALING ROW WISE

hai experts ,

i have the requirement of performing the multiplication in row fields

the fields are

lifnr

name1

matnr

maktx

menge---- A

meins

netpr-------B

total = A*B

i want to multiply the menge and netpr for every row ..

plz help me

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 11:11 AM

    Hi,

    Chinnaiyya wrote :

    the fields are 
    lifnr
    name1
    matnr
    maktx
    menge---- A
    meins
    netpr-------B
    total = A*B
    i want to multiply the menge and netpr for every row ..

    Try in the following way.

    Loop at itab into wa.
    
         total =  wa-menge * wa-netpr.
      
         write :/ wa-lifnr,
                    wa-name1,
                    .......,
                    total.
          clear total.
    endloop.

    Regards,

    Swapna.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 22, 2008 at 11:09 AM

    hi,

    define a variable in final table and in ur final loop use this code.

    var = it_final-menge * it_final-netpr.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 11:11 AM

    hi,

    before displaying loop ur final internal table say

    loop at itab into wa_tab.

    wa_tab-total = wa_tab-menge * wa_tab-netpr.

    modify itab from wa_tab index sy-tabix.

    then display..

    Rgds,

    subash

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 11:11 AM

    Hi,

    loop at itab.

    total = itab-menge * itab-netpr

    write :/ lifnr

    name1

    matnr

    maktx

    mengemeins

    netpr

    total

    clear total.

    endloop.

    regards

    padma

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 11:18 AM

    Dear friend,

    declare one more internal table. Copy entire data into that.

    loop on the both internal tables accoding to the material number, calculate the value what ever you want and append the claculated value into final internal table.

    eg.

    data : itab like iab1 occurs 0 with header line.

    itab1[] = itab[].

    sort itab1 by matnr.

    delete adjacent duplicates from itab1 comparing matnr.

    loop at itab1.

    loop at itab where matnr = ita1-matnr.

    zfinal-amt = qty * amt.

    endloop.

    append zfinal.

    clear zfinal.

    endloop.

    hope it will help you.

    regards,

    Prashanth.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 11:22 AM

    Hi,

    TABLES : vbak.

    TYPES : BEGIN OF ty_vbak,

    vbeln TYPE vbeln_va,

    erdat TYPE erdat,

    erzet TYPE erzet,

    END OF ty_vbak,

    BEGIN OF ty_vbap,

    vbeln TYPE vbeln_va,

    posnr TYPE posnr_va,

    matnr TYPE matnr,

    END OF ty_vbap,

    BEGIN OF ty_output,

    vbeln TYPE vbeln_va,

    erdat TYPE erdat,

    erzet TYPE erzet,

    posnr TYPE posnr_va,

    matnr TYPE matnr,

    product TYPE i,

    END OF ty_output.

    DATA : it_vbak TYPE STANDARD TABLE OF ty_vbak INITIAL SIZE 0,

    it_vbap TYPE STANDARD TABLE OF ty_vbap INITIAL SIZE 0,

    it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,

    wa_vbak TYPE ty_vbak,

    wa_vbap TYPE ty_vbap,

    wa_output TYPE ty_output.

    DATA : fldname TYPE string,

    fldval TYPE i.

    REFRESH : it_vbak,

    it_vbap,

    it_output.

    CLEAR : wa_vbak,

    wa_vbap,

    wa_output.

    SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.

    START-OF-SELECTION.

    SELECT vbeln

    erdat

    erzet

    FROM vbak

    INTO TABLE it_vbak

    WHERE vbeln IN s_vbeln.

    IF NOT it_vbak IS INITIAL.

    SELECT vbeln

    posnr

    matnr

    FROM vbap

    INTO TABLE it_vbap

    FOR ALL ENTRIES IN it_vbak

    WHERE vbeln = it_vbak-vbeln.

    ENDIF.

    LOOP AT it_vbap INTO wa_vbap.

    wa_output-vbeln = wa_vbap-vbeln.

    wa_output-posnr = wa_vbap-posnr.

    wa_output-matnr = wa_vbap-matnr.

    CLEAR wa_vbak.

    READ TABLE it_vbak INTO wa_vbak WITH KEY vbeln = wa_vbap-vbeln.

    IF sy-subrc = 0.

    wa_output-erdat = wa_vbak-erdat.

    wa_output-erzet = wa_vbak-erzet.

    ENDIF.

    wa_output-product = wa_output-vbeln * wa_output-posnr.

    APPEND wa_output TO it_output.

    CLEAR wa_output.

    ENDLOOP.

    LOOP AT it_output INTO wa_output.

    WRITE :/ wa_output-vbeln,

    wa_output-erdat,

    wa_output-erzet,

    wa_output-posnr,

    wa_output-product.

    ENDLOOP.

    thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2008 at 11:33 AM

    generate the report in alv and utilise the features provided in menu bar.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.