Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Increase the variable count....

Former Member
0 Likes
968

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

6 REPLIES 6
Read only

Former Member
0 Likes
871

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.

Read only

0 Likes
871

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

Read only

0 Likes
871

...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.

Read only

0 Likes
871

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.

Read only

0 Likes
871

Worked like a charm Suman. I did not know how to trap the value of a variable.

Thank you.

SC

Read only

0 Likes
871

You should have start this thread by the end!

Have fun,

m.