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

Do varying issue in unicode programs(ECC6.0)

former_member223446
Active Participant
0 Likes
678

Hi,

I am facing the error "Could not specify the range automatically. This means you need a RANGE addition." for the following code.

DATA : W_STRAT_LANC1 LIKE T16FD-FRGCT, "stratégie de lancement 1 +DJA

W_STRAT_LANC2 LIKE T16FD-FRGCT

DO 3 TIMES

VARYING T16FS-FRGCX FROM T16FS-FRGC1 NEXT T16FS-FRGC2 RANGE T16FS

VARYING W_STRAT_LANCX FROM W_STRAT_LANC1 NEXT W_STRAT_LANC2.

Please send me a possible solution.

I have gone through many posts but this is a new issue.

2 REPLIES 2
Read only

Former Member
0 Likes
484

Hi,

This is not a correct way of using the varying addition. Your fields should belong to the same structure...

something like:


TYPES: BEGIN OF ts_lanc,
         lanc1 TYPE frgct,
         lanc2 TYPE frgct,
        END OF ts_lanc.

DATA: w_strat_lancx TYPE t16fd-frgct,
      w_t16fs-frgcx TYPE t16fs-frgsx.

DATA: ws_t16fs TYPE t16fs,
      ws_lanc  TYPE ts_lanc.

DO 3 TIMES
   VARYING w_t16fs-frgcx FROM ws_t16fs-frgc1 NEXT ws_t16fs-frgc2 RANGE ws_t16fs
   VARYING w_strat_lancx FROM ws_lanc-lanc1  NEXT ws_lanc-lanc2  RANGE ws_lanc.
   "...
ENDDO.

Kr,

Manu.

Read only

Former Member
0 Likes
484

You should have been using DO VARYING only for structures, and I'm seeing that W_STRAT_LANC1, W_STRAT_LANC2 and W_STRAT_LANCX are fields. I think that's why it is not working.

Try the following:


TYPES: BEGIN OF TY_STRAT,
  LANC1 TYPE char10 ,
  LANC2 TYPE char10,
  LANC3 TYPE char10,
END OF TY_STRAT.

DATA: wa_strat TYPE ty_strat.

DATA lancx TYPE char10.


DO 3 TIMES
VARYING lancx FROM wa_strat-lanc1 NEXT wa_strat-lanc2.

ENDDO.

Regards,

Mauricio