End routine to fill 0PROFIT_CTR

Hi experts,
i am uploading data from DSO TO INFO CUBE. where some of the customers are assigned to PROFIT CENTER in ECC which is coming to DSO and INFO CUBE perfectly, but most of the customers are not assigned to PROFIT CENTER but assigned to SALES DISTRICT.
so whenever the PROFIT CENTER is blank I need to fill the SALES DISTRICT values for the PROFIT CENTER.
from DSO to CUBE profit center is direct mapping, so i want to write a end routine to fill the values of PROFIT CENTER where PROFIT CENTER is Blank.
here is the default code in the end routine
TYPES:
      BEGIN OF _ty_s_TG_1,
*      InfoObject: 0FISCPER Fiscal year / period.
        FISCPER           TYPE /BI0/OIFISCPER,
*      InfoObject: 0FISCVARNT Fiscal year variant.
        FISCVARNT           TYPE /BI0/OIFISCVARNT,
*      InfoObject: 0LOC_CURRCY Local currency.
        LOC_CURRCY           TYPE /BI0/OILOC_CURRCY,
*      InfoObject: 0DOC_CURRCY Document currency.
        DOC_CURRCY           TYPE /BI0/OIDOC_CURRCY,
*      InfoObject: 0CLEAR_DATE Clearing date.
        CLEAR_DATE           TYPE /BI0/OICLEAR_DATE,
*      InfoObject: 0AC_DOC_TYP Document type.
        AC_DOC_TYP           TYPE /BI0/OIAC_DOC_TYP,
*      InfoObject: 0DOC_DATE Document Date.
        DOC_DATE           TYPE /BI0/OIDOC_DATE,
*      InfoObject: 0POST_KEY Posting key.
        POST_KEY           TYPE /BI0/OIPOST_KEY,
*      InfoObject: 0COMP_CODE Company code.
        COMP_CODE           TYPE /BI0/OICOMP_CODE,
*      InfoObject: 0GL_ACCOUNT G/L Account.
        GL_ACCOUNT           TYPE /BI0/OIGL_ACCOUNT,
*      InfoObject: 0C_CTR_AREA Credit Control Area.
        C_CTR_AREA           TYPE /BI0/OIC_CTR_AREA,
*      InfoObject: 0DUNN_AREA Dunning Area.
        DUNN_AREA           TYPE /BI0/OIDUNN_AREA,
*      InfoObject: 0LAST_DUNN Date of last dunning notice.
        LAST_DUNN           TYPE /BI0/OILAST_DUNN,
*      InfoObject: 0DUNN_BLOCK Dunning block.
        DUNN_BLOCK           TYPE /BI0/OIDUNN_BLOCK,
*      InfoObject: 0DUNN_LEVEL Dunning level.
        DUNN_LEVEL           TYPE /BI0/OIDUNN_LEVEL,
*      InfoObject: 0DUNN_KEY Dunning key.
        DUNN_KEY           TYPE /BI0/OIDUNN_KEY,
*      InfoObject: 0NETDUEDATE Due date for net payment.
        NETDUEDATE           TYPE /BI0/OINETDUEDATE,
*      InfoObject: 0REASON_CDE Difference Reason for Payments.
        REASON_CDE           TYPE /BI0/OIREASON_CDE,
*      InfoObject: 0DSCT_DATE1 Due date for cash discount 1.
        DSCT_DATE1           TYPE /BI0/OIDSCT_DATE1,
*      InfoObject: 0DSCT_DATE2 Due date for cash discount 2.
        DSCT_DATE2           TYPE /BI0/OIDSCT_DATE2,
*      InfoObject: 0SP_GL_IND Special General Ledger Indicator.
        SP_GL_IND           TYPE /BI0/OISP_GL_IND,
*      InfoObject: 0BLINE_DATE Baseline Date For Due Date Calculation.
        BLINE_DATE           TYPE /BI0/OIBLINE_DATE,
*      InfoObject: 0PYMT_METH Payment method.
        PYMT_METH           TYPE /BI0/OIPYMT_METH,
*      InfoObject: 0PMNT_BLOCK Payment block key.
        PMNT_BLOCK           TYPE /BI0/OIPMNT_BLOCK,
*      InfoObject: 0PMNTTRMS Terms of Payment Key.
        PMNTTRMS           TYPE /BI0/OIPMNTTRMS,
*      InfoObject: 0CHRT_ACCTS Chart of accounts.
        CHRT_ACCTS           TYPE /BI0/OICHRT_ACCTS,
*      InfoObject: 0ACCT_TYPE Account type.
        ACCT_TYPE           TYPE /BI0/OIACCT_TYPE,
*      InfoObject: 0COUNTRY Country Key.
        COUNTRY           TYPE /BI0/OICOUNTRY,
*      InfoObject: 0DEBITOR Customer Number.
        DEBITOR           TYPE /BI0/OIDEBITOR,
*      InfoObject: 0FI_DOCSTAT Item Status.
        FI_DOCSTAT           TYPE /BI0/OIFI_DOCSTAT,
*      InfoObject: 0FI_SUBSID Account Number of the Branch.
        FI_SUBSID           TYPE /BI0/OIFI_SUBSID,
*      InfoObject: 0PSTNG_DATE Posting date in the document.
        PSTNG_DATE           TYPE /BI0/OIPSTNG_DATE,
*      InfoObject: 0DEB_CRE_LC Amount in Local Currency with +/- Signs.
        DEB_CRE_LC           TYPE /BI0/OIDEB_CRE_LC,
