How to select max (field) and one more field from table?

Hi experts!
I need to select maximum value of ENDDA from PA0023 and BRANC of max ENDDA.
How can I do that ?
When I trying this code:
This is the  code:
SELECT MAX( endda ) branc
  FROM pa0023
  INTO (pa0023-endda, pa0023-branc).
I get error message:
The field "PA0023~BRANC" from the SELECT list is missing
in the GROUP BY clause. Addition INTO wa or INTO (g1,...,gn)  is required.
So what is the problem?
Thanks forehead.

Hi
Though am not totally sure of your requirement, check below code samples without any syntax errors:
1. As per you current coding:
TABLES: pa0023.
SELECT MAX( endda ) branc
       FROM pa0023
       INTO (pa0023-endda, pa0023-branc)
       GROUP BY branc.
ENDSELECT.
2. Above code results only on one record where as the criteria can be more than one. Eg: for a specific data more than one record can exist. Below code helps you handle the same:
TABLES: pa0023.
TYPES: BEGIN OF t_pa0023,
         endda TYPE endda,
         branc TYPE brsch,
       END OF t_pa0023.
DATA: i_pa0023 TYPE TABLE OF t_pa0023,
      wa_pa0023 TYPE t_pa0023.
SELECT MAX( endda ) branc
       FROM pa0023
       INTO TABLE i_pa0023
       GROUP BY branc.
LOOP AT i_pa0023 INTO wa_pa0023.
ENDLOOP.
3. If the requirement is to get the Industry Key for the record with highest End Date. We can acheive it by using subquery something like:
TABLES: pa0023.
SELECT SINGLE endda branc
       FROM pa0023
       INTO (pa0023-endda, pa0023-branc)
       WHERE endda = ( SELECT MAX( endda ) FROM pa0023 ).
Kind Regards
Eswar

