‎2008 Jun 23 6:21 AM
hi friends ,
can i fill ftab from 2 difff tables out which one have structure with types and other one have like if yes then how.
wit8h regards.
‎2008 Jun 23 6:33 AM
Hi,
Your question is not completely clear.
But you can fill the itab with data from two diffrent tables.
just make sure it has all the fields. and there should be alteast one key field.
explain in detail what exactly you looking for.
Regards,
Nikhil
Edited by: Nikhil A Chitre on Jun 23, 2008 3:33 PM
‎2008 Jun 23 6:33 AM
yes its possible .....
suppose u have 2 ztables...ztable1 and ztable2...suppose zkey is the common field from both the tables...
itab is the table u wanna fill from the two table.....
First select into reqd fiels from ztable1 into itab.
Suppose the field wf_fieldx of itab is to be filled from ztable2.
then select all in to another table from ztable2 to itab2.
loop at itab2.
wa_itab1-wf_fieldx = itab2-wf_fieldx.
wa_itab1-zkey= itab2-zkey.
modify itab1 from wa_itab transporting zkey wf_fieldx.
endloop.
‎2008 Jun 23 6:33 AM
Hi,
Your question is not completely clear.
But you can fill the itab with data from two diffrent tables.
just make sure it has all the fields. and there should be alteast one key field.
explain in detail what exactly you looking for.
Regards,
Nikhil
Edited by: Nikhil A Chitre on Jun 23, 2008 3:33 PM
‎2008 Jun 23 6:35 AM
Hi,
You can go ahead with both of them,
however, as Like:Creates the field f with the same field attributes as the data object (already defined) f1. You can use this technique for any data type (fields, parameters, structures) as long as the data object is fully typed.
f1 can be any ABAP Dictionary reference.
The catch here is if you check the F1 help,you will find this,
No LIKE reference to Dictionary types
In classes only the TYPE reference can be used to refer to data types in the ABAP Dictionary. The LIKE reference is allowed to local data objects only. In local classes this includes the attributes of the class and the data objects of the main program. In global classes only the class attributes can be referenced. This applies both to data declarations and to type assignments of interface parameters and field symbols.
Error message in ABAP Objects if the following syntax is used:
DATA f LIKE dbtab.
Correct syntax:
DATA f TYPE dbtab.
Reason:
The TYPE addition is designed to be the only construct that enables references to data types, whereas the LIKE addition is used only for data objects. The repository objects in the ABAP Dictionary are data types but not data objects. Outside of ABAP Objects the LIKE reference to database tables and flat structures in the ABAP Dictionary is still allowed for reasons of compatibility with previous releases.
I believe we now usually prefer being nearer to OOPs. So better to use type.
cheers
Mohinder Singh Chauhan