How to change code in SAP Query

Hi Experts !!
In SAP QUERY I am getting the  PO  with  all delivey dates & deliveried Qty  but I have to select only  single PO with latest delivery date  & qty. If there r more than one record for latest delivery date than deliveried QTY must be sum of  all QTY (for the  latest delivery date). for example :
this is coming
Po                delivery date                 qty
10001         30.06.2009                   4
10001         30.06.2009                   5
10001         01.05.2009                   4
we want
Po                delivery date                 qty
10001          30.06.2009                   9
Thanks in advance.
Thanks & Regards
Navneet Singhal

>
navneet singhal wrote:
> There is an internal table  %G00 in  query generated program (AQCSZPCWMM======Z_PCW_ORDER_V2) when I use this table in Code section (END-OF-SELECTION ) system thro msg %G00 is not defined . if I define this table in DATA  section than  run the query , It gives the  DUMP  with error %G00 is already decleared.
>
> How can I use %G00 internal table  in my code section.
I have the same problem as the OP. I need to get rid of the duplicates and have all sumarized in just one row. I was thinking about this same solution, but when I add code to the END-OF-SELECTION event, this doesn't appears anywhere (but if I add code to any calculated field, yes).
And the problem of the quoted message. I tried using field-symbols but I have errors saying that it's nos a valid table, etc...
Any ideas???
Thanks!!!

