cancel
Showing results for 
Search instead for 
Did you mean: 

Start Routine. General Information/What would this simple one do?

Former Member
0 Kudos

Hello,

I have the following start routine in Update rules for InfoCube Z_COPA. I was hoping to get some information on what is occurring within the code.

Also just some general information on how Start Routines in Update rules are processed would be helpful!

Thanks A lot!

Nick

PROGRAM UPDATE_ROUTINE.

$$ begin of global - insert your declaration only below this line -

  • TABLES: ...

TYPES: BEGIN OF wa_stru,

material LIKE /bic/azcopc_0500-material,

plant LIKE /bic/azcopc_0500-plant,

fiscper LIKE /bic/azcopc_0500-fiscper,

fiscvarnt LIKE /bic/azcopc_0500-fiscvarnt,

zadjvr LIKE /bic/azcopc_0500-/bic/zadjvr,

amountvr LIKE /bic/azcopc_0500-amountvr,

END OF wa_stru.

DATA: wa TYPE TABLE OF wa_stru WITH HEADER LINE.

  • data: wa type hashed table of wa_stru with unique key

  • material plant fiscper fiscvarnt

  • with header line.

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

  • The follow definition is new in the BW3.x

TYPES:

BEGIN OF DATA_PACKAGE_STRUCTURE.

INCLUDE STRUCTURE /BIC/CS1_CO_PA2900010_DS.

TYPES:

RECNO LIKE sy-tabix,

END OF DATA_PACKAGE_STRUCTURE.

DATA:

DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE

WITH HEADER LINE

WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.

FORM startup

TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring

MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n

DATA_PACKAGE STRUCTURE DATA_PACKAGE

USING RECORD_ALL LIKE SY-TABIX

SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS

CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update

*

$$ begin of routine - insert your code only below this line -

  • fill the internal tables "MONITOR" and/or "MONITOR_RECNO",

  • to make monitor entries

if wa is initial. "load lookup table from /bic/azcopc_0500

select material

plant

fiscper

fiscvarnt

/bic/zadjvr

amountvr

into table wa

from /bic/azcopc_0500.

sort wa by material plant fiscper descending fiscvarnt.

endif.

  • if abort is not equal zero, the update process will be canceled

ABORT = 0.

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

*

ENDFORM.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nick,

From the code u posted, it is doing nothing in the start routine.

Just declared a structure wa_stru. But no data is coming into this structure, so all the time it is empty and so select statement will trigger and selecting records without any selection.

But not appending these records to the data_package. Means no changes are happening to the data_package. this is a sap defined internal table inside the start routine.

So according to my understand, nothing is happening with this code.

I think wa defined globally, means this is available in ur all the routines of the update rules. May be they are doing some calculations or manipulations using this.(in any other routines)

Srini.

Former Member
0 Kudos

Hi Srini,

Could you please explain me that how can you say it is doing nothing here? This select statement will pass data to the internal table WA, which must be used later in the update rules. When you say "into table" it will automatically append data to that table i.e. WA in this case. You are right they are not modifying the data_package, but that may not be purpose of this start routine and it is not necessary to modify data_package always in start routine as start routine may be used for some other purpose also.

Regards,

Rohit

Former Member
0 Kudos

Thanks for your help thus far everyone.

So from what I can gather - This start routine will fill an internal table with the corresponding contents of ZCOPC_05 according the the select statement.

Seeing as how this is a start routine, when I do a data load that has 100 data packages. Will this table be refilled for every data package that comes in? or does the

"if wa is inital" statement prevent that from occuring. Thus per data load the table only gets populated once.

Thanks,

Nick

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Nick,

This code is just pulling up data from azcopc_0500 ODS and passing that to an internal table WA. There is no restriction in the select statement that means complete data from the ODS will get passed to this internal table. After that it is sorting the data by material, plant, fiscper descending, and fiscvarnt. This all process is done only if there is no data in WA header line.

This internal table must have been used in any of the update rules to get data.

Start routine is used if you want some information at the data package level or want to use it at data package level, so that you can refer it later.

Let me know if you have any doubts,

Regards,

Rohit