Need clarification to sum the entries in a internal table

Hi Gurus ,
        Below i have written the logic for have the count of number of records in the internal table along with it i need to find the Total dollar amount of all the records .
iam not sure how to have that total .
please provide me the solution .
you can see at the bottom the where i tryed to sum .
LOOP AT IT_BKPF.
*AP ENTRIES
    IF ( ( IT_bkpf-yke_awsys <> ' ' ) AND
            ( It_bkpf-ldgrp = '0L' OR It_bkpf-ldgrp = ' ' ) AND
             ( IT_BKPF-BLART EQ 'N1' OR IT_BKPF-BLART EQ 'N2' OR IT_BKPF-BLART EQ 'LP' OR
               IT_BKPF-BLART EQ 'TK' OR IT_BKPF-BLART EQ 'L5' OR IT_BKPF-BLART EQ 'L6' OR
               IT_BKPF-BLART EQ '1A' OR IT_BKPF-BLART EQ '1B' OR IT_BKPF-BLART EQ '1C' OR
               IT_BKPF-BLART EQ '1D' OR IT_BKPF-BLART EQ '1E' OR IT_BKPF-BLART EQ '1F' OR
               IT_BKPF-BLART EQ '1G' OR IT_BKPF-BLART EQ '1H' OR IT_BKPF-BLART EQ '1I' OR
               IT_BKPF-BLART EQ '1J' OR IT_BKPF-BLART EQ '1K' OR IT_BKPF-BLART EQ '1L' OR
               IT_BKPF-BLART EQ '1M' OR IT_BKPF-BLART EQ '1N' ) ).
   CLEAR : COUNT_AP_0L ,V_COUNT_AP_0L.
      READ TABLE It_bseg WITH KEY BUKRS = IT_BKPF-BUKRS
                                  BELNR = IT_BKPF-BELNR
                                  GJAHR = IT_BKPF-GJAHR
                                  BINARY SEARCH.
      LOOP AT IT_BSEG FROM SY-TABIX.
        IF IT_BSEG-BUKRS <> IT_BKPF-BUKRS.
       OR IT_BSEG-BELNR <> IT_BKPF-BELNR
       OR IT_BSEG-GJAHR <> IT_BKPF-GJAHR.
          EXIT.
        ENDIF.
        IF SY-SUBRC IS INITIAL .
      COUNT_AP_0L = COUNT_AP_0L + 1.
      MOVE COUNT_AP_0L TO V_COUNT_AP_0L .
      AT END OF DMBTR.
      SUM.
      ENDAT.      ENDIF.
      ENDLOOP.
Thanks ,
vinay

Hi,
Use the sum statment after AT LAST.  statment.
regards,
Santosh Thorat.

