‎2009 Aug 11 6:15 PM
Hi Gurus,
I am not ABAP specilaist, I am trying to split source records(field xyz) to two fields (feild 1: xyz1, Field 2: xyz2) in target.
Basically source data filed will have values starting with J and Z.
Example: J001,Z010 etc..
Now in the transformation i want to split record based on the first character, for example if first character of source fields is J result will be J001 otherwise blank. if first character of source fields is Z result will be Z001 otherwise blank.
Any help greatly appreciated.
Regards,
Reddy.
‎2009 Aug 11 6:57 PM
loop at the internal table where you have data into a work area.
if workarea-fieldname+0(1) = 'J'.
wa2-field1 = 'J001'.
elseif workarea-fieldname+0(1) = 'Z'.
wa2-field1 = 'Z010'.
endif.
append wa into itab2.
clear wa.
endloop.
let me know if you have any doubts.
‎2009 Aug 11 6:57 PM
loop at the internal table where you have data into a work area.
if workarea-fieldname+0(1) = 'J'.
wa2-field1 = 'J001'.
elseif workarea-fieldname+0(1) = 'Z'.
wa2-field1 = 'Z010'.
endif.
append wa into itab2.
clear wa.
endloop.
let me know if you have any doubts.
‎2009 Aug 11 7:07 PM
Hello
Another solution might look like this:
LOOP AT lt_itab INTO ls_record.
CASE ls_record-field+0(1).
WHEN 'J'.
ls_record-field = 'J001'.
WHEN 'Z'.
ls_record-field = 'Z100'.
WHEN others.
ls_record-field = space.
ENDCASE.
APPEND ls_record TO lt_itab2.
ENDLOOP.
Regards
Uwe
‎2009 Aug 13 9:15 AM
Hi Uwe,
I was split the records using your code, But the date is appearing as below
Field A Field B Field C
J001 £ 100
Z001 £ 100
I want the data to be appeared in as single record.
Regards,
Reddy.