Trying out UBOI interfaces in SAP FS-PM solution
When one starts to work with policy management solution from SAP it is important to get familiar with the product . Especially if you are tasked to work with some custom development.
There are few frameworks that make sure things work smoothly in FSPM such as PBT (Policy based technology ) and Time model Functions( to enable the policy positioning n the past or in the future ) . Along with learning these frameworks it is always useful to play with the existing available UBOI interfaces and learn how it works .
Most of the tasks in the FSPM are depending on the policy business object which is manipulated using various UBOI interfaces depending on the requirement.
Please find below sample program to start playing with UBOI interfaces in SAP FS-PM
DATA:
lr_date_service TYPE REF TO /pm0/if_abp_bc_extcordt_srvcs,
lr_date_service_init TYPE REF TO /pm0/cl_abp_bc_excodt_srvcs,
ls_polpr_key TYPE /pm0/abvapolpr, “/PM0/ABVAPOLICY
lt_polpr_keys TYPE /pm0/abvapolpr_t,
lf_extenal_date TYPE abap_bool,
lf_correspondence_date TYPE abap_bool,
lf_bts_date TYPE abap_bool,
lv_applnr_tt TYPE /pm0/abd_applnr_tt,
iv_planstate_id TYPE /pm0/abd_stateextdate_id,
it_polpr TYPE /pm0/abwapolpr_t,
gr_get_policy TYPE REF TO /pm0/if_abp_tc_get_policy,
gr_get_polpr TYPE REF TO /pm0/if_abp_tc_get_polpr,
gr_get_cov TYPE REF TO /pm0/if_abp_tc_get_cov,
lr_uboi TYPE REF TO /pm0/cl_abp_bou_ctr_fac,
ls_policy_key TYPE /pm0/abvapolicy,
it_policy TYPE TABLE OF /pm0/abwapolicy,
lv_duedate TYPE /pm0/abd_duedate_dt.
BREAK-POINT.
DATA :
it_covdetail TYPE TABLE OF /pm0/abwacov,
is_sec_cov TYPE /pm0/abvacov,
ls_cov_det TYPE /pm0/abwacov.
/pm0/cl_ab_bpu_registry=>init( ‘D’).
IF /pm0/cl_ab_bpu_registry=>gr_ctr_fac IS BOUND.
gr_get_policy = /pm0/cl_ab_bpu_registry=>gr_ctr_fac->get_gb_policy( ).
gr_get_polpr = /pm0/cl_ab_bpu_registry=>gr_ctr_fac->get_gb_polpr( ).
gr_get_cov = /pm0/cl_ab_bpu_registry=>gr_ctr_fac->get_gb_cov( ).
ENDIF.
FIELD-SYMBOLS : <fs_polpr> TYPE /pm0/abwapolpr.
*get the application number for a certain existing policy
SELECT SINGLE c~applnr_tt INTO lv_applnr_tt FROM /pm0/abdapolicy AS p INNER JOIN /pm0/abdapolpr AS c ON p~secpol_id = c~policy_id
WHERE p~policynr_tt = ” .“enter existing policy number here
“initialize
/pm0/cl_abp_bc_excodt_srvcs=>initialize_application().
*get reference to the date service
lr_date_service = /pm0/cl_abp_bc_excodt_srvcs=>get_singleton( ).
lr_date_service_init ?= lr_date_service.
*Load the application
lr_date_service_init->load_application(
EXPORTING
iv_effective_dt = sy–datum
iv_policynr_tt = ”“enter existing policy number here
iv_polprnr_tt = lv_applnr_tt
IMPORTING
es_polpr_key = ls_polpr_key
ev_planstate_id = iv_planstate_id
).
CHECK iv_planstate_id EQ ‘0’. ” Plane State OK
ls_policy_key–bo_id = ls_polpr_key–bo_id.
*Get policy Data
TRY.
CALL METHOD gr_get_policy->get_policy
EXPORTING
is_sec = ls_policy_key
IMPORTING
et_policy = it_policy.
CATCH /pm0/cx_abp_uboi .
WRITE : ‘Exception in UBOI’.
CATCH /pm0/cx_3ft_exception .
WRITE : ‘Exception in Framework’.
ENDTRY.
*Get contract data
CALL METHOD gr_get_polpr->get_polpr
EXPORTING
is_sec = ls_polpr_key
IMPORTING
et_polpr = it_polpr.
READ TABLE it_polpr ASSIGNING <fs_polpr> INDEX 1.
MOVE-CORRESPONDING ls_polpr_key TO is_sec_cov.
*Get Coverage data
TRY.
CALL METHOD gr_get_cov->get_cov
EXPORTING
is_sec = is_sec_cov
IMPORTING
et_cov = it_covdetail.
CATCH /pm0/cx_abp_uboi .
CATCH /pm0/cx_3ft_exception .
ENDTRY.
Similarly some other APIS can also be used once the policy BO is loaded
DATA: et_document_cf TYPE /pm0/abcn_cashfl_t,
et_cfdocs TYPE /pm0/abn_cashfl_t,
account_data TYPE REF TO /pm0/cl_ab_int_ac,
et_document_nc TYPE /pm0/abcn_nocash_t.
CREATE OBJECT account_data.
*get cash-flow documents for certain Contract
CALL METHOD account_data->/pm0/if_ab_int_ac~get_docs_cf
EXPORTING
is_polpr_key = ls_polpr_key
IMPORTING
et_document_cf = et_document_cf
et_cfdocs = et_cfdocs.
*get non cash flow documents for certain contract
CALL METHOD account_data->/pm0/if_ab_int_ac~get_docs_nc
EXPORTING
is_polpr_key = ls_polpr_key
IMPORTING
et_document_nc = et_document_nc.
BREAK-POINT.
Hi Amit,
Ii just stumbled over your blog post being surprised that FS-PM now offers publicly available documented APIs. Well, it is not the case, it is the "good old" UBOI interfaces that allow you to interact with the business object (and some other objects in FS-PM like the journal) 🙂 .
Taking a look at your code I have to make some remarks as several spots are not as they should be (at least from my experience):
Cheers
Christian
Thank you very much for going through the blog and replying with really useful information . I decided to share this as I started with FS-PM doing something like this. Really appreciate your valuable inputs here.
the replying is really useful indeed, I would say, not only for guys just started with FS-PM but also for people who have worked with FS-PM for a while. the framework of FS-PM is so complex.
Thank you very much really helpful information .
Can I get some materials related to the FSPM to get the clear concept related to the TMF and BTX.
Thanks in advance.
Hi Naren,
Check out the documentation page of FS-PM.
The development team recently published a guide for both topics. You can find them under the right-hand side column labelled "How To-Guides".
Cheers,
Michael
Thanks for your valuable feedback.
Really helpful information and documents on FSPM.