Similar Messages

  • How to add one more field to an exist internal table

    hi abapers
    i am a very new abap programmer and just started learning it.
    i want to know How to add one more field to an exist internal table.
    lemme me put my question in a very simple way.
    i have a internal table having fields f1,f2,f3 and which also that internal also contains some data.
    now i want to add two more fields (mm & nn) to that internal table now.
    how can i do that.
    and i wanna know the websites names where i can find some brain teasing questions in abap programming.
    eagerly waiting for ur reply
    regards,
    Maqsood A Khan

    Hi, MAQSOOD.
    You can insert more fields in your internal table like this.
    refer this code snippet.
    DATA : BEGIN OF tbl_itab OCCURS 0.
            INCLUDE STRUCTURE zsdtc009.
    DATA :  vkorg   LIKE vbak-vkorg,  "inserted one
            vtweg   LIKE vbak-vtweg,  "inserted one
            vkbur   LIKE vbak-vkbur,  "inserted one
            vkgrp   LIKE vbak-vkgrp,  "inserted one
           END OF tbl_itab.
    you can also read the book "Teach yourself abap in 21 days"
    at http://cma.zdnet.com/book/abap/
    but that book is just about basic concept of abap and report program.
    it doesn't give a lecture for on-line program.
    you can get pdf version books(about abap, sap...things) from sap.
    http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm
    I wish I could help you.
    Regards
    Kyung Woo.

  • Can I load Microsoft Office Word 2011 for MAC on an IPAD 2?  If yes, then how?  I have the software and one more load opportunity left.

    Can I load Microsoft Office Word 2011 for MAC on an IPAD 2?  If yes, then how?  I have the software and one more load opportunity left.
    Reason that I ask is that I'm worried that I will not be able to read or work word or excel docs that people send me.

    No. Office 2011 for Mac is coded to run with OS X. In order to work on the iPad the app must be coded for iOS instead.
    If you look in the iTunes App Store, you will find that there are many apps that allow you to work with Office files on an iPad.
    Allan

  • Infocube and ODS populated with DATA (need to add one more field?)

    Hi,
      If infocube and ODS have been populated with data for past 3 months. Then we need to add one more field to this cube. What is the impact? Please advise.
    The following is my understanding. Please correct me if I am wrong.
    1) Need to delete content of ODS and infocube.
    2) insert the new field at ODS and infocube.
    3) reload the data into ODS and infocube.
    Is there a way that the current data need not be deleted.
    Just add in this new field and only subsequent month, infocube will have this new field? Please advise what is the best approach without affecting existing data.

    Hi,
    Siggi is right. You dont need to delete the previously loaded data to CUBE or ODS. The only catch is that, your new field will be empty as far as history is concerned. But so long as you did map it to the datasource and the datasource is able to fill it up, then your new field will now have value for incoming DELTA Updates.
    Addition of a field is not that complicated compared to deletion of a field from CUBE or ODS.
    --Jkyle

  • QA32 Tcode i want to one more field which is material Description .in our o

    In QA32 Tcode i want to one more field which is material Description .in our output . how to do it please guide .

    Only exit I am aware of is IWOC0004 / EXIT_SAPLIREP1_001 to change the layout, to add customer field, i dont know any exit/badi, so i suggest you copy the report, copy the structure QALS_D02 to a Z-structure, and complete the field catalog and fill the new field in the code of the copied report.
    You could append fields to the structure (QALS_D01 or D02) and use Enhancement method to adapt field catalog and filling new fields (in RQEEAL10 at END-OF-SELECTION or an adequate GET statement)
    Regards,
    Raymond

  • QA: Designer's operation to Add one more Field to display in Query Result Web Part

    QUESTION ABOUT Query Result Web Part presentation +1 Field
    I'd be looking at a property of Web Part to look up Discussion Board through Query Result Web Part. Currently it displays 'Title' column of Discussion Board, and my caring requirement is presentation customization to hold double
    columns of 'Title'+'Updated Date'. How could I add one more field 'Updated Date' to display in addition to that preexisting 'Title' field?
    Any procedural steps to realize how to add Filed to display in Query Result Web Part?

    Hi Yoshihiro,
    As I understand, you want to add the field to display in Query Result Web Part in SharePoint 2013.
    Which web part does you use? Content query web part or search results web part?
    If you use search results web part, you could edit the discussion board result template and add the updated field in the template.
    You could go to Design Manager: Edit Display Templates (site setting-> look and feel->design manager->edit display template), download the Discussion Item.htm file, and edit the file. 
    After editing, upload the file.
    The articles below are about how to modify an existing Display Template in SharePoint 2013.
    http://www.learningsharepoint.com/2012/09/17/sharepoint-2013-the-new-display-templates-for-styling-your-content/
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx
     If you use content query web part, you could edit the content query web part, in the Property Mappings section select the “Change the mapping of managed”, and add the “modifiedOWSDATE” (it means the last modified date) in the line, after
    that you could see the update date under the title.
    Best regards,
    Sara Fan
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Want to add one more field in the standard transation xk02 : screen exit

    Dear All ,
    I want to add one field in transation in Xk02 in withholding tax check box.
    run the transation xk02 and select check box Withholding tax and press enter after that you will get the screen having field
    WH Tax Country  in parellel to this i want one more field Country .
    Is there any screen exit available fot this or any other way to proceed .
    Please provide any solution .
    Regards
    Aryan

    use an iplicit enahnecemnt to call a function module in which you can call a screen popu up with the fields you want update them in the database and return back to the main program. If the the two exits available are not helpful to you.
    RFKRRANZ
    SAPMF02K.

  • Need one more field in standard solman iview

    Hi All,
    I need to add one more field in my standard solman iview which gives only 4 fields and 1 radio button. I require 5 fields and one radio button.
    How can I add an additional field in standard iview?
    Is there any other solman iview which I can use?
    Please Advise.
    Thanks & Regards,

    Shreya,
    you should have system administrator role to work with par file.
    go to system administration -support-portal runtimeBrowse deployment-look for something com.sap.portalepsolman.par.bak and download it.
    you can import that into NWDS and start modifying the jsp files.
    When you import par files into NWDS jar file will be missing in the directory strucuture so you need to add it manually.once you do the changes deploy the par file from NWDS and upload it Portal using system administration-support-portal runtime-administration console-upload
    check these links for more info
    https://forums.sdn.sap.com/click.jspa?searchID=16632942&messageID=6128753
    https://forums.sdn.sap.com/click.jspa?searchID=16632942&messageID=6169428
    If any issue revert to me
    Thanks
    Bala Duvvuri

  • Need one more field based on comparision of other fields

    Report Builder 6.0.8.11.3
    ORACLE Server Release 8.0.6.0.0
    Oracle Procedure Builder 6.0.8.11.0
    Oracle ORACLE PL/SQL V8.0.6.0.0 - Production
    Oracle CORE Version 4.0.6.0.0 - Production
    Oracle Tools Integration Services 6.0.8.10.2
    Oracle Tools Common Area 6.0.5.32.1
    Oracle Toolkit 2 for Windows 32-bit platforms 6.0.5.35.0
    Resource Object Store 6.0.5.0.1
    Oracle Help 6.0.5.35.0
    Oracle Sqlmgr 6.0.8.11.3
    Oracle Query Builder 6.0.7.0.0 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle ZRC 6.0.8.11.3
    Oracle Express 6.0.8.3.5
    Oracle XML Parser     1.0.2.1.0     Production
    Oracle Virtual Graphics System 6.0.5.35.0
    Oracle Image 6.0.5.34.0
    Oracle Multimedia Widget 6.0.5.34.0
    Oracle Tools GUI Utilities 6.0.5.35.0
    Iam having report layout as below
    -- M_6
       -- M_10
          -- B_13
          -- F_94
       -- M_FOR_REP1
          -- R_SALESMAN
             -- M_39
                -- B_74
                -- F_113
             -- M_7
                -- B_33
                -- F_2
             -- M_CUSTOMER
                -- R_CUSTOMER
                   -- F_98
                   -- M_GNAME
                      -- R_5
                         -- M_12
                            -- F_41Above is my full layout of my report how it look like
    (B_33) Sales Men : F_2
    F_2 lists out the all the salesmen.(david, george .... so on)
    F_98 Lists out all the categories of products (Furniture , Automobiles .... so on)
    F_41 Lists out amount of particular category
    F_113 lists out the sum of F_41.
    Parameters that i pass is :
    From Date : 01-AUG-11
    To Date : 31-AUG-11
    Company Code : 110
    Orgn Name : Cytrex OU
    Sales Type :
    Salesmen From : DAVID FOO
    Salesmen To : DAVID FOO
    Customer From :
    Customer To :
    Year From Date : 01-JUN-11
    Year To Date : 31-AUG-11
    Report Detail : Yes
    And the output for my report is
    Item Type                      ProductFamily                  Quantity            Sales
    (MYR)
    Sales Men : DAVID FOO
    01FN
    01FN
    FNDM
    FNUM
    NEW CASA [BROWN (CS5839)]
    CELLINI LEATHER [BEIGE FL35A]
    CELLINI LEATHER [BLACK FL 10B]
    21,585.50i need one more field and the result should like to compare F_2, F-98, F_41
    For every salesman(F-2) there will be different category (F_98), i need to add the amount (F_41) for all the same category.
    like
    Customer :  David
             Sales men :     Thomas
    Furniture                100
    Automotives               50
    Textiles                  20
    Mobiles                   10
             Sales men :    Daniel
    Furniture                 30
    Textiles                  10
    Ship                      20
    Customer : George
             Sales men :      Thomas
    Furniture                 20
    Mobiles                   50
             Sales men :    Daniel
    Furniture                 10
    Mobiles                   20
    {code }
    result Salesmen : Thomas Daniel
    Furniture 120 40
    Automotives 50
    Textiles 20 10
    Mobiles 60 20
    Ship 20
    means all the based on the category for each salesman for different customers should be added.Please explain me how to place the extra field and write the logic for that. i am trying for this from past one month nobody is giving proper feedback, if you want to know anything more regarding this let me know i will provide you with the full fledge information.
    Edited by: user9093700 on Mar 12, 2012 1:08 AM

    your break is nt the better for this
    i think you can create a temporary table
    the fields salesman category and quantity
    insert and update for each record with a formula or create a new sql query and maybe use a matrix to show as you want

  • Need one more field in PO search help ..

    Hi,
    In ME22N, I try to search for a PO, press F4  and use the fields in the tab "Purchasing documents per collective number". Here I want to add one more field, i.e. document date. Existing input fields are ; Collective Number, Purch Org, Purch Doc.
    How to do this ?
    thnks

    Yes Alex. I verified all that and its perfect.
    But I found that when I tested MEKK_T from se12 (menu search help-> test) I was able to see the Document date !!!  This MEKK_T has my new Z_MEKKS search help, so that means my custom search help is working fine in test mode.
    So the assignments are as follows:
    EBELN has MEKK_C as the search help assigned.
    MEKK_C has MEKK_T in its included search help.
    MEKK_T has Z_MEKKS (my custom help) in included search helps list.
    What else could be wrong ?
    thnks

  • Adding one more field to the VL06O report

    Hi everybody
       When  u execute the TR code VL06O a screen will appear from that screen select list outbound deliveries and then provide some date and execute.
    The output will come having fields delivery,ship-to-party,name of ship-to-party like that 7 fields are there and now i want to see one more field called shipment number in the output along with the previuos 7 fields.
    what should i do it is a standard program?
    please guide me?

    Hello.
    See note 128150 to more details.
    There are user exists to add new fields (user fields).
    Regards.

  • How To select maximum Value in a specifieid field in internal table.

    How To select maximum Value in a specifieid field in internal table?

    Step : 1
    Sort itab by <Field1> descending.
    Just sort the internal table by the field.
    STEP: 2
    Then read the table at index 1.
    Read table itab index 1.               
    ITAB-FIELD = MAX .                  " Max field will come in the first row of the internal table.
    Regards,
    Gurpreet

  • I am working in Numbers and can't seem to change the generic value assigned to the legend.  Any advice on how to select the legend and save new values?

    I am working in Numbers and can't seem to change the generic value assigned to the legend.  Any advice on how to select the legend and save new values?

    Ntenich,
    If your table has a Header and your Legend text is in the header, it will be picked up by the table.
    Jerry

  • How to select the printer and select the ICC profile for printing with VBScript?

    I try to automate my printing procedure in photoshop. The problem is that I don't know how to select the printer and select the icc profile for printing with vbscript like I manually do in the print-menu in photoshop?
    Anyone has done this before?
    Thanx!
    jus

    Client/Server version:
    - D2KWUTIL.PLL library provides a 'Select Printer' dialog box to be used in Forms: WIN_API_DIALOG.SELECT_PRINTER
    http://guenter-huerkamp.dyndns.org/oracle-doc/docs/html/d2kwutil.html
    I suggest you to create a form to invoke the report, allowing user to select the printer and then pass it as parameter DESNAME

  • My grandson deleted my phone, contacts email and one other setting from my new iPhone 4s. How do I recover them????? HELP

    My grandson deleted my phone, contacts, email and one other icon from the bottom of my iPhone 4s screen. How do I recover them????? HELP!!!!

    If they are in a folder, tap the folder and tap and hold the icon and move it out of the folder and on to the screen you wish. If they are on a different screen, tap and hold the icon until it wiggles, then move it to the edge of the screen and hold for a second or two until it jumps to he adjacent screen.

Maybe you are looking for

  • Can I run my iPad to a projector wirelessly with no internet?

    Before I start, you need to know that I don't know what things like "WAN" and "LAN" mean, this seems to be the cause of my misunderstanding so far.  If you could help me out in common English words, that would be fantastic! I'm a music teacher, I tea

  • List of Values Problem (messageLovInputBean).

    Hi There, I have a quite anoying problem with LOV's on my page. I'm using JDeveloper for RUP7. I have a messageComponentLayout region with my data. I have a input field named Category. This field contains the value of my LOV. I have create an LOV VO

  • Inbound Email Attachments with MIME type of application/octet-stream

    I'm hoping someone can help me here. I'm trying to start a BPEL process via email. The email can consist of no attachments or multiple attachments. All the attachments should be text, e.g. XML, CSV, etc. Where I have got to is receiving the email and

  • Java missing plug ins

    So I am having this problem that is apparently famous with Java on mac. I can display certain things from web pages even though Java is updated on my mac. It says missing plugin and I update it and I have tried installing all the files below from for

  • Import scripts from another computer

    I bought a new computer and exported the scripts from my old computer to a flat file, then imported onto the new computer (after a new install of XE from the website). I got a security error that I was not in the same security group as the exporter!