Adding amounts in an internal table

I have created an internal table which has values BP number, Contract Account and amount paid. i would like to add the amounts paid per business partner and per contract account and only display the total amount paid per business partner and per contract account. may i have the code to make the addition of the amounts in an internal table.

Hello,
So what was meant is that for the same business partners and same Contract account numbers the amount should get added.....
do the following...imagine that you have data in int_tab with 3 fields...Declare int_tab1 as the same internal table type
Sort int_tab by BP Contract_AC.
loop at int_tab into workarea.
collect workarea to int_tab1.
endloop.
Collect statement compares the "BP" and "Contract A/C"
and for the same BP and contractA/C number it adds and appends..if an entry exists in int_tab1 it adds the amount only
eg:
BP | CAno: | Amount
A   |  23A      | 100
A   |  23A      | 50
A   |  24A      |  11
B   |  23A      | 12
after the collect statement..internal table contains
A | 23A | 150
A | 24A | 11
B | 23A | 12
but it will work only if int_tab contais 3 fields as mentioned..if more fields are there which are non-numeric it will compare that also...
in addition to it also check if the contract Account number is getting added by putting a breakpoint in the code..if so... there are 2 options
(1) Declare a new internal table and pass the field contract number as a character....and use collect on the new internal table..so the contract account number will not get added...
or
instead of collect statement use loops and other logic to suit your requirement
Reward if helpful
Regards
Byju