Similar Messages

  • Problem in Summing the value in one internal table. Its very urgent.

    Hi Experts,
    I have 10 fields in one internal table and based on the 8th field changing, I have to sum the 3rd field.
    I am unable to use AT END OF <FIELD8>, because any of the fields from 1 to 7 are changing, then this control break statement triggering.
    Could any body tell me, how I have to do this.
    Thanks,
    bsv.

    Hi,
    I think it could be as simple as below.
    DATA: l_field8 TYPE bla bla.
    READ TABLE itab
         INTO wa_itab
         INDEX 1.
    l_field8 = wa_itab-field8.
    LOOP AT itab INTO wa_itab.
         IF l_field8 NE wa_itab-field8.
              "Do the sum here
         ENDIF.
    ENDLOOP.
    Regards,
    Teddy
    Edited by: Teddy Kurniawan on Jan 25, 2008 8:38 AM

  • Using for all entries of two internal tables in where clause of the select

    Hi experts,
    My requirement is, need to select Marc-minbe and wrpl-sobst, for all the entries of the two internal tables it_mara , and it_t001w.
    here is the select queries i have used,
    select matnr normt from  mara into it_mara for all entries in it_data where normt = it_data-normt.
    select konnr werks from t001w into it_t001w for all entries in it_data where konnr = it_data-konnr.
    now i need to select minbe of marc table and sobse of wrpl table for all the entries of above internal tables, it_mara and it_t001w, using both matnr of it_mara and werks of it_t001w in where condition.
    Pls advise how i can do it.
    Thanks.
    Moderator message: very basic, please work on this yourself first, these forums are not a substitute for ABAP training.
    Edited by: Thomas Zloch on Dec 6, 2010 9:38 AM

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

  • Maintain the entries in /IXOS/DC_TALNTUA table

    Hi,
    I want to modify the entries in /IXOS/DC_TALNTUA table for maintaining the archive mode for a particulat user.
    Is there any transaction/config  to maintian this table in SAP?
    Thanks& Regards
    Manoj  Seth

    Hi Manoj ,
    You can do this by table maintenence SM30.
    You should also confirm  that is their any existing report to do so , As per my understanding there should be as we do not handle these cases by making direct entries in table. Please confirm from your side.

  • "The entry    is missing in table T030"

    Hi,
    I'm trying to close a period but, after all the selections made, when I execute I get this message: "The entry is missing in table T030". I mention that I'm trying to do this in localization for Romania. Maybe somebody could tell me what this message means and what should I do?!
    Thanks, Andreea

    Hi Andrea
    It looks like there is some account determination that is missing. Please recheck using TCode OBYC(relating to MM). Also please provide detailed information as to what transaction was exceuted when you got the error message.
    However do check your automatic posting procedures in OBYC.
    Regards,
    Karthik
    Message was edited by:
            Karthik Coneru

  • Max no. of entries in an internal table?

    Max no. of entries in an internal table?

    Hi,
    You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following addition:
    INITIAL SIZE <n>
    This size does not belong to the data type of the internal table, and does not affect the type check. You can use the above addition to reserve memory space for <n> table lines when you declare the table object.
    When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each are then allocated.
    You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The space occupied, depending on the line width, is 16 <= <n> <= 100.
    It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and need to allocate exactly that amount of memory
    (exception: Appending table lines to ranked lists). This can be particularly important for deep-structured internal tables where the inner table only has a few entries (less than 5, for example).
    To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB.
    Regards,
    Bhaskar

  • Moving the data from multiple internal tables into a single one

    Hello everyone,
    I am creating a classical report which uses the following tables.
    tables : ekko, ekpo, mara, makt,lfa1.
    my input parameter is 
    Select-options Purchase Order number
    Following fields are getting used.
    Doc no                  EKKO-EBELN
    Material              EKPO-MATNR
    Item number          EKPO-EBELP
    Quantity             EKPO-MENGE
    Material Group          MARA-MATKL
    Vendor                  EKKO-LIFNR
    Old Material code   MARA-BISMT
    Material Desc.           MAKT-MAKTX
    Vendor name         LFA1-NAME1
    Now i need to do the following task.
    1 Select record from EKKO Using document number.
    2 Select record from EKPO using EKKO record using Document no as key.
    3 Find out Old Material code of each and every material from Material master.
    4 Find out Material description for each and every material from MAKT.
    5 Sort record on Vendor, Purchase Order number and Material.
    I have defined seperate internal tables for these operation.
    Once i have fetched records into these individual internal tables  from the corresponding DB tables i need to move these values into a new internal tables which has all the above fields mentioned
    I need to move these values into a new internal table because to display the values on the report.
    Any idea for the above ? Plz help with a sample example or some relevant.
    Regards,
    Ranjith Nambiar

    Hi
    1 Select record from EKKO Using document number.
    2 Select record from EKPO using EKKO record using Document no as key.
    Use inner join and retrive data into one internal table.for Ex ITAB1
    3 Find out Old Material code of each and every material from Material master.
    Use ITAB1 with for allentries in MARA table to get the onl materil number populate in to one table.
    4 Find out Material description for each and every material from MAKT.
    Get the Material desc with the same manner as above,
    5 Sort record on Vendor, Purchase Order number and Material.
    now sort the ITAB1 as you req.
    now Loop on the ITAB1.
    and read above 2 tables for old matnr and matner deac and append into another table as you want.
    Hope this will help.
    Regards,
    Hiren Patel

  • Extract Cube data for all entries of an internal table

    Hi
    I want to fetch the data from the cube for all entries of another internal table.
    Scenario : Fetching the COMPANY_CODE and DATE into an internal table and for those company codes and Dates, I have to fetch the records of the Cube.,
    I am using the Function Module : RSDRI_INFOPROV_READ
    But not sure how to accommodate the multiple selections condition for this.
    Selection Required:
                                    *For all entries of it_cc
                                      where comp_code = it_cc-comp_code and
                                                  date = it_cc-date.*
    Please help me how to such multiple conditions and "for all entries" functionality for fetching the data from the cube.
    Thanks.
    Veera Karthik G

    HI
    You can try like this
    LOOP AT lt_donotcall_old .
    <ls_donotcall>-examination_date = sy-date.
    <ls_donotcall>-examination_time = sy-time.
    ENDLOOP.
    append it_donotcall_old.
    Reward all helpfull answers
    Regards
    Pavan

  • Count of entries in an Internal table

    Hi all,
    Can anyone give me a code as to how to get the count of entries in an internal table??
    Regards
    Sukanya

    Hi,
    with
    data: count type i.
      DESCRIBE TABLE it_table LINES count.
    will get the number of entries in a table,
    regards,
    Stefan Huemer

  • The work area (or internal table) "IT_ZLE_LAGERPLANUNG" is not flat,

    ***Data declaration
    TYPES : BEGIN OF t_zle_lagerplanung,
               SEl,                               "stores which row user has selected
               kdauf TYPE zle_lagerplanung-kdauf,
               kdpos TYPE zle_lagerplanung-kdpos,
               etenr TYPE zle_lagerplanung-etenr,
               papiermaschine TYPE zle_lagerplanung-papiermaschine,
               runnr TYPE zle_lagerplanung-runnr,
               prio  TYPE zle_lagerplanung-prio,
               werk TYPE zle_lagerplanung-werk,
               durchmesser TYPE zle_lagerplanung-durchmesser,
               breite TYPE zle_lagerplanung-breite,
               anzle TYPE zle_lagerplanung-anzle,
             occupied TYPE zle_lagerplanung-text30,
             free TYPE zle_lagerplanung-text30,
               lgpla TYPE zle_lagerplanung-lgpla,
               lgtyp  TYPE zle_lagerplanung-lgtyp,
               art TYPE zle_lagerplanung-art,
               anzhoehe TYPE zle_lagerplanung-anzle,
             zindicator TYPE zle_lagerplanung-text30,
               fa TYPE zle_lagerplanung-fa,
               field_style  TYPE lvc_t_styl, "FOR DISABLE
    END OF t_zle_lagerplanung.
    I am getting the data in internal table by using thiis select statement.
      SELECT kdauf kdpos etenr papiermaschine runnr prio werk durchmesser breite
             anzle lgpla lgtyp art anzhoehe fa
        FROM zle_lagerplanung INTO CORRESPONDING FIELDS OF TABLE it_zle_lagerplanung
       WHERE kdauf IN s_kdauf
    "     AND kdpos = p_kdpos
          AND KDPOS IN s_kdpos
         AND werk = p_werks.
    But while updating the particular field in ztable using this statement
          UPDATE zle_lagerplanung from table it_zle_lagerplanung.
    it is giving syntax error
    "The work area (or internal table) "IT_ZLE_LAGERPLANUNG" is not flat, or
    contains reference or internal tables as components. components.
    components. components. components."
    Could any one help me out how to resolve this problem....
    Thanks in advance

    Hi Shyamal,
    lvc_s_styl is a structure so you will get the same error.
    for your select and update statement you dont need field "field_style".
    regards
    rea

  • Copying data from a table in the Database to an internal table.

    Hello,
    How do I copy data that is a table that is in the database and and then load the data to an internal table in the ABAP/4 Aditor.
    Please help.

    hi,,
    do this way ...
    tables : mara.
    parameters : p_matnr like mara-matnr,
    start-of-selection.
    select <fields>  from mara into table it_mara
         where matnr = p_matnr.
      if sy-subrc = 0.
    endif.

  • The contents in a internal table

    Hi Experts,
    I have a doubt in filling the contents of an internal table with the database table fields reference.
    For eg: There is an internal table like this:
    data: begin of t_conditions occurs 0,
                 kschl like rv13a-kschl,
                 vkorg like komg-vkorg,
                 kunnr like komg-kunnr,
                 matnr like komg-matnr,
                 kbetr(15) type c,
                 datab(10) type c,
                 datbi(10) type c,
          end of t_conditions.
    in the above example, the "matnr" he has taken with the reference field "komg-matnr"..
    Please look at the following internal table:
    data: begin of t_material occurs 0,
                    matnr(18) type c,
                    matkl(9)  type c,
                    bismt(18) type c,
          end of t_material.
    In the above 2 examples the declaration of "matnr" field is diffrent from one with the other.
    in 1st eg., he has taken as: <b>matnr like komg-matnr</b>
    where as in the 2nd eg: <b>matnr(18) type c,</b>
    my question is: how can i know where to declare as in the 1st eg., and where to use like in the 2nd eg.,
    Please clarify.
    I greatly appreciate your help.
    Thanks,

    Hi sey
    If you see in the domain level both the DOMIAN's will be the same. So it doesn't matter. All the matnr will have a character type of size 18.
    for the programmer reference they will using the table name in which they want to select the data.
    i.e for the first ex. he will be selecting data from the KOMG table and in the second from the MARA table.
    but both the Matnr type are same.
    <b>there is a small change since the second ex doesn't use any table it is simply of type c. the difference is when you reference to any Data DICTIONARY object then it can contain certain conversion exits, etc. so it will apply for your reference data typr</b>
    regards
    kishore
    Message was edited by: Harikishore Sreenivasulu

  • Difference between the Field Group  and Internal Table.

    Hi all,
    Can anybody tell me the difference between the Field group and Internal table and when they will used?
    Thanks,
    Sriram.

    Hi
    Internal Tables: They are used to store record type data in tabular form temporarily in ABAP programming. Or we can say, it stores multiple lines of records for temporary use in ABAP programming.
    A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
    Use
    The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
    When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
    Regards
    Ashish

  • Create an internal table with the rows of another internal table.

    Hi I want to know if posible to create an internal table structure with the  rows of another internal table?
    ex.
    If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third.
    Now I want that the structure of my internal table be: first, second, third

    Hi,
    If you do this way then what will be the difference between the two table anyway?? First internal table has the same structure irrespective of which row you select. and you are going to store the data from each row to the rows of the second internal table. In that case, the structure of the internal table is the same as first table. and it would have same rows.
    Am I missing something here? or you want to declare the internal table with each field being the structure of the first table? In this case you'd have to do a dynamic declaration of data as the first table can have any no of rows then the second table would have any no of fields in the structure.
    Now if you know that your first internal table is going to have a fixed no of rows eg 3 rows then it becomes simple. Do the following then
    Data: begin of second_table occurs 0,
    first type <first_table type>,
    second type <first_table type>,
    third type <first_table type>,
    end of second_table.
    Regards
    Prasenjit

  • FM to upload the Excel file to internal table

    Hi
    Is any FM available to upload the Excel file to internal table.
    Thanks
    Anbu

    Hi
    se this code
    EXCEL to INTERNAL TABLE and then to APPLICATION SERVER
    *& Report  ZSD_EXCEL_INT_APP
    REPORT  ZSD_EXCEL_INT_APP.
    parameter: file_nm type localfile.
    types : begin of it_tab1,
            f1(20),
            f2(40),
            f3(20),
           end of it_tab1.
    data : it_tab type table of ALSMEX_TABLINE with header line,
           file type rlgrap-filename.
    data : it_tab2 type it_tab1 occurs 1,
           wa_tab2 type it_tab1,
           w_message(100)  TYPE c.
    at selection-screen on value-request for file_nm.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      PROGRAM_NAME        = SYST-REPID
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       STATIC              = 'X'
      MASK                = ' '
      CHANGING
       file_name           = file_nm
    EXCEPTIONS
       MASK_TOO_LONG       = 1
       OTHERS              = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    start-of-selection.
    refresh it_tab2[].clear wa_tab2.
    file = file_nm.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        filename                      = file
        i_begin_col                   = '1'
        i_begin_row                   =  '1'
        i_end_col                     = '10'
        i_end_row                     = '35'
      tables
        intern                        = it_tab
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 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.
    loop at it_tab.
      case it_tab-col.
       when '002'.
        wa_tab2-f1 = it_tab-value.
       when '004'.
        wa_tab2-f2 = it_tab-value.
      when '008'.
        wa_tab2-f3 = it_tab-value.
    endcase.
    at end of row.
      append wa_tab2 to it_tab2.
    clear wa_tab2.
      endat.
    endloop.
    data : p_file TYPE  rlgrap-filename value 'TEST3.txt'.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *--- Display error messages if any.
      IF sy-subrc NE 0.
        MESSAGE e001(zsd_mes).
        EXIT.
      ELSE.
    *---Data is downloaded to the application server file path
        LOOP AT it_tab2 INTO wa_tab2.
          TRANSFER wa_tab2 TO p_file.
        ENDLOOP.
      ENDIF.
    *--Close the Application server file (Mandatory).
      CLOSE DATASET p_file.
    loop at it_tab2 into wa_tab2.
      write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
    endloop.

Maybe you are looking for

  • Scheduler task to save file to KM.

    Dear all I have seen the following blog for scheduler task. <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1515">Link to blog</a> But my scenario is a little bit different. I want to create a sceduler task which creates and save a fil

  • Locked Folder

    Why is it that after I select the "Write only(Dropbox)" option when locking a folder, I receive the following message when I try to open it..."You do not have permission to open the document "<<folder name>>". Contact your computer or network adminis

  • Why can't I set boot to 10.10 when I'm booted to 10.6.8?

    ok, I have a multi-boot set up, I have 10.6.8 and 10.10 installed on a pair of HD's, After the debacle of installing yosemite, Why Can't I see the install when I'm booted to my tried and true 10.6.8 system (in Sys Pref/startupdisk/)? Only way I can g

  • Can find E-Business Control Center

    I'm running portal 4.0 on solaris and currently trying to get things working. I've managed to get most up and running but I can't the e-business control center up and running? It looks as if I'm missing the files which has something to do with the EB

  • Business Object for FNM1 or FNM1S

    Hello alls, Does anyone know say what are the business object to the transaction FNM1 or FNM1S? It started as a workflow in these transactions for release of payment before the document be counted? The document will count only if the approver release