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

AT NEW usage.

former_member216668
Participant
0 Likes
481

Hi Gurus,

I have an internal table i_final2 with values Country, brand, pack and curr pri. I need to extract only the first value for any country and put iti n another internal table i_final2. I used AT NEW statment and wrote the following code.

loop AT i_temp INTO w_temp.
              MOVE w_temp-country TO w_final1-country.
              MOVE w_temp-brand TO w_final1-brand.
              MOVE w_temp-pack TO w_final1-pack.
              MOVE w_temp-curr_pri  TO w_final1-curr_pri.
             APPEND w_final1 TO i_final1.
         endloop.
        IF i_final1 IS NOT INITIAL.
          Loop AT i_final1 INTO w_final1.
            AT NEW country.
              APPEND w_final1 TO i_final2.
              CLEAR w_final1.
            ENDAT.
          endloop.
        ENDIF.

But in the output i get the country code properly , where as the other values appear as astericks like *****, *******, etc. Can anyone help me in the regard?

Thanks & Regards.

1 ACCEPTED SOLUTION
Read only

former_member491305
Active Contributor
0 Likes
457

Hi,

Between Control Block statement,all the fields next to the field used in control break statement will be like * only .

So you just move the value of the remaining fiedls just above the AT new statemnt.

data:w_final2 like w_final1.

Loop AT i_final1 INTO w_final1.

w_final2 = w_final1.

AT NEW country.

APPEND w_final2 TO i_final2.

CLEAR w_final2.

ENDAT.

Endloop.

Edited by: Vigneswaran S on Jun 2, 2008 6:33 AM

3 REPLIES 3
Read only

Former Member
0 Likes
457

hi,

jus read the internal table after AT NEW.

SORT I_FINAL1 BY COUNTRY.
Loop AT i_final1 INTO w_final1.
            AT NEW country.
             READ TABLE I_FINAL1...

now u'll get the values right! Sort the internal table before using control break statements.

regards,

madhu

Read only

former_member491305
Active Contributor
0 Likes
458

Hi,

Between Control Block statement,all the fields next to the field used in control break statement will be like * only .

So you just move the value of the remaining fiedls just above the AT new statemnt.

data:w_final2 like w_final1.

Loop AT i_final1 INTO w_final1.

w_final2 = w_final1.

AT NEW country.

APPEND w_final2 TO i_final2.

CLEAR w_final2.

ENDAT.

Endloop.

Edited by: Vigneswaran S on Jun 2, 2008 6:33 AM

Read only

0 Likes
457

Thanks Vignesh,

It worked like a beauty!!!