2008 Jul 16 4:55 PM
Hi Gurus,
I have to read the following data into my internal table by splitting at | into workarea.
800|ZIXBSVCREQ|47114711|L2|FB2FFF5916C299489D0613840D4ED507|ZIXDSVCREF|20080502|00000000|FAX|47114711|20070312||
800|ZIXBSVCREQ|80004711|L2|7E9C31636213D44688EBD6593D633D53|ZIXDSVCREF|20060502|00000000|FAX|80004711|20080312|89224444|
800|ZIXBSVCREQ|90004711|L2|E777FD51E6798449977005A20C754B30|ZIXDSVCREF|20070502|00000000|FAX|90004711|20060312||
If the last field value is blank, it move the | into the workarea and so into the internal table.
How to avoid the copying of | into the workarea and internal table?
Please reply soon.
Regards,
Rahul
Hi Gurus,
I have to read the following data into my internal table by splitting at | into workarea.
800|ZIXBSVCREQ|47114711|L2|FB2FFF5916C299489D0613840D4ED507|ZIXDSVCREF|20080502|00000000|FAX|47114711|20070312||
800|ZIXBSVCREQ|80004711|L2|7E9C31636213D44688EBD6593D633D53|ZIXDSVCREF|20060502|00000000|FAX|80004711|20080312|89224444|
800|ZIXBSVCREQ|90004711|L2|E777FD51E6798449977005A20C754B30|ZIXDSVCREF|20070502|00000000|FAX|90004711|20060312||
If the last field value is blank, it move the | into the workarea and so into the internal table.
How to avoid the copying of | into the workarea and internal table?
Please reply soon.
Regards,
Rahul
2008 Jul 16 5:04 PM
2008 Jul 16 5:07 PM
Put a check before moving the value to the table like:
split '800|ZIXBSVCREQ|47114711|L2|FB2FFF5916C299489D0613840D4ED507|ZIXDSVCREF|20080502|00000000|FAX|47114711|20070312||'
into wa-fdl1
wa-fld2
....
wa-fldn at '|'.
perform zinitial using :
wa-fdl1,
wa-fld2,
....
wa-fldn.
append wa to itab.
form zinitial using p_fld type c.
if p_fld = 'I'.
clear p_fld.
endif.
endform.
Regards,
Joy.
2008 Jul 16 5:09 PM
I am sure you are reading from the text file. Loop at the table from where it is comming and then use the SPLIT command..
check this example.
DATA: str1 TYPE string,
str2 TYPE string,
str3 TYPE string,
itab TYPE TABLE OF string,
text TYPE string.
text = `What a drag it is getting old`.
SPLIT text AT space INTO: str1 str2 str3,
TABLE itab.
Shreekant
2008 Jul 16 5:11 PM
Hi,
READ DATASET l_floc INTO l_fdata.
l_floc - filelocation
l_fdata - string
IF sy-subrc EQ 0.
SPLIT l_fdata AT '|' INTO it_tab-f1 it_tab-f2 it_tab-fn.
ENDIF.
Regards,
Srini
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |