<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Logic for end routine in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-end-routine/m-p/3579419#M861736</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gurus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to load the values into a field named Ysind which is present in a cube in BI 7 based on the following logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have three tables with the following corresponding fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1: /BIC/PYMAT&lt;/P&gt;&lt;P&gt;Fields: Ymat, Prdh5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2: /BIO/TPRD_HIER&lt;/P&gt;&lt;P&gt;Fields: Prd_hier, TXTMD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table3: result_fields (refers to the ODS fields which feeds the Cube)&lt;/P&gt;&lt;P&gt;Fields: Ymat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ysind should be equal to TXTMD from /BIO/TPRD_HIER if Prd_hier from /BIO/TPRD_HIER = Prdh5 from /BIC/PYMAT and Ymat from /BIC/PYMAT = Ymat from result_fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you provide me with a sample code or the logic for the end routine to be implemented between the ODS and the cube for this. Furthermore, how can i use internal tables for this purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help in this regards is appreciated and points will be assigned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rishi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Mar 2008 20:03:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-31T20:03:21Z</dc:date>
    <item>
      <title>Logic for end routine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-end-routine/m-p/3579419#M861736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gurus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to load the values into a field named Ysind which is present in a cube in BI 7 based on the following logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have three tables with the following corresponding fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1: /BIC/PYMAT&lt;/P&gt;&lt;P&gt;Fields: Ymat, Prdh5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2: /BIO/TPRD_HIER&lt;/P&gt;&lt;P&gt;Fields: Prd_hier, TXTMD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table3: result_fields (refers to the ODS fields which feeds the Cube)&lt;/P&gt;&lt;P&gt;Fields: Ymat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ysind should be equal to TXTMD from /BIO/TPRD_HIER if Prd_hier from /BIO/TPRD_HIER = Prdh5 from /BIC/PYMAT and Ymat from /BIC/PYMAT = Ymat from result_fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you provide me with a sample code or the logic for the end routine to be implemented between the ODS and the cube for this. Furthermore, how can i use internal tables for this purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help in this regards is appreciated and points will be assigned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rishi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2008 20:03:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-end-routine/m-p/3579419#M861736</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-31T20:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for end routine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-end-routine/m-p/3579420#M861737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rishi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Routine&lt;/P&gt;&lt;P&gt;An end routine is a routine with a table in the target structure format as input and output parameters. You can use an end routine to postprocess data after transformation on a package-by-package basis. For example, you can delete records that are not to be updated, or perform data checks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the target of the transformation is a DataStore object, key figures are updated by default with the aggregation behavior Overwrite (MOVE). You have to use a dummy rule to override this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expert Routine&lt;/P&gt;&lt;P&gt;This type of routine is only intended for use in special cases. You can use the expert routine if there are not sufficient functions to perform a transformation. The expert routine should be used as an interim solution until the necessary functions are available in the standard routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use this to program the transformation yourself without using the available rule types. You must implement the message transfer to the monitor yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have already created transformation rules, the system deletes them once you have created an expert routine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: End Routine &lt;/P&gt;&lt;P&gt;In the SAP ERP system, you are loading data using the General Ledger: Transaction Figures DataSource (0FI_GL_1) into the DataStore object FIGL: Transaction Figures (0FIGL_O06).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want to create an end routine to fill the additional InfoObject Plan/Actual Indicator (ZPLACTUAL). You also want the routine to read field Value Type. If the value is 10 (actual), value A is written to the Plan/Actual Indicator InfoObject; if the value is 20 (plan), value P is written to the Plan/Actual Indicator InfoObject.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       1.      You are in transformation maintenance. Choose  Create End Routine. The routine editor opens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       2.      You enter the following lines of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD end_routine.&lt;/P&gt;&lt;P&gt;*=== Segments ===&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    FIELD-SYMBOLS:&lt;/P&gt;&lt;P&gt;      &amp;lt;RESULT_FIELDS&amp;gt;    TYPE &lt;U&gt;ty&lt;/U&gt;s_TG_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$ begin of routine - insert your code only below this line        &lt;STRONG&gt;-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    loop at RESULT_PACKAGE assigning &amp;lt;RESULT_FIELDS&amp;gt;&lt;/P&gt;&lt;P&gt;      where vtype eq '010' or vtype eq '020'.&lt;/P&gt;&lt;P&gt;      case &amp;lt;RESULT_FIELDS&amp;gt;-vtype.&lt;/P&gt;&lt;P&gt;        when '010'.&lt;/P&gt;&lt;P&gt;          &amp;lt;RESULT_FIELDS&amp;gt;-/bic/zplactual = 'A'. "Actual&lt;/P&gt;&lt;P&gt;        when '020'.&lt;/P&gt;&lt;P&gt;          &amp;lt;RESULT_FIELDS&amp;gt;-/bic/zplactual = 'P'. "Plan&lt;/P&gt;&lt;P&gt;      endcase.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;$ end of routine - insert your code only before this line         &lt;STRONG&gt;-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "end_routine&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code loops through result_package searching for values that have the value type 10 or 20. For these values, the appropriate value is passed on to InfoObject Plan/Actual Indicator (ZPLACTUAL).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       3.      You exit the routine editor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       4.      You save the transformation. An edit icon  next to the End Routine indicates that an end routine is available&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;karthik&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the above information is usefull to you.pls reward me points&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2008 20:43:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-end-routine/m-p/3579420#M861737</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-31T20:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for end routine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-end-routine/m-p/3579421#M861738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kartikeya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the Info but it would really help if you can provide some logic for my scenario. I wrote the following code, can this be optimized using internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;  lv_prdh5   type /BI0/OIPRDH5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt; lv_txtsh type RSTXTSH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at RESULT_PACKAGE assigning &amp;lt;result_fields&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear lv_prdh5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if not &amp;lt;result_fields&amp;gt;-/BIC/YMAT is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select single prdh5 into lv_prdh5&lt;/P&gt;&lt;P&gt;      from /BIC/PYMAT&lt;/P&gt;&lt;P&gt;      where /BIC/YMAT = &amp;lt;result_fields&amp;gt;-/BIC/YMAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     select single TXTMD into lv_txtsh&lt;/P&gt;&lt;P&gt;     from /BI0/TPRD_HIER&lt;/P&gt;&lt;P&gt;      where PRD_HIER = lv_prdh5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      &amp;lt;result_fields&amp;gt;-/bic/ysind = lv_txtsh.&lt;/P&gt;&lt;P&gt;    endif.  &lt;/P&gt;&lt;P&gt;  endif. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify  RESULT_PACKAGE from &amp;lt;result_fields&amp;gt;.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2008 21:36:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/logic-for-end-routine/m-p/3579421#M861738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-31T21:36:44Z</dc:date>
    </item>
  </channel>
</rss>

