<?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 Re: Data fetch from live cache in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-fetch-from-live-cache/m-p/3887975#M933965</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some time ago I worked on SAP APO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To read live cache, you first have to open a SIM session.&lt;/P&gt;&lt;P&gt;You can do this as shown in this function module:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION ZS_SIMSESSION_GET.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IV_SIMID) TYPE  /SAPAPO/VRSIOID
*"  EXPORTING
*"     REFERENCE(EV_SIMSESSION) TYPE  /SAPAPO/OM_SIMSESSION
*"----------------------------------------------------------------------
CONSTANTS:
  lc_simsession_new       TYPE c LENGTH 1 VALUE 'N'.

DATA:
  lt_rc                   TYPE /sapapo/om_lc_rc_tab,
  lv_simsession           LIKE ev_simsession.

  IF NOT ev_simsession IS INITIAL.
    EXIT.
  ENDIF.

*--&amp;gt; create Simsession
  CALL FUNCTION 'GUID_CREATE'
    IMPORTING
      ev_guid_22 = lv_simsession.

*--&amp;gt; create transactional simulation
  CALL FUNCTION '/SAPAPO/TSIM_SIMULATION_CONTRL'
    EXPORTING
      iv_simversion            = iv_simid
      iv_simsession            = lv_simsession
      iv_simsession_method     = lc_simsession_new
      iv_perform_commit        = space
    IMPORTING
      et_rc                    = lt_rc
    EXCEPTIONS
      lc_connect_failed        = 1
      lc_com_error             = 2
      lc_appl_error            = 3
      multi_tasim_registration = 4.
  IF sy-subrc &amp;gt; 0.
    CLEAR ev_simsession.
*   error can be found in lt_rc
  ENDIF.

