Data fetch from live cache

How can I retrieve data from live cache?This is in Demand Planning : SCM APO.
Please suggest ways.
Thanks & Regards,
Savitha

Hi,
some time ago I worked on SAP APO.
To read live cache, you first have to open a SIM session.
You can do this as shown in this function module:
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.
*--> create Simsession
  CALL FUNCTION 'GUID_CREATE'
    IMPORTING
      ev_guid_22 = lv_simsession.
*--> 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 > 0.
    CLEAR ev_simsession.
*   error can be found in lt_rc
  ENDIF.
* return simsession
  ev_simsession = lv_simsession.
ENDFUNCTION.
Then you can access the live cache.
In this case we read an order (if I rememver correctly, it's a plan order):
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.
If you change something in your simsession, you have to merge it back afterwards, so that your changes become effective.
You can do this like that:
* 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.
I hope this helps...

Similar Messages

  • MRP Data from Live Cache

    Hi
    Please let me know the FM/BAPI which will get me the MRP data from Live cache.
    My requirement is to get the date and quantity for each element, MRP elements to be used are VC,VE,LF based on the plant and material
    Thanks in advance
    Amit

    Hello Sebastian,
    FM '/SAPAPO/OM_PEG_CAT_GET_ORDERS' seems to cover my requirements and I'm happy I found out about it here. Unfortunately I have some problems testing with SE37:
    Specifying only PEGID together with needed categories was not successful. Searching for calling programs of this FM I found FM '/SAPAPO/ATP_DISP_LC_SINGLE' which additionally sets parameter IS_GEN_PARAMS-SIMVERSION to '000' and receives the correct values.
    Now I have the problem that with setting the same input values I still receive exception 'LC_APPL_ERROR' and don't know why. Since I'm new to APO it could be some basic setting, still I'm wondering why this could be. Hopefully you can provide some helpful information, otherwise I think I'm lost
    Thanks in advance,
    eddy

  • Read AMON1 from live cache

    HI Gurus,
    I want to read AMON1 data from live cache.Could you guys help me in this.
    Regards

    CALL FUNCTION '/SAPAPO/OM_ALERTS_GET_DATA'
    EXPORTING
    is_gen_params     = ls_gen_params
    iv_simsession     = lv_simsession
    it_peglist        = lt_pegid
    it_alertid        = lt_alertid
    IMPORTING
    et_alerts         = lt_alerts
    et_rc             = lt_rc
    EXCEPTIONS
    lc_connect_failed = 1
    lc_com_error      = 2
    lc_appl_error     = 3
    OTHERS            = 4.
    There is a new book on Programming in SAP APO. You might want to check that out.
    http://www.flipkart.com/programming-sap-apo-1st/p/itmdgt9hbdh6auzu?pid=9781259028441&ref=bc49ea80-1a9b-403b-b9b7-9cf00d7f05db&srno=s_1&otracker=from-search&query=ankush%20agrawal

  • Data fetching from BSEG table

    Hi,
    I have used smartforms for generating suppler payment statement for financial department. more time duration is taken by the program when it is generating.
    I think this problem comes while data fetching from BSEG table. because, it has more records for one vendor ID.
    I want reduce this time duration.
    Please guide me.

    Have you tried this selection in se16? I'm quite sure that It will take
    a long time.
    The problem has been explained in this group before and I think you
    should search for bseg in the answers given.
    As a hint: It has to do with the selection universe. You are restricting
    only bukrs from the primary key (all the other restrictions in your
    where clause are filters that are applied on SAP's side (not on the
    database side)). The problem is that bseg isn't stored as separated
    fields in the RDBMS, but as a table with the primary key and a stream of
    bits in a raw field.
    You should review and change the logic you're using before reading bseg.
    It's the only way you'll improve the performance of this select. (for
    example, you could use one or more secondary index tables - bi or ba
    to retrieve belnr and access bseg with a better where clause).

  • Deleting orders from Live Cache

    Hi Gurus,
    Is there any way where we can delete orders directly from Live cache?
    I have a situation where Process orders are present in R/3 and not available in APO. It shows up in the CCR report, but when we push them it gets stuck in the queue with the error Order Type 6 and 'A table entry exists with this Secondary Key'.
    I verified these orders in OM16 transaction and these orders are available there, but I am unable to view them in RRP3. When I check in Tcode: OM19 this is availavble in ORDMAP Object.
    Is there any way I can delete them from directly Live cache ? or how can I make both the systems sync?
    Thanks in advance.
    Regards,
    Murali.

    Hi
    Check the following
    1)Use this Program /SAPAPO/DELETE_PP_ORDER and make sure the check box LV_EXECU is ticked and specify the time period of the orders. Becuase some times without specifying the above it will not display the details
    2) Use the Program /SAPAPO/RLCDELETE and execute. I'm not sure on this. But you can try
    3) Tell me- This Process orders are created in R3 and ciffed to APO or it got converted in APO from Planned order to Production order. Pls look at the origin of Process orders
    Hope this helps
    regards
    Vijay

  • Data fetch from table without Refresh and without using tab key.

    hi Friends,
    I have a problem i want to extract data from table without Refresh into text field without using Tab key. when i'll enter any value in a text field then corressponding value should come in to corressponding textfield without using Tab Key.
    eg. when i enter emp_id 101 in a text field then the first_name and last_name ,adress should come in to corressponding text fields without refresh and without using Tab key.
    How Can I do this.
    Thanks
    Manoj

    Hi Manoj,
    I assume that this is similar to: Data fetch without Refresh rather than Re: Value of one textfield should come into another textfield Without Using TAB ?
    If so, the only change you need to make on the first one is to use "onkeyup" instead of "onchange" in the item's "HTML Form Element Attributes" setting.
    Note, however, that the user must move away from the item at some point (for example, to click a button), so the onchange will be triggered anyway.
    Andy

  • Data storage in Live Cache

    Hi,
         Can some1 explain me how the SNP data is stored in the live cache.
    I know it's by series of order. But tell me is there any mapping involved in it?
    Thanks,
    Siva.

    Order series data is used by both SNP and PPDS.
    While I do not know the exact way data is stored in liveCache the following helps me to explain and understand.
    Each record in liveCache for Order Series data is stored as
    Location Product combination-ATP Category-Quantity-Time Stamp.
    Unlike Timeseries data CVC is replaced by a location product combination only, keyfigure is replaced by ATP Category (each kind of Order elements has its own ATP Category) and Time Bucket is replaced by actual Time Stamp (in UTC ddmmyyyyhhmmss format).
    The mapping is essentially with ATP Category which maps to corresponding MRP elements in ECC or R/3.
    In the SNP Planning Area for each keyfigure the Category Group defines the grouping of ATP Categories for which orderseries data will be displayed in that particular keyfigure.
    Hope this helps.
    Thanks,
    Somnath

  • Data fetched from buffer or database

    Hi,
    How to check tin the select query the data is being fetched from buffer or database .Is there any method to trace that  or it is just the setting we are  doing while creating a table..
    Pls suggest

    Hi,
    >
    arun purushothaman wrote:
    >Is there any method to trace that  or it is just the setting we are  doing while creating a table..
    > Pls suggest
    sure. ST05.
    SQL Trace shows everything that is going to the database. This means those statements are NOT
    using the buffer. The SQL Trace lines are yellow.
    Buffer Trace shows everything that is going to the buffer. This means those statements are NOT
    going to the database. The Buffer Trace lines are blue.
    Kind regards,
    Hermann

  • Data fetching from Standard tables or transaction to SAP PI

    Dear Friends !
         Good day ! How are you ? 
         I have one requirement , My client asks me to develop a solution in that I should get the data from standard SAP tables like EKKO, EKPO ( MM related ) etc..  and send it to PI system and then PI system sends it to third party system database system.
    We have current scenario is working fine,  I have abap proxy that I called in various  standard transaction codes ( MIRO, MIGO, etc ) ' Baddis just beforethe commit stament and it passed the data to SAP PI system and it sends to SQL system.
    but my client dont want me to use Baddis. Client wants  like u should read from those EKKO,EKPO tables as soon as you get new entry there and send it to PI system.  I have no clue How can I go further in that. Shall I use events ? but then question is same I need to trgger them somewere?  Is any one have idea  How I can send the data to PI system frm SAP standard tcodes and tables without using Baddis.
    Please reply me. your any help will be appreciated.
    Regards
    Naeem

    The current Approach of your development perfectly good approach,
    it is not possbiel to read data directly from SAP Tables, you have to use IDoc/RFC/Proxy,if you want to avoid BADI's then better to contact ABAP Team, they will help you different approches .
    But you have to use Porxy/IDoc/BAPI for sure.
    Regards,
    Raj

  • Data written to Live cache but not visible in SNP Planning Book

    Hello All,
    We have an issue this morning, Customer service cordinator placed a Purchase Order in SNP (VMI). Order was sent to ECC and a sales order was created. This morning when we check the sales order, it shows 4574 cases but in TLB Pur chase order, it only some 2000 something. I went to OM16 and checked the sales order and it had the entire 4574 cases written in the live cache. Any help on how to get the entire quantity to be seen is appreciated. Thank you.
    Regards,
    Rohit.

    Hi Ada,
    Thanks for the reply. The issue got resolved by itself.
    Regards,
    Rohit.

  • Get orders from Live cache

    Hi,
              I want to find out how many orders do we have in the live cache by orders.
    I have
    BAPI_MOSRVAPS_GETLIST3 to get Planned/Production orders together.
    But I want to get the number of Planned orders and Production orders seperately. How can I get that?
    I have BAPI_POSRVAPS_GETLIST3 to get Purchase requisitions/orders.
    How can i get a breakup of how many each are?
    Also I want to find out how many "Manual Reservations" are. is there a FM or BAPI for this?
    Thanks.

    Hi Visu,
    Base on ATP Category you can look for PO /PReq and Prod order and pld order .
    You can look for the right category in planning area : /SAPAPO/MSDP_ADMIN.
    Like :
    Purchase req: AG
    Purorder:BF
    Manish

  • Perofrmance issue on data fetch from db table

    Dear Experts,
    I have one requirement which explained below step wise.
    Step - 1 : I have a parameter on selection screen from where i ll get my ebeln value (User Input field) and that ebeln i ll check in ekpo table for validations.
                  If valid i  keep it in a variable gw_ebeln.
    Step - 2 : Need to fetch lifnr fron ekko based on gw_ebeln value.
    Step - 3 : Need to fetch adrnr from lfa1 based on lifnr (Previously fetched from ekko table in step 2)
    Step - 4 : Need to fetch email field from adr6 table based on adrnr value (Previously fetched from lfa1 table in step 3)
    Step - 5 : Now for these mail id , I need to send mail by given fm.
    My question is : I can create structure for step 2 , step 3, step 4 and by using " for all entries " in select statement i ll fetch my mail id in step 4.
    So instead of creating structure and then use for all entries , I can fetch by using "select single" statement for step 2 , step3 step 4.bcz i am fetching only one field from all 3 table.
    So which one is better performance wise and why ?
    I need more and clear clarifications on these difference.
    Please provide me suggestions.
    Thanks & Regards,
    Ajit Sarangi

    Hi Ajit,
    We are referring item table EKPO. Multiple entries are possible.
    To append the values in final internal table, we are going to process the LOOP. Inside loop, we should not use the Select statement, that decreases the performance. Database Interaction process should not done inside Loop...Endloop.
    That's why we are creating the Internal table for processing the values. Since we need limited number of fields in the particular table, we are creating our own structure in the program.
    For this case, For all entries will give better performance with compare to Select Single.
    Regards
    Rajkumar Narsimman

  • Fetching order data from Live Cache

    Hi
    The requirement is to fetch order data from liveCache for a given product based on ATP category . (AY - dependent demands and AU - order reservations)
    I want to get information about the dates and order quantity.
    I have identified following two FM's.
    /SAPAPO/OM_PEG_CAT_GET_ORDERS
    /SAPAPO/OM_ORDER_GET_DATA
    Which one of the two FM is more suitable specific to my requirement ? Also what are the important parameters to be passed in the applicable FM ?
    I would also like to know the difference in these two FMs?
    Thanks in advance,
    Yogesh

    Hi,
    I tried FM PAPO/OM_PEG_CAT_GET_ORDERS
    I am giving the following inputs
    1. PEGID which I am getting from /SAPAPO/DM_MATERIAL_GET_PEGID for a given product location.
    2. ATP category in IT_CATEGORY = BM and CC
    3. V_SIMSESSION = 000
    4. IV_IONODE_PEG_SEL = 0
    But I am getting LC_COM_ERROR
    What parameters am I missing ?
    Regards,
    Yogesh

  • Data fetch from table GLPCA taking long .

    Hi Friends,
    I am fetching five fields from GLPCA table and i have RACCT and RPRCTR ( account Number and profit Centre res ) in the where condition. neither of these field is the primary key of the table GLPCA. I have around 161096,482 entries in the GLPCA. It takes around 20 min to fetch the data. can you guys think of some method so that it works faster.

    Hi Vidya,
    The time utilization is due to the way data base is been accessed. Just think that you are selecting same data in SE16 with 200 hits. See how that behaves. If you find its Ok(i.e. around 1/2 mins) go for open cursor logic. Check this syntax and change the code accordigly and try:
    OPEN CURSOR w_cur1 FOR
           SELECT  ktabg vkorg ktaar ktaer kunnr
                   vtweg spart
                   FROM vbka
                   WHERE ktabg IN so_ktabg AND
                         vkorg IN so_vkorg AND
                         kunnr IN so_kunnr AND
                         ktaar IN so_ktaar AND
                         ktaer IN so_ktaer.
        DO.
          FETCH NEXT CURSOR w_cur1 INTO CORRESPONDING
                FIELDS OF TABLE it_vbka2 PACKAGE SIZE 200.
          IF sy-subrc NE 0.
            CLOSE CURSOR w_cur1.
            EXIT.
          ENDIF.
       ENDDO.
      It behaves just like Select ... Endselect. The most important thing here is the Pakage size which you have to decide based on the SE16 results. Also please mind that if the Package size is less, number of times it hits the DB is high, reducing the efficiency thereby.
    Regards & Thanks,
    Anand

  • Cost center data fetch from COSS/COSP tables.

    Hi Experts,
    I need to fetch data from COSS/COSP tables for particular Cost centers fetched in CSKS select.
    As there is no Costcenter field I cannot access the database tables directly.
    Fetching entire dat and then deleting is causing performance issue with the report.
    I need to reduse the time taken by COSS/COSP table select , as I have Cost center field on the selection screen.
    Is there any other method or  FM that I can use?
    Thanks in advance!!!

    Hi
    This is my code to get the data from a certain cost element group:
    }call function 'G_SET_GET_ID_FROM_NAME'
         exporting
           shortname                      = p_kagru
           tabname                        = 'CCSS'
           fieldname                      = 'KSTAR'
           kokrs                          = p_kokrs
           ktopl                          = 'ENPC'
           setclass                       = '0102'
           check_set_empty                = 'X'
         importing
           new_setid                      = setid
    *     SET_INFO                       =
        exceptions
          no_set_found                   = 1
          no_set_picked_from_popup       = 2
          wrong_class                    = 3
          wrong_subclass                 = 4
          table_field_not_found          = 5
          fields_dont_match              = 6
          set_is_empty                   = 7
          formula_in_set                 = 8
          set_is_dynamic                 = 9
          others                         = 10
       if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       endif.
       call function 'G_SET_GET_ALL_VALUES'
         exporting
    *     CLIENT                      = ' '
    *     FORMULA_RETRIEVAL           = ' '
    *     LEVEL                       = 0
           setnr                       = setid
    *     VARIABLES_REPLACEMENT       = ' '
    *     TABLE                       = ' '
    *     CLASS                       = ' '
    *     NO_DESCRIPTIONS             = 'X'
    *     NO_RW_INFO                  = 'X'
    *     DATE_FROM                   =
    *     DATE_TO                     =
    *     FIELDNAME                   = ' '
         tables
           set_values                  = t_set_values
        exceptions
          set_not_found               = 1
          others                      = 2
       if sy-subrc <> 0.
         message id sy-msgid type sy-msgty number sy-msgno
                 with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       endif.
      loop at t_set_values.
        count = count + 1.
        r_kstar(3) = 'IEQ'.
        r_kstar-low = t_set_values-from.
        append r_kstar.
        if count = 500.
          perform read_coep.
        else.
          at last.
            perform read_coep.
          endat.
        endif.
      endloop
    U can use somthing like that to get data from cost center
    Max

