cancel
Showing results for 
Search instead for 
Did you mean: 

How to append an itab into xth_data

Former Member
0 Kudos

Hi All,

I am implementing an exit function in BPS for copy function. I have all the copied data correctly in an internal table itab. Now at the end of the program I want to insert/append all the records to xth_data. I don't want to loop over itab and then append it to xth_data because it is taking a lot of time. This is happening because of large number of data in the itab.

Using loop theoretically it is possible,

loop at itab into wa.

collect wa into xth_data.

endloop.

This is working fine but taking too much time (30min around) for just this loop. The structure of wa is or itab is same as xth_data.

Please note that I can not use,

append lines of itab to xth_data because xth_data is of type hashed table in Exit Functions.

Please suggest me some alternative statement where I don't need to loop over entire itab and still able to append the records to xth_data.

Thanks in advance,

Shiwesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Shiwesh,

please take a look at section Appending Several Lines at the following link

[http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb36c8358411d1829f0000e829fbfe/content.htm]

bye Matthias

Answers (2)

Answers (2)

Former Member
0 Kudos

... or if you prefer the insert statement ...

[http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb361f358411d1829f0000e829fbfe/content.htm]

Former Member
0 Kudos

Hi Shiweesh,

Firstly,i suggest you to clear Xth data after copying Xth data to any internal table,then get the size(no of records) of the internal table with a Describe Statement, and then insert the extra records by index with Insert statement as mentioned below,atlast copy from internal table to Xth data.

1) Copy data from Xth data to Internal table

it_table = xth_data[].

2)get num of records from internal table

Describe table it_table into w_cnt

3) Insert the new records by index

insert wa_table into it_table index w_cnt.

4) Refresh XTH_data.

5) xth_data = it_table[].

All the best !!!