Skip to Content
author's profile photo Former Member
Former Member

Optimize BW start and end routine

Hello,

I created start and end routine from dso to cube to enhance some other data.

In developement system everything works fine. But in production system there are too much data. Because of that dtp needs a lot of time.

Can you tell me how I can optimize coding?

Global:

*$*$ begin of global - insert your declaration only below this line *-*
* 20130517 2462
* Deklaration der internen Tabellen und Workareas

* Lieferköpfe inkl. Lieferpriorität
TYPES:
BEGIN OF gs_dlv_head,
deliv_numb TYPE /bi0/oideliv_numb,
dlv_prio TYPE /bi0/oidlv_prio,
END OF gs_dlv_head.

DATA: lt_dlv_head TYPE STANDARD TABLE OF gs_dlv_head
WITH KEY deliv_numb.
"interne Tabelle
DATA: ls_dlv_head LIKE LINE OF lt_dlv_head. "Workarea

*$*$ end of global - insert your declaration only before this line *-*

Start routine:

* 20130517 2462
* Füllen der internen Tabellen aus Lieferköpfen (ZSD_D28).

BREAK-POINT.

* Auftragspositionen

LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
SELECT deliv_numb
dlv_prio

FROM /bic/azsd_d2800
INTO ls_dlv_head
WHERE deliv_numb = <source_fields>-refer_doc.
ENDSELECT.
APPEND ls_dlv_head TO lt_dlv_head.
ENDLOOP.

BREAK-POINT.

SORT lt_dlv_head ASCENDING BY deliv_numb.
DELETE ADJACENT DUPLICATES FROM lt_dlv_head COMPARING deliv_numb.

*$*$ end of routine - insert your code only before this line *-*

End routine:

*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
* raise exception type CX_RSROUT_ABORT.

* 20110124 IT_CBO
* Füllen der fehlenden Felder im Ziel mit Daten aus den
* Auftragskpoepfen und Lieferpositionen.

DATA: lt_rp LIKE RESULT_PACKAGE.
DATA: lv_count TYPE i.
DATA: lv_ship_point(10) TYPE c,
lv_sales_off(10) TYPE c.

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

* Auftragspositionen

BREAK-POINT.

READ TABLE lt_dlv_head
INTO ls_dlv_head
WITH KEY deliv_numb = <result_fields>-deliv_numb.

IF sy-subrc = 0.
<result_fields>-dlv_prio = ls_dlv_head-dlv_prio.
<result_fields>-deliv_numb = ls_dlv_head-deliv_numb.
ELSE.
<result_fields>-deliv_numb = ''.
<result_fields>-deliv_item = ''.
IF <result_fields>-bill_type = 'ZBV' OR
<result_fields>-bill_type = 'ZBVR'.
<result_fields>-dlv_prio = '50'.
ENDIF.
ENDIF.

CONCATENATE '000000' <result_fields>-sales_off INTO lv_sales_off.
CONCATENATE '000000' <result_fields>-ship_point INTO lv_ship_point
.

IF <result_fields>-ship_point IS INITIAL.
<result_fields>-profit_ctr = lv_sales_off.
ELSE.
<result_fields>-profit_ctr = lv_ship_point.
ENDIF.

ENDLOOP.

I hope you can help me!

Regards

Jesper

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on May 27, 2013 at 03:13 PM

    Instead of having a start and end routine, consider using an expert routine. That way the data is only gone through once. You have to code any rules by hand, however.

    Define tl_dlv_head as a sorted table, or, even better, a hashed table.

    Use SELECT... FOR ALL ENTRIES... into a suitably defined internal table and read from that, instead of one select per loop.

    If the logic gets more complicated, it's probably worth investing in the time of an expert ABAP developer.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 28, 2013 at 04:37 AM

    Rather than:

    CONCATENATE '000000' <result_fields>-sales_off INTO lv_sales_off.

    Use

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    INPUT = <result>-sales_off

    OUTPUT = lv_sales_off.

    This will ensure that you get the correct number of leading zeros, without having to worry about the length of the fields yourself. It also makes the code more robust - you don't need to change it should the lengths of the fields change. Unlikely, I know, but still it is safer.

    Similarly for

    CONCATENATE '000000' <result_fields>-ship_point INTO lv_ship_point

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.