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 with Loop....endloop.

Former Member
0 Likes
901

Hello all i have an internal table. If i am not looping it it is doign everything fine. However if i am looping it i dont see any results.

I guess it a small error but unable to figure it.

here is the code without loop.

data : i_output_details like ZSD_INQUIRY_OUTPUT_DETAILS occurs 0

with header line.

data : i_errors like ZSD_INQUIRY_ERRORS occurs 0 with header line.

*Output Results

i_output_details-CHARGE_TYPE = ' '.

i_errors-ERROR_MESSAGE = 'ERROR'.

if i_output_details-CHARGE_TYPE = ' '.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = i_errors-ERROR_MESSAGE

TXT1 = 'error'

TXT2 = 'error'

  • TXT3 = ' '

  • TXT4 = ' '

.

else.

write 😕 'hello'.

endif.

HERE IS THE CODE WITH PROBLEM AFTER I HAVE LOOP.... ENDLOOP.

data : i_output_details like ZSD_INQUIRY_OUTPUT_DETAILS occurs 0

with header line.

data : i_errors like ZSD_INQUIRY_ERRORS occurs 0 with header line.

*Output Results

i_output_details-CHARGE_TYPE = ' '.

i_errors-ERROR_MESSAGE = 'ERROR'.

Loop at i_output_details.

if i_output_details-CHARGE_TYPE = ' '.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = i_errors-ERROR_MESSAGE

TXT1 = 'error'

TXT2 = 'error'

  • TXT3 = ' '

  • TXT4 = ' '

.

else.

write 😕 'hello'.

endif.

endloop.

Thanks ,

Shejal.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
863

Hi,

Check if there is data in the table.

or

if i_output_details-CHARGE_TYPE = ' '

do it like this

if i_output_details-CHARGE_TYPE is initial.

8 REPLIES 8
Read only

Former Member
0 Likes
863

hi shejal,

u did not write <b>append i_output_details</b> and u are looping onto the table.

<b>i_output_details-CHARGE_TYPE = ' '.

append i_output_details.</b>hope this helps,

do reward if it helps,

priya.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
863

You internal table contains no data, only the header line of the itab contains data. You must APPEND to your itab before LOOPing at it.

i_output_details-CHARGE_TYPE = ' '.
append i_output_details.

Regards,

Rich Heilman

Read only

0 Likes
863

hi,

append i_output_details. is missing after i_output_details-CHARGE_TYPE = ' '...

i.e, i_output_details-CHARGE_TYPE = ' '

append i_output_details.

by this data is not getting populated in to your internal table.

Regards,

santosh

Read only

Former Member
0 Likes
864

Hi,

Check if there is data in the table.

or

if i_output_details-CHARGE_TYPE = ' '

do it like this

if i_output_details-CHARGE_TYPE is initial.

Read only

0 Likes
863

Thanks Guys Problem is solved.

Shejal.

Read only

0 Likes
863

hi shejal,

did u check my reply.

Read only

0 Likes
863

Hi Priya,

I did check your reply and it helped. My problem is solved. Thanks Priya for your reply.

Shejal.

Read only

Former Member
0 Likes
863

hi,

you need to use <b>append i_output_details.

clear i_output_details.</b>

regards

vijay