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

error during a loop pass

Former Member
0 Likes
1,535

Hello Experts,

This is my code

loop at gt_all_nodes INTO WA_ALL_NODES.

SHIFT wa_all_nodes-parent_id LEFT DELETING LEADING ' '.

READ TABLE PT_NVALS INDEX 1.

if WA_all_nodes-parent_id GE PT_NVALS-ID.

(

CODE

)

ELSE

EXIT.

The problem which I am facing is as suppose the value of pt_nvals-id is 36, then as soon as the value wa_all_nodes-parent_id is becomes more than 2 digits like 100 or more, even though it is fulfilling the criteria it exits the loop. The loop is working fine for 2 digits value.

I am clearing all the work areas, the data type of wa_all_nodes-parent_id and pt_nvals-id is the same. but still the problem is not getting solved.I am not able to find out where the problem is?

Thanx in advance

17 REPLIES 17
Read only

Former Member
0 Likes
1,502

Hello,

Give one example with values.

Read only

0 Likes
1,502

loop at gt_all_nodes INTO WA_ALL_NODES.

SHIFT wa_all_nodes-parent_id LEFT DELETING LEADING ' '.

READ TABLE PT_NVALS INDEX 1.

if WA_all_nodes-parent_id GE PT_NVALS-ID.

(

CODE

)

ELSE

EXIT.

The value of pt_nvals-id is 36 and the value of wa_all_nodes-parent_id is 103.

This condition should ideally be true but in the loop pass it is failing the condition and exiting the loop.

Read only

Former Member
0 Likes
1,502

I am not too sure whether this will help u or not , but still u can try.

Use the condense statement before the if statement.

condense WA_all_nodes-parent_id.

condense PT_NVALS-ID.

Regards

Sam.

Read only

0 Likes
1,502

yaar priya try once again ..

Read only

0 Likes
1,502

>

> yaar priya try once again ..

Nice Cheering

Regards

Karthik D

Read only

0 Likes
1,502

I have tried soo many times..without any results ;(

Read only

Former Member
0 Likes
1,502

Hi Priya,

I would just like to add on .

Check your DATA TYPE for the field ID.

If it CHAR then try using

CONDENSE <the fields > no-gaps.

After using SHIFT its always good to use CONDENSE.

Regards,

SuryaKiran

Read only

0 Likes
1,502

oh priya ..

sorry yaar i'm fuctional cosultant ...

but give me some time for discuss with my ABAP team here ..

if any solution i'll forrward to u very soon..

Read only

0 Likes
1,502

Thanx that will be very kind of you.

Read only

0 Likes
1,502

my plesure

Read only

0 Likes
1,502

>

> my plesure

I hope this is not a chat forum, rather you can ask your ABAPER to reply to this question

Regards

Karthik D

Read only

0 Likes
1,502

put break-point on if WA_all_nodes-parent_id GE PT_NVALS-ID.

check the value of WA_all_nodes-parent_id and pt_nvals-id

at runtime..

thanks

Punit Singh

Read only

0 Likes
1,502

put break-point on if WA_all_nodes-parent_id GE PT_NVALS-ID.

check the value of WA_all_nodes-parent_id and pt_nvals-id

at runtime..

in case of 3 digit...

Read only

0 Likes
1,502

I have already done that as soon as the value reaches 3 digits, it exits the loop

Read only

0 Likes
1,502

check the data type of both..

parent_id and id..

after this ..make shift stmt comment..

Read only

0 Likes
1,502

then again check..with break-point..

Read only

Former Member
0 Likes
1,502

loop at gt_all_nodes INTO WA_ALL_NODES.

*SHIFT wa_all_nodes-parent_id LEFT DELETING LEADING ' '.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = wa_all_nodes-parent_id

IMPORTING

OUTPUT = wa_all_nodes-parent_id.

READ TABLE PT_NVALS INDEX 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = PT_NVALS-ID

IMPORTING

OUTPUT = PT_NVALS-ID .

if WA_all_nodes-parent_id GE PT_NVALS-ID.

(

CODE

)

ELSE

EXIT.