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

internal table with work area

Former Member
0 Likes
925

hi all,

data: BEGIN OF it_summ OCCURS 0.

INCLUDE STRUCTURE yapn_summary.

data: END OF it_summ.

data : wa_demo1 type yapn_summary.

clear wa_demo1.

wa_demo1-sumr = 'hai'.

append wa_Demo1 to it_summ.

WRITE: it_summ-sumr.

its not get output..

i want to display for hai using it_summ.

donot use work area.

how to change it.?

reply me soon,

s.suresh.

hi all,

data: BEGIN OF it_summ OCCURS 0.

INCLUDE STRUCTURE yapn_summary.

data: END OF it_summ.

data : wa_demo1 type yapn_summary.

clear wa_demo1.

wa_demo1-sumr = 'hai'.

append wa_Demo1 to it_summ.

WRITE: it_summ-sumr.

its not get output..

i want to display for hai using it_summ.

donot use work area.

how to change it.?

reply me soon,

s.suresh.

6 REPLIES 6
Read only

matt
Active Contributor
0 Likes
903

You can't write out an internal table - you can only write out a line (or components of a line) of an internal table. So you MUST use a work area. If you use OCCURS 0 then you've a table with a headerline, and so don't need a workarea. However, later versions of ABAP discourage tables with headerline, and it is preferred to define a specific work area. So, either:

data: BEGIN OF it_summ OCCURS 0.
INCLUDE STRUCTURE yapn_summary.
data: END OF it_summ.

clear it_summ.
it_summ-sumr = 'hai'.

append wa_Demo1 to it_summ.

LOOP AT it_summ.
  WRITE: it_summ-sumr.
ENDLOOP.

Now, you see here that at some points it_summ refers to the table, and at others to the header-line. This is ambiguous, and therefore BAD. It's better to define the table and work area seperately.

data: it_summ TYPE STANDARD TABLE OF yapn_summary WITH NON-UNIQUE KEY table_line.

data : wa_demo1 type yapn_summary.

clear wa_demo1.
wa_demo1-sumr = 'hai'.

append wa_Demo1 to it_summ.

LOOP AT it_summ INTO wa_demo1.
  WRITE: wa_demo1-sumr.
ENDLOOP. 

matt

Read only

Former Member
0 Likes
903

Hi,

inorder to get data in the internal table u have to loop the\at table write like this.

loop at it_summ.

WRITE: it_summ-sumr.

endloop.

if u have any further query u can contact me on [email protected]

Read only

Former Member
0 Likes
903

Hi

if u want to get the data using internal table then u should use itab only dont use workarea.

it_demo1-sumr = 'hai'.

append it_summ.

WRITE: it_summ-sumr.

in u r program u have 2 use

WRITE: wa_summ-sumr, 2 get the output.

Read only

Former Member
0 Likes
903

Hi,

Internal table with OCCURS and HEADER-LINE are not supported in the latest versions, those are obsolete. :

ans to your query:

data: BEGIN OF it_summ OCCURS 0.

INCLUDE STRUCTURE yapn_summary.

data: END OF it_summ.

it_summ[]-sumr = 'hai'.

append it_summ[].

WRITE: it_summ-sumr.

regards,

Renjith Michael.

http://www.sourceveda.com/

Read only

Former Member
0 Likes
903

data: BEGIN OF it_summ OCCURS 0.

INCLUDE STRUCTURE yapn_summary.

data: END OF it_summ.

data : wa_demo1 type yapn_summary.

clear wa_demo1.

wa_demo1-sumr = 'hai'.

append wa_Demo1 to it_summ.

LOOP at it_summ.

WRITE:/ it_summ-sumr.

ENDLOOP.

Read only

Former Member
0 Likes
903

Hi Suresh,

If you don't want to use work area to display your output, you can look into the following code :

DATA: BEGIN OF it_summ OCCURS 0.

INCLUDE STRUCTURE yapn_summary.

DATA: END OF it_summ.

it_summ-sumr = 'hai'.

APPEND it_summ.

LOOP AT it_summ.

WRITE:/ it_summ-sumr.

ENDLOOP.

Here, it_summ is an internal table with header line.Using this,you can ignore the use of work area.

Note: Declaring internal tables using header line or OCCURS is now obsolete.

Regards,

Kaveri.