Maybe you are looking for

  • Audio attachment will not open and play on Ipad4 but works fine on PC. Any suggestions?

    I have been sent an audio attachment in an email to a Hotmail account. It opens and plays fine on my PC but will not open on my Ipad. I get a pop up wanting to forward the attachment from my Comcast email account but neither will open and play it. An

  • Inserting stop commands between clips

    I have 4 video clips that I plan to use for a presentation. I need the DVD to stop at the end of each clip, so I can talk about each one. What's the best (easiest) way to do this? TIA! MacBook Pro, Power Mac G5, Dual 2 ghz   Mac OS X (10.4.7)  

  • FCE crashes when import Live Type Files

    FCE crashes everytime I try and import a Live Type file. It even asks if I want to report a bug to apple. I have tried reinstalling both Live type and FCE with no luck. Any other ideas? Has anyone had this problem?

  • In conversation window, which calls are incoming a...

    Hi: On the Skype conversation window, I've got a list like this under a number for someone I've been trading messages with. Under "Today," here's what appears:  Call 39 seconds Call 16 seconds Call – no answer Call 47 seconds But are those incoming o

  • An error occurred while backing up this iPad (-5000)

    I'm trying to update someone else's iPad for him. Windows XP Home computer. Latest version of iTunes. The iOS 5 file has downloaded from Apple. When I start the upgrade, first step is a backup of the iPad. I get maybe 4 green bars on the progress win