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

Customer exit and optimization

Former Member
0 Likes
670

Hello All,

In the Customer Exit (tcode cmod in R/3) for a specific DataSource I have an access to a table, as in this example

SELECT kostl UP TO 1 ROWS FROM cobrb INTO c_opa_6-zzbiocosts

WHERE objnr = aufk-objnr

  AND perbz = 'PER'.

ENDSELECT.

For performance reasons I want to access to this table outside of the datapackage loop and to use FOR ALL ENTRIES option.

How can I implement this possible solution?

Any help or simple example will be greatly appreciated.

Thanks in advance for your kind support.

Regards,

    Giovanni

3 REPLIES 3
Read only

Former Member
0 Likes
578

It would help if you gave the enhancement name and function module you are looking at because there might then be another exit (such as a BTE etc) that does what you want,  but not knowing what exit you are using we can't help.

Also,  I hope you're not using SELECT-ENDSELECT blocks....

Rich

Read only

RaymondGiuseppi
Active Contributor
0 Likes
578

Customer exits EXIT_SAPLRSAP_001 and EXIT_SAPLRSAP_002 receive a batch of records by package, so yes you could use a FOR ALL ENTRIES IN it_data or ct_data. Only exceptions would come from buffered tables.

But in you example you read data related to an InfoObject (Order), not from the actual document (0CO_OM_OPA_6 actual cost in delta mode?) so shouldn't this data be appended to an attribute 0COORDER filled with  0COORDER_ATTR, then used in some attributes of the final Info Provider. In your solution what will happen if order is modified after extraction of those costs?

Regards,

Raymond

Read only

Former Member
0 Likes
578

Giovanni,

You mentioned DataSource and data package in your message, so I am assuming this is BW related.
However, it is not clear as to which DataSource user exit you are working on.

Assumptions: (1) the data structure already has OBJNR in it.

(2) redundant OBJNR values will exist in the data package

<define an internal table just like the C_T_DATA structure and call it t_objnr.>

<define another internal table for two fields: aufk-objnr and cobrb-kostl. and call it t_kostl>

t_objnr[] = c_t_data[].

SORT t_objnr BY objnr.

DELETE ADJACENT DUPLICATES FROM t_objnr COMPARING objnr.

SELECT objnr

               kostl

INTO      TABLE t_kostl

FROM    cobrb

FOR       ALL ENTRIES IN t_objnr

WHERE objnr = t_objnr-objnr

     AND  perbz = 'PER'.

SORT t_kostl by OBJNR.

FREE t_objnr.