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

report

Former Member
0 Likes
498

hi experts

plse help to get the text in the output.

-


sort i_tab by matnr.

loop at i_tab into wa_tab.

at new matnr.

write:/05 wa_tab-matnr,

25 wa_tab-maktx.

endat.

endloop.

-


i got output like this

matnr: 0000000255

maktx: ****************

-


in the internal table there is a data for material and its description but with in the 'at new ' statement description is converterd to ' all stars'. plse help me to display the data asit is in the internal table to the list.

with regards

serma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
477

Hi Madhu,

create a temporary variable v_maktx.

data : v_maktx like makt-maktx.

sort i_tab by matnr.

loop at i_tab into wa_tab.

v_maktx = wa_tab-maktx.

at new matnr.

write:/05 wa_tab-matnr,

25 v_maktx.

endat.

endloop.

5 REPLIES 5
Read only

Former Member
0 Likes
477

hi,

try

on change of matnr.

endon.

Read only

Former Member
0 Likes
477

Hi,

If you use at new Fieldname remainning fields will always have ****.

Please refer to the SAP docu below :

Variant 1

AT NEW f.

Variant 2

AT END OF f.

Effect

f is a sub-field of an internal table or extract dataset (EXTRACT) which is being processed with LOOP, i.e. the variants 1 and 2 only make sense within a LOOP.

Both "AT NEW f." and "AT END OF f. " introduce processing blocks which are concluded by " ENDAT.".

These processing blocks are processed whenever the contents of a field f or a sub-field defined before f change as a result of processing with LOOP. "AT NEW f." begins a new group of (table) lines with the same contents as the field f while "AT END OF f." concludes such a group.

Within the AT ... ENDAT processing of internal tables, all argument fields following f are filled with "*".

Examples

1. AT for sub-fields of an internal table

DATA: BEGIN OF COMPANIES OCCURS 20,

NAME(30),

PRODUCT(20),

SALES TYPE I,

END OF COMPANIES.

...

LOOP AT COMPANIES.

AT NEW NAME.

NEW-PAGE.

WRITE / COMPANIES-NAME.

ENDAT.

WRITE: / COMPANIES-PRODUCT, COMPANIES-SALES.

AT END OF NAME.

SUM.

WRITE: / COMPANIES-NAME, COMPANIES-SALES.

ENDAT.

ENDLOOP.

The AT statements refer to the field COMPANIES-NAME.

Examples

2. AT for the field of an extract dataset

DATA: NAME(30),

SALES TYPE I.

FIELD-GROUPS: HEADER, INFOS.

INSERT: NAME INTO HEADER,

SALES INTO INFOS.

...

LOOP.

AT NEW NAME.

NEW-PAGE.

ENDAT.

...

AT END OF NAME.

WRITE: / NAME, SUM(SALES).

ENDAT.

ENDLOOP.

Notes

If the processing you want to perform on an internal table is fairly restricted (i.e. a WHERE addition with the LOOP statement), do not use the AT statements specified in variants 1 to 5, since the interaction of the WHERE addition and the AT statement is currently not defined.

When you use LOOP with an extract dataset, fields on hex zero are ignored during control level checking with AT NEW or AT END OF . This procedure is the same as the SORT statement. When sorting extracted datasets, this statement always sorts blank fields (i.e. fields on hex zero) regardless of the sequence (ascending or descending) before all fields that contain values.

Since fields addressed with AT are not set to an initial value when you enter a LOOP, the first new group of (table) lines in AT NEW f may not be processed, if f happens to be set to this value.

Thanks,

Sri.

Read only

Former Member
0 Likes
478

Hi Madhu,

create a temporary variable v_maktx.

data : v_maktx like makt-maktx.

sort i_tab by matnr.

loop at i_tab into wa_tab.

v_maktx = wa_tab-maktx.

at new matnr.

write:/05 wa_tab-matnr,

25 v_maktx.

endat.

endloop.

Read only

RoySayak
Active Participant
0 Likes
477

Hi,

I'm sure that your i_tab doesnot contain the value of maktx. check it properly.

Thnaks

SAYAK

Read only

Former Member
0 Likes
477

Hi

I got also same problem, then i followed like this.

LOOP AT i_analysis INTO wa_analytot.

AT NEW kunnr.

SUM.

READ TABLE i_analysis INTO wa_analysis WITH KEY

kunnr = wa_analytot-kunnr

BINARY SEARCH.

wa_analytot-name1 = wa_analysis-name1. (text)

APPEND wa_analytot TO i_analytot.

ENDAT.

ENDLOOP.