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 loop in unicode

Former Member
0 Likes
1,082

Hi All,

Thanks for this great helpful website!

I have following code...this used to work under non unicode system...now since we are upgrading to unicode system...it is giving us error... any thoughts or guidance would be greatly appreciated.

Thanks in advanced....

DATA: BEGIN OF i0041,

date_type LIKE p0041-dar01,

date LIKE p0041-dat01,

END OF i0041.

.

.

DO 12 TIMES VARYING i0041 FROM p0041-dar01

NEXT p0041-dar02.

.

.

Error I get is as follows:

"P0041-DAR01" and "I0041" are type-incompatible.

5 REPLIES 5
Read only

Former Member
0 Likes
718

Please check in the below link:

Reward all the helpful answsers

Thanks

Murali

Read only

Former Member
0 Likes
718

Check this out -

DO - varying

Syntax

DO ... VARYING dobj FROM dobj1 NEXT dobj2 [RANGE range].

[statement_block]

ENDDO.

Effect

: The addition VARYING assigns a new value to a variable dobj for each run of a DO loop. It can be used more than once in a DO statement.

dobj1 and dobj2 are the first two data objects in a sequence of data objects that are the same distance apart in the memory. The data types of the data objects dobj, dobj1, and dobj2 must be flat.

<b>In Unicode programs, dobj, dobj1, and dobj2 must be compatible. Also in Unicode programs, dobj1 and dobj2 must either be structure components that belong to the same structure, or subareas of the same data object specified by offset/length specifications. </b>

In the first completion of the loop, the content of the data object dobj1 is assigned to dobj, and in the second loop, the content of the data object dobj2 is assigned. In the subsequent loops, dobj is assigned the content of the data object that is the same distance in the memory from the previously assigned data object, as dobj2 is from dobj1. There is no type conversion.

Hope above explanation helps.

Please reward points if helpful.

Read only

Former Member
0 Likes
718

Hi J Are,

Can you show us the declaration of p0041 in your program?

Regards,

VIvek

Read only

0 Likes
718

Hello all,

thanks for the answers...I used field symbols to solve this error...thanks.

Read only

0 Likes
718

Hi J,

I'm facing the same issue and would like to see how you used field symbols to solve your problem. I haven't used them that much and I'm interested in seeing how you did.