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: 

SQ01 Queries; Any rules / Coding posssible?

Former Member
0 Kudos

Hi,

I must make a query and want to use TX SQ01.

When I join the 2 tables I have the issue that the link field has a leading zero in one table and without leading zero in the other table.

So the join will not work.

I am wondering if there is any option to implement a short coding (contatenate '0' with number on one table in the query, I did not find any option in SQ01 however perhaps someone knows....

Thanks in advance,

Thomas

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

if one of the two tables is Z, you should change the type of the field to the type of the other table.

See you soon,

5 REPLIES 5

Former Member
0 Kudos

Hi ,

Yes we can write the code in SQ01. Please Refer the link Hope it will useful.

<<link removed by moderator>>

if is not helpful go to the program which has generated...and then change the code.

Regards,

Dhina..

Edited by: Dhina DMD on Jun 3, 2011 7:25 AM

Edited by: kishan P on Jun 3, 2011 11:52 AM

Former Member
0 Kudos

Hello,

if one of the two tables is Z, you should change the type of the field to the type of the other table.

See you soon,

0 Kudos

Hi,

Thanks for answer.

Yes, one of the tables is a Z-Table.

The link between both tables are the account number and the bankkey:

In the Z-Table the account number is a CHAR20 and the bank Key a CHAR15.

In the StD-table the account number is a CHAR35 and the bank Key a CHAR15.

I have only experience with Quick Viewer in SQV1 and would appreciate your help.

I understand I have to create first in SQ02 an Infoset. (Data Source "Table join using basis Table").

There I enter the name of the STD-table and confirm.

Next screen is a grafic screen where I add the second table (same screen as in Quick viewer)

Automatically there is no link between both tables on the graphic screen.

When I go back the info pops up: Z-Table must be the right hand table in a join. Continue Processing Join?"

I confirm YES and then a pop up appears "Field Groups - include all table fields / key fields / empty"

What should I choose? I select all.

The I have a new screen where I see left the both table names and title "JOIN"

How can I go ahead and create the link between both tables where the bank key = bankkey

and the number of STD table = account number of Ztable = account if we concatenate a leading zero.

???

Thanks in advance!

Thomas

0 Kudos

Hi,

1) I suggest better dont select Table join better select direct read from table. Give the Standard Table here.

because if you select the table join the join condition is automatically assigned.

2) The pop up appears "Field Groups" I would suggest using the third option (create empty field groups)

because you donu2019t need all the fields (nobody does), so itu2019s better to choose whatever you really need

from scratch (empty) to improve the query performance. In next screen, choose which fields you want to include

into the infoset, itu2019s fairly simple actually because all you need to do is click and drag the fields

from the left pane into the right pane.

3) Click u2018Codeu2019. in that code selection having so many event and data declaration also. Please write the code over here.

4) In the declaration better declare one internal table.

5) in the start-of-selection write the code as below:


loop at standard table to wa.

"call CONVERSION_EXIT_ALPHA_OUTPUT get the field values as leading zero's
"pass into the newly created itab
append wa to it.

endloop.

"and write the select query with for all entries.

Please see the below link its sample of SQ02.

www dot saptechnical dot com/Tutorials/SAPQuery/ABAPCode/Page1 dot htm

Regards,

Dhina..

Edited by: Dhina DMD on Jun 3, 2011 11:03 AM

0 Kudos

Hi Dhina,

This is amazing. Thaks for this detailed description.

I will try this one by one on Monday and come back to you.

Have a nice weekend.

Thomas