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

problem with at statement

Former Member
0 Likes
650

hi,

i have this codes below,

SORT i_employee1 BY carrid.

CLEAR wa_employee1.

LOOP AT i_employee1 INTO wa_employee1.

AT NEW carrid.

WRITE: / wa_employee1-carrid,

wa_employee1-connid,

wa_employee1-countryfr.

ENDAT.

endloop.

only carrid display... the rest are asterisks(*)...

why is that so considering that i already put the entry into work area...

thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
629

As these are control break statements and these will perform the aggregation on the fields, so asterik(*) is appearing for the character & numeric fields.

Put the carrid at the last or.

Before using the control break statement, transfer the entire data into temp internal table and use that table like

SORT i_employee1 BY carrid.

i_employee_temp[] = i_employee1.

CLEAR wa_employee1.

LOOP AT i_employee1 INTO wa_employee1.

AT NEW carrid.

read table i_employee_temp into wa_employee_temp with key carrid = wa_employee1-carrid.

if sy-subrc eq 0.

WRITE: / wa_employee_temp-carrid,

wa_employee_temp-connid,

wa_employee_temp-countryfr.

endif.

ENDAT.

clear:wa_employee_temp.

endloop.

Regards

Kannaiah

5 REPLIES 5
Read only

Former Member
0 Likes
629

Hi,

Display carrid as the last column.

Regards,

Subramanina

Read only

Former Member
0 Likes
629

i hope .. at new should be like this...then it is possible

at new wa_employee1-carrid.

Read only

Former Member
0 Likes
630

As these are control break statements and these will perform the aggregation on the fields, so asterik(*) is appearing for the character & numeric fields.

Put the carrid at the last or.

Before using the control break statement, transfer the entire data into temp internal table and use that table like

SORT i_employee1 BY carrid.

i_employee_temp[] = i_employee1.

CLEAR wa_employee1.

LOOP AT i_employee1 INTO wa_employee1.

AT NEW carrid.

read table i_employee_temp into wa_employee_temp with key carrid = wa_employee1-carrid.

if sy-subrc eq 0.

WRITE: / wa_employee_temp-carrid,

wa_employee_temp-connid,

wa_employee_temp-countryfr.

endif.

ENDAT.

clear:wa_employee_temp.

endloop.

Regards

Kannaiah

Read only

Former Member
0 Likes
629

Kannaiah's explanation is spot on.

Slightly different way :

SORT i_employee1 BY carrid.
CLEAR wa_employee1.
LOOP AT i_employee1 INTO wa_employee1.

AT NEW carrid.
read table i_employee1 into wa_employee1 index sy-tabix.
if sy-subrc = 0.
WRITE: / wa_employee1-carrid,
wa_employee1-connid,
wa_employee1-countryfr.
endif.
ENDAT.
endloop.

Read only

Former Member
0 Likes
629

HI

Just make sure that field carrid is first field of the internal table i_employee1.

At statment works with only the first field of an internal table.

This will solve your problem.

Reward points if helful.

Regards

Bikas