*      InfoObject: 0DISC_BASE Amount eligible for cash discount in docum
*ent currency.
        DISC_BASE           TYPE /BI0/OIDISC_BASE,
*      InfoObject: 0DSC_AMT_LC Cash discount amount in local currency.
        DSC_AMT_LC           TYPE /BI0/OIDSC_AMT_LC,
*      InfoObject: 0DEB_CRE_DC Foreign currency amount with signs (+/-).
        DEB_CRE_DC           TYPE /BI0/OIDEB_CRE_DC,
*      InfoObject: 0DSC_AMT_DC Cash discount amount in document currency
        DSC_AMT_DC           TYPE /BI0/OIDSC_AMT_DC,
*      InfoObject: 0CREDIT_DC Credit amount in foreign currency.
        CREDIT_DC           TYPE /BI0/OICREDIT_DC,
*      InfoObject: 0CREDIT_LC Credit amount in local currency.
        CREDIT_LC           TYPE /BI0/OICREDIT_LC,
*      InfoObject: 0DEBIT_DC Debit amount in foreign currency.
        DEBIT_DC           TYPE /BI0/OIDEBIT_DC,
*      InfoObject: 0DEBIT_LC Debit amount in local currency.
        DEBIT_LC           TYPE /BI0/OIDEBIT_LC,
*      InfoObject: 0NETTAKEN Net period used.
        NETTAKEN           TYPE /BI0/OINETTAKEN,
*      InfoObject: 0INT_CALC_1 Interest Calculation Numerator Days 1 (Ag
*reed).
        INT_CALC_1           TYPE /BI0/OIINT_CALC_1,
*      InfoObject: 0INT_CALC_2 Interest calculation numerator days 2 (ag
*reed).
        INT_CALC_2           TYPE /BI0/OIINT_CALC_2,
*      InfoObject: 0INT_CALC_N Interest Calculation Numerator Net (Agree
*d).
        INT_CALC_N           TYPE /BI0/OIINT_CALC_N,
*      InfoObject: 0INT_CALCT1 Interest Calculation Numerator Days 1 (Re
*alized).
        INT_CALCT1           TYPE /BI0/OIINT_CALCT1,
*      InfoObject: 0INT_CALCT2 Interest Calculation Numerator Days 2 (Re
*alized).
        INT_CALCT2           TYPE /BI0/OIINT_CALCT2,
*      InfoObject: 0INT_CALCTN Interest Calculation Numerator Net (Reali
*zed).
        INT_CALCTN           TYPE /BI0/OIINT_CALCTN,
*      InfoObject: ZPART_FUN Partner Function.
        /BIC/ZPART_FUN           TYPE /BIC/OIZPART_FUN,
*      InfoObject: ZAC_CLERK Accounting Clerk.
        /BIC/ZAC_CLERK           TYPE /BIC/OIZAC_CLERK,
*      InfoObject: 0PROFIT_CTR Profit Center.
        PROFIT_CTR           TYPE /BI0/OIPROFIT_CTR,
*      InfoObject: 0SALES_DIST Sales District.
        SALES_DIST           TYPE /BI0/OISALES_DIST,
*      InfoObject: 0SALES_OFF Sales Office.
        SALES_OFF           TYPE /BI0/OISALES_OFF,
*      InfoObject: 0SALES_GRP Sales group.
        SALES_GRP           TYPE /BI0/OISALES_GRP,
*      InfoObject: 0RATING Rating.
        RATING           TYPE /BI0/OIRATING,
*      InfoObject: 0CO_AREA Controlling area.
        CO_AREA           TYPE /BI0/OICO_AREA,
*      InfoObject: ZAM_INSUR Amount Insured.
        /BIC/ZAM_INSUR           TYPE /BIC/OIZAM_INSUR,
*      InfoObject: 0CURRENCY Currency key.
        CURRENCY           TYPE /BI0/OICURRENCY,
*      InfoObject: 0CRED_LIMIT Customer's Credit Limit.
        CRED_LIMIT           TYPE /BI0/OICRED_LIMIT,
*      InfoObject: 0RISK_CATEG Credit Management: Risk Class for New Cus
*tomer.
        RISK_CATEG           TYPE /BI0/OIRISK_CATEG,
*      InfoObject: 0CLR_DOC_NO Clearing Document Number.
        CLR_DOC_NO           TYPE /BI0/OICLR_DOC_NO,
*      InfoObject: 0REF_DOC_NO Reference document number.
        REF_DOC_NO           TYPE /BI0/OIREF_DOC_NO,
*      InfoObject: 0INV_DOC_NO Invoice Number.
        INV_DOC_NO           TYPE /BI0/OIINV_DOC_NO,
*      InfoObject: 0DOC_NUMBER Sales document.
        DOC_NUMBER           TYPE /BI0/OIDOC_NUMBER,
*      Field: RECORD.
        RECORD           TYPE RSARECORD,
      END   OF _ty_s_TG_1.
    TYPES:
      _ty_t_TG_1        TYPE STANDARD TABLE OF _ty_s_TG_1
                        WITH NON-UNIQUE DEFAULT KEY.
