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

Multiple loop in one loop

ace_bw
Participant
0 Likes
621

Dear experts,

Please find the code below.This is text variable customer exit.Can u ple help me to put these multiple loops into one loop.Do u suggest this code is ok?

Appreciate your help.

WHEN 'ZSTXTPE01AA'or 'ZSTXT0FISCPER305AA'or 'ZSTXT0FISCYEAR01AA'

INCLUDE Z_VARIABLES_TEXT

DATA: vtype i,

fisper i,

fisyear i

IF I_STEP=2.

LOOP AT I_T_VAR_RANGE INTO loc_var_range WHERE VNAM='ZS0VTYPE01AA'

vtype=LOC_VAR_RANGE-LOW

ENDLOOP.

CLEAR L_S_RANGE.

L_S_RANGE-LOW= vtype.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

LOOP AT I_T_VAR_RANGE INTO loc_var_range WHERE VNAM='ZS0FISCPER305AA'

fisper=LOC_VAR_RANGE-LOW

ENDLOOP.

CLEAR L_S_RANGE.

L_S_RANGE-LOW= fisper.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

LOOP AT I_T_VAR_RANGE INTO loc_var_range WHERE VNAM='ZS0FISCYEAR01AB'

fisyear=LOC_VAR_RANGE-LOW

ENDLOOP.

CLEAR L_S_RANGE.

L_S_RANGE-LOW= fisyear.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

APPEND L_S_RANGE TO E_T_RANGE.

ENDIF.

Rgds

ACE

4 REPLIES 4
Read only

Former Member
0 Likes
565

Hi,

Use Case endcase inside the loop to check for the name of the vnam and append to the appropriate ranges.


LOOP AT I_T_VAR_RANGE INTO loc_var_range.
case VNAM.
when 'ZS0VTYPE01AA'.
 " Your code for ZS0VTYPE01AA
when ''...
endcase.
Endloop.

regards,

Advait

Read only

Former Member
0 Likes
565

LOOP AT I_T_VAR_RANGE INTO loc_var_range

WHERE VNAM IN('ZS0VTYPE01AA', 'ZS0FISCPER305AA','ZS0FISCYEAR01AB')

vtype=LOC_VAR_RANGE-LOW.

endloop.

L_S_RANGE-LOW= vtype.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

L_S_RANGE-LOW= fisper.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

L_S_RANGE-LOW= fisyear.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

APPEND L_S_RANGE TO E_T_RANGE.

try the above code

also

What u r doing inside ur loop endloop?

Read only

0 Likes
565

Dear Karthik,

Thanks alot.Well am trying to get the text of the base variable(with processing type customer exit) i. e ZS0VTYPE01AA.My text variable is ZSTXTPE01AA.Same case for fisccal period and fiscal year.I have declared Vtype i,fisper i and fisyear i,is this ok?.I will use your approach to make one loop.As you said i will explore about case statement given above.

Thanks

ACE

Read only

0 Likes
565

Hi,

How did you declare L_S_RANGE ?

I can see three different values passed to the L_S_RANGE-LOW but only one append statment and thus it is overwritten and only the third value will be passed to L_S_RANGE-LOW.

I have declared Vtype i,fisper i and fisyear i,is this ok?.

But you have only one range (E_T_RANGE). You need 3 different ranges to handle three different types of values.

So depending on the VNAM, you will pass the low, high, sign and option to the work area and append to its respective range.

regards,

Advait