AT NEW, AT END OF query

Hi experts,
       I have a requirement in which i have to do the sum total of one field as per 2 key fields.Currently my internal table o/p is like this: I am using at end of f1.
      f1        f2        f3
      a         2         m
      a         3         m
      a         1         s
   Total       6
      b         2         p
      b         3         p
      b         4         r
    Total      9
But now i want the o/p as follows: f2 shd sum up as per f3
   f1--f2--
f3
   a-- 5--
m
1----
o
   Total----- 6
   b--5--
p
4----
r
   Total------9
Someone plz help quick.
Thanks.

Check the below code which i modified according to your data.
REPORT z_sample_alv.
data : begin of i_data occurs 0,
       f1 type c,
       f3 type c,
       f2 type i,
       end of i_data.
data wa_data like i_data.
data flag type c.
data v_f2 type i.
data v_f3 type i.
start-of-selection.
i_data-f1 = 'a'.
i_data-f2 = 2.
i_data-f3  = 'm'.
append i_data.
clear : i_data.
i_data-f1 = 'a'.
i_data-f2 = 3.
i_data-f3  = 'm'.
append i_data.
clear : i_data.
i_data-f1 = 'a'.
i_data-f2 = 1.
i_data-f3  = 's'.
append i_data.
clear : i_data.
i_data-f1 = 'b'.
i_data-f2 = 2.
i_data-f3  = 'p'.
append i_data.
clear : i_data.
i_data-f1 = 'b'.
i_data-f2 = 3.
i_data-f3  = 'p'.
append i_data.
clear : i_data.
i_data-f1 = 'b'.
i_data-f2 = 4.
i_data-f3  = 'r'.
append i_data.
clear : i_data.
sort i_data by f1 f3.
loop at i_data.
move i_data to wa_data.
at first.
write:/2 'f1', 22 'f2',35 'f3'.
endat.
v_f2 = v_f2 + i_data-f2.
v_f3 = v_f3 + i_data-f2.
at end of f3.
write:/2 wa_data-f1,13 v_f2,35 wa_data-f3.
clear v_f2.
endat.
at end of f1.
skip 1.
write:/2 'Sub total',13 v_f3.
skip 1.
clear v_f3.
endat.
clear : flag,
        wa_data,
        i_data.
endloop.
Thanks
Seshu

