Application Development 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: 

AT New or AT end of

radhushankar
Participant
0 Kudos

Hi All,

Here is my table entries :

Internal table 1.

Infnr Text 100 test1 100 test2 100 test3 101 test4 102 test5 I need to update tthe text throught create_text. I have consolidate the text for common infnr and i need to post. Can any one please let me know whether AT New or AT End of will do my requirement. Appreciate ur inputs. Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

try this:

data: consolidated_text type string.

loop at it.

concatenate consolidated_text it-text

into consolidated_text.

at end of Infnr.

create_text with consolidated_text

clear consolidated_text.

endat.

endloop.

10 REPLIES 10

Former Member
0 Kudos

try this:

data: consolidated_text type string.

loop at it.

concatenate consolidated_text it-text

into consolidated_text.

at end of Infnr.

create_text with consolidated_text

clear consolidated_text.

endat.

endloop.

0 Kudos

Hi

Thanks for your inputs.

When i checked it in debugger i am getting value in text like this *******************************

Any suggestions plz..

Thanks

0 Kudos

>

> When i checked it in debugger i am getting value in text like this *******************************

>

Hi,

When you use the control break statements like AT NEW, AT END OF , AT FIRST etc..

It is a standard behavior of ABAP that it puts '*' to all the fields that are on the right hand side of the field that you mentioned in the control break statment.

To overcome this , you will have to copy the contents of the work area to an auxilary work area and then process your data as you want.



loop at itab into wa

wa_aux = wa.

at new field.
 " Here you concatenate the fields from wa_aux to the string.
endat.

endloop.

Hope this helps.

regards,

Advait

0 Kudos

This message was moderated.

0 Kudos

Hi rahul,

Simply use the above code but instead of doing the processing in AT END so the same outside ,simply use the fla that is set in the AT END and clear in the AT NEW.

data: consolidated_text type string.

loop at it.

concatenate consolidated_text it-text
into consolidated_text.

at end of Infnr.
create_text with consolidated_text
clear consolidated_text.
endat.

endloop.

just add the below code in this :

DATA : l_flag type i default 0.

AT NEW ifnr.
l_flag = 0.
clear consolidate_text."clear the text here 
endat.
"do same processing of concatenate ect. 

AT END infnr.
l_flag =1.
endat.

if l_flag = 1.
"do the create_text processing here 
endif.

Now you'll able to get the data in the string.

Pooja

Edited by: Pooja Gupta on Feb 18, 2009 10:58 AM

0 Kudos

Its standard behaviour of ABAP. My suggestion is, maintain a loop counter and inside AT NEW, read internal table with this loop counter so that your internal table headr has latest value.

LOOP AT ITAB.

loop_counter = loop_counter + 1.

AT NEW.

read table ITAB index loop_counter. """Now your header will not have *********

****Do whatever is your requirement.

ENDAT.

ENDLOOP.

Hope this helps!!!

Ramesh.

Former Member
0 Kudos

Hi,

I think AT NEW will help you print text instead of asterixs.

Thanx,

Pritha.

sagarmehta
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Radhu,

Try this...

DATA: create_text type string.

LOOP AT itab INTO wa.
  AT NEW infnr.		  "Every time a new Infnr comes
    WRITE: / create_text. "Display the concatenated texts
    ULINE.
    clear create_text.    "clear it for the next set of Infnr
  ENDAT.

  CONCATENATE create_text ', ' sflight_wa-connid into create_text.  "concatenate the texts

  AT LAST.		  "Display for the last one
    WRITE: / create_text.
    ULINE.
    clear create_text.
  ENDAT.
ENDLOOP.

Hope this was of some help,

Best Regards,

Sagar.

Former Member
0 Kudos

hi,

Use of

ON CHANGE OF <data_obj>
 ----
 ENDON

would also suffice your requirement.

Thanks

Sharath

radhushankar
Participant
0 Kudos

Thanks