Similar Messages

  • Adding Amount field in BSEG table and display it single line item?

    hi experts,
           I am doing credit / debit form now my requirement is
                                               According to BELNR , GJAHR,BUKRS i want to find credit amount for this selection cretiria.
                         so i want to add all the lines of amount filed for a particular BELNR and display it as single line.
    so i am getting data from print program like this
    SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 2.
    PARAMETERS: p_belnr LIKE bkpf-belnr OBLIGATORY,
                p_bukrs LIKE bkpf-bukrs OBLIGATORY,
                p_gjahr LIKE bkpf-gjahr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b0.
    SELECT SINGLE *
                   FROM bkpf
                   INTO  i_bkpf
                   WHERE belnr = p_belnr
                         AND ( blart = 'DG' OR blart = 'ZG' )
                         AND bukrs = p_bukrs
                         AND gjahr = p_gjahr.
    IF sy-subrc = 0.
        SELECT  *
              FROM bseg
              INTO  table it_bseg
              WHERE belnr = i_bkpf-belnr .
      ENDIF.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = 'Z_CREDIT_DEBIT'    " p_name
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
        IMPORTING
          fm_name                  = v_form_name
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    CALL FUNCTION v_form_name
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        i_bkpf                     = i_bkpf
        i_bseg                     = i_bseg
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    so my I_BSEG containing all line items of particular BELNR . with the field SHKZG  iam  getting only credit line items .
      now i want to do is add all credited amount and display like this in a table.
    against ref#  (BSEG-REBZG) ! details (BSEG-SGTXT)!  amount
    124569                                   10%discount                950.00(total amount ie sum of all lines amount for a BELNR)
                                                                                    10.00(total tax amt ie sum of   all lines of tax amount for a BELNR)                                                                               
                                                                                    960.00

    hi arun,
             i used collect in smartform my procedure is like this .
                   i am getting data into i_BSEG because i declared like this in TABLES parameter
                      i created a loop .
                             in that i mentioned like I_BSEG into WA_BSEG.
                                   then i created a program lines here i mentioned like this.
                                                  COLLECT WA_BSEG INTO IT_BSEG.
               but because of BUZEI "Number of Line Item Within Accounting Document .it is not same it is varying for every credited time that means for every line of BELNR. thats why it is not adding it is just appending .
    so pls tell me any other chance to find sum .
    because i want to sum up all credted amount and display it in single line
    ie first column REBZG "Number of the Invoice the Transaction Belongs to(against ref) i want to display once .
    And Second column  SGTXT "item text(details) for amount once and for tax amount once
    And Third column Amount first line consists total amount & second line consists total for tax amount
    regards,
    satheesh.
    [email protected]
    any doubts chat me regarding this post.

  • How to get total in ALV report in same Internal table?

    Data : Begin of it_data,
            kunnr type kunnr,
            name1 type name1,
            amt1  type btrt01, " CURR 15,2
           end of it_data.
    loop at it_data into wa_data
    endloop.      
    Hello friends,
    I am developing one ALV report with 20 rows.
    I have filled one internal table with some fileds like amount.
    I want to get total of all amount1 in AMT1 field.
    So, How to get total of amount in same internal table in ALV report ?
    It is ok if i get duplicate rows in internal table.
    Points 'll be awarded soon.
    Regards,
    NVM

    Hi Ronny,
    the alv output will display the sum at the last row.
    for this functionality u have do this logic.
    data: lw_fcat type slis_fieldcat_alv.
    data: lt_fcat type slis_t_fieldcat_alv/
    wa_fcat-fieldname = 'AMT1'.
    wa_fcat-tabname = 'ITAB'.
    wa_fcat-do_sum = 'X'.
    append wa_fcat to lt_fcat.
    and then pass it to reuse_alv_grid_display function,
    regards,
    Santosh Thorat

  • Declaring the internal table in ABAP objects

    Hi every1,
    Please any one let me know how to declare an internal table in class (ABAP objects). Bcos i am new to this classes.
    help me out.
    Regards,
    Madhavi

    Hi,
    Check this example..
    TYPES: BEGIN OF TYPE_DATA,
                   MATNR TYPE MATNR,
                   WERKS TYPE WERKS_D,
                 END OF TYPE_DATA.
    DATA: T_DATA TYPE STANDARD TABLE OF TYPE_DATA.
    DATA: WA_DATA TYPE TYPE_DATA.
    Adding rows to the internal table.
    WA_DATA-MATNR = 'AA'.
    APPEND WA_DATA TO T_DATA.
    Processing the interna table
    LOOP AT T_DATA INTO WA_DATA.
    ENDLOOP.
    Thanks,
    Naren

  • Help on Internal table checking

    Hi All,
    I need some advise on how to group the data in the internal table with sum up the total value for each group and display it in final internal table. Can anyone help on this. Thanks.
    Internal table which holding the value as below
    (1)indicator field: Only can be value 'A' or 'B'.
    (2) Group_name field: values are not fixed to be old_student, new_student or graduated. It depend the values we extracted from table as it can be more.
    Sample internal table:
    Indicator , Group_name , Amount
    A              , Old_Student                 ,1
    B               ,New_Student               ,2
    A               ,New_Student               ,20
    A               ,Old_Student                 ,3
    A               ,Graduated                    ,1
    Report need to be displayed are in below format with using ALV list.
    Indicator  fields - it's the sum up total amount from above internal table with the same group_name.
    Group_name      , Indicator A           , Indicator B       , Total
    Old_student         , 4                           , 0                    , 4
    New_student        ,20                          , 2                    ,20
    Graduated            ,1                            , 0                    ,1
    Total:                  ,25                            ,2                    ,25
    Moderator message: "spec dumping", please work yourself first on your requirement.
    Edited by: Thomas Zloch on Jun 26, 2011 11:20 AM

    use subtotal functionality in alv

  • Which is the suitable Internal table.

    Hi,
    I want to know which type of internal table would be suitable for the below mentioned process.
    There is some initial set of data in a internal table. The table is looped and i do operation on the data available in that line and get another data which has to be added to the same internal table. So that when the control is done with the intial set of data in the table, it starts reading the newly added line and do the same operations mentioned below.
    Warm Regards,
    Aruna G

    Hi,
    The loop wont be infinite, cos at  one point the above mentioned processiing of data wont happen since it wont meet some of the criteria. Its just i want to use a table sequentially and append data to it at the end.
    Warm Regards,
    Aruna G

  • Tow internal table to one commone internal table

    hi
    i have two internal table
    itab1 having fields
    f1
    f2
    f3
    f4
    and second internal table having fields
    HERE F1 IS COMMON FIELD BETTWEEN TWO
    f1
    f5
    f6
    f7
    f8
    f9
    f10
    i want the data of both the internal table into one final table having data
    F1
    F2
    F3
    F4
    F5
    F6
    F7
    F8
    F9
    F10
    IE COMBINED DATA OR BOTHE IE I AM ADDING THE COLUIMNS OF INTERNAL TABLE 1 AND INTERNAL TABLE 2 TO FINAL OUTPUT TABLE
    PLEASE SUGGEST ?
    REGARDS
    ARORA

    hi RAAM
    the situation is like this
    her is the internal table with data and rows
    IT_APC                         Table[58x64]     
    it_dep                         Table[14x48]     
    it_Dep_Apc                     Table[1x108]     
    now iand combining data of itapc and itdep to it_dep_apc
    both have only one common firled bukrs
    and as rows and columns as displayed above
    now if i do below as suggeted by u
    LOOP AT IT_APC INTO WA_APC.                                                                               
    READ TABLE IT_DEP INTO WA_DEP WITH KEY BUKRS = WA_APC-BUKRS      
    BINARY SEARCH.     
    then the all the data is not combined i suppose as i need to have the final table all the data from both the internal tables....
    ie common rows plus extra rows for bukrs
    regards
    Arora

  • Sum of one column of an internal table

    Hi All,
    I have an internal table with two columns.
    First column is having standard taxt "ZSSS" (for all rows).
    The second column is having Amount value.
    Internal table might have multiple lines with this structure.
    Now i would like to sum the second column which is having Amount value.
    How to code to get the sum in such scenario?
    Your help will be appreciated.....
    Regards
    Pavan

    Hi
    This is possible with COntrol Break Stamnts\Check below Code for example..
    DATA: BEGIN OF line,
            carrid   TYPE sbook-carrid,
            connid   TYPE sbook-connid,
            fldate   TYPE sbook-fldate,
            custtype TYPE sbook-custtype,
            class    TYPE sbook-class,
            bookid   TYPE sbook-bookid,
          END OF line.
    DATA itab LIKE SORTED TABLE OF line WITH UNIQUE KEY table_line.
    SELECT carrid connid fldate custtype class bookid
           FROM sbook INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT itab INTO line.
      AT FIRST.
        WRITE / 'List of Bookings'.
        ULINE.
      ENDAT.
      AT NEW carrid.
        WRITE: / 'Carrid:', line-carrid.
      ENDAT.
      AT NEW connid.
        WRITE: / 'Connid:', line-connid.
      ENDAT.
      AT NEW fldate.
        WRITE: / 'Fldate:', line-fldate.
      ENDAT.
      AT NEW custtype.
        WRITE: / 'Custtype:', line-custtype.
      ENDAT.
      WRITE: / line-bookid, line-class.
      AT END OF class.
        ULINE.
      ENDAT.
    ENDLOOP.
    Hope it helps.
    Praveen

  • Runtime error in Dynamic internal table with AMOUNT and Quantity Fields..

    Dear friends,
    I am attempting write a dymanic Select Statement (with joins).
    And the sleect query looks like this..
      SELECT (LT_SEL_LIST)
      INTO CORRESPONDING FIELDS OF
      TABLE <DYN_TABLE>
      FROM (LT_FROM_LIST)
      WHERE (LT_WHERE3).
    Here the into table is a dynamically created internal table..
    which is created by ...this
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = IT_OUTPUT2[]
        IMPORTING
          EP_TABLE        = DY_TABLE.
    the it_output2 contains the the fieldcatlog information of dynamically given fields :-
    like:-
           TABNAME
           FIELDNAME
           DATATYPE
           LENG
           INTTYPE
           ROLLNAME
           DECIMALS
           REFTABLE
           REFFIELD
    i mean the internal table is constructed with reference to all the bove metadata.
    Problem:- This query run fine with all the fields Except AMOUNT AND QUANTITY fields....
    When the selection list contain VBAK-NETWR or MSEG-MENGE..It throws a runtime error.
    "The data read during a SLECT access couldnt be inserted into the target field,either conversion is not supported for
    the target field's type or the target field is too short."
    after this I even tried to construct the dynamic table with CFILEDNAME and QFIELDNAME in the Fieldcatalog.
    so now my fieldcatlog looks like this:---
    LOOP AT IT_DD03L..
      IF IT_DD03L-DATATYPE = 'CURR'.
           TABLEFIELD-CFIELDNAME = IT_DD03L-FIELDNAME .
           ENDIF.
       IF IT_FIELDCAT3-DATATYPE = 'QUAN'.
           TABLEFIELD-QFIELDNAME = IT_DD03L-FIELDNAME .
      ENDIF.
           TABLEFIELD-TABNAME     = IT_DD03L-TABNAME.
           TABLEFIELD-FIELDNAME   = IT_DD03L-FIELDNAME.
           TABLEFIELD-DATATYPE    = IT_DD03L-DATATYPE.
           TABLEFIELD-INTLEN      = IT_DD03L-LENG.
           TABLEFIELD-INTTYPE     = IT_DD03L-INTTYPE .
           TABLEFIELD-ROLLNAME    = IT_DD03L-ROLLNAME.
           TABLEFIELD-DECIMALS    = IT_DD03L-DECIMALS.
           TABLEFIELD-REF_TABLE   = IT_DD03L-REFTABLE.
           TABLEFIELD-REF_FIELD   = IT_DD03L-REFFIELD.
    APPEND TABLEFIELD.
    CLEAR TABLEFIELD.
    ENDLOOP.
    Note:- this is a test code so ignore performance issues...
    Please help me with some code ...to avoid the Runtime erorr.
    Thanks,
    jeevan.

    Hi Jeevan,
    Why are moving only few fields from DD03L table to your field catalog? Why don't you use move-corresponding? The following code works for me in ECC6.0.
    data: it_dd03l type table of dd03l initial size 0,
          ls_dd03l type dd03l,
          lt_fldcat TYPE lvc_t_fcat,
          ls_fldcat TYPE lvc_s_fcat,
          ls_where(72) TYPE c,
          lt_where LIKE TABLE OF ls_where,
          lt_fld LIKE TABLE OF ls_where,
          lt_data_dy TYPE REF TO data.
    field-symbols: <ft_data> TYPE STANDARD TABLE.
    select * into table it_dd03l from dd03l
        where tabname = 'VBAK'
          and ( fieldname = 'VBELN' or fieldname = 'NETWR' ).
    check sy-subrc eq 0.
    loop at it_dd03l into ls_dd03l.
      move-corresponding ls_dd03l to ls_fldcat.
      append ls_fldcat to lt_fldcat.
      move ls_dd03l-fieldname to ls_where.
      append ls_where to lt_fld.
      if ls_dd03l-fieldname = 'VBELN'.
        clear ls_where.
        concatenate ls_dd03l-fieldname ' <> ''''' into ls_where.
        append ls_where to lt_where.
      endif.
    endloop.
    check not lt_fldcat is initial.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = lt_fldcat
          IMPORTING
            ep_table                  = lt_data_dy
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
        IF sy-subrc <> 0.
          RAISE no_configuration_data.
        ENDIF.
        ASSIGN lt_data_dy->*  TO <ft_data>.
    check sy-subrc eq 0.
    select (lt_fld) from VBAK into corresponding fields of table
        <ft_data>
        where (lt_where).
    Thanks
    Bala

  • Adding leading zeros to a field in an Internal table

    HI Experts,
    I have an Internal table with 3 fileds
    and the second filed is of lengh 10,
    In this filed i get the data which is of 4 character
    I want the leading 6 0's to be added for that 2 field
    For Eg
    HI 1234      HELLO
    HI 1222      HELLO
    I need the Output as
    HI 0000001234 HELLO
    HI 0000001222 HELLO
    Thanks

    Hello,
    >
    Karthick raz wrote:
    > HI Experts,
    >
    > I have an Internal table with 3 fileds
    >
    > and the second filed is of lengh 10,
    >
    > In this filed i get the data which is of 4 character
    >
    > I want the leading 6 0's to be added for that 2 field
    >
    > For Eg
    > HI 1234      HELLO
    > HI 1222      HELLO
    >
    >
    > I need the Output as
    >
    > HI 0000001234 HELLO
    > HI 0000001222 HELLO
    >
    > Thanks
    Consider field2 is the second field that u have mentioned.
    data: temp(4) type c,
             field2 type n.
    temp = '1234'.
    write temp to field2 right justifield.
    Hope this helps.
    Thanks & Regards,
    Anand Patil

  • Adding Specific columns of dynamic internal table row into another column

    Hi Gurus,
    I need to add  few columns of a dynamic internal table row into another column:
    Article description hy01 hy02 total
    101      panza         10     12      22
    102      masht         12     12     24
    dynamic internal table is created and columns hy01 hy02.... can increase
    How to add the the values in hy01 hy 02... into total.
    Regards,
    Dep

    Hi,
    If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
    Here an example how to generate a dynamic table based on another internal table, hope this will help you.
    TYPE-POOLS: slis.
    PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
    * Type ZST_T:
    *   matnr  TYPE matnr
    *   maktx  TYPE maktx
    *   hy01   TYPE i
    *   total  TYPE i
    TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
    PERFORM main.
    *&      Form  main
    *       text
    FORM main.
      DATA: lt_fieldcat     TYPE slis_t_fieldcat_alv,
            lt_t            TYPE ty_t,
            lr_new_t        TYPE REF TO data.
      FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
      "Add some lines to LT_T just to have something to display on screen
      DO 10 TIMES.
        APPEND INITIAL LINE TO lt_t.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZST_S'
        CHANGING
          ct_fieldcat      = lt_fieldcat.
      "Copy LT_T to LR_NEW_T
      PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
      CLEAR lt_t. "Not needed anymore...
      ASSIGN lr_new_t->* TO <lt_new_t>.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <lt_new_t>.
    ENDFORM.                    "main
    *&      Form  extend_and_copy_table
    FORM extend_and_copy_table USING ut_t           TYPE STANDARD TABLE
                                     uv_nb_hy       TYPE i
                               CHANGING cr_t        TYPE REF TO data
                                        ct_fieldcat TYPE slis_t_fieldcat_alv
                               RAISING cx_sy_struct_creation cx_sy_table_creation.
      DATA: lo_tabledescr      TYPE REF TO cl_abap_tabledescr,
            lo_structdescr     TYPE REF TO cl_abap_structdescr,
            lo_new_structdescr TYPE REF TO cl_abap_structdescr,
            lo_new_tabledescr  TYPE REF TO cl_abap_tabledescr,
            lt_components      TYPE cl_abap_structdescr=>component_table,
            ls_component       TYPE cl_abap_structdescr=>component,
            lv_field_cnt       TYPE numc2,
            ls_fieldcat        TYPE slis_fieldcat_alv,
            lr_fieldcat        TYPE REF TO slis_fieldcat_alv.
      FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
                     <lt_new_t> TYPE STANDARD TABLE,
                     <ls_new_s> TYPE ANY.
      "Get the list of all components from UT_T line structure
      lo_tabledescr  ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
      lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_components  = lo_structdescr->get_components( ).
      "The new columns will be from type of column HY01
      ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
      "The new columns will have the same fieldcat info as column HY01
      READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
      "HY<lv_field_cnt> = new field name
      lv_field_cnt = uv_nb_hy + 1.
      "For each new column...
      DO uv_nb_hy TIMES.
        "Generate the new column field name
        CONCATENATE  'HY' lv_field_cnt INTO ls_component-name.
        ls_fieldcat-fieldname = ls_component-name.
        "Add the new field to the components of the new structure
        INSERT ls_component INTO lt_components INDEX 4.
        "Add the new field's fieldcat info to the fieldcat
        INSERT ls_fieldcat  INTO ct_fieldcat   INDEX 4.
        lv_field_cnt = lv_field_cnt - 1.
      ENDDO.
      "Adjust the COL_POS from fieldcat
      LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
        lr_fieldcat->col_pos = sy-tabix.
      ENDLOOP.
      "Create the new table
      lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
      lo_new_tabledescr  = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
      CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
      ASSIGN cr_t->* TO <lt_new_t>.
      "Copy all data from old to new table
      LOOP AT ut_t ASSIGNING <ls_old_s>.
        APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
        MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
      ENDLOOP.
    ENDFORM.                    "main

  • Adding only one field of an internal table.

    Hi gurus,
    I have an internal table with values Brand , Country, Code & Amount.
    with values as follows
    Brand     Country    Code          Amount
    1533       IN            121213       56.00
    1533       IN            121213       75.00
    1533       IN            138808       66.00
    1533       BR           121111      23.00
    1533       BR           121212      46.00
    Now i want a sum total of amounts based on country( The code is ignored).
    Brand     Country    Code          Amount
    1533       IN                             197.00
    1533       BR                            69.00
    I already tried the COLLECT statement but was not successful,
    Any ideas will be welcomed.
    Regards,
    K

    hiiii
    use following code..you will solve your problem by that.
    FORM display_flight_data .
      LOOP AT t_flight INTO fs_sflight.
        IF s_carrid EQ fs_sflight-carrid
           AND sflight-connid EQ fs_sflight-connid.
          WRITE: /20 fs_sflight-fldate COLOR 2,
          40 fs_sflight-seatsmax COLOR 2,
          58 fs_sflight-seatsocc COLOR 2.
        ELSE.
          ULINE.
          WRITE: /1(50) 'Total Booking So Far ' COLOR 3, w_total COLOR 3.
          WRITE:/10 fs_sflight-carrid COLOR 5,
             20 fs_sflight-connid COLOR 5.
          w_payment = w_payment + fs_sflight-paymentsum.
          w_total = w_payment.
          w_grandtotal = w_payment + w_total.
          w_finaltotal = w_grandtotal.
        ENDIF.
        s_carrid = fs_sflight-carrid.
        sflight-connid = fs_sflight-connid.
      ENDLOOP.
      WRITE: /1(50) 'Total Amount Of Bookings So Far For ' COLOR 3 ,
                     w_finaltotal COLOR 3.
    ENDFORM.                    " display_flight_data
    reward if useful
    thx
    twinkal

  • Adding a column in an internal table

    Hi,
    I want to know how to add different rows of a  column in an internal table.
    My code :
    Declaration Part-----
    types : begin of imchb,
            clabs like mchb-clabs,
            cumlm like mchb-cumlm,
            cinsm like mchb-cinsm,
            tot_val_stock type p decimals 3,
            pm_percent type p decimals 6,
            end of imchb.
    data : int_inv type standard table of imchb with header line,
           wa_inv like line of int_inv.
    Then I do few calculations and display it in the column pm_percent.
    Now I want to sum this column.
    Summation---
    loop
    at int_inv into wa_inv.
    at end of pm_percent.
    sum.
    endat.
    endloop.
    write :/ wa_inv-pm_percent.
    However , wa_inv-pm_percent only gives me the value of the last row of the column.
    Kindly suggest .

    Hi,
    Please try this code:
    loop at int_inv into wa_inv.
        lv_count = lv_count + 1.
        AT END OF posnr.   <------- The field you want to sum..
          gs_total-posnr      = wa_inv-posnr.
          gs_total-cov_total  = lv_count.
          APPEND gs_total TO gt_total.
          CLEAR : gs_total,
                  lv_count,
                  wa_inv.
        ENDAT.
      ENDLOOP.

  • ADDING CONTENTS ON A FIELD IN A INTERNAL TABLE

    HI ,
    the requirement is like that:
    there is a internal table. i have to add the values of one particular field say Filed X and compare it with the value of another field y
    Could anybody please provide a sample code
    Regards,
    Sharad Narayan

    loop at itab assigning <fs>.
      <fs>-X = .
      if <fs>-X = <fs>-Y.
         " Do process...
      endif.
    endloop.

  • Adding the field in the internal table based on another field

    Hi all,
    I am Creating a Function module with three fields (HKONT,EBELN,DMBTR) in the output internal table(ITAB)
    My Requirement is that as soon as the value of the HKONT in the internal table changes,  i need to sum the DMBTR field values  and should pass into a variable(v_sum).
    ON CHANGE OF seems to me Obsolete.
    Please help me in doing this.
    Thanks
    Ajay

    HI,
         Use control break event . AT END OF.
         loop at ITAB.
           V_DMBTR = V_DMBTR + ITAB-DMBTR.
           at end of HKONT.
              v_sum =  V_DMBTR.
              clear : V_DMBTR.
           endat.
         endloop.
    Regards,
    Srini.

Maybe you are looking for

  • Cannot open projects on iPad created with Mac

    HI, I want to transfer projects I created on my mac in garageband (6.0.5) to my iPad, but it's not working. First I tried to just copy an existing file. It will show up in the loops audio files, but I cannot select it or use it. I then tried to creat

  • PP CS5 Capture problems..

    I recently got my new Macbook and Adobe Production premium hoping to finally edit some of the work that was waiting for this gear but have run into a little problem that scares me a bit. Equipment list: Sony PD170 (SD Mini DV Tape) 13.3'' Macbook Pro

  • I lost all my informations in my phone and computer , what can I do to find them ?

    Can you help me to retreive all my adress book / I lost everything during downloading the pictures frrom my Iphone to my computer . I even lost it in my computer .

  • Re:Transfer Routine to split an incoming data record

    Hi , We need to split an incoming data record coming from R/3 in to multiple records before updating into the cube. The requirement is as follows. We are having a record whose structure is as follows: Order No  | Transaction Value for 1st Fiscal Peri

  • Turn computer on, goes to green, flashes yellow, back to green and no scree

    So I turn the computer on, the power button goes to green, flashes yellow, back to green and all the while the screen is not turning on. This just happened all of a sudden after no unusual circumstances. Help please! I've been looking for similar top