Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Append line within if in bw user exit

$
0
0

Hi experts,

 

I am coding a BW User Exit for a extractor in the framework of function module EXIT_SAPLRSAP_001, include ZXRSAU01.

My code is retriveing the values that i need. But i am stuck with one thing.

 

In the context of an if, i have to append a new line.

 

Here my complete code:

 

TABLES: prps, catsdb.

 CASE i_datasource.

WHEN 'TEST_EXTRACTOR'.

     DATA:      s_data_cats TYPE zoxd780009,                it_data TYPE STANDARD TABLE OF zoxd780009,                wa_hours TYPE catshours,                it_prps TYPE STANDARD TABLE OF prps INITIAL SIZE 0,                wa_prps TYPE prps,                it_catsdb TYPE STANDARD TABLE OF catsdb INITIAL SIZE 0,                wa_catsdb TYPE catsdb,                wa_catsdb2 TYPE catsdb.     REFRESH it_data.     it_data[] = c_t_data[].     SELECT * FROM prps INTO table it_prps FOR ALL ENTRIES IN it_data     WHERE pspnr = it_data-rproj.     SELECT * FROM catsdb INTO table it_catsdb FOR ALL ENTRIES IN it_data     WHERE counter = it_data-refcounter.     LOOP AT c_t_data INTO s_data_cats.
 *     Get WBS Element POSID.       READ TABLE it_prps into wa_prps with key pspnr = s_data_cats-rproj BINARY SEARCH..       if sy-subrc = 0.         s_data_cats-posid = wa_prps-posid.         IF s_data_cats-refcounter IS NOT INITIAL.           READ TABLE it_catsdb INTO wa_catsdb WITH KEY counter = s_data_cats-refcounter BINARY SEARCH..           IF SY-SUBRC = 0.             wa_hours = wa_catsdb-catshours.             if s_data_cats-RPROJ eq wa_catsdb-RPROJ.               s_data_cats-catshours = s_data_cats-catshours - wa_hours.             endif.
******************************************************           else.             s_data_cats-catshours = s_data_cats-catshours.
*****and append new line*************************           ENDIF.         ENDIF.       endif.       MODIFY c_t_data FROM s_data_cats .       CLEAR s_data_cats.     ENDLOOP.


 ENDCASE.



 

 

My issue is on that part, *********and append new line**********************

 

What i need to do, is to create and add a supplementary by changing the content of some fields, the only way that i know to perform it is a loop and read table like following:


 

LOOP AT itab1 INTO struc1.

READ TABLE itab1 INTO struc2 WHERE ref_counter = struc1-counter.

struc3-project = struc2-project.

struc3-hours   = struc1-hours.

APPEND struc3 TO itab2.

ENDLOOP.

 

But a loop under another loop, that's too much and not good for extraction performance.

 

How can i bypass this issue?

 

Thanks.

 

Amine



Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>