This website is not affiliated with, sponsored by, or approved by SAP AG.

Start Routine issues

Business Warehouse

Moderators: Snowy, thx4allthefish

Start Routine issues

Postby NiceDaily » Sun Oct 16, 2011 11:43 pm

Hi,gurus here.

I want to copy SOURCE_PACKAGE in start routine to another inner table and increase the inner table's volume.
But when I write the code like this "DATA ITAB4 TYPE _ty_t_SC_1." (Also Source_package is TYPE _ty_t_SC_1.)
The system reports an error as: E:Type "_TY_T_SC_1" is unknown

So how to make it up?

Or anybody can provide some sample codes like to copy Source_package to an inner table,increase some customized-fields in this inner table and then copy the inner table back to Source_package?

Thanks,for a lot.
NiceDaily
 
Posts: 1
Joined: Wed Oct 12, 2011 7:50 pm

Re: Start Routine issues

Postby JohnLang » Thu Nov 17, 2011 1:09 am

Hi NiceDaily,

Scenario 1: When you are modifying only the existing fields in the SOURCE_PACKAGE then you do not need to copy out to another internal table and back again. Just use the code below to loop over the existing SOURCE_PACKAGE and modify the records directly. Do not add or remove records while processing the loop.

Code: Select all
*--------------------------------------------------------------------*
field-symbols: <wa_sp> like line of SOURCE_PACKAGE.

loop at SOURCE_PACKAGE assigning <wa_sp>.

* Example: Ensure 0CALDAY is always populated.
  if <wa_sp>-calday is initial.
    <wa_sp>-calday = sy-datum.
  endif.
 
* Example: Assign additional time dimension InfoObjects.
  <wa_sp>-calyear   = <wa_sp>-calday+0(4).
  <wa_sp>-calmonth  = <wa_sp>-calday+0(6).
  <wa_sp>-calmonth2 = <wa_sp>-calmonth+4(2).
  compute <wa_sp>-calquart1 = trunc( ( <wa_sp>-calmonth2 - 1 ) / 3 ) + 1.
  <wa_sp>-calquarter+0(4) = <wa_sp>-calyear.
  <wa_sp>-calquarter+4(1) = <wa_sp>-calquart1.
 
endloop.
*--------------------------------------------------------------------*


Scenario 2: Should you need to add new fields to the SOURCE_PACKAGE internal table then change the ETL to utilise an InfoSource. Add the new InfoObjects to the InfoSource. Use the code provided in solution 1 to fill in each new field as the loop processes each record. The above example code assumes that only the 0CALDAY InfoObject is available from the DataProvider and that the InfoSource has been extended with 0CALYEAR, 0CALMONTH, 0CALMONTH2, 0CALQUART1 and 0CALQUARTER.

Note: The code was done in notepad from memory. Please reply post any modifications if required.

Kind Regards,
John.
JohnLang
 
Posts: 16
Joined: Wed Jul 20, 2011 3:56 am
Location: Australia


Return to Business Warehouse

Who is online

Users browsing this forum: No registered users and 4 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.