*$*$ begin of global - insert your declaration only below this line  *-*
... "insert your code here
*$*$ end of global - insert your declaration only before this line   *-*
    METHODS
      new_record__end_routine
        IMPORTING
          source_segid             type rstran_segid
          source_record            type sytabix
        EXPORTING
          record_new               type sytabix.
    METHODS
      end_routine
        IMPORTING
          request                  type rsrequest
          datapackid               type rsdatapid
        EXPORTING
          monitor                  type rstr_ty_t_monitors
        CHANGING
          RESULT_PACKAGE              type _ty_t_TG_1
        RAISING
          cx_rsrout_abort.
    METHODS
      inverse_end_routine
        IMPORTING
          i_th_fields_outbound         TYPE rstran_t_field_inv
          i_r_selset_outbound          TYPE REF TO cl_rsmds_set
          i_is_main_selection          TYPE rs_bool
          i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
          i_r_universe_inbound         TYPE REF TO cl_rsmds_universe
        CHANGING
          c_th_fields_inbound          TYPE rstran_t_field_inv
          c_r_selset_inbound           TYPE REF TO cl_rsmds_set
          c_exact                      TYPE rs_bool.
ENDCLASS.                    "routine DEFINITION
Pleae provide me the end routine code.
regards
venuscm
Edited by: venugopal vadlamudi on Sep 7, 2010 1:14 PM
Edited by: venugopal vadlamudi on Sep 7, 2010 1:15 PM

hi experts,
i have written the end routine
if not RESULT_PACKAGE is INITIAL.
  LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
    IF <RESULT_FIELDS>-PROFIT_CTR IS INITIAL .
      <RESULT_FIELDS>-PROFIT_CTR = <RESULT_FIELDS>-SALES_DIST.
      MODIFY RESULT_PACKAGE FROM <RESULT_FIELDS>.
    ENDIF.
  ENDLOOP.
endif.
but while doing DTP from DSO to CUBE it is giving following error.
Characteristic value '1000 ' of characteristic 0PROFIT_CTR is not ALPHA -converted.
0PROFIT_CTR info object is ALPHA Converted while 0SALES_DISTRICT is not.
pl provide me the solution
regards
venuscm
Edited by: venugopal vadlamudi on Sep 7, 2010 2:55 PM

