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: 

Internal table with header line

Former Member
0 Kudos

Hi,

If i use internal table with header line, do i need to append the internal table before I read it? Thanks!

1 ACCEPTED SOLUTION

prabhu_s2
Active Contributor
0 Kudos

yes using append u can fill the internal table to read the records or process the internal table. woitout any data put in the internal table u cannot process it

12 REPLIES 12

prabhu_s2
Active Contributor
0 Kudos

yes using append u can fill the internal table to read the records or process the internal table. woitout any data put in the internal table u cannot process it

Former Member
0 Kudos

I use the below codes. When I debug, i_messages from the FM has value but it stays in the header line. when I read table i_messages, the sy-subrc = 4 though it has value. so is it really necessary to append i_messages b4 i read it?Thanks!

CALL FUNCTION 'BAPI_PROCORD_CREATE'

EXPORTING

orderdata = x_orderdata

IMPORTING

return = i_messages

order_number = v_orderno.

READ TABLE i_messages INTO i_messages2 WITH KEY type = c_error.

IF sy-subrc EQ 0.

READ TABLE i_messages2 INDEX 1.

IF sy-subrc EQ 0.

MESSAGE i000 WITH i_messages2-message.

ENDIF.

LEAVE TO SCREEN 0.

ENDIF.

Former Member
0 Kudos

Hi,

No not required.

Regards

rose

Former Member
0 Kudos

Hi,

Can you please re-phrase the question?

Regards,

Kiran

Former Member
0 Kudos

Hi

yes you can append

Former Member
0 Kudos

hi,

Internal Tables With Header Line

You access internal tables record by record. You must use a work area as an interface for transferring data to and from the table.

When you read data from an internal table, the contents of a specified table record or line overwrites the contents of the work area. Then, you can reference the contents of the work area in your program. When you write data to an internal table, you must first enter the data in the work area from with the system can transfer the data to the internal table.

To avoid inconsistencies, it is beneficial if the work area has the same data type as the records or lines of the internal table. A safe procedure for creating work areas which are compatible with internal tables is to use the same data type for declaring both the internal table and the work area.

In ABAP/4, you can distinguish between two kinds of internal tables:

To avoid inconsistencies, it is beneficial if the work area has the same data type as the records or lines of the internal table. A safe procedure for creating work areas which are compatible with internal tables is to use the same data type for declaring both the internal table and the work area.

In ABAP/4, you can distinguish between two kinds of internal tables:

Hope this answers, Do reward.

Former Member
0 Kudos

HI

yes, u need to append or fill the internal table before using read.

Former Member
0 Kudos

Hi,

Yes.

The header line is supposed to be appended to the internal table.

data : itab like table of spfli with header line.

itab-field1 = 'XX'.

itab-field2 = 'XXXX'.

append itab.

itab-field1 = 'XX'.

itab-field2 = 'XXXX'.

append itab.

itab-field1 = 'XX'.

itab-field2 = 'XXXX'.

append itab.

Regards,

Priyanka.

Former Member
0 Kudos

hi,

yes u need to append or fill the internal table before you read it

Former Member
0 Kudos

Hi,

Yes, your understaing is correct.

Thanks,

Sriram Ponna.

gopi_narendra
Active Contributor
0 Kudos

Hi Mark,

Did you mean that the record is still in the HEADER LINE, but not in internal table.

In that case YES, you need to append the record first to the internal table and then only you can read the record.

Regards

Gopi

Former Member
0 Kudos

In this case , yes you need to append it before reading the table contents.But as far as the FM goes, the parameter return is just a strucuture, so you can declare i_messages as a structure rather than an internal table and access the data directly (without the need of "appending" and using "read table" statement).Hope you got what i am trying to tell

Regards,

Kiran

Edited by: Kiran NN on Mar 11, 2008 8:21 AM