10-08-2008 10:34 AM
hi everybody
is there a fm or a command which separates each field in a line, where theres no separator, but the fields are of a specified length
10-08-2008 10:39 AM
hi
use offset commands. i gave sample below
wa = 'WELCOME'
wa1 = wa+0(3).
value is WEL
wa2 = wa+3(2)
value is CO
10-08-2008 10:37 AM
Is all your data character based? Then you don't need to.
For example, if you have a field1 length 10, and field2 length 12, simply do this:
DATA: BEGIN OF my_line,
field1 TYPE C LENGTH 10,
field2 TYPE C LENGTH 12,
END OF my_struc.
" l_line contains ABCDEFGHIJZZZZZZZZZZZZ
my_line = l_line.
" my_line-field1 now contains ABCDEFGHIJ
" my_line-field2 now contains ZZZZZZZZZZZZ
matt
10-08-2008 10:42 AM
10-08-2008 10:39 AM
Hi,
Firstly how many parts do you need to split ?
If is is 2/3/4 you need not use a function module. You can do it in simple coding.
Ex : Say you want split the following set of characters into 3 words of known length. then you can use the following coding.
Data : w_total(15) type c value 'SAPSDNFORUM',
w_sap(3) type c,
w_sdn(3) type c,
w_for(3) type c.
w_sap = w_total+0(3).
w_sdn = w_total+3(3).
w_for = w_total+6(5).
Regards,
Pramod
10-08-2008 10:39 AM
hi
use offset commands. i gave sample below
wa = 'WELCOME'
wa1 = wa+0(3).
value is WEL
wa2 = wa+3(2)
value is CO