‎2008 Feb 08 8:00 AM
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!!
‎2008 Feb 08 8:21 AM
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.
‎2008 Feb 08 8:27 AM
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.
‎2008 Feb 08 8:28 AM
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
‎2008 Feb 08 8:32 AM
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
‎2008 Aug 25 1:32 PM
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