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

Itab to string variable

Former Member
0 Likes
443

halo,

I ' ve an itab which has 2 fields out of which 1 field has longtext as its

content(in no.of records)..i want to move all these records(longtext) into

a string variable which inturn i'm passing to an attribute of a method.

Is it possible to move the records of an itab to a string variable? if so, how?

Thank you.

-Swaminathan.

3 REPLIES 3
Read only

Former Member
0 Likes
363

Hi Swami,

If my understanding is correct. Check the below logic.

Loop at itab.

concatenate string itab-field1 into string.

(You can use specific feild separator to make an identity of each record.)

Endloop.

Read only

Former Member
0 Likes
363

data: it001 type table of t001 with header line.

data: string type string.

select * into table it001 from t001.

loop at it001.

concatenate string it001 into string separated by ','.

endloop.

shift string left deleting leading ','.

write:/ string.

Regards

Read only

Former Member
0 Likes
363

Hi Swami,

For moving the internal table value to local variable it will be like this.

READ TABLE int_tab with key pernr = p_pernr

for all entries in int_tab.

loc_pernr = int_tab-pernr.

loc_name = int_tab-name.

Like this way you can move value from internal table to local variable.

************************

Using the below method you will be moving the value from local varaible to internal table by this method.

Here loc_nname,loc_init are local variables.

SELECT SINGLE nachn inits FROM pa0002

INTO (loc_name,loc_init)

WHERE pernr EQ int_employee-wf_pernr."#EC *

CONCATENATE loc_name loc_init

INTO int_employee-wf_ename SEPARATED BY ', '.

****************

Thanks,

Sakthi C

*Rewards if useful*