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

* character while looping in an internal table

Former Member
0 Likes
1,027

Hi gurus,

I have a problem. It may be esy but ı couldnt find any solution yet.

I have an internal table. I fill it with some data.

However, while loooping in it, the data con-mes as ****

not data like 9876. What may the problem. Thanks in advance?

My codes like this:

LOOP AT itab_detail INTO ls_detail.

At new CHARG.

IF ( ls_detail-bwart eq '102' or ls_detail-bwart eq '544' ).

ls_detail-menge = ls_detail-menge * ( -1 ).

MODIFY itab_detail FROM ls_detail.

ENDIF.

CLEAR:ld_menge543,ld_menge101.

IF ( ls_detail-bwart eq '101' or ls_detail-bwart eq '102' ).

ld_menge101 = ld_menge101 + itab_detail-menge.

ELSE.

ld_menge543 = ld_menge543 + itab_detail-menge.

ENDIF.

itab_objectdetail-MATNR = ls_detail-matnr.

itab_objectdetail-CHARG = ls_detail-charg.

itab_objectdetail-MENGE101 = ld_menge101.

itab_objectdetail-MENGE543 = ld_menge543.

APPEND itab_objectdetail.

ENDAT.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
990

Hello,

This is a common problem when using loop control statements (AT ... ENDAT).

Copy the work area to a another variable & use the values as needed!

LOOP AT itab_detail INTO ls_detail.

  ls_detail = ls_temp_detail. "Copy to a temporary work area

  AT NEW CHARG.

  ENDAT.
ENDLOOP

BR,

Suhas

7 REPLIES 7
Read only

Former Member
0 Likes
990

Hi,

please have a look at ABP keyword documentation for keyword "AT" in internal tables.

Regards,

Klaus

Read only

former_member404244
Active Contributor
0 Likes
990

Hi,

as you have used control break statement in your code hence you got '*'.. Pass the values from work area to a variable and then pass the variable vale to the internal table.you will get the desired result.

Regards,

Nagaraj

Read only

0 Likes
990

It didnt work. It is still not working, I mean * character comes instead of real value.

Any further ideas??

Read only

0 Likes
990

Hi,

Please paste your code what you have written..

Regards,

Nagaraj

Read only

0 Likes
990

&----


*& Report ZED103

*&

&----


*&

*&

&----


REPORT ZED103.

Data: BEGIN OF itab_detail OCCURS 0,

CHARG LIKE MSEG-CHARG,

MATNR LIKE MSEG-MATNR,

BWART LIKE MSEG-BWART,

MENGE LIKE MSEG-MENGE,

END OF itab_detail.

SELECT CHARG MATNR BWART MENGE FROM ZPP_FASON_TAKIP INTO CORRESPONDING FIELDS OF TABLE

itab_detail where

budat in p_budat and

matnr eq LD_MATNR and

( bwart eq '101' or bwart eq '102' or bwart eq '543' or bwart eq '544' ).

LOOP AT itab_detail INTO ls_detail.

At new CHARG.

IF ( ls_detail-bwart eq '102' or ls_detail-bwart eq '544' ).

ls_detail-menge = ls_detail-menge * ( -1 ).

MODIFY itab_detail FROM ls_detail.

ENDIF.

CLEAR:ld_menge543,ld_menge101.

IF ( ls_detail-bwart eq '101' or ls_detail-bwart eq '102' ).

ld_menge101 = ld_menge101 + itab_detail-menge.

ELSE.

ld_menge543 = ld_menge543 + itab_detail-menge.

ENDIF.

itab_objectdetail-MATNR = ls_detail-matnr.

itab_objectdetail-CHARG = ls_detail-charg.

itab_objectdetail-MENGE101 = ld_menge101.

itab_objectdetail-MENGE543 = ld_menge543.

APPEND itab_objectdetail.

ENDAT.

ENDLOOP.

Read only

0 Likes
990

Hi,

Already Suhas has given the reply.. try the code wht suhas suggested. it will work.

Regards,

Nagaraj

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
991

Hello,

This is a common problem when using loop control statements (AT ... ENDAT).

Copy the work area to a another variable & use the values as needed!

LOOP AT itab_detail INTO ls_detail.

  ls_detail = ls_temp_detail. "Copy to a temporary work area

  AT NEW CHARG.

  ENDAT.
ENDLOOP

BR,

Suhas