This website has been archived, it is working in read-only mode.

This website has been archived, it is working in read-only mode.

hi all,

is it possible to read the livecache data? I need to ready a specific planning book/dataview for specific key figures.

thanks, neobat

asked 12 Dec '11, 14:38

neobat's gravatar image

neobat
16112
accept rate: 0%

edited 13 Dec '11, 04:49

pedrolima's gravatar image

pedrolima ♦♦
1.1k232840


Typically we read the livecache data indirectly using the function modules specific for the diferent objects. To read the planning book you can use BAPI_PBSRVAPS_GETDETAIL2. See below a minimal example of reading some data from a planning book using the BAPI.

ls_selection-characteristic_name = 'SP_MHO_IP'.
ls_selection-char_val_sign = 'I'.
ls_selection-char_val_option = 'EQ'.
ls_selection-char_val_low = 'SP-MHO-MAN-UM'.
append ls_selection to lt_selection.

ls_groupby-characteristic_name = 'SP_MHO_IP'.
append ls_groupby to lt_groupby.
ls_groupby-characteristic_name = 'SP_MHO_IM'.
append ls_groupby to lt_groupby.

ls_keyfigselection-key_figure = 'SP_MHO_CF'.
append ls_keyfigselection to lt_keyfigselection.

call function 'BAPI_PBSRVAPS_GETDETAIL2'
  exporting
    planningbook                = 'SP_MHO_PROGNOSE'
    data_view                   = 'INBOUND MSC'
    planning_version            = '000'
    period_type                 = 'D'
    date_from                   = '01.06.2004'
    date_to                     = '01.01.2005'
  tables
    selection                   = lt_selection
    group_by                    = lt_groupby
    key_figure_selection        = lt_keyfigselection
    key_figure                  = lt_keyfigure
    key_figure_value            = lt_keyfigure_value
    characteristics_combination = lt_ccomb
    return                      = lt_return.

You can also call directly the LC routines using database calls with native SQL (example below). But for most cases this is not needed.

  EXEC                                                  "#EC CI_EXECSQL
    SQL.
    EXECUTE PROCEDURE SAPTS_CHANGE_TG (
                        IN  :LS_GEN_COM_PARAMS,
*                       Return-Codes der COM-Routine
                        OUT :LV_RC,
                        OUT :ET_RC,
*                       Importdaten (Daten AN die COM-Routine)
                        IN  :IV_TG,
                        IN  :IV_TG_REF,
                        IN  :IV_TYPE,
                        IN  :LT_STAMPS,
                        IN  :IV_CHANGE_MODE
                        )
  ENDEXEC.

Update: Some more information on the parameters of the BAPI_PBSRVAPS_GETDETAIL2

An example probably helps. Consider a PA with characteristics COLOR, SHAPE, TEXTURE and with key figures FORECAST, SALES, OPEN.

These 3 tables are inputs to the function: selection, group_by, key_figure_selection.

selection: is a range table where you specify the characteristic values you want to restrict your data selection.

COLOR I EQ RED <- filter the results to only have CVCs with red color

group_by: lists the characteristics that will be in the output results. So if you have 5 characteristics in the PA but you only put one in this table, then your key figure values will be aggregated for the combinations of this single characteristic.

COLOR, SHAPE <- only show the combinations of color and shape; the key figures are aggregated to this level)

key_figure_selection: only the key figures in this list will be in the output.

FORECAST, SALES <- only show the SALES and FORECAST KF in the results

Output tables:

characteristics_combination - this table lists the output characteristic combinations values (CVCs) and for each CVC there is an ID that links to the other results tables

ID   C_NAME  C_VALUE 
1    COLOR   RED     
1    SHAPE   SQUARE  
2    COLOR   RED     
2    SHAPE   CIRCLE

key_figure - this is a table the lists combinations of the selected CVCs and key figures and for each combination there is a unique ID (that will be used in the KF values table)

KF_ID  CC_ID   KEY_FIGURE
1      1       SALES
2      2       SALES
3      1       FORECAST
4      2       FORECAST

key_figure_value - this table has the key figure values for each period in the selection and for each key figure ID (which is the combination of CVC and key figure).

KF_ID  BEGIN      END         VALUE
1      1.1.2012   31.1.2012      10
2      1.1.2012   31.1.2012      20
3      1.1.2012   31.1.2012      30
4      1.1.2012   31.1.2012      40
1      1.2.2012   29.2.2012       5
2      1.2.2012   29.2.2012       5
3      1.2.2012   29.2.2012       6
4      1.2.2012   29.2.2012       6
permanent link

answered 13 Dec '11, 04:48

pedrolima's gravatar image

pedrolima ♦♦
1.1k232840
accept rate: 32%

edited 30 Jan '12, 17:49

Hi Pedrolima,

Please also clarify this:

What does the below parameters signify in the BAPI?

key_figure                  = lt_keyfigure
key_figure_value            = lt_keyfigure_value
characteristics_combination = lt_ccomb
return                      = lt_return.

Also, please provide the declaration for the below objects:

lt_selection lt_groupby lt_keyfigselection

Thank you very much.

(07 Mar '12, 10:45) kgcharan

Hi kgcharan, you can find the declarations for all those variables by going to transaction SE37 and looking at the function definition for BAPI_PBSRVAPS_GETDETAIL2. The key figure, key figure value and characteristic combination are output tables in the BAPI, see above an example for the data that you can expect to see there. The detailed meaning of these fields is something that you can find in the demand planning documentation.

(12 Mar '12, 05:19) pedrolima ♦♦

Hi, Your reply was much helpful. But, can you please also explain all the lt_* internal tables used in teh BAPI. It would be much helpful and is greatly appreciated. Thanks.

permanent link

answered 30 Jan '12, 10:58

kgcharan's gravatar image

kgcharan
16337
accept rate: 0%

Hi kgcharan, I did a small update to explain the BAPI tables. Hope it helps.

(30 Jan '12, 17:51) pedrolima ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×15
×1

question asked: 12 Dec '11, 14:38

question was seen: 18,034 times

last updated: 12 Mar '12, 05:19