‎2011 Oct 05 6:10 PM
Hi,
I have 28 variables from var1 to var28.
I do not want to check the value of each variable.
Is it possible to do it in "DO n TIME ......... ENDDO" loop using fiedl symbols.
I used concatenate to make a variable name but how to check its value and compare it with anothe field in the internal table.
I tried but no luck so far.
Please let me know if it is possible by any method.
Regards
SC
‎2011 Oct 05 6:17 PM
Hi,
This is not very clear
When you say variable are you talking about an internal table column?
and compare it with anothe field in the internal table.
Which field? can you give us more details?
Kr,
m.
‎2011 Oct 05 6:53 PM
I have 28 variables from var1 to var28.
Each is assigned a check box. Each check box has its value also in form a title, whcih is also in 28 variable (title1 ....title28).
There is a internal table with some rows. Not all checkboxes will be checked.
I want to delete some entries from the internal table based on checked boxes.
I want to do it dynamically in a loop without checking 28 times explicitly for each variable.
I am trying this but not working -
data: var1(20),
var2 type i,
var3(2).
FIELD-SYMBOLS: <cf> TYPE C.
do 28 times.
var3 = sy-index.
concatenate 'title' var3 into var1.
assign var4 to <cf>.
read table serlst with key zhost = <cf>.
if sy-subrc = 0.
endif.
enddo.
Is it possible?
Regards
SC
‎2011 Oct 05 8:51 PM
...This is still very unclear!... Tell me if I understood this correctly:
- You have a list of checboxes (28)
- Each checkbox correspond to a host name (assumption based on your internal table)
- You want to remove the entries that correspond to the unchecked checkboxes from an internal table
- That internal table has a unique key which is the host name
If this is the idea, well yes it's possible...otherwise, please elaborate
Kr,
m.
‎2011 Oct 05 8:51 PM
Check the below code to access variables title1, title2....title28 values in Do loop.
DATA: var1 TYPE c LENGTH 20,
var2 TYPE i,
var3 TYPE c LENGTH 2.
FIELD-SYMBOLS: <cf> TYPE c.
DO 28 TIMES.
var3 = sy-index.
CONCATENATE 'title' var3 INTO var1.
ASSIGN (var1) TO <cf>.
IF sy-subrc EQ 0.
READ TABLE serlst WITH KEY zhost = <cf>.
IF sy-subrc = 0.
ENDIF.
ENDIF.
ENDDO.
‎2011 Oct 05 9:20 PM
Worked like a charm Suman. I did not know how to trap the value of a variable.
Thank you.
SC
‎2011 Oct 05 9:24 PM