Similar Messages

  • Adding the ABAP code to SAP Query to support Query's ALV Double click.

    Hi, Expert.
    I need to add some ABAP Code into SAP Query (or Infoset) to support the double click event on ALV cell of result of query.
    Is it possible & How to do ?
    Thank you very much.
    Best Regard
    Nattapash C.

    Hi, Gautham.
    I've put BREAK-POINT in all code section e.g. INITIALIZATION, END-OF-SELECTION..
    I found there are some section for add code that will be executed when query is processing before output data to ALV.
    What I need to know is Where I can input the code after ALV output. For support the Double Click Event on Query's ALV cell.
    Best Regard,
    Nattapash C.

  • Transaction code for SAP query reports

    Hi All,
    I am trying to create transaction code for sap query report but couldn't go further.
    1) Created User group in SQ03
    2) Created infoset in SQ03 and assigned that to the user group
    3) Created query in SQ01 using the infoset.
    I executed the report in SQ01 and it is working fine.
    Now I try to create a transaction code in SE93 using the steps mentioned in the following link:
    Assign transaction code to SAP Query (created via SQ01)
    But when try to execute the report using the transaction code, it is giving error message 'User group xxxxxx is not yet created'
    Could any one advice me if I miss something? Or please help me to create this transaction code and transport to production?
    Thanks in advance

    HI,
    based on the thread you've already mentioned:
    In SE93, Create a Paramter Transaction
    -> Transaction = Start_report
    -> In default values, give the below details:
    D_SREPOVARI-REPORTTYPE = AQ
    D_SREPOVARI-EXTDREPORT = Name of the Query
    D_SREPOVARI-REPORT = User Group
    So check if the user group is typed correct in SE93 and check also if the user group exits in the system where you are trying to run the transaction.
    best regards, Christian

  • How to change logo in sap provided smartform

    Hi gurus,
    How to change logo in sap provided smartform
    Regards
    Naveen

    select your logo in tcode se78 and check if it is color or black and white logo , after that copy your smartfrom to zsmartfrom  then goto tocde samrtfrom and click the logo window and change the name.
    otherwise  goto smartform check logo name and   upload the new logo with same name . it will disply new logo. before overwrite the logo check this logo  was using some other forms alao..

  • How show the Extractor's Sap query

    Hi masters,
    I have a custom extractor in R/3 created with SAP Query method.
    By RSA2, if I try to double click on Extractor name it does not succeed nothing!
    How can I see the Sap Query created behind The Extractor?
    Thanks so much!

    Hi Martina,
    if you want see the infoset in the extractor use sq02.
    Bye

  • 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

  • Question on creation of t-code for SAP query

    Hello,
    I posted a thread in here back on 06/20/2007 asking for help on creating a t-code for a SAP query. one of the responses that I recieved was
    <i>"Sure, all you need to do is get the report name which is generated by the query. You can find this in SQ01, select the query and from the menu, Query, More Functions, Display Report name. Then go to Se93 and create the tcode with this report name."</i>
    the report name was AQFKZFINANCE====GL_FRANCE=====.
    I created the t-code using this name. I had it transported to my QAS system an now we are getting a error stating that the the program is not found.
    When I check in SE38, I can see this program AQA0ZFINANCE====BP_RECON====== in both my development system and my QAS system.
    Should I have created in the t-code using the AQA0ZFINANCE====BP_RECON====== instead of the AQFKZFINANCE====GL_FRANCE===== program? 
    Is there any reason why the program AQFKZFINANCE====GL_FRANCE===== would not be in QAS?
    I do not have access to SQ01 in our QAS system so I cannot perfrom the process stated above.
    thanks in advance for the help.

    Hi,
    Please check this thread perhaps it may help.
    Re: How to create TCode for Sapquery
    Regards,
    Ferry Lianto

  • Transaction code thro' SAP Query for customer spefific report

    hi experts,
    how to create transaction code (using SE43-) for the sap query created on own??
    I have created the following required for a customer specific report
    1.Infoset thro sq02
    2.user group thro sq03 and assigned it to infoset
    3.query thro sq01 and saved it with text
    earlier i have used logical database PNPCE ( relevant for PA and payroll modules reports)
    using sq01 , go to basic list , selected required infotypes and fields and
    then selected, SAP List viewer for viewing and i get the report.
    Now my question is how to create a separate transaction code for this sap query which i created
    should i use SE43( area menu maintenance and area class???_)
    should i create a variant and go to SE43??
    advice solicited
    snr

    Hello
    when you excecute the query in right han side corner  you can get the program name
    go to se80 select program & type this name and then you can create a tcode for that prog in SE80
    reward points if helpful.
    the prog name will be something like : AQZZ/SAPQUERY/* " ur query name
    you can search for the name also in this manner

  • How to Sum in a SAP Query

    Folks,
    I have given up....Really need some advice....
    I need a report example: Order Number, Order Type, Order Date, Customer number, Net Price, Total order cost
    I can get all I need from file VBAK, EXCEPT total order cost, which is at the line level (VBAP).  Now I need to show one line per order and sum the cost field (VBAP/WAVWR)...
    How can I accomplish this in SAP Query?  IS this even possible?

    Hi,
    I am sure about SAP Query...
    But check this program which might satisfy your requirement..
    Declarations.
    TYPE-POOLS: slis.
    DATA: BEGIN OF wa_data,
            vbeln LIKE vbak-vbeln,
            auart LIKE vbak-auart,
            audat LIKE vbak-audat,
            kunnr LIKE vbak-kunnr,
            netwr LIKE vbak-netwr,
            wavwr LIKE vbap-wavwr,
            waerk LIKE vbak-waerk,
            posnr LIKE vbap-posnr,
          END OF wa_data.
    DATA: itab LIKE wa_data OCCURS 0 WITH HEADER LINE.
    DATA: itab_final LIKE wa_data OCCURS 0 WITH HEADER LINE.
    DATA: v_tabix TYPE sytabix.
    DATA: t_fieldcat TYPE slis_t_fieldcat_alv.
    Selection-screen.
    PARAMETERS: p_erdat LIKE vbak-erdat OBLIGATORY.
    START-OF-SELECTION.
    Get the data
      SELECT avbeln aauart
             aaudat akunnr
             anetwr bwavwr
             awaerk bposnr
             INTO TABLE itab
             FROM vbak AS a INNER JOIN vbap AS b
             ON avbeln = bvbeln
             WHERE a~erdat = p_erdat.
      IF sy-subrc <> 0.
        MESSAGE s208(00) WITH 'No data found'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      SORT itab BY vbeln.
    Sum the cost.
      LOOP AT itab.
    Store the tabix.
        v_tabix = sy-tabix.
        wa_data = itab.
        AT END OF vbeln.
          SUM.
    modify the cost.
          MOVE wa_data TO itab_final.
          MOVE itab-wavwr TO itab_final-wavwr.
          APPEND itab_final.
          CLEAR itab_final.
        ENDAT.
      ENDLOOP.
    SHow the report.
      DATA: v_repid TYPE syrepid.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name     = v_repid
                i_internal_tabname = 'WA_DATA'
                i_inclname         = v_repid
           CHANGING
                ct_fieldcat        = t_fieldcat.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program = v_repid
                it_fieldcat        = t_fieldcat
           TABLES
                t_outtab           = itab_final.
    Thanks,
    Naren

  • SAP Query: How to filter records from SAP Query output before display

    Hi Friends,
      Can I delete records from an SAP query basic list before it is displayed?
    For example I want to delte all the orders whose system status is "RELEASED" before the basic list of that SAP query is displayed.
    I have gone through SAP help and found out that we can write some code in <b>END code</b> section which will execute before the basic list of the query is displayed. But I could not figure out how the code this...following is an excerpt form SAP help.
    <b>"The END-OF-SELECTION code consists of two parts (Before list output and After list output). The first part is processed before the list is output and the second part afterwards."</b>
    Can anybody help me?
    Regards,
    Bharat.
    Message was edited by:
            Bharat Reddy V

    Try this simple procedure. <b>Hope</b> this should work for you.
    You do the slection of the status in the List-Processing. say your final field of status flag is GF_STATUS.
    Immediatly after that use this within the List-Processing.
    CHECK GF_STATUS EQ '<RELEASED STATUS>'
    How it works:
    SELECT  <>       "<-------Query processing(system code).
    *< Your code put in the List processing
    CHECK GF_STATUS EQ '<RELEASED STATUS>'   "< --only released records passed.
    *>
    ENDSELECT      "<-----Query endselect(system code).
    Please let me know the result.
    Regards,
    A.Singh
    Message was edited by:
            Amarjit Singh

  • How to edit a standard SAP Query

    I need to do authority check for satndard SAP Query....How to do it

    If you put code similar the following in the Infoset ---> Extras -> Code -> Start of Selection it should work
    CALL FUNCTION 'SD_ORGDATA_AUTHORITY_CHECK'
    EXPORTING
       I_VKORG            = P_VKORG
    *   I_VTWEG            =
    *   I_SPART            =
        I_ACTVT            = '01'
    EXCEPTIONS
       NO_AUTHORITY       = 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.
    So, if the user does not have the proper authorization, it will exit the program.  You will need to check with your Security administrator to verify what value to use for the Activity Code.

  • How to change code in MV50AFZZ

    HI,
    i want change the code in Include MV50AFZZ (FORM USEREXIT_LGORT_DETERMINATION). this include is provided for user exits. can any one please help me how to change the code in this Include and what are the necessary actions i need to take.

    You'll have to request a SCCR Key on SAP OSS ( http://service.sap.com )
    Then :
    -> Sap Notes Search
    -> Key and request
    -> SSCR Keys
    -> Registration ( You provides the following info : Basis Release, eg 620 then
    R3TR / Prog / MV50AFZZ
    Of course, you need an OSS user.
    Best Regards,
    Erwan

  • How to Find Code for SAP Exit variables.....

    Gurus:
    The SAP Business Content Query "0FIAR_C03_Q0005" uses several BC variables of 'SAP Exit' type for determining "Date" values. I would like to see the code used in these variables. Can anyone please suggest how I can find it?
    For examople, the variable on Posting Date is "0P_KEYD2". What is the ABAP code for this? Please give me the Steps..!
    Thanks in Advance......PB

    Generally SAP doesn't give access to the code behind SAP exit variables, but you can find what the variable is doing using help documentation. Here is some info i saw on SAP help for your variable
    0CWD Current workday
    0DAT Current calendar day
    0P_KEYDT Key date of due date
    0P_KEYD2 Key date of posting (from key date of due date)
    0P_KEYD3 Key date of clearing (from key date of due date)
    0P_KEYD4 Key date of posting (posting date)
    0P_KEYD5 Key date of clearing (from key date of posting)

  • How to remove duplicates in SAP Query

    Dear Frns,
    I created a simple SAP query with quickviewer by table join option.
    tables are MAST & STPO.
    Link is only STLNR.
    I am getting a duplicate extra line with same data.
    Can anyone suggest me how it happened.
    Is there anyway to remove these duplicate lines.
    pl suggest

    Hi,
    You can sort the internal table and then delete the duplicate entries.
    sort itab ascending by STLNR.
    delete adjacent duplicates from itab comparing STLNR.
    Reward points for useful answers.

  • How to insert code in a QUERY

    Hi All,
    I'm creating a Query to extract the data from EKKO, EKPO and EKKN.
    here I have to insert a piece of code as checking below.
    IF EKPO-KNTTP ne '   '.      "not equal to blank
    extract the data from table EKKN.
    ENDIF.
    here I need your help like how to write this code in a Query or Functional Area (Info Set).
    Thanks,
    Sunil Bodda.

    Duplicate POST.....
    select the query and go to QUERY in the menubar then goto more functions where you have an option display report name it will give you the report name.
    Menubar ---> Quer ---> MoreFunctions ----> Display Reportname.
    Goto SE80/SE38-->Report name and add the Codes in the program.
    Regards,
    gurpreet

Maybe you are looking for

  • How can i change my icloud email adress?

    Quick question so when i turned on imail in icloud settings, it made me make an icloud email. I was wondering how can i delete that icloud email adress since i chose one at random to test it. Thanks

  • Where are the Manage Security Policy Settings Stored

    I want to upgrade from Acrobat Pro 9 to X....and I'm prompted to uninstall 9 first.  I have a ton of passwords saved under Manage Security Policies in Acrobat 9 and I don't want to lose these.  I know they are stored in some file, but I don't know th

  • Using XML as key-value pair in OSB 11g

    Hi All, I have made a new project Test. In that there are 2 folders: 1. Proxies - which contain proxy services 2. xml - which contains XMLs An example of XML (Name of XML - TestXML) present in xml folder: <valueDetails> <key1>abc</key1> <key2>123</ke

  • Yet Another Help! Connecting to Windows 2000

    Hello all, I see this is a popular topic. Got the latest 60 gig ipod and my Windows 2000 SP4 with the latest ipod updater and itunes. All of this and the program simply won't recognize my ipod. Windows sees it as a generic usb harddrive and that's it

  • How to Save a file uploaded in WebDynpro Java to Windows server

    Hi Guys, I need to save a file uploaded in WebDynpro Java to a location on one of my companys many internal Window servers but I cannot get it to work.  I do not get any errors with the following code, but NOTHING happens...  And when I check the fol