* return simsession
  ev_simsession = lv_simsession.

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can access the live cache.&lt;/P&gt;&lt;P&gt;In this case we read an order (if I rememver correctly, it's a plan order):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
  lv_vrsioid                  TYPE /sapapo/vrsioid,
  lv_simsession           TYPE /sapapo/om_simsession.

* Get vrsioid
  CALL FUNCTION '/SAPAPO/DM_VRSIOEX_GET_VRSIOID'
    EXPORTING
      i_vrsioex_fld = '000'  "By default
    IMPORTING
      e_vrsioid_fld = lv_vrsioid
    EXCEPTIONS
      not_found     = 1
      OTHERS        = 2.

CALL FUNCTION 'ZS_SIMSESSION_GET'
      EXPORTING
        iv_simid      = iv_vrsioid
      IMPORTING
        ev_simsession = lv_simsession.

  CALL FUNCTION '/SAPAPO/RRP_LC_ORDER_GET_DATA'
    EXPORTING
      iv_order      = iv_orderid
      iv_simversion = iv_vrsioid
    IMPORTING
      et_outputs    = lt_outputs
      et_inputs     = lt_inputs.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you change something in your simsession, you have to merge it back afterwards, so that your changes become effective.&lt;/P&gt;&lt;P&gt;You can do this like that:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Merge simulation version (to commit order changes)
  CALL FUNCTION '/SAPAPO/TSIM_SIMULATION_CONTRL'
    EXPORTING
      iv_simversion                = lv_vrsioid
      iv_simsession                = lv_simsession
      iv_simsession_method         = 'M'
    EXCEPTIONS
      lc_connect_failed            = 1
      lc_com_error                 = 2
      lc_appl_error                = 3
      multi_tasim_registration     = 4
      target_deleted_saveas_failed = 5
      OTHERS                       = 6.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Nov 2010 20:43:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-11-25T20:43:09Z</dc:date>
    <item>
      <title>Data fetch from live cache</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-fetch-from-live-cache/m-p/3887973#M933963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I retrieve data from live cache?This is in Demand Planning : SCM APO.&lt;/P&gt;&lt;P&gt;Please suggest ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Savitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 15:46:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-fetch-from-live-cache/m-p/3887973#M933963</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T15:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Data fetch from live cache</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-fetch-from-live-cache/m-p/3887974#M933964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone knows this? I would also know how to get data from LiveCache by ABAP coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR, Jari Seppänen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Nov 2010 15:06:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-fetch-from-live-cache/m-p/3887974#M933964</guid>
      <dc:creator>former_member519147</dc:creator>
      <dc:date>2010-11-25T15:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data fetch from live cache</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-fetch-from-live-cache/m-p/3887975#M933965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some time ago I worked on SAP APO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To read live cache, you first have to open a SIM session.&lt;/P&gt;&lt;P&gt;You can do this as shown in this function module:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION ZS_SIMSESSION_GET.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IV_SIMID) TYPE  /SAPAPO/VRSIOID
*"  EXPORTING
*"     REFERENCE(EV_SIMSESSION) TYPE  /SAPAPO/OM_SIMSESSION
*"----------------------------------------------------------------------
CONSTANTS:
  lc_simsession_new       TYPE c LENGTH 1 VALUE 'N'.

DATA:
  lt_rc                   TYPE /sapapo/om_lc_rc_tab,
  lv_simsession           LIKE ev_simsession.

  IF NOT ev_simsession IS INITIAL.
    EXIT.
  ENDIF.

*--&amp;gt; create Simsession
  CALL FUNCTION 'GUID_CREATE'
    IMPORTING
      ev_guid_22 = lv_simsession.

*--&amp;gt; create transactional simulation
  CALL FUNCTION '/SAPAPO/TSIM_SIMULATION_CONTRL'
    EXPORTING
      iv_simversion            = iv_simid
      iv_simsession            = lv_simsession
      iv_simsession_method     = lc_simsession_new
      iv_perform_commit        = space
    IMPORTING
      et_rc                    = lt_rc
    EXCEPTIONS
      lc_connect_failed        = 1
      lc_com_error             = 2
      lc_appl_error            = 3
      multi_tasim_registration = 4.
  IF sy-subrc &amp;gt; 0.
    CLEAR ev_simsession.
*   error can be found in lt_rc
  ENDIF.

* return simsession
  ev_simsession = lv_simsession.

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can access the live cache.&lt;/P&gt;&lt;P&gt;In this case we read an order (if I rememver correctly, it's a plan order):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
  lv_vrsioid                  TYPE /sapapo/vrsioid,
  lv_simsession           TYPE /sapapo/om_simsession.

* Get vrsioid
  CALL FUNCTION '/SAPAPO/DM_VRSIOEX_GET_VRSIOID'
    EXPORTING
      i_vrsioex_fld = '000'  "By default
    IMPORTING
      e_vrsioid_fld = lv_vrsioid
    EXCEPTIONS
      not_found     = 1
      OTHERS        = 2.

CALL FUNCTION 'ZS_SIMSESSION_GET'
      EXPORTING
        iv_simid      = iv_vrsioid
      IMPORTING
        ev_simsession = lv_simsession.

  CALL FUNCTION '/SAPAPO/RRP_LC_ORDER_GET_DATA'
    EXPORTING
      iv_order      = iv_orderid
      iv_simversion = iv_vrsioid
    IMPORTING
      et_outputs    = lt_outputs
      et_inputs     = lt_inputs.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you change something in your simsession, you have to merge it back afterwards, so that your changes become effective.&lt;/P&gt;&lt;P&gt;You can do this like that:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Merge simulation version (to commit order changes)
  CALL FUNCTION '/SAPAPO/TSIM_SIMULATION_CONTRL'
    EXPORTING
      iv_simversion                = lv_vrsioid
      iv_simsession                = lv_simsession
      iv_simsession_method         = 'M'
    EXCEPTIONS
      lc_connect_failed            = 1
      lc_com_error                 = 2
      lc_appl_error                = 3
      multi_tasim_registration     = 4
      target_deleted_saveas_failed = 5
      OTHERS                       = 6.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Nov 2010 20:43:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-fetch-from-live-cache/m-p/3887975#M933965</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-25T20:43:09Z</dc:date>
    </item>
  </channel>
</rss>

