04-08-2010 6:01 AM
Dear All,
I am having issue passing the contents of one internal table to another.
I have 2 internal tables declared like this.
Global declaration:
Types:
T_AFVGD LIKE AFVGD OCCURS 0,
DATA : IAFVGD TYPE T_AFVGD WITH HEADER LINE.
FORM get_eban .
Local declaration
DATA: t_iAFVGD type standard table of afvgd.
t_iafvgd = iafvgd.
ENDFORM.
Now i want to assign the value of iafvgd to t_iafvgd.
I cannot make changes to global declaration.
I can make changes to local declaration of t_iafvgd.
But not supposed to declare local declaration as occurs 0 or with header line due to coding
standard of client.
When i have used as above and run a syntax check i get error telling
"The type of "T_IAFVGD" cannot be converted to the type of "IAFVGD"."
guide me as to how i need to declare the internal table t_iafvgd and how to assign the contents of iafvgd to t_iafvgd.
Regards,
SuryaD.
Edited by: SuryaD on Apr 8, 2010 10:33 AM
04-08-2010 6:08 AM
Try This
Global declaration:
Types:
T_AFVGD LIKE AFVGD OCCURS 0,
DATA : IAFVGD TYPE T_AFVGD WITH HEADER LINE.
FORM get_eban .
Local declaration
DATA: t_iAFVGD type standard table of afvgd.
data : wa_iafvgd type afvgd.
loop at iafvgd.
move-corresponding iafvgd to wa_iafvgd.
append wa_iafvgd to t_iafvgd.
endloop.
ENDFORM.
Regards
Vinod
04-08-2010 6:22 AM
Thanks for the response vinod.
I made changes accordingly
But i am still getting the same error when trying to pass the contents from iafvgd to t_iafvgd.
The type of "T_IAFVGD" cannot be converted to the type of "IAFVGD".
Regs,
SuryaD.
04-08-2010 6:29 AM
Thanks Prasath and Vinod.
Issue is fixed.
i have declared it like this
DATA: t_iAFVGD type standard table of afvgd,
wa_iafvgd type afvgd.
refresh t_iafvgd.
loop at iafvgd.
move-corresponding iafvgd to wa_iafvgd.
append wa_iafvgd to t_iafvgd.
endloop.
t_iafvgd[] = iafvgd[].
Regs,
SuryaD.
Edited by: SuryaD on Apr 8, 2010 11:00 AM
04-08-2010 6:33 AM
Hi,
When the reference structure is that of a standard table, you can just declare it as
*Types:
*T_AFVGD LIKE AFVGD OCCURS 0.
DATA : IAFVGD TYPE STANDARD TABLE OF AFVGD.
FORM get_eban .
DATA: t_iAFVGD type standard table of afvgd.
data : wa_iafvgd type afvgd.
t_iafvgd = iafvgd.
ENDFORM.
04-08-2010 6:45 AM
Hi Surya ,
Please Follow the below mentioned procedure to make it more efficient.
* Declaration Part
DATA: t_iAFVGD type standard table of afvgd,
iafvgd type standard table of afvgd.
* populate the ITAB iafvgd
use either Method 1 or Method 2 mentioned below to move the records to ITAB t_iafvgd
Method 1 : This is best and simple.
t_iafvgd[ ] = iafvgd[ ].
Method 2 : as suggested by Vinod
you need declare the wa_iafvgd for using this method.
Loop at iafvgd.
move-corresponding iafvgd to wa_iafvgd.
append wa_iafvgd to t_iafvgd.
endloop.
04-08-2010 6:11 AM
Hi Surya,
Why dont you declare both ITAB either with Header line or as Standard table globally.
while assigning an ITAB1 to ITAB2 , the syntax should be ITAB2[ ] = ITAB [ ]. in your Case it should be t_iafvgd[ ] = iafvgd [ ] in the local declaration.
additionally , When you declare ITAB Local i.e inside the form , data will be initialized once flow move out of the form. you cannot use the second internal table outside.