2009 Feb 25 10:46 AM
Hi All,
I have a requirement where i have to fetch mutiple rows of a table and then concatenate the data of a particular field of all the rows and put it into a single variable.
I have no restrictions on the no of rows to be fetched due to which i cannot plan of the size of that single variable.
Can anyone suggest me some data type which can take variable lengths at run time. also the size limit can go beyond 255.
Please help.
Thanks,
Chandna
Hi All,
I have a requirement where i have to fetch mutiple rows of a table and then concatenate the data of a particular field of all the rows and put it into a single variable.
I have no restrictions on the no of rows to be fetched due to which i cannot plan of the size of that single variable.
Can anyone suggest me some data type which can take variable lengths at run time. also the size limit can go beyond 255.
Please help.
Thanks,
Chandna
2009 Feb 25 10:48 AM
2009 Feb 25 10:48 AM
Hi,
U can use string or xstring as the data type and concatenate all the variables into the string type one.
U can declare as :
DATA: str type string.
concatenate field1 field2 field3 into str.
Keerthi
Edited by: Keerthy K on Feb 25, 2009 11:49 AM
Edited by: Keerthy K on Feb 25, 2009 11:50 AM
2009 Feb 25 10:52 AM
2009 Feb 25 10:53 AM
HI,
use EDI_SDATA data element which can hold 1000 characters.
OR
text should be treated as Long Text.
And the steps are:
1. Create Text Object Using SE75.
2. Create Text ID Using SE75.
3. Now you have to Save the text with FM SAVE_TEXT.
Regards,
Venkatesh
2009 Feb 25 10:55 AM
2009 Feb 25 10:59 AM
Hi,
You can use local variable with lenght 65535 type c. It's the maximum length allowed for char data type.
Regards,
Surendar Reddy.
2009 Feb 25 11:18 AM
Hello Chandna,
You can go with the following workaround;
DATA:
w_var1 TYPE string,
w_var2 TYPE string.
LOOP AT t_table INTO fs_table.
CONCATENATE w_var1 fs_table-field1 INTO w_var2.
ENDLOOP.Now, every time loop is run, current value is attached to previous value and at the end, you'll get concatenated values in w_var2.
You can very well use w_var2.
Hope, it helps you.
Thanks: Zahack
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |