Copy Source Package In Start Routine

Need 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

How to correct it? 

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?

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.

*--------------------------------------------------------------------*
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.

SAP BW Tips

Get help for your SAP BW problems
SAP BW Forum - Do you have a SAP BW Question?

Also read
SAP SD Standard InfoCubes and DataSources

SAP Business Warehouse Books
SAP BW Books - Certification, Interview Questions and Configuration

SAP BW Tips
SAP BW Tips and Business Information Warehouse

Main Index
SAP Basis, ABAP Programming and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.