SAP Query code extension
Hi experts,
Normally I don not use SAP Query tool for several reasons.
Now I have been asked to create something like a user exit for some existing queries: The requirement is to change the contents of one list field using an existing function module.
I remember a couple of years ago it was possible to add some source code at some events of the query and then save/regenerate the query.
I can't find anything like this is SQ01 menus.
Please help: What is the way to make coding extensions to a query e x c e p t modification of the generated query report. Or did SAP cancel this?
Answers to this question highly welcome.
Regards,
Clemens
Thanks Rich,
that's what I just found out myself - thanks anyway.
Regards,
Clemens
Similar Messages
-
At line-selection in SAP Query ( Infoset ) code
Hi all ,
Here is one for you : can I put somehow the following code in a Sap Query ( at infoset level of course ) :
at line-selection.
set parameter id 'BUK' field XXX-bukrs.
set parameter id 'BLN' field XXX-belnr.
set parameter id 'GJR' field XXX-gjahr.
call transaction 'FB03' and skip first screen.
(In other words I would like to see the documents behind a line in the list)
Some explains : my query's output would be ABAP list , the bukrs, belnr, gjahr fields are on the lines of my resulting list, and my problem is with those XXX 's - I don't know where are stored the lines of my ABAP list.
I'm pretty new at ABAP so any idea and explains about the generated SAP Query code
is appreciated . I looked at the final code but seemed very complex for my level.
Please guide me in this area ( I know the basic things like writing pretty simple reports )
Thanks !
Best of all
ZoliHi,
You need to add extra piece of code as below:
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
I_callback_user_command = 'USER_COMMAND' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
"For further information please refer the link below :
http://www.sapdev.co.uk/reporting/alv/alvgrid_ucomm.htm
Thanks,
Sriram Ponna. -
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 -
Issue in transaction code creation for sap query report .
Hi Gurus,
I have a requirement to create transaction codes for sap query reports. I found two ways to create transaction code for sap query report
1) By Generating program for sap query report and creation of transaction code for that generated Program. in tcode.
2) By using parameter transaction options in start object of se93
What are the difference between creation of these two ways. Please specify the advantages and disadvantages of both methods.
Regards,
Suneel Kumar Uggina.Hi Jogeswara Rao,
But I am getting problem while transporting form development system to the production system. After transporting to Production system I have used the code created in development system, but it is giving Error ' No Program Found for that Transaction Code. And I would like to know on what conditions should I have to use the First one and as well as a second one in sap query reports.
Thank You,
Suneel Kumar Uggina. -
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 advanceHI,
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 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!!! -
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
snrHello
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 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,
SamHi 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 -
Sap Query Additional Fields using Abap Code
Hi Experts,
I am relatively new to the world of SAP query (Log Database PNPCE), I have written a number of additional fields to retrieve previous info-type data using the select statement E.G
prev_endda = p0008-begda - 1.
SELECT single bsgrd
INTO FTE1
FROM
pa0008
WHERE pernr EQ P0008-pernr
AND endda EQ prev_endda
Although I can retrieve the previous info-type data , I was wondering if there was a easy way where I could take this a step further and show the Previous , Previous record. I.E
Pernr FTE Current FTE1 FTE2
101 60% 30% 75%
I guess what I am asking is , is there a way to loop through the HR info-type records, does anybody know if there is a standard function or macro I can use to achieve this.
Your help is much appreciated.Hi ,
Thanks for our reply.
I have pasted some example code into my additional field which I have created in SAP Query But im not sure how the loop bit works and how I can populate the additional fields that I have created , could you please explain this
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = '000000019'
infty = '01'
BEGDA = '18000101'
ENDDA = '99991231'
tables
infty_tab = p0008
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2
LOOP AT p0008.
NOT SURE WHAT TO PUT IN THIS SECTION *****
ENDLOOP.
I have created 3 additional Fields in the infoset Current FTE ,FTE1 FTE2 , and I want to loop through the records and populate the relevant Additional field with the employees FTE (I only want to populate where there is a change)
Sample Data
Begda Endda FTE Salary
1/1/2010 31/12/999 60% 19K (Current FTE)
01/08/2009 31/12/2009 100% 27k (FTE1)
01/07/2008 31/7/2009 50% 17K (FTE2)
Thanks in anticipation
DM -
Steps for creating T.code for SAP Query
Hi Friends,
I have developed and SAP Query through SQ01, i want to assign an T.code for that.
What are the steps we have to do in SE93.
Regards
Kumar MHi
Create a report pgm with the following code & create a T.Code for this pgm in se93.
data: gv_test type sy-repid.
DATA: GV_USERGROUP TYPE AQADEF-BGNAME VALUE 'FI',
GV_QUERY TYPE AQADEF-QUNAME VALUE 'ZCON_FI_QUERY',
GV_RNAME TYPE AQADEF-PGNAME .
CALL FUNCTION 'RSAQ_REPORT_NAME'
EXPORTING
WORKSPACE = ''
USERGROUP = GV_USERGROUP
QUERY = GV_QUERY
IMPORTING
REPORTNAME = GV_RNAME
* For the dynamic excution of the called query assisgn GV_RNAME to <gv_test>.
gv_test = GV_RNAME.
submit (gv_test) via selection-screen and return. -
Can we give Transaction code for an SAP Query(SQ01)..?
Hi All,
Can we assign an Transaction code for an SAP Query...?If yes, How..?
Waiting for your valuable replies.
Thanks and regards,
Rahul.Hi Rahul,
In SQ01,
go to menu path
Query--->morefunctions -
>Display report name.
Copy this program name. then
GotoSE93 .enter a tcode name .press create.
select program and selection screen option .
enter the Program name.
Reward points if helpful.
regards,
Hemant -
SAP Query Custom Field with ABAP Code
Hi All,
I have a custom field in my SAP query which has some ABAP code under it. The code finally writes some value to a variable. My question is do i need to explicitly link the variable in the ABAP code to the custom field OR it's done automatically. For some reason i don't see any value for this custom field. Thanks.Thanks Sandra
-
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. -
How i can keep my code after %dba standard table in sap query
hi expert,
how i can keep my code after %dba standard table in sap query..
add 1 to %count-VBRP.
%linr-VBRP = '01'.
extract %fg01.
%linr-VBRP = '02'.
extract %fg02.
%linr-VBRP = '04'.
extract %fg04.
%linr-VBRP = '05'.
extract %fg05.
%ext-VBRP05 = 'X'.
extract %fgwrVBRP05.
endselect.
i want keep my code after filling the standard table generated by sap abap query
Thanks & regards
Sajad AhmadHi,
the above code is excuted succesfully, but if i have
return "Navigation" ;
it is not working
any idea why?????????? -
How to create t.code for a sap query
i have created a sap query.
user wants this as a t.code.
how to assign a t.code for teh sap query.
kindly explain me.hi,
The other way of doing it.
1. Instead of creating your queries in SQ01, use SQVI. Create a query in your production system.
2. Now execute the query. When you have reached the selection screen, go to System > Status.
3. Copy the program name.
4. Now create a Z executable program in your development client. Put this one line of code in it:
submit program_name_copied_fr_production via selection-screen and return.
5. Create a TCode and assign the Z program to the TCode.
6. Transport the Z program and TCode over to Production system.
Hope this works for you, Do reward.
Maybe you are looking for
-
Error with creating star schema using HsvStarSchemaACM
Hi, I am trying to create a star schema using the API HsvStarSchemaACM. But when calling the create function of API, i get the below exception. Exception from HRESULT: 0x80040251 (A general error occurred while trying to obtain a database Reader/Writ
-
Please excuse the length and detail of this post - I'm just trying to be very clear... Also, it would be helpful if anyone having definitive information about this topic could please email me directly in addition to replying to this forum topic, in o
-
In CS6, Folio Builder says to run Updates, but when I do, everything is already up-to-date. What else can I check to get it working?
-
Error with viewing out of Firewire (hard to explain in 1 line)
I am editing on an iMac with FCP 5.1. For capturing I have my DV camera running into one of the firewire ports and my external drive running into the other firewire port which I am capturing to. This works great However while I am editing I view the
-
Please help me.. After configuring Transactional Replication with a publisher, distributor , subscriber and with one database and one table . and in subscriber the database in read write mode. so, we can perform changes . Here my question is.... w