10-30-2009 1:36 PM
Hi all,
First of all, I'm new to this so bare with me..
I was wondering if anyone knew a way to loop over and move data from an internal table ( has more then 40 fields ) into a single line of another internal table separated by '~' .
I do not wish to concatenate all the fields because of the share amount of fields within the donor internal table.
Help would be much appreciated.
10-30-2009 1:40 PM
>
> Hi all,
>
> First of all, I'm new to this so bare with me..
>
> I was wondering if anyone knew a way to loop over and move data from an internal table ( has more then 40 fields ) into a single line of another internal table separated by '~' .
>
> I do not wish to concatenate all the fields because of the share amount of fields within the donor internal table.
>
> Help would be much appreciated.
Single line of another internal table? This may be a line ... if not, where do you accommodate ~ in the line?
If it is a single line where there are no fileds - i am not sure u can do this without concatenate.
Assume it is a internal table line and you have added fields to accommodate ~ in the line... you can loop the internal table and move corresponding fields to the line then move the ~ to other fields....
10-30-2009 1:54 PM
Hi Sampath Kumar,
Thx for your swift reply!
Let me try to explain it again.
I have a internal table with many fields.
I would like to move these fields into another IT witch looks like this DATA:
BEGIN OF blablabla,
line(999),
END OF blablabla.
All fields need to be seperated by '~' within 'blablabla-line'
is there an easier way to do this without having to concatenate all the fields from the donor IT together separated by '~'.
10-30-2009 2:08 PM
>
> Hi Sampath Kumar,
>
> Thx for your swift reply!
>
> Let me try to explain it again.
>
> I have a internal table with many fields.
>
> I would like to move these fields into another IT witch looks like this DATA:
>
> BEGIN OF blablabla,
> line(999),
> END OF blablabla.
>
> All fields need to be seperated by '~' within 'blablabla-line'
>
> is there an easier way to do this without having to concatenate all the fields from the donor IT together separated by '~'.
First of all, you have the line and want to append data into this line - forget about '~' symbol.
to do this, you need to concatenate all the fields and there is no easy way to do this. I couldnt find any FM to do this for more than 2 fields. There is an FM but it is for 2 strings only .
STRING_CONCATENATE
Go to the function group of the above FM and also package then search for FM's to do your job. Again, as far as i know, there is no easy way of doing this.
Any one else has an idea?
10-30-2009 2:31 PM
REPORT zpwtest .
TABLES : mara .
DATA : i_mara TYPE TABLE OF mara ,
ls_mara TYPE mara .
FIELD-SYMBOLS : <fs_item> TYPE ANY .
DATA : lv_item TYPE string ,
lv_line TYPE string .
SELECT-OPTIONS : s_matnr FOR mara-matnr .
START-OF-SELECTION .
SELECT *
INTO TABLE i_mara
FROM mara
WHERE matnr IN s_matnr .
LOOP AT i_mara INTO ls_mara .
CLEAR lv_line .
DO .
ASSIGN COMPONENT sy-index OF STRUCTURE ls_mara TO <fs_item> .
IF sy-subrc = 0 .
lv_item = <fs_item> .
CONCATENATE lv_line lv_item INTO lv_line SEPARATED BY '~' .
ELSE.
EXIT.
ENDIF.
ENDDO.
WRITE : / lv_line .
* Use value of lv_line to append in your target internal table
ENDLOOP.
Edited by: Pawan Kesari on Oct 30, 2009 8:02 PM
Edited by: Pawan Kesari on Oct 30, 2009 8:02 PM