Application Development and Automation 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: 
Read only

Is it possible to write an abap code be SAP SQL query.(ECC 6)

Former Member
0 Likes
819

hello guys,

Is it possible to write an abap code be SAP SQL query.

Scenario : table A has a field say f1 of length 10 and table B has a field say s1 of lenght 20. in sap sql i am able to link all the other tables but i am not able to link

table Af1 --->Table Bs1. as the length doesnot match. so is it possibel that using abap code I can pick 10 characters from table A field f1 adjust it to 20 characters using abap and map it to field s1 of table B.

Please let me know how to accomplish this if possible.

thanks in advance!!

5 REPLIES 5
Read only

josgabriel_martnez
Participant
0 Likes
620

Hello hemaraaja,

For optimal results, the fields should be the same lenght/type. Even, some times the ABAP compiler do not let you use different field type to extract data from db tables to internal tables.

Please, type the code you are trying to use (specifying db tables, internal tables, etc).

Regards,

José Gabriel Martínez.

Read only

0 Likes
620

Thanks for your prompt reply,

Just to clarify i am using SAP SQL Query (sq01 sq02) to generate a list. tables/fields are LIPS-MATNR and AUSP-OBJEK.

Regards,

Sai.

Read only

Former Member
0 Likes
620

Hello Hemaraaja,

You can easily do so. But you need to keep in mind that while mapping the field of table A to table B the length should be same.

This you can do by just transferring the field from table A say field 1 (10 char) to another variable say Var 1 (20 char)

and then map Var 1 (20 char) to field of table 2 say field 2 (20 char).

Jayant Sahu

Read only

0 Likes
620

Jayant,

thanks for your reply.....

how do i do this using SAP Sql query( tcode :sq01/sq02). can you please explain me in details.

Thanks!

Hem

Read only

0 Likes
620

Herm,

Adding code is done in the infoset.

Please do following:

> Goto SQ02

> Type in the infoset that the basis for your query, <change>

> Press <code> OR <shift><f8>

> Tou'll see 4 tabs: Extras, Selections, Code, Enhancements.

> GoTo tab Code

> Choose the coding section (<f4> gives you an overview)

> Enter the code.

You may set a breakpoint to see what the query in SQ01 will do with it.

Succes!

Frank