

How to trigger PaPM function from Analysis for Off... - SAP Community
source link: https://community.sap.com/t5/technology-blogs-by-members/how-to-trigger-papm-function-from-analysis-for-office/ba-p/13602142
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Let me share with your how to call PaPM function from Analysis for Office step-by-step.
Scenario allows user to update workbook by clicking on the button “Reconcile”. Button triggers remote call PaPM function by Function ID with parameters from workbook. In this case, variable “Planning version” value passed to PaPM function as selection fields.
To carry out into practice this scenario it is necessary proceed next steps:
- Create the PaPM environment and functions for processing
- Create the functional module additionally processing variables from workbook
- Create the set of BW objects to realize the planning function
- Create Macros to call the planning function
I describe each of them bellow in details.
1. Creating PaPM environment
My PaPM environment assumes reconciliation between two Model BW, implemented with Join and Writer function. Rules restricted by SELFLD0 and SELFLD1 fields, which are BW info-objects. SELFLD1 “Planning version” has a variable ZV_MSM_SELFLD1_01, which used in workbook. (SAP Help: SAP Profitability and Performance Management )
2. Creating the Functional Module
The functional module creating is carried out in thansaction SE37. Easy ABAP code allows implementing the necessary rules to construct the parameters string, passed to the standard functional.
FUNCTION ZNXI_RUN_BY_SELFLD1_FOX
IMPORTING
VALUE(I_ENV_ID) TYPE /NXI/P1_DTE_ENV_ID
VALUE(I_VER) TYPE /NXI/P1_DTE_VER
VALUE(I_FID) TYPE /NXI/P1_DTE_FID
VALUE(I_PROC_ID) TYPE /NXI/P1_DTE_PROC_ID OPTIONAL
VALUE(I_SELFLD1) TYPE /BIC/OISELFLD1 OPTIONAL
EXPORTING
VALUE(E_EXPTN) TYPE I. "Type’s used to easy access in FOX
TYPES:
BEGIN OF ls_AUXSTRC,
/bic/SELFLD0 TYPE /bic/oiSELFLD0, "Dependent selection field
/bic/SELFLD1 TYPE /bic/oiSELFLD1, "Selection field from Workbook
END OF ls_AUXSTRC.
DATA:
l_selfld1 TYPE /BIC/OISELFLD1 VALUE '',
l_pckg_sel TYPE /NXI/P1_DTE_PACKAGE_SEL VALUE '',
l_tab_msg TYPE BAPIRET2_TAB.
E_EXPTN = 0. "OK execution by default
IF I_ENV_ID IS INITIAL OR I_VER IS INITIAL OR I_FID IS INITIAL.
E_EXPTN = 1. "Must be defined
RETURN.
ENDIF.
IF I_PROC_ID IS INITIAL.
l_selfld1 = I_SELFLD1. "If proccess wasn’t defined, selection field should be
ENDIF.
IF l_selfld1 IS NOT INITIAL.
SELECT SINGLE * FROM MYRELTBL INTO @DATA(ls_AUXSTRC)
WHERE /BIC/SELFLD1 = @I_SELFLD1.
CONCATENATE 'SELFLD0=( SELFLD0 = ''' ls_AUXSTRC-/bic/SELFLD0
''');SELFLD1=( SELFLD1 = ''' ls_AUXSTRC-/bic/SELFLD1 ''')' INTO l_pckg_sel.
ENDIF.
CALL FUNCTION '/NXI/P1_FW_RUN_FUNCTION_PC'
EXPORTING
i_env_id = I_ENV_ID
i_ver = I_VER
i_fid = I_FID
i_proc_id = I_PROC_ID
i_package_sel = l_pckg_sel
i_run_type = 'RUN'
i_rspc_synchronous = 'X'
i_execute_post_run = 'X'
IMPORTING
e_tab_msg = l_tab_msg.
IF l_tab_msg IS NOT INITIAL.
E_EXPTN = 2. "Execution with errors
RETURN.
ENDIF.
ENDFUNCTION.
To allow using the function ZNXI_RUN_BY_SELFLD1_FOX inside the FOX script, it should be declared in table RSPLF_FDIR via transaction SM30.
3. Creating the set of the BW objects to realize the planning function
The blog post How to Trigger BW Process Chains from Analysis for Office explains clearly and in detail how to create the set of objects for planning. As a result, set of ADSO ZNXIDZ20, Composit Provider ZNXIVZ20, Aggregation ZNXIAZ20 are created.
In my case, ADSO ZNXIDZ20 consists of combination of standard info-objects /NXI* and Info-object SELFLD1, which store the selection filed value. Using SELFLD1 gives easy access to the necessary type within the FOX script, described below.
The Planning function ZNXAZ20_F001 is a formula type function (0RSPL_FORMULA) with the next configuration:
The following FOX script inside the planning function ZNXAZ20_F001 looks like bellow.
DATA LV_ENV TYPE /NXI/ENV_ID.
DATA LV_VER TYPE /NXI/VER.
DATA LV_FID TYPE /NXI/FID.
DATA LV_PS_V TYPE SELFLD1.
DATA LV_ERR TYPE I.
LV_FID = VARV( 'ZV_MSM_NXIFID_01' ).
LV_PS_V = VARV( 'ZV_MSM_SELFLD1_01' ).
LV_ENV = VARV( 'ZV_MSM_NXIENV_01' ).
LV_VER = VARV( 'ZV_MSM_NXIVER_01' ).
CALL FUNCTION 'ZNXI_RUN_BY_SELFLD1_FOX'
EXPORTING I_ENV_ID = LV_ENV I_VER = LV_VER I_FID = LV_FID I_SELFLD1 = LV_PS_V
IMPORTING E_EXPTN = LV_ERR.
IF LV_ERR <> 0.
MESSAGE E000( 0 ) WITH 'Error! Watch Application Monitor for details.'.
ENDIF.
4. Creating Macros to call planning function
And the last but not least, Workbook macros for Reconcile button should be defined.
Add Planning function ZNXAZ20_F001 to workbook with alias PF_1. After that, add macros code like bellow:
Public Sub ReconcileButtonAction()
Call Application.Run("SAPExecutePlanningFunction", "PF_1")
Call Application.Run(“SAPExecuteCommand”, "Refresh", "DS_1")
End Sub
Вesides the Planning function execution, the related data store with alias DS_1 might be refreshed.
How to add the planning function described in blog post Using Planning Objects in Analysis For Microsoft Excel .
Thank you for reading through and I hope you now get a knowledge to apply in your practice.
Irina.
Recommend
-
7
Is there a method for creating a trigger and trigger function in a single query in PostgreSQL advertisements I have a problem with PostgreSQL....
-
9
How to create an event in AWS Cloudwatch to trigger a Lambda Function Amazon CloudWatch Events describe changes in AWS resources. We can match events and route them to one or more target functions. CloudWatch Events come to know abo...
-
6
Paul Anthony Gabog April 4, 2022 3 minute read ...
-
5
SAP PaPM Cloud: Uploading Input Data Efficiently With more than a year since SAP Profitability and Performance Management Cloud (SAP PaPM Cloud) was released to the market, customers are now starting to configure, model an...
-
6
Less than a month ago, one of my colleagues released a blogpost SAP PaPM Cloud : “When” to expect “What” to reach your tenant w...
-
5
Justine Angeles March 11, 2022 6 minute read...
-
10
【Azure 应用服务】本地创建Azure Function Kafka Trigger 函数和Kafka output的HTTP Trigger函数实验 ...
-
9
经过前两篇文章,分别使用VM搭建了Kafka服务,创建了Azure Function项目,并且都在本地运行成功。 现在,本文中将把Kafka Trigger Function代码部署到Azure中,并解决Function在云上运行时遇见的 (Failed to resolve 'xxxxxxtest01.c2vbkl4ntjrehlq...
-
7
Introduction AWS Lambda Event Notifications allow you to receive notifications when certain events happen in your...
-
9
Opinion: How Elon Musk's removal of the block function on X could trigger its hellish demise by Jay Daniel Thompson,...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK