2014 Jun 10 7:04 AM
Hi All,
I need to implement a logic where in i should be able to read multiple values seperated by commas which are entered in an input/ output field on a screen.
need pointers to implement the logic.
Thanks & Regards,
SriLalitha.
2014 Jun 10 7:58 AM
Hi SriLatha,
As all the above suggested, you can use the SPLIT statement. But there an issue will arise. How many TO fields needs to be declared and how many of them needs to be used in the SPLIT statements. Means, these can be dynamic.
So I will suggest you can go with the following logic for SPLIT statement.
DATA : gt_str TYPE TABLE OF tdline.
SPLIT IP_TEXT AT ',' INTO TABLE gt_str.
So this will split all the values into a table and this will be dynamic.
Regards,
Abijith
2014 Jun 10 7:09 AM
Hi Sri Lalitha,
I believe you can use the below mentioned code to fulfill your need
data strng1 type string value 'aaa, bbbb, cc, dddddd, bbb,cccccc,dd,eee'.
data strng2 type string.
data strng3 type string.
data : begin of fs,
col1(20) type c,
col2(20) type c,
col3(20) type c,
col4(20) type c,
end of fs.
data itab like table of fs.
string2 = string.
while string2 <> space.
split string2 at ',' into fs-col1 fs-col2 fs-col3 fs-col4 string2.
append fs to itab.
clear fs.
endwhile.
loop at itab into fs.
write / fs.
endloop.
Let me know in case you require any further inputs.
BR/Thanks
Pranav Agrawal
2014 Jun 10 7:15 AM
Pranav,
my requirement is that - i have an i/o field on a screen. here i enter aaa, bbb. so how can i read aaa and bbb seperately so that i need to pass these values to seperate variables
Thanks & Regards,
SriLalitha
2014 Jun 10 7:18 AM
Hi,
You can use the SPLIT statement for your requirement. Check for SPLIT statement , use different variable to get the value .
Regards
Sivaganesh
2014 Jun 10 7:25 AM
Hi Sri Latha,
Below is the answer to your further query.
Suppose screen parameter is string2.
Then you enter string2 = aaa, bbb.
split string2 at ', ' into stg1 stg2.
The corresponding values in string2 variable will go in stg1 and stg2 i.e.
stg1 = aaa and stg2 =bbb.
Please validate the same at your end as well.
BR/Thanks
Pranav Agrawal
2014 Jun 10 7:58 AM
Hi SriLatha,
As all the above suggested, you can use the SPLIT statement. But there an issue will arise. How many TO fields needs to be declared and how many of them needs to be used in the SPLIT statements. Means, these can be dynamic.
So I will suggest you can go with the following logic for SPLIT statement.
DATA : gt_str TYPE TABLE OF tdline.
SPLIT IP_TEXT AT ',' INTO TABLE gt_str.
So this will split all the values into a table and this will be dynamic.
Regards,
Abijith
2014 Jun 10 8:24 AM
Hi,
If your requirement is to read the screen field value of any standard screen and to pass the values to separate variables, follow the below code.
For example:
"Field Symbols
FIELD-SYMBOLS: <fs_vbak> TYPE vbak.
"Read the VBAK structure populated for SO
ASSIGN ('(SAPMV45A)VBAK') TO <fs_vbak>.
IF <fs_vbak> IS ASSIGNED.
"Put logic required
ENDIF.
Regards
Gangadhar