Application Development 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: 

Find a value from 10 variable

Former Member
0 Kudos

Hi ,

I am finding a value into 10 different fields . By using IF-ElSE i know it is possible but i have to do a 10 level nesting .Can any one help me to do this .

Actually in table TOBJ first i check the object once it find then i have to check whether this auth fields contain in 10 diff field (. The value will be somewhere in fields FIEL1 u2013 FIEL0.) with same auth object .

I have done this way

SELECT SINGLE *

FROM TOBJ

WHERE OBJCT = ISWAUDC-OBJECT.

IF SY-SUBRC <> 0.

            • code ********

ELSE.

CONCATENATE TOBJ-FIEL1 TOBJ-FIEL2 TOBJ-FIEL3 TOBJ-FIEL4 TOBJ-FIEL5

TOBJ-FIEL6 TOBJ-FIEL7 TOBJ-FIEL8 TOBJ-FIEL9 TOBJ-FIEL0 INTO

L_FND_STRNG . "SEPARATED BY SPACE.

IF L_FND_STRNG NS ISWAUDC-FIELD .

            • code ********

ENDIF.

ENDIF.

Thanks in Advance

Ta

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

We can use it IF and END but instead you use CASE ENDCASE.

5 REPLIES 5

Former Member
0 Kudos

Hello,

We can use it IF and END but instead you use CASE ENDCASE.

Former Member
0 Kudos

Use CASE.. ENDCASE

CASE < OUTPUT-FIELD>

WHEN TOBJ-FIEL1 .

WHEN TOBJ-FIEL2.

.

.

.

.

ENDCASE.

former_member222860
Active Contributor
0 Kudos

Hi,

I hope you are trying to do dynamic concatenation.

Just check this sample code:

data: begin of itab occurs 0,
        word(100),
       end of itab.

data: begin of jtab occurs 0,
        word(100),
       end of jtab.

itab-word = 'field1'.
append itab.

itab-word = 'field2'.
append itab.

itab-word = 'field3'.
append itab.

itab-word = 'field4'.
append itab.

loop at itab.
   concatenate jtab itab-word into jtab separated bY SPACE.
endloop.
  append jtab.

loop at jtab.
write:/ jtab-word.
endloop.

Former Member
0 Kudos

Hi,

you need to do like that only

Former Member
0 Kudos

Hi Tarak,

Why dont you try with

DO 10 TIMES varying v_field from TOBJ-FIEL1 next TOBJ-FIEL2.

here you check for the values in v_field.

if v_field is initial.

exit.

endif.

ENDDO.

Regards,

Kumar.