Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Changing existing SAP Query.

Former Member
0 Kudos

Hi Community,

We have requirement where we need to alter the existing sap query. We have searched many forums to achieve the requirement but could achieve only half of the requirement. Need your valuable inputs for solving my problems.

Req: Need to add a new Customer Hierarchy number field on to the selection screen of a sap query and then fetch the 1 series customers for the given hierarchy number and display the report.

Things we did so far:

1. In the infoset we already have CB Hdr, item, Billing Doc, MARA and KNA1 tables. So, to get the HKUNNR on to the selection screen we have added KNVH table to the query joins and created field group and added the field to the field group.

2. In SQ01, we have given the sequence that required to the field and now we are able to see the field on the selection screen when press F8.

Please find the issues that I am facing below:

1. Now, we want to access the HKUNNR values in the SQ02 Coding part as we need to get the 1series customers for the respective HKUNNRs that are entered on the selection screen. Please suggest how can we achieve this?

2. We already have a t-code created for this query, but the program that got generated for the query and the program for the t-code are different (Like, the generated program is AQZZZ** but the t-code program is AQAUZ**, not sure what AUZ stands for). So in order to reflect the changes that are made to the T-code selection scree, what could be the process?

Thanks in advance.

Regards,

Amrita.

2 REPLIES 2

Jelena
Active Contributor
0 Kudos

Regarding question # 2: Google -> "SQ01 query program name site:sap.com" -> many existing posts that explain how the program name is formed and alternatives to use for the transaction.

Regarding # 1: not sure what is "1series customers" and what/where exactly are you looking to do in the coding. Might want to be more specific and post the screenshots as well. If you've added a database field (say KNVH-HKUNNR) to the selection screen in query then the query program will take care of selecting the data that fits the selection criteria. Therefore when you get to the code that is executed in the data processing, it's irrelevant what was on the selection screen and you can refer to the DB fields used in the infoset as usual by using <table>-<field>.

If you have to refer to the selection option field in the infoset code then I believe you'll need to define it in the infoset instead of query. Infoset is generated before the query, so in the code you can't refer to the object that does not exist yet.

Former Member
0 Kudos

Hi Jelena,

Thanks for replying.

We have added the field in the infoset. We have added the field using Select Criteria which gives us the field on the selection screen in a separate block. But we want to have the field as additional field in the infoset so that we can add it into a field group.

Suggest us the steps if you are aware of it.

Thanks,

Amrita.