Similar Messages

  • Filling Data fields of a DSO in End Routine

    Hi Everyone,
    The data fields of a DSO contains 2 key figures and a characteristic.
    In the End routine of the transformation, i have assigned constant values for the infoobjects in the data field.
    After executing the DTP, if I check in the New Table of the DSO, these constant values are present.  But when I activate the DSO, the values for key figures gets initialised and the values for the characterisitic becomes empty (NULL).
    Is it not possible to assign values for the infoobjects in the data field? If so, why is this limitation?
    Thanks in advance,
    Uma

    Uma,
    To populate any field in the end routine, you have to assign some constant in the transformation first and then re-populate them using the end routine.
    Sometimes if you dont assign any constant in transformation, the values remain initial and even after you write a code fo that field, it is not populated in the end routine.
    All you have to do is assign constant 0 to the key figures you are populating in the end routine and run the DTP again.
    Thanks
    Sachin

  • End Routine ABAP to read from Internal table and do calculation.

    Hi All...
    I have completed some coding in a start routine to extract some fields from a DSO containing Master Data (Stock Age) into an internal table (the internal table has been defined in the global declarations area) which will then be read in the end routine.
    (the internal table will be read) at loadtime in the end routine and used in a calculation as described below.
    I.E
    GLOBAL DATA DECLARATION
    Data: ITAB1 TYPE TABLE OF /BIC/DSOTAB
    (DSOTAB has 3 fields PLANT, STYLE, 1STDATE (1STDATE IS A DATE FIELD)
    The start routine has the following code:
    IF ITAB1 IS INITIAL.
    SELECT /BIC/PLANT /BIC/STYLE /BIC/1STDATE
                    FROM /BIC/DSOTAB
                    INTO CORRESPONDING FIELDS OF TABLE ITAB1.
    This is working fine when run under simulation i.e ITAB1 is filled no problem.
    I then need to do a calculation in the end routine.
    1. First I have to find the record in the internal table using the key of PLANT AND STYLE from the RESULT_PACKAGE.
    The code i am using now is as follows....
        READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
        /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
        <result_fields>-/BIC/STYLE.
    Once this record has been read I then have to perform the following calculation using the following additional fields
    <result_fields>-/BIC/DYS1ST is a NUMC field in the <result_fields> that will be be filled by the result of the calculation described below.
    <result_fields>-CALDAY is a date field which is already populated in the <result-fields> which is used in the calculation below.
    The Calculation required is a difference in days between two dates
    DYS1ST = CALDAY - 1STRED.
    The code i am using is
    If sy-subrc = 0.
         <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
         i_t_1stred_dso-/BIC/1STRED.
    So the whole section of code inside the LOOP at RESULT PACKAGE looks like this in the end routine
           READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
        /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
        <result_fields>-/BIC/STYLE.
    IF sy-subrc = 0.
         <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
         i_t_1stred_dso-/BIC/1STRED.
    Im getting the error
    "ITAB1 " is a table without a header line and therefore has no component called "/BIC/1STRED
    Please can someone advise as to what I need to do to get this fixed please.
    Thanks in advance
    Stevo:)

    Hi,
    You will have to do few changes in your code as below,
    GLOBAL DATA DECLARATION
    Data: ITAB1 TYPE standard TABLE OF /BIC/DSOTAB.
    After that declare a workarea to read the values.
    DATA: i_wa_itab1 type /bic/dsotab.
    (DSOTAB has 3 fields PLANT, STYLE, 1STDATE (1STDATE IS A DATE FIELD)
    The start routine has the following code:
    IF ITAB1 IS INITIAL.
    SELECT /BIC/PLANT /BIC/STYLE /BIC/1STDATE
    FROM /BIC/DSOTAB
    INTO CORRESPONDING FIELDS OF TABLE ITAB1.
    This is working fine when run under simulation i.e ITAB1 is filled no problem.
    I then need to do a calculation in the end routine.
    1. First I have to find the record in the internal table using the key of PLANT AND STYLE from the RESULT_PACKAGE.
    The code i am using now is as follows....
    READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
    /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
    <result_fields>-/BIC/STYLE.
    Once this record has been read I then have to perform the following calculation using the following additional fields
    <result_fields>-/BIC/DYS1ST is a NUMC field in the <result_fields> that will be be filled by the result of the calculation described below.
    <result_fields>-CALDAY is a date field which is already populated in the <result-fields> which is used in the calculation below.
    The Calculation required is a difference in days between two dates
    DYS1ST = CALDAY - 1STRED.
    The code i am using is
    If sy-subrc = 0.
    <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
    i_t_1stred_dso-/BIC/1STRED.
    So the whole section of code inside the LOOP at RESULT PACKAGE looks like this in the end routine
    READ TABLE ITAB1 into i_wa_itab1 WITH KEY
    /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
    <result_fields>-/BIC/STYLE.
    IF sy-subrc = 0.
    <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
    i_wa_itab1-/BIC/1STRED.
    Once you do this changes, your code will work fine.
    Regards,
    Durgesh.

  • Selecting, reading and sum of billing quantity for last 12 months in transformation end routine

    Hi experts,
    i have requirement to write end routine to read a DSO for last 12 months sales quantity for each month and sum value pass to keyfigure
    not interested using bex variable, while data loading from source to target dso in end routine i am trying to read another DSO which is same as my
    target dso where information is stored by fiscal period, year material etc. finally there is  a keyfigure in target whih needs to be filled with sum of 12
    months sales quantity, for each record form sourc to target maximum of 12 records will be in read dso (for 12 months) my routine is like below.
    i am not expert in abap please kindly gothrough and guide me in this
    TYPES: BEGIN OF s_/BIC/AZOSLS00,
    FISCPER  type /BI0/OIFISCPER,
    FISCVARNT  type /BI0/OIFISCVARNT,
    PLANT  type /BI0/OIPLANT,
    STOR_LOC  type /BI0/OISTOR_LOC,
    /BIC/MATERIAL  type /BIC/OIMATERIAL,
    VTYPE  type /BI0/OIVTYPE,
    BILL_QTY  type /BI0/OIBILL_QTY,
    END OF s_/BIC/AZOSLS00.
    DATA: it_/BIC/AZOSLS00 TYPE TABLE OF s_/BIC/AZOSLS00,
    wa_/BIC/AZOSLS00  TYPE s_/BIC/AZOSLS00.
    SELECT
    FISCPER
    FISCVARNT
    PLANT
    STOR_LOC
    /BIC/MATERIAL
    VTYPE
    BILL_QTY
         FROM /BIC/AZOSLS00 INTO TABLE it_/BIC/AZOSLS00
           FOR ALL
          ENTRIES IN RESULT_PACKAGE
           WHERE
    below field is from value of fiscal period (which is fiscal period -999 ex:  for 001.2014 this
    value will be 002.2013 so 12 months including current period)
    FISCPER >=  RESULT_PACKAGE-/BIC/ZFISCPERF
    below is result filed fiscal period (here i dont know which keyword or statement to be used to select
    interval values this between statement giving syntax error that can not be used in where for for all entries
    between RESULT_PACKAGE-FISCPER
            AND
             FISCVARNT = RESULT_PACKAGE-FISCVARNT AND
             PLANT = RESULT_PACKAGE-PLANT AND
             STOR_LOC = RESULT_PACKAGE-STOR_LOC and
          /BIC/MATERIAL = RESULT_PACKAGE-/BIC/MATERIAL .
        SORT it_/BIC/AZOSLS00 BY FISCPER FISCVARNT PLANT STOR_LOC
        /BIC/MATERIAL .
        LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
          READ TABLE it_/BIC/AZOSLS00 INTO wa_/BIC/AZOSLS00 WITH KEY
    below dont know what statement i need to use in read statement for interval of fiscal periods
    giving error that >= can not be used
         FISCPER >=  <result_fields>-/BIC/ZFISCPERF
    FISCPER = <result_fields>-FISCPER
             FISCVARNT = <result_fields>-FISCVARNT
             PLANT = <result_fields>-PLANT
             STOR_LOC = <result_fields>-STOR_LOC
          /BIC/MATERIAL = <result_fields>-/BIC/MATERIAL
           BINARY SEARCH.
          BREAK-POINT.
          IF sy-subrc = 0.
    below for each record there will be 12 records in read so sume of 12 records quantity i need to pass to result again dont know what to say here
    sum statement giving error
                <result_fields>-/BIC/ZLSTSLS12 =
                 sum(wa_/BIC/AZOSLS00-BILL_QTY).
              ENDIF.
        ENDLOOP.
    friends please help me in this.
    Thanks
    Chandra.

    Hiii,
    If you only want to store last  12 months data in Target ODS .
    Then Create filter in DTP and write routine in filter for calmonth or fiscal period.
    Refer the below link to create filter routine :
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80b2db87-639b-2e10-a8b9-c1ac0a44a7a6?QuickLink=index&…
    Regards,
    Akshay

  • Start & End Routines in BI 7  Transformations

    Hi,
    In Transformations from DSO1-->DSO2
    In Start Routine for all entries in Source Package i read some fields from DSO3 and filled an iternal table
    And  in end routine i read the iternal table and filled the result package/fields
    In the mapping i haven't mapped any thing to the fields to which i intended to fill using routines
    When i executed data load those fields are not populated with any value
    But if i debug the transformation...results are updating in all fields in the  result package.......
    Do i need to make any setting or mappings to the fields which i want to update using end routine
    Thanks

    HI,
    For support pack 16 and above you get one more button besides End Routine (once end routine is created).
    This button is to update behaviour of fields in End Routines. You get two options once you select this button. One needs to make selection of proper option as it is mandatory.
    The default setting for the pushbutton is that only the fields with active rules are updated in the transformation. With this selection, fields populated in End routine wont be updated in the data target if no active rule exists for them in Transformation.
    Alternatively, you can define that all the fields should always be updated by selecting 2nd radio button. As a result, fields filled in the end routine are not lost if there is no other active rule.
    So in your case if you are in SP 15 or lower, then you will have to map the fields.
    Go through this article it gives the above explanation along with screenshots.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/30d35342-1fe3-2c10-70ba-ad0da83d23bd
    Hope this helps.
    Thanks,
    Rahul

  • Difference between Start Routine  and End Routine in Transformations

    Hi  Friends,
      I'm using BI 7.0... here in Transformations step  we have two options..that is START ROUTINE... and END ROUTINE... What is the Difference between Start Routine  and End Routine in Transformations..
       When  we go for Start Routine.. and when we go for End Routine..
    Plz clarrify... points will be rearded..
    thanks
    babu

    Hi,
    One real time scenario for End Routine.
    We have a scenario where in a datasource field is mapped to three infoobjects on the datatarget side. There are 2 key figures which need to get data after these these Infoobjects are filled. The best place for this to happen would be in a End Routine, where in we would loop through the results package and using the values of the infoobjects from the data target ( Cube in this case).
    Hope this helps,
    HD

  • End routine

    Hello,
    I have the code below as a model .
    As far as I see , it is done for fiscal period. I need something similar, to put date and time.
    I move data from cube 1 to cube 2, BW 7.0.
    My cube 2 has two more extra fields then cube 1(date and time of the request that comes).
    I don't understand why I need the read table instruction and how I test in my case for request, instead of fiscal period.
    Any suggestions/ clues ...?
    Thank you.
      METHOD end_routine.
        FIELD-SYMBOLS:
          <RESULT_FIELDS>    TYPE tys_TG_1.
        DATA:
          MONITOR_REC     TYPE rstmonitor.
    $$ 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.
      DATA: fiscper type RSBK_S_RANGE-high,
            RESULT type tys_TG_1,
            l_tabix type sy-tabix,
            l_requnr TYPE fieldname,
            e_th_selections type RSBK_TH_RANGE,
            e_th_fiscper type line of RSBK_TH_RANGE.
    e_th_selections = p_r_request->get_th_range( ).
    READ TABLE e_th_selections WITH KEY fieldnm = 'FISCPER'
        INTO e_th_fiscper.
      fiscper = e_th_fiscper-high + 1.
      LOOP AT RESULT_PACKAGE INTO RESULT.
        l_tabix = sy-tabix.
        result-fiscper  = fiscper.
        result-fiscyear = fiscper+37(4).
        result-fiscper3 = fiscper+41(3).
        MODIFY RESULT_PACKAGE FROM RESULT INDEX l_tabix.
        CLEAR RESULT.
      ENDLOOP.

    I am not sure I understand - do you want to populate cube infoobjects with the current date and time in an end routine, or using the methods provided by p_r_request ?
    p_r_request has methods like GET_TSTMP_START, that you can see if they work for you.

  • End Routine and test on a field not present in target system

    Hello,
    I find an issue in testing a field present in the ODS source system, using a Transformation.
    More exactly, I do not have a field that I need to test in my end routine because I can't find it in the RESULT_PACKAGE structure (because it is not present in the target Cube). In BW 3.x I solved this problem with an enhancement in the communication structure of my ODS and using a start routine.
    Any idea for a Transformation?
    Many thanks in advance for your kind support.
    Regards,
         Giovanni

    Hello and thanks for your reply.
    I have two conditions to implement.
    1) Fill some fields of the Cube, NON present in my ODS.
    2) Condition on one filed of my ODS (filed NON present in the Cube) for filling some field of the Cube.
    In my tys_SC_1 structure of the start routine I find all fields of my ODS and the fields that I need to check but I need to check this filed in one point of my process and set a filed in  my Cube (filed not present in my ODS), not present in the tys_SC_1 structure of the start routine.
    I hope to have described in a better way may issue.
    Any idea?
    Thanks.
          Giovanni

  • End Routine ABAP running slow

    We have written the following end routine but performance is too slow because of the number of loops.
    We have introduced the third loop since we need the records in the specific order to populate ZCUST.  Can someone advise on how we can optimize
    Thanks
    $$ begin of routine - insert your code only below this line        -
        data: TEMP_RESULT_PACKAGE like RESULT_PACKAGE,
              WA_RESULT_PACKAGE type TYS_TG_1,
              WA type TYS_TG_1.
        TEMP_RESULT_PACKAGE[] = RESULT_PACKAGE[].
        delete adjacent duplicates from RESULT_PACKAGE
                        comparing DIVISION DISTR_CHAN SALESORG CUST_SALES.
        loop at RESULT_PACKAGE into WA_RESULT_PACKAGE.
          clear WA.
          loop at TEMP_RESULT_PACKAGE into WA
                           where DIVISION = WA_RESULT_PACKAGE-DIVISION
                           and   DISTR_CHAN = WA_RESULT_PACKAGE-DISTR_CHAN
                           and   SALESORG = WA_RESULT_PACKAGE-SALESORG
                           and   CUST_SALES = WA_RESULT_PACKAGE-CUST_SALES.
            if not WA-SHIP_TO is initial.
              WA_RESULT_PACKAGE-SHIP_TO = WA-SHIP_TO.
            endif.
            if not WA-CUST_HIE01 is initial.
              WA_RESULT_PACKAGE-CUST_HIE01 = WA-CUST_HIE01.
            endif.
            if not WA-CUST_HIE02 is initial.
            if not WA-BILLTOPRTY is initial.
              WA_RESULT_PACKAGE-BILLTOPRTY = WA-BILLTOPRTY.
            endif.
            if not WA-PAYER is initial.
              WA_RESULT_PACKAGE-PAYER = WA-PAYER.
            endif.
            if not WA-/BIC/OSSLSREP is initial.
              WA_RESULT_PACKAGE-/BIC/ZSREP = WA-/BIC/ZSREP.
            endif.
            if not WA-/BIC/OSBRO is initial.
              WA_RESULT_PACKAGE-/BIC/ZBRO = WA-/BIC/ZBRO.
            endif.
            if not WA-/BIC/OSCTREMP is initial.
              WA_RESULT_PACKAGE-/BIC/ZREMP = WA-/BIC/ZREMP.
            endif.
            if not WA-/BIC/OSOPR is initial.
              WA_RESULT_PACKAGE-/BIC/ZPRI = WA-/BIC/ZPRI.
            endif.
            endloop.
            sort TEMP_RESULT_PACKAGE by DIVISION DISTR_CHAN SALESORG CUST_SALES /BIC/ZBRO /BIC/ZSREP /BIC/ZREMP.
            clear WA.
                  loop at TEMP_RESULT_PACKAGE into WA
                           where DIVISION = WA_RESULT_PACKAGE-DIVISION
                           and   DISTR_CHAN = WA_RESULT_PACKAGE-DISTR_CHAN
                           and   SALESORG = WA_RESULT_PACKAGE-SALESORG
                           and   CUST_SALES = WA_RESULT_PACKAGE-CUST_SALES.
            IF NOT WA-/BIC/ZCUST IS INITIAL.
              WA_RESULT_PACKAGE-/bic/ZCUST = WA-/BIC/ZCUST.
            ENDIF.
          endloop.
          modify RESULT_PACKAGE from WA_RESULT_PACKAGE.
          clear WA_RESULT_PACKAGE.
        endloop.

    Hi,
    I have to suggestions for you:
    1. use typed field-symbols for every loop
    2. I try to understand, what you are doing: you will at least be sure, that every necessary/key infoobject is filled with the same value from your result_package.
    I would try to separate it in two steps:
    1) build up your temp_result_package and make your assignments.
    2) do only a efficient read-table (sorted/hashed with key DIVISION DISTR_CHAN SALESORG CUST_SALES /BIC/ZBRO /BIC/ZSREP /BIC/ZREMP and field-symbols) on your inside your loop.
    3. by using field-symbols, your modify table is obsolete and costs a lot of time.
    Kind regards,
    Hendrik

  • End Routine issue

    I am adding new records to the result_package in the end routine.
    How will I populate the SID and datapakid values to my new records?
    I am not able to code these fields in the end routine as they are not available and they get filled dynamically.
    Are there any system fields that hold SID value and data package value?
    Please help.
    Thanks.

    I have added move-corresponding code from result_package and it has solved my issue.
    Thanks.

  • Calculations in Update rules/Start routine/End Routine

    Hi Friends,
    I have loaded data to a DSO and i have three fields in to it. Lets say Filed1, Filed2 and Field3. Field1 and Field2 are being populated through an update rule in transformation. Aggregation type for these two fields are "Summation".
    Now, after the transformation executed, the Field1 and Field2 are filled with values. I want to calculate the value of Field3 as follows:
    Field3 = Field1 - Field2
    Can anyone tell me where can i do this calculation? I know we can do this in End routine and in Query  but i want to know if there is any other place i can do this calculation in transformation? In try to do this calculation in the update rule for Field3 in transformation, i dont see Field1 and Field2 as these are not source fields. I can not write formula also because we can write formula only on source fields not the data target fields.
    Your help will be appreciated in terms of points.
    Thanks,
    manmit

    Hi,
    in the start routine in the global section define the two fields:
    data: g_amount1 type /bic/oi<your keyfigure name>,
    g_amount2 type /bic/oi<your keyfigure name>.
    in the routines to your 2 keyfigures store the result in that fields too.
    routine for field1.
    g_amount1 = result.
    routine for field2.
    g_amount2 = result.
    and in the routine to field3
    result = g_amount1 - g_amount2." or whatever calculation/derivation has to be done.
    kind regards
    Siggi
    Message was edited by:
            Siegfried Szameitat

  • Performance: reading huge amount of master data in end routine

    In our 7.0 system, each day a full load runs from DSO X to DSO Y in which from six characteristics from DSO X master data is read to about 15 fields in DSO Y contains about 2mln. records, which are all transferred each day. The master data tables all contain between 2mln. and 4mln. records. Before this load starts, DSO Y is emptied. DSO Y is write optimized.
    At first, we designed this with the standard "master data reads", but this resulted in load times of 4 hours, because all master data is read with single lookups. We redesigned and fill all master data attributes in the end routine, after fillilng internal tables with the master data values corresponding to the data package:
    *   Read 0UCPREMISE into temp table
        SELECT ucpremise ucpremisty ucdele_ind
          FROM /BI0/PUCPREMISE
          INTO CORRESPONDING FIELDS OF TABLE lt_0ucpremise
          FOR ALL ENTRIES IN RESULT_PACKAGE
          WHERE ucpremise EQ RESULT_PACKAGE-ucpremise.
    And when we loop over the data package, we write someting like:
        LOOP AT RESULT_PACKAGE ASSIGNING <fs_rp>.
          READ TABLE lt_0ucpremise INTO ls_0ucpremise
            WITH KEY ucpremise = <fs_rp>-ucpremise
            BINARY SEARCH.
          IF sy-subrc EQ 0.
            <fs_rp>-ucpremisty = ls_0ucpremise-ucpremisty.
            <fs_rp>-ucdele_ind = ls_0ucpremise-ucdele_ind.
          ENDIF.
    *all other MD reads
    ENDLOOP.
    So the above statement is repeated for all master data we need to read from. Now this method is quite faster (1,5 hr). But we want to make it faster. We noticed that reading in the master data in the internal tables still takes a long time, and this has to be repeated for each data package. We want to change this. We have now tried a similar method, but now load all master data in internal tables, without filtering on the data package, and we do this only once.
    *   Read 0UCPREMISE into temp table
        SELECT ucpremise ucpremisty ucdele_ind
          FROM /BI0/PUCPREMISE
          INTO CORRESPONDING FIELDS OF TABLE lt_0ucpremise.
    So when the first data package starts, it fills all master data values, which 95% of them we would need anyway. To accomplish that the following data packages can use the same table and don't need to fill them again, we placed the definition of the internal tables in the global part of the end routine. In the global we also write:
    DATA: lv_data_loaded TYPE C LENGTH 1.
    And in the method we write:
    IF lv_data_loaded IS INITIAL.
      lv_0bpartner_loaded = 'X'.
    * load all internal tables
    lv_data_loaded = 'Y'.
    WHILE lv_0bpartner_loaded NE 'Y'.
      Call FUNCTION 'ENQUEUE_SLEEP'
      EXPORTING
         seconds = 1.
    ENDWHILE.
    LOOP AT RESULT_PACKAGE
    * assign all data
    ENDLOOP.
    This makes sure that another data package that already started, "sleeps" until the first data package is done with filling the internal tables.
    Well this all seems to work: it takes now 10 minutes to load everything to DSO Y. But I'm wondering if I'm missing anything. The system seems to work fine loading all these records in internal tables. But any improvements or critic remarks are very welcome.

    This is a great question, and you've clearly done a good job of investigating this, but there are some additional things you should look at and perhaps a few things you have missed.
    Zephania Wilder wrote:
    At first, we designed this with the standard "master data reads", but this resulted in load times of 4 hours, because all master data is read with single lookups.
    This is not accurate. After SP14, BW does a prefetch and buffers the master data values used in the lookup. Note [1092539|https://service.sap.com/sap/support/notes/1092539] discusses this in detail. The important thing, and most likely the reason you are probably seeing individual master data lookups on the DB, is that you must manually maintain the MD_LOOKUP_MAX_BUFFER_SIZE parameter to be larger than the number of lines of master data (from all characteristics used in lookups) that will be read. If you are seeing one select statement per line, then something is going wrong.
    You might want to go back and test with master data lookups using this setting and see how fast it goes. If memory serves, the BW master data lookup uses an approach very similar to your second example (1,5 hrs), though I think that it first loops through the source package and extracts the lists of required master data keys, which is probably faster than your statement "FOR ALL ENTRIES IN RESULT_PACKAGE" if RESULT_PACKAGE contains very many duplicate keys.
    I'm guessing you'll get down to at least the 1,5 hrs that you saw in your second example, but it is possible that it will get down quite a bit further.
    Zephania Wilder wrote:
    This makes sure that another data package that already started, "sleeps" until the first data package is done with filling the internal tables.
    This sleeping approach is not necessary as only one data package will be running at a time in any given process. I believe that the "global" internal table is not be shared between parallel processes, so if your DTP is running with three parallel processes, then this table will just get filled three times. Within a process, all data packages are processed serially, so all you need to do is check whether or not it has already been filled. Or are you are doing something additional to export the filled lookup table into a shared memory location?
    Actually, you have your global data defined with the statement "DATA: lv_data_loaded TYPE C LENGTH 1.". I'm not completely sure, but I don't think that this data will persist from one data package to the next. Data defined in the global section using "DATA" is global to the package start, end, and field routines, but I believe it is discarded between packages. I think you need to use "CLASS-DATA: lv_data_loaded TYPE C LENGTH 1." to get the variables to persist between packages. Have you checked in the debugger that you are really only filling the table once per request and not once per package in your current setup? << This is incorrect - see next posting for correction.
    Otherwise the third approach is fine as long as you are comfortable managing your process memory allocations and you know the maximum size that your master data tables can have. On the other hand, if your master data tables grow regularly, then you are eventually going to run out of memory and start seeing dumps.
    Hopefully that helps out a little bit. This was a great question. If I'm off-base with my assumptions above and you can provide more information, I would be really interested in looking at it further.
    Edited by: Ethan Jewett on Feb 13, 2011 1:47 PM

  • End routine to populate Info-cube.

    Hi ,
    Is it possible to load fileds of a Info-cube using End routines in the following scenairos.
    1.Loading fields of info-cube by referencing/using a master data table in End routine.
    2.Loading fields of info-cube by referencing/using a DSO fields  in End routine.
    3.Loading fields of info-cube by referencing/using a fields of another info-cube in End routine.
    Please advise.

    Hi Stalin,
    Before answering your question you need to understand something about "End routine" and "Expert routine".
    End Routine:
    - Result_fields and Result_package are available
    - End routine contains only those fields available in Data target.
    Start Routine:
    - Source_fields and Source_package are available
    - Start routine contains only those fields coming from source.
    Expert Routine:
    -  Source_fields, Source_package, Result_fields and Result_package are available
    So Now if you want write code to look up into some other cube, in look up you may need to test condition using source fields, in that case " Expert Routine" is only the option.
    For Ex
    my data target contains : x,y and z fields (it becomes result_field)
    source contains : a field ( it becomes source_field)
    now if i want to write look up code like this " select x,y and z fields from other cube where my a field value = other cube a field value. here u r accessing both S_F as well as R_F. So only the option is "EXPERT ROUTINE"
    or else u want to write code only with R_F then "End routine " is enough.
    Thanks,
    Gowd

  • How to add new records in Start routine or end routine.

    Hi All,
            My requirement is to transfer data from one DSO to anothe DSO. But while transfering a single record frorm DSO1 i want to add 7 records to DSO2 for each record in DSO1 with slight change in data( with a different key). I want to do it in start routine or end routine. How can i do it. If you have any ABAP code for this then please send.
    Regards
    Amlan

    you can use this code, replace the fields where i have marked with <>.
    DATA : WA_RESULT_PACKAGE TYPE DSO2,
           WA_RESULT_PACKAGE1 LIKE WA_RESULT_PACKAGE.
    DATA : IT_RESULT_PACKAGE LIKE TABLE OF WA_RESULT_PACKAGE.
    DATA : DATE1 TYPE SY-DATUM.
    DATA : DAYDIFF TYPE i.
    DATA : RECORD_NO type rsarecord.
    SORT RESULT_PACKAGE BY <KEY FIELDS> "specify the key fields here
    RECORD_NO = 1.
    LOOP AT RESULT_PACKAGE INTO WA_RESULT_PACKAGE.
         IF WA_RESULT_PACKAGE_1-<KEYFIELDS> NE WA_RESULT_PACKAGE-<KEYFIELDS>.
              WA_RESULT_PACKAGE_1 = WA_RESULT_PACKAGE.
              DAYDIFF = WA_RESULT_PACKAGE-ENDDATE - WA_RESULT_PACKAGE-STARTDATE.
                   WHILE DAYDIFF NE 0.
                        DATE1 = WA_RESULT_PACKAGE-STARTDATE + DAYDIFF.
                        MOVE DATE1 TO WA_RESULT_PACKAGE-<KEYFIELDDATE>.
                        MOVE RECORD_NO TO WA_RESULT_PACKAGE-RECORD.
                        APPEND WA_RESULT_PACKAGE INTO IT_RESULT_PACKAGE.
                        DAYDIFF = DAYDIFF - 1.
                        RECORD_NO = RECORD_NO + 1.
                        CLEAR DATE1.
                   ENDWHILE.
              CLEAR DAYDIFF.
         ENDIF.
    ENDLOOP.
    DELETE RESULT_PACKAGE[].
    RESULT_PACKAGE[] = IT_RESULT_PACKAGE[].
    Reg Point 3.
    The Key figures will then show up in the report aggregated.Hope that is fine with you.
    Note:
    Before loading data, in DTP set the semantic key with the key field of the DSO1.This brings all the similar data w.r.t the key fields from the PSA together in a single package.
    rgds, Ghuru

  • Source Field in End Routine of DSO Transformation

    Hi,
    I made a transformation from source DSO to Target DSO.
    There are 7 fields in source & 6 fields in target..All the 6 fields are one to one mapped from the source to Target
    I need to write a simple ABAP Logic in End Routine based on the 7th source field which is not mapped.
    Please let me know the piece of ABAP code or steps where i can get the value of Source table in End routine
    Regards
    Suresh

    Hi Suresh,
                      Check here.........
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e73bfc19-0e01-0010-23bc-ef0ad53f2fab
    http://help.sap.com/saphelp_nw70/helpdata/en/e3/732c42be6fde2ce10000000a1550b0/frameset.htm
    Regards,
    Vijay.

Maybe you are looking for

  • Cannot assign an email address to SharePoint group (distribution groups)

    Hello, I configured incoming email awhile back in our SharePoint 2010 environment and it works great. I can assign an email address to a list and the necessary contact is created in AD in the OU I configured for incoming email and of course the item

  • 3G spin/touch/scroll wheel not working

    after about 3 times of restoring this iPod, it has yet to fix anything that's wrong with my wheel. it stopped working yesterday when I tried to update it manually. the other buttons work but this still doesn't allow me to search for artists, playlist

  • Reinstalling iPhoto 4.0.3 from back-up?

    Greetings all, New to this area and not completely sure of protocol so please excuse any blunders. In brief, I basically screwed up my copy of iPhoto and attempted to simply uninstall it and drag a copy from a back-up disc into applications which of

  • Ciscoworks daemon manager stuck at Stopping state

    I am working on LMS 3.2 . Tried to stop the daemon service with " net stop crmdmgtd ". It stuck on stopping state since few hours now. I can still open the application. Need a suggestion to terminate the previous command and restart the daemon servic

  • Bex Analyzer formula

    Dear all, There are a lot of formula in analyzer which generate by the SAP BW, anybody have a document about what the formula can do. I only know a little about the Bex Formula. Thanks in advance. Regards, Tienus