Good Morning to all Guru's,
can anybody explains me how i can find out the total length of one field from the internal table at run time?
example.
i wanted to some thing like this.
TYPES:BEGIN OF text12,
text1 TYPE string,
num(4) TYPE n,
calc TYPE i,
off TYPE i,
off1 TYPE i,
END OF text12.
DATA:wa TYPE text12.
DATA:itab TYPE TABLE OF text12.
MOVE 'i know you know' TO wa-text1.
MOVE 1234 TO wa-num.
MOVE 5678 TO wa-calc.
APPEND wa TO itab.
LOOP AT itab INTO wa.
FIND 'you' IN wa-text1 MATCH OFFSET wa-off.
FIND (wa-num) MATCH OFFSET wa-off1 . "here i am strucked
SHIFT wa-text1 BY wa-off PLACES.
SHIFT wa-num BY 2 PLACES.
SHIFT wa-num BY wa-off1 PLACES.
WRITE:wa-text1,wa-num,wa-calc.
ENDLOOP.
Please help me out.
Thanks
Priyalatha
Hi Priya,
Try This code If it suffices ur requirement. Award Points if useful.
TYPES:BEGIN OF text12,
text1 TYPE string,
num(4) TYPE n,
calc TYPE i,
off TYPE i,
off1 TYPE i,
END OF text12.
DATA : l(5) TYPE n.
DATA : t(5).
DATA:wa TYPE text12.
DATA:itab TYPE TABLE OF text12.
MOVE 'i know you know' TO wa-text1.
MOVE 1234 TO wa-num.
MOVE 5678 TO wa-calc.
APPEND wa TO itab.
LOOP AT itab INTO wa.
FIND 'you' IN wa-text1 MATCH OFFSET wa-off.
FIND wa-num IN wa-num MATCH LENGTH l.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = l
IMPORTING
output = l.
FIND l IN wa-num MATCH OFFSET wa-off1.
SHIFT wa-text1 BY wa-off PLACES.
SHIFT wa-num BY 2 PLACES.
SHIFT wa-num BY wa-off1 PLACES.
WRITE:wa-text1,wa-num,wa-calc.
ENDLOOP.
hi priya
try like this
TYPES:BEGIN OF text12,
text1 TYPE string,
num(4) TYPE n,
calc TYPE i,
off TYPE i,
off1 TYPE i,
name type string,
name1 type string,
END OF text12.
DATA:wa TYPE text12.
DATA:itab TYPE TABLE OF text12.
data: len type i,
num type i.
MOVE 'i know you know' TO wa-text1.
len = strlen( wa-text1 ).
num = 0.
do len times .
num = num + 1 .
*MOVE wa-text1(num) TO name.
move wa-text1(num) to wa-name .
enddo.
MOVE 5678 TO wa-calc.
APPEND wa TO itab.
LOOP AT itab INTO wa.
FIND 'you' IN wa-text1 MATCH OFFSET wa-off.
FIND (wa-num) MATCH OFFSET wa-off1 . "here i am strucked
SHIFT wa-text1 BY wa-off PLACES.
SHIFT wa-num BY 2 PLACES.
SHIFT wa-num BY wa-off1 PLACES.
WRITE:wa-name ,wa-num,wa-calc.
ENDLOOP.
LOOP AT itab INTO wa.
FIND 'you' IN wa-text1 MATCH OFFSET wa-off.
FIND (wa-num) MATCH OFFSET wa-off1 . "here i am strucked
SHIFT wa-text1 BY wa-off PLACES.
SHIFT wa-num BY 2 PLACES.
SHIFT wa-num BY wa-off1 PLACES.
WRITE:wa-name ,wa-num,wa-calc.
ENDLOOP.
in this wa-off is i so change the off type is c
then its work fine.
regard
kk.
Add a comment