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

How to Format Dynamic internal table

Former Member
0 Likes
719

In Dynamic internal table having 20 fields how can we format this.

can any body have idea how to process through control break statements like(AT LAST SUM, AT NEW etc).

And how to give coloumn heading etc......

8 REPLIES 8
Read only

Vinod_Chandran
Active Contributor
0 Likes
693

Try to use field symbols.

LOOP AT ITAB INTO <FLD_SYM>.

Read only

0 Likes
693

Hi

I am already using field symbols.

here is my code.....

LOOP AT <FS_1> INTO <FS_2> .

DO.

ASSIGN COMPONENT sy-index OF STRUCTURE <FS_2> TO <field>.

IF sy-subrc = 0.

WRITE <field>.

else.

exit.

ENDIF.

ENDDO.

new-line.

ENDLOOP.

Now i want to do some additions while showing output.

Like i want to use AT LAST.

SUM.

END AT.

I have more than 20 fields in my Dynamic table.

And i want to use ...

AT NEW BUKRS...

SUM.

ENDAT.

so please suggest some code regarding this.

Thanking you,

Deepak.

Read only

0 Likes
693

Hi,

If u want to use AT LAST or AT NEW fieldname, then that fieldname should be the first field in the table u defined or it wont work.

Thanks & Regards,

Judith.

Read only

0 Likes
693

BUKRS is my first field.

RACCt is my second field.

remaining all are TLSVT(Amount type) now i must add these amounts....

Thanking you,

Deepak.

Read only

andreas_mann3
Active Contributor
0 Likes
693

Hi,

try that

  field_name = 'BUKRS'.
  ASSIGN COMPONENT  field_name  OF STRUCTURE <dyn_wa> TO <f>.
..
  field_name = 'DMBTR'.
  ASSIGN COMPONENT  field_name  OF STRUCTURE <dyn_wa> TO <sum>.

...

  AT END OF <f>.
    SUM.
    uline.skip.
    WRITE: / <sum>.
  ENDAT.

regards Andreas

Read only

0 Likes
693

Hi Andreas,

In side loop SUM is not working.

Read only

0 Likes
693

Hi Deepak,

try sth like that:

AT...
sum.
dO.
ASSIGN COMPONENT sy-index OF STRUCTURE <FS_2> TO <field>.
IF sy-subrc = 0 
if sy-index > 2."values after position 2
WRITE <field>.
endif.
else.
Exit.
Endif.
enddo.
...
  ENDAT.

pls reward points when answers are useful

thanks and regards Andreas

Read only

0 Likes
693

Hi Andreas,

In-side LOOP SUM ia not accepting.

Is there any other possibility.

Thanks,

Deepak.