Similar Messages

  • Create new variable in a query using if

    Is it possible to create a new variable in a query based on an if statement.
    eg select A, B, C from table where condition
    C is the new variable and should have a value of 10 if A is > 100 and a value of one if A > 100 and B < 200 for example.

    Yes. Why not.
    select a,
             b,
             case
                 when a> 100 then
                    10
                 when a> 100 and b<200 then
                   1
              end c
    from table
    where <condition>;Regards.
    Satyaki De.

  • How to add new fields in SAP-Query

    Hi,
    Can any body tell how to add new fields to the existing query.
    Thanks a lot,
    Bhaskar.

    hi,
    when we create internal tables like. in final table you can include the extra fields.
    data : begin of itab_mara,
             matnr like mara-matnr,
             erdat like mara-erdat,
             end of itab_mara.
    data : begin of itab_marc,
             matnr like marc-matnr,
             werks like marc-werks,
             end of itab_marc.
    data : begin of itab_final,
             matnr like mara-matnr,
             erdat like mara-erdat,
             werks like marc-werks,
             date like sy-datum,
             status(10) type c,  * new fields
             end of itab_final.
    <select statement>.
    Append all the fields to itab.
    loop at itab_final.
    write :/ itab_final.
    endloop.
    Reward with points if helpful.
    Message was edited by:
            Vinutha YV

  • New front end editor problem

    I'm quite new on this forum, so don't be so angry if I'm asking about something that someone else was asking for, by i didn't found answer on my question.
    So...
    In my company, administrator made some updates in 4.7, after that updates new front end editor is avalible (this with code colorin, code hinting, code folding etc).
    But I have some problem with keyboard mapping scheme. When i try to save my own setting or change keymapping to another one, SAP stop responding (it's not a crash with short dump but simple aplication freezing). I tried to find some solution to this behaviour but I didn't found it yet.
    My question is:
    1) Did someone else have the same behaviour as I?
    2) Where to find SAP notes about front end editor?
    Thx in advance for any help

    Keymapping settings in file:
    C:\Documents and Settings\<username>\ab4_data\keymap.xml
    You should also check the following dir:
    c:\Program Files\SAP\FrontEnd\SapGui\ab4_data\
    During patch installation this dir is overwritten, and during the first use of the new editor, the files from here copied to the <username>\ab4_data dir, where you can change them.
    Might be permission problem, I can imagine, that if you have no authorization to change these files, the GUI starts hanging or chrashing.
    Peter

  • New Front-End Editor is Dumping when I try to check an ABAP source code

    Hi Experts
    I'm trying to check the source code of any ABAP in SE38 with the new front-end editor, but I'm facing a dump, maybe there is missing a patch or something like that. if any of you have information about that I really appreciate your aswers.
    I reinstalled the SAP GUI and still have the issue.
    part of the dump is here
    Runtime Errors         MESSAGE_TYPE_X
    Date and Time          04/09/2008 15:12:51
    Short text
         The current application triggered a termination with a short dump.
    What happened?
         The current application program detected a situation which really
         should not occur. Therefore, a termination with a short dump was
         triggered on purpose by the key word MESSAGE (type X).
    Error analysis
         Short text of error message:
         Control Framework : Error processing control
         Long text of error message:
          Diagnosis
              An error occurred when the system tried to process the commands
              from the Automation Queue on the presentation server.
              There are several possible reasons for this:
              - The installation of the SAP GUI on the presentation server is
              faulty or obsolete.
              - There is an error in the application program
              - There is an error in the SAPGUI or an integrated control

    Hernan Enriquez ,
                               Hi you can try the below things :
    1) You need have the latest patch of the SAP GUI installed.
    2) If you have the above try to re-install the GUI from the scratch. It might be courrupted.
    3) If VISTA need to check the GUI compatibility.
    Thanks,
    Greetson

  • AT NEW & AT END is not triggered

    Hi All,
    I am having following code where AT NEW & AT END is not get triggered, whenever there is data like following in table.
    Can any once comment why AT NEW & AT END OF not getting triggered in this case?
    ITAB-A  ITAB-B
    Tube                             0
    Tube                             10
    Tube                              0
    LOOP AT ITAB where B > 0..
    AT NEW A.
    u2026.
    ENDAT.
    u2026.
    AT END OF A.
    u2026.
    ENDAT.
    ENDLOOP.
    Regards

    Example :
    Data : Begin of ITAB occurs 0,
                first type c,
                second type c,
                third type c,
           end of itab.
    sort itab by first.
    loop at itab.
    AT NEW FIRST.
       flag = X.
    ENDAT.
    if flag =  X.
       write ; itab-first, itab-second, itab-third.
    endif.
    AT END of FIRST.
         write : 'END OF THE COMMAND'.
    endat.
    endloop.
    *****Hope this will give u idea.
    endloop.

  • New front end issue - services not starting

    Have build an additional lync 2013 standard edition server, the setup went through fine without error but the following services will not start and cannot figure out why.
    Lync Server Audio Test Service
    Lync Server Front-End
    Event logs only give the following
    This process was not able to update its health status
    The IM Conferencing Server failed to send health notifications to the MCU factory at https://Server/????.ac.uk:444/liveserver/mcufactory/.
    A component could not be started.  The service has to stop.
    Component: Live Communications Applications Module  Error code: C3F2765F!_HRX! (APIEM_E_ESBASE_MISSING!_HRM!)
    urn:application:testbot
       Exception: Microsoft.Rtc.ApplicationServerCore.ApplicationServerMethodTimeoutException > ErrorCode: 2 > Message: The method call CallStartAsync failed due to The method timed out. > TargetSite: Void CallMethod() > StackTrace: at Microsoft.Rtc.ApplicationServerCore.ApplicationMethodCaller.CallMethod()
    at Microsoft.Rtc.ApplicationServerCore.ApplicationHost.CallApplicationStart() > Source: Microsoft.Rtc.ApplicationServerCore > HResult: -2146233088  
    Cant find anything else in the event logs

    I have made sure they are all on the same CU update but the new front ends will still not start, following errorsWhere would i see if its a certificate related error as they look ok from the lync deployment wizard?
    Event log errors
    The UserServices module was not found in the Application List.
    Application Uri: 'http://www.microsoft.com/LCS/UserServices'
    Cause: The server configuration requires the UserServices module to be registered and active. However the configuration information is not found.
    Resolution:
    UserServices configuration is installed at setup time. Check the application list and ensure that it is present. If it is not present, reinstall the server. If this problem occurred after you installed a new application, contact the application vendor to rectify
    the problem.
    Failed to initialize the API subsystem.
    Cause: Review earlier events to determine the specific reason APIEM failed to initialize.
    A component could not be started.  The service has to stop.
    Component: Live Communications Applications Module  Error code: C3F2765F!_HRX! (APIEM_E_ESBASE_MISSING!_HRM!)
    The Lync Server Front-End service terminated with the following service-specific error:
    %%3287447135

  • ABAP New Front-end editor not opening in Windows 7

    Hi ,
    When I am trying to open a  report with the ABAP New Front-End Editor with  Windows 7 as OS, the system is getting  freezed without navigating to any other screen .The SAP GUI that I am using is  Release 710 with Patch level 17.
    Please help me to sort out the problem
    Thank You.
    Regards,
    Bala

    Hello
    please install the latest Sapgui patch 20 and the problem is solved.
    BR
    Sven

  • How to remove new line character from query output?

    Hi,
    How to remove new line character from query output?
    have tried select replace(column_name, CHR(10), ' ') from table_name.
    Edited by: GreenHorn on Sep 11, 2008 12:53 AM

    Please consider, that windows uses a sequence of chr13||chr(10) Unix uses only one character chr(10).
    The new line character(s) may be OS-dependent.
    You could consider both with:
    replace(replace(column_name, CHR(13)||CHR(10), ' '),CHR(10),' ')
    Hartmut
    Edited by: hartmutm on 11.09.2008 01:32

  • Support the news front-end languages of the GUI

    Hi all,
    I want know about the roadmap for support the news front-end languages of the GUI, especially about Brazilian Portuguese language.
    Thanks,
    Renato Soti
    Message was edited by:
    rjsoti

    Hi Renato
    As with other Oracle software the GUI translation in other languages is based on a business case basis. Pl send me an email at [email protected] , detailing the customer case and I will take it up with all concerned folks.
    Thanks
    Vishal

  • Original Mac Pro vs. New High End iMac

    I need some advice on whether to upgrade my system, based on the new iMacs just released. Here is what I currently own:
    Mac Pro with two Intel 2.66 dual-core processors
    (Early 2007 edition)
    16x SuperDrive
    6 GB of RAM
    1 TB HD
    ATI Radeon X1900 XT (512 MB)
    23" Apple Cinema Display
    I'm thinking of selling all of that and buying the new high-end 27" iMac...
    2.66 GHz Intel Core i5
    4 GB of memory (I'd upgrade it to 8 GB)
    2 TB Hard Drive
    ATI Radeon HD 4850 graphics card
    27" display (included)
    I've done the research and I would roughly break even. Cost is not a concern. The following factors are under consideration...
    What is the performance difference between the 4 cores I have in the 2.66 Xeon vs the 4 cores in the Core i5?
    My X1900 graphics card is not supported under Snow Leopard's OpenCL. The new HD 4850 would be.
    I'd like to have the larger display (27" vs. 23") and the built-in video camera for iChat video conferencing.
    I am not a professional user. I consider myself a high-end consumer user, primarily doing HD video editing with iMovie, some video encoding with Handbrake, and "prosumer" work with RAW files in Aperture. The rest is basic use- such as email, internet, etc.
    I would love to have some objective advice on this decision!
    Thanks....

    If performance of the current system is acceptable, I would keep it and use it as long as possible. You have the capability to do things like replace the display (with a new one of your choosing), upgrade the video card, and add additional internal SATA drives. Having additional internal storage at SATA speed, and using separate drives to store OS/apps and user data, will increase your system's productivity.
    When performance of your Mac Pro is no longer acceptable, get a new Mac Pro.

  • Migrate the Production APPS and DB to New High End Server

    Hi,
    current Low end server:
    Single Node Installation: DB & APPS
    Version: 12.1.1 (11.1.0.7)
    Operating System: Redhat Linux 5.4 (x86-64)
    We have bought new high end machine with more cpu, RAM anad More Hard Disks.
    We are going to move everything from current low end server to new high end server.
    1. Install Linux 64 bit on New High End Server with required RPMS, Kernel Parameters, User Limits etc etc
    2. Make partitions on this server as same as current server ( Mount Points should be same as current server)
    3. Make users and groups and assign proper permissions on partitions
    4. Maintain same hostname and IP Address in Target Server
    5. Run Preclone in both DB Tier and Apps Tier in Source Server
    6. Take backup of current server and copy it to Target Server
    7. Shutdown the Source Server
    8. Run config clone on Target Server
    9. Start the Services in Target Server, after clonining, Make sure that all services are running including concurrent managers
    10. Configure Printers at OS Level with same in Oracle Applications Printers Screen
    12. Copy the Backup scripts from source to target server
    13. If tape drive is configured at current server, configure it new Server as well.
    Please let me know, if i miss anything....
    thanks in advance......

    Hi oraDBA2,
    It's been long time, how are you doing?
    Your steps are correct and I would say there is nothing missing. Please note the mount points on the target node(s) do not have to follow the same naming you have on the source node as you are going to run postclone on the target server(s). However, keeping it the same would make it more straightforward. As long as you have all pre-req. OS packages and software installed and you are going to keep the same hostname/domainname as well as IP Address, you should be good.
    An alternative would be restoring the files on the target node(s) without running preclone/postclone but this requires relinking as per the following documents.
    Note: 356878.1 - How to relink the whole Applications 11i Installation
    Note: 131321.1 - How to Relink Oracle Database Software on UNIX
    Note: 407055.1 - Process To Upgrade the Operating System and Oracle Database Server
    Since Rapid Clone is your option (which I personally prefer) you can skip this part as relinking will be done by Rapid Clone, so you do not have to worry about it.
    Good luck!
    Thanks,
    Hussein

  • Rumor: Nokia to reveal new high end smartphone soon

    Forbes is reporting from anonymous source that Nokia is going to announce a new high end smartphone at the start of MWC (2/27).  No word if it's a Windows Phone device or not.
    Speculation on some of the posts throughout the interwebs is that it might be the 801 running Belle

    John,
    Neither is an ideal machine. 64MB VRAM (and other video card factors) is not sufficient to run all Photoshop features. But the G5 may also need a video card upgrade (check Adobe's list of appropriate cards), which may or not be practical. And more and more apps are being developed for Intel only, so you are buying dated technology either way.
    I'd be looking into a more capable Intel machine, either second-hand, refurbished, or as a lease (if for business).
    Neil

  • How to add new codes into SAP Query/Infoset

    Hi Experts,
    First time working with SAP Query.
    I need to enhance an existing Query to add a new field into a report.  I have added new tables into this Infoset and joined my new  tables with existing tables and able to extract the new fields out on the report.  But here are my problems:
    Example of original output:
    X88888 500000
    X99999 400000
    Example of new output after adding my 2 new tables to get 1 new field to output:
    X88888 50000  01/08/2009
    X88888 50000  01/25/2009      <--- for X88888 customer, I want only this record w/ latest date to be output
    X88888 50000  01/22/2009   
    X99999 40000  03/09/2009
    X99999 40000  04/18/2009
    X99999 40000  04/19/2009      < -- for X99999, I want only this record w/ latest date to be output
    Where/How i can add the code to control this logic so that only 1 record per customer with the highest date can be output.  I looked at the query program and it looks very confusing and hard to understand.
    Please advise,
    Thanks,
    Sam

    Hi Sam,
    Instead on adding new table/tables , better way to use Direct Read from your single table.
    Please read the below steps to suffice your requirement.
    Assumption: Let your original table be A and second table is B.
                            Tables A and B are having field X1 and X respectively, using these fields, they can be joined.
                             You want field date1 of table B.
    Infoset Changes:
    1. Go to SQ02 (Enter Infoset name, click on Change button)
    2. Create an extra field E_date of type date (Sy-datum), by clicking on 'Extras' (F5) button.
    3. Select that field in one of the field group of your Infoset.
    4. Click on Code Icon (Shift+F8) displayed on application bar, you will be getting lists events in 'Code section'.
    5. In Data Section , declare an internal table like below code (here pseudo code)
    data: begin of itab_date occurs 0,
                       date1  like B-date1,
                       end of itab_date.
    6. In Recod processing Event write the following code.
    CLEAR itab_date.
    CLEAR E_date.
    SELECT date1 FROM B into table itab_date                           " Retrieving date field from table B
    WHERE X = A-X1.
    Sort itab_date by itab_date-date1  DESCENDING.                 "Sort internal table B in decendind order on date1
    READ TABLE itab_date index 1.                                            "Read first record of interanal table
    E_date  = itab_date-date1                                                      "Assigning top most date of internal table into field E_date.
    7. Generate the Infoset
    Query changes
    1.Go To SQ01 (in a new session),
    2.Give your Query name, click on change button, and select that field group in which you have added extra field.
    3.Select extra field.
    4.Go to basic list to select that field in your O/p list.
    5.Click on Test button, and see if you are getting desired result.
    Please let me know if you need further details.
    Regards,
    Dinesh

  • Addition of new column into SAP query program

    Hi freinds,
    There is a query program(joins EKKO,EKPO) which contains columns like vendor,purchase doc,item,material and material description etc..
    I need to insert a new column 'Supplying plant' in 2nd position after vendor column...When I try to add a field into internal table,am getting short dump error...
    Kindly suggest on this problem...
    Thanks in advance...
    Bharat.

    Hi,
    the program you got is it a copy from a SAP QUERY created on TCode SQ01 ?
    If yes got to Tcode SQ01 draw a new one and see the report generated
    Best Regards
    Jaime

Maybe you are looking for

  • BP replication from CRM 7.0 to ERP 6.0

    Hello. I was made customizing replication BUPA_MAIN object from CRM 7.0 to ERP as of Best Practics. When i creating a BP in CRM it's replicating in ERP as Customer only, not as BP. What I need to customize that BP is created during replicating from C

  • Payment Lot Reconciliation

    Hello Experts, Our client has requirement for payment reconciliation i.e. validating payment posted using payment lot (bank payment lot file contains specific individual customer transactions) and actual cash received in the bank account/s. (containe

  • Use of bpelx built-in methods like getVariableData in custom java classes

    Hi, how can I use bpelx built-in methods like getVariableData ... inside custom java classes embedded with BPEL project? I have large java code to embed with BPEL process and it will be very useful .... It is possible to access these methods like sta

  • Behaviuor in reading logs from DB13 - redo log backup for DB

      Hi all, I have a question , We have scheduled redo log backup using HP DP Tool. When I am reading a backup log from DB13 , I am facing the weird behavior. copy, delete, save 0000 aeomzyok.cds copy, delete, save 0001 aeomzyoh.cds Where ever the RC i

  • Ep5.0 and WAS cookies...

    Hi, I have an iView that is calling a web page on WAS6.40.  Now my problem is when I leave the page from 6.40, it ends the session from the server, but the problem that I am running into is it also kills the portal session, deleting the cookie. Is th