Using aggregation in ABAP code for internal table

I have written following code to get cumulative amount on a date but i have to hit database for each record.
Can't I use some function similar to SUM for doing the same thing on internal table??It would increase my performance.
code is:
    SELECT SUM( DEB_CRE_LC ) FROM /BIC/AZFIAR_O500
     INTO LV_BALMONTH   WHERE   DEBITOR = LV_DEBITOR AND
    CALMONTH GE LV_STARTMONTH AND CALMONTH  LE LV_LASTCALMON.
I want to put  ZFIAR data to internal table and read and do SUM thing..is it possible?? withotut usiong loop.
regards,
rakesh

Hi Rajesh,
types : begin of ty_tab,
            date type dats,
            DEB_CRE_LC   type .....     " delare type & is the filed need to summerized
            end of ty_tab,
data: itab type standard table of ty_tab.
SELECT date
              SUM( DEB_CRE_LC )  as DEB_CRE_LC  FROM /BIC/AZFIAR_O500
              INTO corresponding fields of itab
              where CALMONTH GE LV_STARTMONTH AND CALMONTH LE LV_LASTCALMON
              group by date.   " date is the field available in your ODS/transparent table
simulate the above code in your program...
Hope this will work..

Similar Messages

  • Help with basic ABAP code (merge internal tables, sort of...)

    Hello,
    Can someone please help write some basic code for a Basis guy with limited ABAP knowledge?
    Should be some easy points for an experienced ABAPer!
    I have identicaly structured internal tables I_A and I_B and I_C which have already been filled by function models I called.
    How will I code the following?:
    I want to read all the data of I_A into a new internal table I_MASTER (structured the same as I_A,I_B and I_C).
    Then I want to read I_B and:
    1)Update I_MASTER with NEW records
    2)Update existing records if the value of field MYFIELD in I_B is smaller than the value of MYFIELD in I_MASTER.
    Then I want to read I_C and:
    1)Update I_MASTER with NEW records
    2)Update existing records if the value of field MYFIELD in I_C is smaller than the value of MYFIELD in I_MASTER.
    Let me know if I can provide anymore information.
    Thanks in advance for you help!
    Adriaan
    Message was edited by: Adriaan
    Message was edited by: Adriaan

    Hi Adriaan ,
    I want to read all the data of I_A into a new internal table I_MASTER (structured the same as I_A,I_B and I_C).
    <b>i_master[] = i_a[] .</b>
    loop at i_b .
    read table i_master with key myfiled < i_b-myfield .
    if sy-subrc = 0 .
    append i_master from i_b .
    endif.
    endloop.
    loop at i_c .
    read table i_master with key myfiled < i_c-myfield .
    if sy-subrc = 0 .
    append i_master from i_c .
    endif.
    endloop.
    Let me know if this helped .
    Regards,
    Varun .
    Message was edited by: varun sonu

  • Why using workarea for internal table is better in performance

    Please tell me
    why using workarea for internal table is better in performance

    Hi Vineet ,
      Why would we choose to use an internal table without a header line when it is easier to code one  with a header line?
    it has following reason.
    1)Separate Internal Table Work Area:
         The work area (staging area) defined for the internal table   is not limited to use with just one internal table.
    take ex-
    Suppose you want two internal tables for EMPLOYEE – one to contain all records and one to contain only those records where country = ‘USA’.  You could create both of these internal tables without header lines and use only one work area to load data into both of them. You would append all records from the work area into the first internal table.  You would conditionally append the ‘USA’ records from the same work area into the second internal table.
    2)  Performance Issues:  Using an internal table without a header line is more efficient than one  with a header line
    3) Nested Internal Tables:  If you want to include an internal table within a structure or another   internal table, you must use one without a header line.
    If this one is helpful ,then rewards me
    Regards
    Shambhu

  • How To Create ABAP Code For HR Context Sensitive Structural Authorization

    Hello,
    We have created a HR Custom Program which IS NOT built off the PCH or PNP Logical Database. As a result, we need to manually create ABAP code for HR Context Sensitive Structural Authorization Check in our custom HR program. Via HR Context Sensitive Structural Authorizations, we are restricting access to personnel numbers and the underlying HRP* tables.
    Any assistance would be greatly appreciated with the identification of the SAP standard function modules (Ex. RH_STRU_AUTHORITY_CHECK, HR_CHECK_AUTHORITY_INFTY, HR_CHECK_AUTHORITY_INFTY , etc) used in HR Context Sensitive Structural Authorization Check, how they are used to control HR Structural authorization (P_ORGINCON), and some sample code.
    Thank you in advance for all your assistance,
    Ken Bowers

    Hello Ken
    You can use the interface methods IF_EX_HRPAD00AUTH_CHECK to get the same structural authorization as you can see in PA20/PA30. You need to use the methods set_org_assignment and check_authorization for this purpose. For more information you can refer to include FP50PE21 from line 237 onwards till 270.
    Regards
    Ranganath

  • Aggregate functions for internal table.

    Hi Gurus,
    I'm just wondering whether we can use aggregate functions for internal table. I wanted to know the max value for a particular column in my internal table. How can I achieve this easily and quickly.
    Thanks,
    David.

    sort the table on which you want the maximum value and read it. Please find below example code.
    TYPES : BEGIN OF ty_mvke,
            matnr TYPE mvke-matnr,
            vkorg TYPE mvke-vkorg,
            vtweg TYPE mvke-vtweg,
           AUMNG type mvke-AUMNG,
            END OF ty_mvke.
    DATA : wa_mvke TYPE ty_mvke,
           it_mvke TYPE STANDARD TABLE OF ty_mvke.
    data : temp_AUMNG type AUMNG.
    START-OF-SELECTION.
      SELECT matnr vkorg vtweg AUMNG FROM mvke INTO
            table it_mvke.
    sort it_mvke by AUMNG.
    read TABLE it_mvke into wa_mvke INDEX 1.
    if sy-subrc = 0.
    move wa_mvke-AUMNG to temp_AUMNG.
    write : temp_AUMNG.
    endif.
    Thanks,
    Sreekala.

  • ABAP Code for BI objects

    Hi Friends,
    I have created BI objects like infocubes, infoobjects, DTP, Datasource to transfer data from a flat file to BI system using SAP GUI... All data from flat file are transfered to BI successfully... i dont have any knowledge in ABAP... So i need to see the ABAP code for the BI objects i created above in my project... how can i see the coding for that?
    thanks in advance
    sasi

    Hi Sasi,
    All the objects which you create in BI will be stored in some standad tables,it only fetch details accordingly from those tables.For MasterData you can find the option as Display Routines in Extras.If you want to get more infomation about the STD Table and the Program involed in BI objects,just enter in (/h) mode.
    Regards,
    Prem

  • Needs sample ABAP code for field routine

    Dear Expert,
    There is a field "Pay Scale Group" in my DSO which stores the data in the format
    AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
    InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
    I need to write a field routine on the transformation between DSO and Cube.
    Can any one please help me with the sample ABAP code for this scenario.
    Some more examples for better understanding of the requirement:-
    Data in DSO(Source)            Data in Cube(Target)
    ===================            ===================
    AA1/B1/CCC2/DD2/EEE1            EEE1
    AAA1/BB2/CC1/DDD3/EE2           EE2
    A2/BBB2/CC2/DDD3/EEE5           EEE5
    AA2/BB1/C1/DDD3/EE3             EE3
    A3/B1/CC2/DDD1/EE4              EE4
    Many thanks in advance.
    Regards,
    Prakash
    Please do not dump your code requirements in SDN
    Edited by: Pravender on May 18, 2011 11:37 AM

    Hi,
    You can use the following code :
    Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
    And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
    My assumption is that there will always be 4 '/'.
    In the field routine write the below code
    data: V1(5) type c,
              V2(5) type c,
             V3(5) type c,
              V4(5) type c,
             V5(5) type c.
    data : VAR1 TYPE /BIC/OIZPAY_SGRP.
    split VAR 1  at '/' into V1 V2 V3 V4 V5.
    result = V5.
    V5 will be having the characters after the last '/' .That is V5 = EEE1.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh
    Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
    Edited by: Ashutosh Singh on May 17, 2011 4:17 PM

  • Transaction code for custom table

    Hi there,
    I created one custom table. I created Tbale Maintenance Generator for this. I have to create transaction code for this table so that user can directly open this custom table in SM30. Can anybody suggest on this. is there any other way to do this so that user can directly open this custom table in SM30 mode?
    Regards,
    Zakir.

    Hi
    Check this link for creating a transaction code for a TM
    http://www.sap-img.com/abap/create-a-table-maintance-program-for-a-z-table.htm
    Please go throught below link ..... it was given with screen shots of the T.code Creating for the table after the maintaince view had been created ......
    http://www.sapdevelopment.co.uk/tips/tips_tabmaint_tcode.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/how%20to%20implement%20events%20in%20table%20maintenance.doc
    Regards
    Anji

  • Need ABAP code for the below Services requirement

    Hi,
    We have a requirement to show all the services for a particular Purchase order number.For this I built a view on 2 tables ESLL and EKPO.Now based on the below logic I need to bring the services for the Purchase order..
    1.Enter PO number,item no. and Doc category in EKPO and find the Pack no.
    2.Now take the Pack no. of EKPO and give in ESLL and find the Sub pack no.
    3.Now take this Subpack no. and Give this sub pack as Pack no. in ESLL
    4.This will be the Service entry record for that PO number.
    Can any one Please suggest me to how to write the ABAP code for the above logic.
    Thanks & Regards,
    Dinakar

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • System Variable For Internal table count

    Can anybody tell me what the system variable for internal table count?
    I just wants to know how many recoreds are there in my internal table ?
    Regards,
    pandu.

    Hi ,
    DESCRIBE TABLE <itab> [LINES <l>] [OCCURS <n>] [KIND <k>].
    If you use the LINES parameter, the number of filled lines is written to the variable <lin>. If parameter, the you use the OCCURS value of the INITIAL SIZE of the table is returned to the variable <n>. If you use the KIND parameter, the table type is returned to the variable <k>: ‘T’ for standard table, ‘S’ for sorted table, and ‘H’ for hashed table.
    using variable
    SY-TFILL
    After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3798358411d1829f0000e829fbfe/content.htm
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 21, 2008 4:53 PM

  • SSD code for internal bank

    Making customizing for automatic payment, i have error F0275 "no SSD code for internal bank" when generating. Following the link to customizing i enter in the internal bank setting. But what is the field to fill? i dont found fields with SSD description.
    thanks
    Davide

    Found!
    It is necessary fill the field T012D-DTAWS; in Italy it isn't used but in Germany (we working on german subsidiary) is necessary.

  • Code for inverse table query

    I'm looking for a program that will tell you, when a list is uploaded to a table, what values in the list are NOT in the table.
    The program would have other optional fields as well.  For example, you would enter the table name and field names.  So to query table BKPF where field XXX = 'SB' and all records where field YYY are NOT in the table.
    Surely someone somewhere has to have written ABAP code for this.  It's a hassle downloading data from tables and doing VLOOKUPS in Excel to find out what values are NOT in the table.

    HI Rohit,
    go through below links
    https://cw.sdn.sap.com/cw/docs/DOC-21028
    go to this thread
    Difference between "start_routine" and "inverse_start_routine"
    http://help.sap.com/saphelp_nw70/helpdata/en/45/f5af4a4db53482e10000000a1553f6/content.htm
    Thanks
    sreenu

  • ABAP code for wrting a file to application server

    <Moderator Message: We are not here to do your job for you>
    Hi All,
    i have a requirement to get the data from some other ABAP program and this data has to be written in one of the files present in application server.
    please provide me the exact ABAP code for this...
    Edited by: Siegfried Szameitat on Dec 17, 2008 10:40 AM

    this has to be done using a process chain

  • ALV display using dynamic field catalog and dynamic internal table

    hi ,
    please guide me for ALV display using dynamic field catalog and dynamic internal table.
    Thank you.

    Hi Rahul,
    maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
    Regards Rudi

  • Abap code for sap exit variables?

    Hi,
    i) Where can I find the abap code for SAP exit variables
    OP_KEYDT used for the net due date
    OP_KEYD2 used for the posting date
    OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
    Based on the Net Due Date, which  is key date(0NETDUEDATE),  entered by the user at runtime, the posting date and celaring date are populated.
    II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom  Net Due Date(ZNETDUEDATE).And this date is populated to posting date and  clearing date variables.
    How do we acheive that.
    Thanks.

    Please tell how u solved ur issue i have the same scenario to be do.

Maybe you are looking for

  • How do you create the FPGA I/O Start Node shown in the NI 9233 Getting Started FPGA VI

    The fourth frame of the sequence structure in the NI 9233 Getting Started (FPGA) VI (from examples, browse by task, Toolkits>>FPGA>>cRIO>>AI>>Modules>>9233) shows an FPGA I/O node with a Start Terminal.  Can someone tell me how to generate the Start

  • Splitting and loading a movie in segments

    Help would be greatly appreciated. I am trying to figure out the best practices for loading a movie. I have an empty clip set up with a preloader that loads the swf file, but the wait time is too long. I want to split up the movie and load sections a

  • Mac mini hookup

    Hello i found an old mac mini today for $100 at this local elec. shop... But i'm on the road with my laptop and no other external monitor.... Is there a quick and easy (no $$) way to hook it up and view/operate it's desktop on my laptop...?? Help...

  • Transfering Video 8 tape for editing in FCP

    I'd like to bring some Video 8 tapes from a camcorder without a firewire port, into FCP to edit them. What should I have the footage converted into .... miniDV tape, Quicktime, DVD ??? Which will give the best results to work with? Thanks a lot monic

  • AVCHD audio glitch/drop on spanned clips - CS4

    Hello all, I was wondering if anyone else is experiencing this issue.  We have an Sony NX5U Camera, and when we shoot long format, the camera breaks the AVCHD clips into 2gb sections. (Spanned clips). When we bring them into Premiere CS4 they play ju