2007 Sep 13 6:32 AM
Hi i have some data in the internal table itab. which contains few fields. Some of the fields are blanks and some contains data. Now i am transfering this internal table to file which is in Application Server. When i trnasfer itab to file, blank fields are concatenated by next field.
Explanation:
itab contains fallwoing data:
field1 field2 field3 field4 field5
uu kk nn ii
when i transer this to file it is coming as fallows
field1 field2 field3 field4 field5
uu kk nn ii
how can i solve this problem
Thanx in Advance
Subhani.
2007 Sep 13 7:07 AM
Hi Subhani,
This probelm can be fixed very easily. All you need to do is to use Offsets while writing to the file from internal table. This is done as follows:
DATA: gv_string(217) TYPE c, " Holds text to display
Loop at <itab> into <wa>.
gv_string+0(5) = <wa>-<fieldname>
gv_string+10(5) = <wa>-<fieldname>
do this for all the fileds.
Endloop.
Note: In the above code snipet, 0(5) represents 'Starting for the 0th position, reserve 5 characters and print it there. Use this for all the fields of your internal table. Based on the size of the field(s) of the itab, allocate the space accordingly.
<b>PLZ REWARD POINTS IF HELPFUL</b>
Hi i have some data in the internal table itab. which contains few fields. Some of the fields are blanks and some contains data. Now i am transfering this internal table to file which is in Application Server. When i trnasfer itab to file, blank fields are concatenated by next field.
Explanation:
itab contains fallwoing data:
field1 field2 field3 field4 field5
uu kk nn ii
when i transer this to file it is coming as fallows
field1 field2 field3 field4 field5
uu kk nn ii
how can i solve this problem
Thanx in Advance
Subhani.
2007 Sep 13 6:35 AM
Problem Explanation Again:
itab contains fallwoing data:
field1 field2 field3 field4 field5
uu-----kk
when i transer this to file it is coming as fallows
field1 field2 field3 field4 field5
uu-----kk-nn-ii--
Ignore the doted line.
2007 Sep 13 6:46 AM
try putting a field separator such as a comma between the fields
2007 Sep 13 7:07 AM
Hi Subhani,
This probelm can be fixed very easily. All you need to do is to use Offsets while writing to the file from internal table. This is done as follows:
DATA: gv_string(217) TYPE c, " Holds text to display
Loop at <itab> into <wa>.
gv_string+0(5) = <wa>-<fieldname>
gv_string+10(5) = <wa>-<fieldname>
do this for all the fileds.
Endloop.
Note: In the above code snipet, 0(5) represents 'Starting for the 0th position, reserve 5 characters and print it there. Use this for all the fields of your internal table. Based on the size of the field(s) of the itab, allocate the space accordingly.
<b>PLZ REWARD POINTS IF HELPFUL</b>
2007 Sep 13 7:13 AM
Hi Subhani,
This can be achieved by writing the keyword "separated by space" or "separated by comma".
You can press F1 on the transfer keyword and you will get the various options.
The other way can be to use the offsets as mentioned above.
The third solution can be to convert the file to ascii and then you can transfer the data easily.The function module for the same is :SAP_CONVERT_TO_TEX_FORMAT.
I hope I have tried to answer your query.
In case you have any further queries,feel free to ask.
Regards,
Puneet Jhari.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |