ABAP Query - addition of logic in infoset

Hi Friends,
I have generated a query and there is a problem. There is a field 'Cycle count date'. Each material can have more than 1 count date. So my report displays repeated lines with same material and other details remaining same except that there are different count dates. Hence the users think there is a repetition of entries.
The requirement is to have only the most recent count date displayed and all the other lines should be removed.
I tried coding for the internal table %G00 (the table in the system generated code) but the infoset is throwing an error that the table is not declared. And if I declare, the system says same internal table declared twice (since it is already declared in the system generated code).
How do I code for this in the infoset.
Appreciate your quick response.
Regards,
Dikshitha

Hi
Here is what you should do:
1. In the infoset, go to event END-OF-SELECTION(After list).
    Here you'll find table %G00 with final data to be displayed.
2. You should enter the following ABAP code:
    data: str type string.
   field-symbols: <GOO> type table.
   field-symbols: <GOO_WA> type any.
   str = '%g00[]'.
   ASSIGN (str) TO <GOO>.
   loop at <GOO> assigning <GOO_WA>.
   ...do whatever you like here....
   endloop.
3. Of course, you don't need to do a loop here, you can do whatever you want.
This solution was created with the brilihant developer Hayit Yuzis.
Good luck
Yasmin Yezerski.

Similar Messages

  • How to create an ABAP Query with OR logical expression in the select-where

    Hi,
    In trying to create an ABAP query with parameters. So it will select data where fields are equal to the parameters entered. The default logical expression is SELECT.. WHERE... AND.. However I want to have an OR logical expression instead of AND.. how can I attain this??
    Please help me on this.. Points will be rewarded.
    Thanks a lot.
    Regards,
    Question Man

    Hi Bhupal, Shanthi, and Saipriya,
    Thanks for your replies. But that didn't answer my question.
    Bhupal,
    You cannot just replace AND with OR in an ABAP QUERY. ABAP QUERY is a self generated SAP code. You'll just declare the tables, input parameters and output fields to be displayed and it will create a SAP standard code. If you'll try to change the code and replace the AND with OR in the SAP standard code, the system will require you to enter access key/object key for that particular query.
    Shanthi,
    Yes, that is exactly what need to have. I need to retireve DATA whenever one of the conditions was satisfied.
    Saipriya,
    Like what I have said, this is a standard SAP code so we can't do your suggestion.
    I have already tried to insert a code in the ABAP query (there's a part there wherein you can have extra code) but that didn't work. Can anybody help me on this.
    Thanks a lot.
    Points will be rewarded.
    Regards,
    Question Man

  • Interactive list musing abap query and how to create infoset records

    hi,
    Can any one suggest how to create interactive list using ABAP Query .And also infosets and ranked list ..thanks in advance
    Regards,
    Raghu.

    Hi,
    Check this
    Re: How to make output of ABAp query interactive(drill down)..?
    some info on the ABAP query
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40bec8da-4cd8-2910-27a9-81f5ce10676c
    hope it helps.
    Regards!

  • ABAP QUERY - SQ02 addition of logic in infoset (END-OF-SELECTION)

    I guys I have read this discussion: http://scn.sap.com/message/8193608#8193608
    but solve partially my problem.
    In particular I need special logic to interpret the single field from field symbol, for example:            
         loop at <goo> assigne <goo_wa>.                  
               tot_qty = tot_qty + <goo_wa>vbap-zmeng.
         endloop.
    I would like to add new row, with my logic into stracture of query %G00.
    thanks for any idea Omar

    resolved, it is must to use for all filed-symbols
    example
    types: beging of l_summary,
         matnr type matnr,
    end of l_summary.
    data: lt_summary type standard table of l_summary,
             ls_summary type line of lt_summary,
             lf_string type string.
    fiel-symbols: <gt> type standard table,
    <ls> type any,
    <lf> type any.
    lf_string = '%G00[]'.
    unassign <gt>
    assign (lf_string) to <gt>.
    if <gt> is assigned.
    loop at <gt> assigning <ls>.
    lf_string = '<ls>-vbap-matnr'.
    unassign <lf>.
    assign (lf_string) to <lf>.
    if <lf> is assigned.
    ls_summary-matnr = <lf>.
    endloop

  • Syntax error in ABAP Query

    Hi All,
    We are facing syntax erro with ABAP query.
    We have a infoset/query which is perfectly working in one system and we downloaded the both infoset and query from this system.But the same query when it is uploaded to other system is not working.
    Infoset is not giving any syntax error while activation. Morever, the generated report struture is also different from the other system. In old system, report was having one include for declaration and other for data retrieval process etc.
    Can you please help us to resolve this issue?
    Thanks

    Hi,
    The query generated is based on the table structures available as they are used, etc.
    So please check if there is any difference in the fields available in the tables used, LDB used if any.
    In addition, may be few of the properties of the SAP query and info set does not get copied properly.
    and after activating the info set only, activate the query, etc...check them once again.
    Regards,
    Santhosh.

  • ABAP Query Transport request related

    Hi,
    I have created a Abap query,
    1) User group
    2)Infoset
    3) Query
    But when i transport the request in to Quality, I can see only Infoset, not able to see User group and query which i created in the
    Development
    Please suggest, is this std behaviour or is anything missed
    Rgds,
    Jai

    Thanks to all,
    I just created TR with new package for user group and included ifoset and query in the same TR
    and imported, issue is resolved
    But my question is,where we can utilize below help material, I have spent much time to understand below given explaination and finally left without any conclusion
    Short text
    SAP Query: Transport tool
    Description
    The report RSAQR3TR handles all tasks concerning the transport of queries, InfoSets and user groups.
    General information
    Queries, InfoSets and user groups are stored in the table AQDB. This table is client-specific. For the transport of queries, InfoSets and user groups, there is a special client-independent transport table called TAQTS. You can carry out transports either
    ·     from a client (source client) of an SAP system to another client (target client) in the same SAP system or
    ·     from a client (source client) of an SAP system (source system) to a client (target client) in another SAP system (target system).
    In both cases, you have to perform similar actions.
    The objects to be transported must first be copied from the source client using an export from the table AQDB into the transport table TAQTS. At the same time, a transport request is created for the transport system that includes all entries created by the export from table TATQS (transport dataset). The name of this transport request conforms to the transport system naming conventions (sysKnnnnnn) and is included in the export log. The transport dataset is stored in the table TAQTS under a key which matches the name of the transport request.
    If you are transporting within one SAP system (from one client to another), you can import the transport dataset from the target client. The name of the transport request to use for this purpose is that specified during the export, since it should match the key of the transport dataset in the table TAQTS. With this import, the transport dataset is read from the transport table TAQTS and inserted into the table AQDB, where extensive checks ensure that there are no inconsistent statuses in the table AQDB.
    If you are transporting from one SAP system to another, you must first use the transport system to release and export the transport request generated by the export. This transports the transport dataset from the transport table TAQTS into the target system. Then, you can import from the target client of the target system, as described above.
    The transport datasets generated by exports in the transport table TAQTS are not deleted after successful import unless this is explicitly requested. Therefore, you can import a transport dataset several times (when copying a functional area to several different clients, for example).
    This report handles exports (generation of transport datasets), imports (reading of transport datasets) as well as the management (display and deletion) of transport datasets.
    As transport action, you must specify one of the values EXPO (export), IMPO (import), SHOW (display transport dataset) or DELE (delete transport dataset).
    Transport action EXPO (exports)
    If you select the 'Test only' parameter when exporting (no blank characters), the system determines only those queries, InfoSets and user groups that would be selected according to the selections for transport described below and generates an appropriate log. A transport dataset is not generated in the table TAQTS. This allows you to check whether a selection really includes the queries, InfoSets and user groups to be transported.
    With exports, there are four different options for selecting objects (user groups, InfoSets, queries) to be transported. These are 'Transport of user groups', 'Transport of InfoSets', 'Transport of InfoSets and queries' and 'Transport of queries'. You must choose exactly one of these transport types.
    In each case, you can also define an import option depending on the transport type. This allows you to determine how the transport dataset is inserted in the table AQDB of the target client during a later import.
    The import options, each of which has an abbreviated syntax,
    are as follows:
    REPLACE  or R
    MERGE    or M
    GROUP=ug or G=ug    (ug = name of a user group)
    UNASSIGN or U
    If you use the transport type 'Transport of user groups', all user groups are transported according to the select option 'user groups' and the selected import option. The import options REPLACE and MERGE are allowed.
    If you use the transport type 'Transport of InfoSets', all InfoSets are transported according to the select option 'InfoSet' and the selected import option. The import options REPLACE, MERGE, GROUP=ug and UNASSIGN are allowed.
    If you select the transport type 'Transport of InfoSets and queries', all InfoSets are transported according to the select option 'InfoSets' and the selected import option. The import options REPLACE and MERGE are allowed. Also, all queries are transported for each functional area selected, according to the select option 'queries'. In this case, the user groups of the queries are irrelevant and only the import option REPLACE is allowed.
    This transport type allows you to transport a modified InfoSet and all the associated queries.
    For the transport type 'Transport of queries', all queries are transported according to the select option 'User groups' and the select option 'Queries' as well as the selected import option. The import options REPLACE and GROUP=ug are allowed.
    The export log displays which user groups, which InfoSets and which queries are transported, as well as the import options used.
    Transporting a user group
    Transporting a user group means transporting all members of the group from the source client. However, the InfoSet assignment to the user group in the source client is NOT transported.
    The import option REPLACE first deletes all members of the group in the target client and then enters the members from the source client.
    The import option MERGE leaves all members of the group assigned in the target client and adds the members of the group from the source client.
    Entering a new member in a user group in the target client is possible only if a user master record exists.
    In the target client, the assignment of InfoSets to this user group remains.
    Transporting an InfoSet
    Transporting an InfoSet means transporting the InfoSet and the InfoSet assignment to user groups in the source client.
    Importing an InfoSet is possible only if the same logical database exists in the target client. Extensive checking is also performed to ensure that there are no inconsistencies between the InfoSet and the logical database.
    The import option REPLACE first deletes the assignment of the InfoSet to user groups in the target client, provided there are no queries dependent on the InfoSet. The InfoSet is then transported to the target client and the assignment of the InfoSet to user groups is copied from the source client, if user groups also exist in the target client.
    The import option GROUP=ug first deletes the assignment of the InfoSet to user groups in the target client, provided there are no queries referring to the InfoSet. The InfoSet is then transported to the target client and assigned to the user group ug of the target client, if such a user group exists.
    The import option MERGE leaves the assignment of the InfoSet to user groups in the target client and transports it to the target client. It then copies the assignment of the InfoSet to user groups from the source client if user groups also exist in the target client.
    The import option UNASSIGN first deletes the assignment of the InfoSet to user groups in the target client, provided there are no queries referring to the InfoSet. The InfoSet is then transported to the target client. No assignment of the InfoSet to user groups is performed.
    Transporting a query
    Transporting a query means only the query itself is transported.
    Importing a query is possible only if a corresponding user group (see below) and a corresponding InfoSet exist in the target client and if the InfoSet is assigned to the user group. To demonstrate the effect of the import options, suppose that the query has the name QU and belongs to the user group BQ in the source client.
    The import option REPLACE overwrites the query QU of the user group BQ in the target client if the user group exists.
    The import option GROUP=ug overwrites the query QU of the user group UG in the target client if the user group exists. In this case, the query is explicitly assigned to a user group in the target client. This target user group may be differnet from the user group in the source client.
    Transport action IMPO (imports)
    If you choose the 'Test only' parameter with imports, only a test import is performed. This means that the system performs checks as for a real import and generates an import log. The import log contains information on the locks that have to be set. With a test import, you can check whether a transport dataset can be imported without any problem and which changes it would make in the table AQDB of the target client. A test import itself never makes changes in the table AQDB of the target client.
    All transport datasets are imported according to the select option 'transport request'. In this case, the system outputs a detailed log of all checks carried out and all changes made in the table AQDB.
    If you select the parameter 'Delete after successful import', the transport dataset in the table TAQTS is deleted after the import of each transport dataset if no errors occur during the import.
    Transport action SHOW (display)
    All transport datasets included in the transport table TAQTS are output with name (also the name of the transport request) and contents in the form of an overview.
    Transport action DELE (delete)
    All transport datasets are deleted according to the select option 'transport request'. To avoid unintentional deletion, the select option 'transport request' must contain values, meaning that the transport action DELE is not performed if this select option is empty.
    Transport of ABAP Query
    I am involved in this upgrade project to 4.7 
    The users are not able to find any reports (in QA System) which were there before the upgrade in SQ01. But they can see them in production which is not yet upgraded. They want me to copy all the reports to the QA system now....I dont have any idea how to do that. 
    I remember a similar problem upgrading to 4.6C from 4.5B ...... 
    Take a look at OOS note 672784. 
    You can transport queries between systems in SQ02 (hit the lorry button) or run program RSAQR3TR. 
    You download the infosets, queries etc into a file and load them into whichever system you wish.
    Just wanted to share my experience of transporting queries:
    I needed to move a user group, 2 infosets and 3 queries from a 4.6 system to a 4.7 system. 
    When I tried doing this via the SQ* transactions I did not get the import/export option, so instead ran RSAQR3TR. 
    Step 1. Run RSAQR3TR in 'old' system. Select EXPORT and specify the objects to be transported. 
    (System includes these in an automatically created transport request) 
    Step 2. Release this transport and request it be transported to 'new' system. 
    (This results in the entries being populated in transport table AQTDB in 'new' system). 
    Step 3. Run RSAQR3TR in 'new' system. Select IMPORT and tick the Overwrite checkbox. Specify the transport number in the field labelled 'dataset with imports'. 
    (RSAQR3TR gives the message that stuff has been imported OK). 
    Step 4. In my example I still couldn't find the queries, so ran RSAQR3TR one more time, this time specifying 'Copy Standard Area -> Global Area'. 
    (Now my queries etc were available in new system). 
    Perhaps there are better ways, but after 1.5 days of struggling I was glad to get this far.  
    regards,
    Jai

  • Unable to access Archived data with an ABAP Query

    I have an ABAP Query that uses Logical Database KDF (Vendor) for reporting.
    KDF is Archive Enabled and I can access archived document via SAP standard programs that used the KDF Logical Database.
    the query appears accessing the data but nothing shows on the report.
    Has anyone successfully written and ABAP query and included access to the Archived data?
    Any help is appreciated.

    Hi Gena,
    I'm facing exactly the same problem as you...
    Since this post is an old one, I imagine that you may not remember, but I have to try...
    Have you solved it? If yes, could you please tell me how?
    I've tried to use CL_ABAP_GZIP and CL_ABAP_UNGZIP_BINARY_STREAM and I'm getting the same error 30 at the  IctDecompressStream function.
    Tks in advance,
    Flavio.

  • Can we change the ABAP QUERY exists in Global area

    Hi All,
    I have a requirement to  add new column in the ABAP query in layout for that I am changing a ABAP query ME80FN which is calling  infoset  /SAPQUERY/ME80FN  defined in the global area ( Environment->query areas->global area).
    1) Can I change this infoset and query
    or
    2) Do I need to follow any other steps.
    If I change the existing query in DEV can I transport this to production.
    Please clarify.
    Thanks,
    Jwala

    Yes. We can change the background of an input field. The way you do this is by editing the theme that webdynpro application uses. To edit the theme, you will need to install NWDS PLUS the theme edit plugin (Available for download from SAP).
    Once you have edited the theme, you will need to upload your theme back to application server. You can use the program : BSP_UPDATE_MIMEREPOS to do this.
    Bydefault, the theme used by webdynpro applications is :
    /SAP/PUBLIC/BC/UR/nw5/themes/sap_tradeshow
    You can apply another theme by calling the webdynpro application with a theme parameter. For example, if my webdynpro application name is "zgopaltest", then
    <i><b>http://<server>:port/sap/bc/webdynpro/sap/zgopaltest?SAP-EP-THEMEROOT=/SAP/PUBLIC/BC/UR/nw5/themes/sap_tradeshow</b></i>
    will apply the sap_tradeshow theme.
    Likewise, you can apply diffrent theme. There is another theme that SAP provides. Its called : sap_hcb. Hence, you can apply the theme to the above application by:
    <i><b>http://<server>:port/sap/bc/webdynpro/sap/zgopaltest?SAP-EP-THEMEROOT=/SAP/PUBLIC/BC/UR/nw5/themes/sap_hcb</b></i>

  • Pnp- logical db in abap query

    hi.
    i need to create an ABAP/sap query. when i created the InfoSet i used logical db-pnp.
    if i want to get only the employees which entered my organization during the last month where should i add the ABAP code,  under which section => extras -> code. i have there several options - data, initialization, at selection-screen output etc, what to choose??????????
    thanks,
    Ami

    Hi
    Welcome to SDN forum
    query has got some limitatins compared to Reports which we write using SE38
    these queries are user specific and client specific and can't be transportable and you can't write your own code as you wish like reports
    see the doc
    http://help.sap.com/saphelp_46c/helpdata/en/35/26b413afab52b9e10000009b38f974/content.htm
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
    Step-by-step guide for creating ABAP query
    http://www.sappoint.com/abap/ab4query.pdf
    ABAP query is mostly used by functional consultants.
    SAP Query
    Purpose
    The SAP Query application is used to create lists not already contained in the SAP standard system. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists.
    Features
    SAP Query's range of functions corresponds to the classical reporting functions available in the system. Requirements in this area such as list, statistic, or ranked list creation can be met using queries.
    All the data required by users for their lists can be selected from any SAP table created by the customer.
    To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in WYSIWYG mode whenever you want using drag and drop and the other toolbox functions available.
    ABAP Query, as far as I Believe, is the use of select statements in the ABAP Programming. This needs a knowledge of Open SQL commands like Select,UPdtae, Modify etc. This has to be done only by someone who has a little bit of ABAP experience.
    To sum up, SAP queries are readymade programs given by SAP, which the user can use making slight modification like the slection texts, the tables from which the data is to be retrieved and the format in which the data is to be displayed.ABAP queries become imperative when there is no such SAP query existing and also when there is a lot of customizing involved to use a SAP Query directly
    use either SQ02 ans SQ01
    or SQVI tr code
    for more information please go thru this url:
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
    http://goldenink.com/abap/sap_query.html
    Please check this PDF document (starting page 352) perhaps it will help u.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    check the below link will be helpful for u
    Tutorial on SQVI
    once you create query system generates a report starting with AQZZ/SAPQUERY/ABAGENCY2======= assing this report to tr code for the same
    Regards
    Anji

  • Additional field in selection screen of a abap query

    Hi,
    I am adding a new additional field in the selection screen through abap query(using transaction SQ02) which is of type VBRK-FKSTO.
    The value entered can be 'X' or empty space.But the value which is entered in the selection screen is not getting reflected in the code.Kindly advice me on what needs to be done to capture the selection screen value in the code.
    Regards,
    S.Subasree

    Hi
    You can add new field in VFX3 selection screen as follow. In the report code we can see various explicit enahcement points provided by SAP.One of them is ENHANCEMENT-POINT sdblbddl_01 SPOTS es_sdblbddl STATIC. Here you can declare your selection screen parameters.  Then in the processing i can see a call customer fucntion happening in VBSK_DISPALY which you can implement to add your logic.
    Thanks
    Nabheet

  • Select from KONV using Additional Code in ABAP Query

    I'm attempting to modify an ABAP Query Infoset (using transaction SQ02) that already has a join in it between tables VBAP and VBAK, and two additional alias tables on KONV (to get price history for sales documents).  I wish to get history of all PN00 records from KONV.  I can get ONE record with the following code in the Record Processing of the Extras element in my Infoset:
    SELECT SINGLE KBETR KPEIN KMEIN KDATU
    INTO (PN00_PRICE, PN00_PER, PN00_UOM, PN00_DATE) FROM KONV
      WHERE KNUMV  = VBAK-KNUMV
      AND KPOSN  = VBAP-POSNR
      AND STUNR = 198
      AND ZAEHK = 01.
    But we have many counters (field ZAEHK) for the PN00 condition and I want to have a new row for each PN00 record in KONV.  I've tried some loop syntax, but I've not been able to get any code to function or return more than one row for each sales order item row (VBAP-POSNR).
    Thanks for any hints.
    Dan Gallagher

    Change it like this
    SELECT KBETR KPEIN KMEIN KDATU
      INTO (PN00_PRICE, PN00_PER, PN00_UOM, PN00_DATE)
      FROM KONV
    WHERE KNUMV = VBAK-KNUMV
       AND KPOSN = VBAP-POSNR
       AND STUNR = 198.
    ..... do something with this record and store
    ENDSELECT.

  • Logical database of ABAP query

    Hi,
    Can anybody please let me know what is the Logical database for ETXDCI, ETXDCH & ETXDCJ (Tax tables) with any sales document tables? I need to develop one ABAP query for the users.
    I am a Functional person so I would like to know Can anybody please let me know how I can find out the Logical database?
    Your time and help will be really appreciate.
    Thanks & Regards,
    Niki Shah.

    Try the BRF logical database.
    I found it by searching in which programs the tables were used.
    It show program SAPDBBRF which is the program for logical database BRF.
    Kind regards,
    Arthur Parisius

  • Problem with logical database DDF in ABAP query

    Hi All,
          I have created an ABAP query via the transaction SQ01 using the logical database DDF to retrieve customer master data from tables KNA1 & KNB1. The selection screen used is the screen 903 of the logical database DDF. But now the problem is that when I execute the query, I am getting a blank value in the tax code4(KNA1-STCD4) field though there is value in the KNA1 table for this particular field. This field was added to the table by means of a customizing include. Can anyone suggest a way to get around this problem so that I can view the content of the field STCD4 in the query.
    Thanks and regards,
    Sarath.

    I think it's not used by DDF.
    so you must check it with:
    check kna1-bran1 in s_bran1.
    A.

  • SAP / ABAP Query - using logical database

    Hi ,
    We have a mandate to implement SAP Query using only Logical Databases (LDB ) .
    We understand that there are several issues using this approach .
    1 ) Paralled tables in MM need to be displayed on separate lines .
    2 ) Statistics based on fields from 2 different tables cannot be produced eg: EKPO ( PO Number )  and EKKN . (Cost Center )
    Please share your experiences .
    Thank you in advance .
    Kishore
    Kishore

    Adeel,
    I do appreciate your experience and respect you for knowledge on SAP Query. 
    Joining tables seem simple to IT experts but not so for end users.  SAP Query is an end-user tool and users seem to need a simple user-friend, drag-and-drop solution to extract information using SAP Query based on a pre-defined infoset.  Various SAP conferences have been advocating the use of SAP delivered Logical Databses to create infosets in order to harness the various advantages of LDBs. 
    In MM there are several LDBs (e.g. ELM, EBM etc) to create queries on EKPO and EKKN.  The problem arises when you use the same LDB to extract information from more than the above two tables e.g. EKPO, EKET, EKKN and EKBE.  SAP expects you to display fields on multiple lines and also does not allow producing statistics based on fields from two parallel tables say EKKN and EKBE.  Moreover, multi-line reports cannot be produced in the ALV/SLV format.  
    We are also looking for best practise solutions in providing SAP Query to MM or FI users based on SAP delivered Logical Databases.  
    Pascal

  • Addition of checkbox and 2 fields in ABap query selection screen

    Hi
    I need to add chack boxes and 2 fields in ABAP query which is using LDB QMI. can u pls let me know how to do that.

    Hi Tarun,
    I am still not clear with the problem..I guess you require plant in your selection screen which you have.
    i guess if you go to sq01tcode there is a option infoset query from where you can give your selection options and value.
    have you selected all the fields in infoset and made a selection screen?
    When you have done with your infoset you just need to diplay the fields and there is a automatic program generated.
    Let me know...
    Regards,
    Nihkil.

Maybe you are looking for