In SAP S/4HANA Sales, you can flexibly propose requested delivery dates and pricing dates by using the Configurable Parameters and Formulas (CPF) framework. The CPF framework enables you to create as complex a set of conditions for your business needs. Assignments can be made freely on combinations of values of a set of pre-defined sales document header fields, custom fields on sales document header, and other sales document header fields defined in your own data source.
In this blog post, you will learn to create your data source. The following steps and sample codes will guide you to add sales document header fields (fields from table VBAK) as input parameters by using your Business Add-In (BAdI) implementation.
METHOD if_cpf_data_source~get_value.
DATA: lv_component_name TYPE cpf_parameter_name,
lv_length TYPE I.
FIELD-SYMBOLS: <fs_param> TYPE cpfs_dtsrc_parameter,
<fs_vbak> TYPE vbak,
<fv_value> TYPE any,
<fs_name> TYPE any.
DATA(lr_data) = cl_sd_sls_va_factory=>get_reqd_deliv_date( )->get_source_data( ).
CHECK lr_data IS BOUND.
ASSIGN lr_data->* TO <fs_vbak>.
LOOP AT it_dtsrc_param ASSIGNING <fs_param>.
CASE <fs_param>-parameter_name.
WHEN ‘ZSOLDTOPARTY’.
ASSIGN <fs_param>-parameter_value->* TO <fv_value>.
<fv_value> = <fs_vbak>-KUNNR.
ENDCASE.
APPEND <fs_param> TO et_dtsrc_param.
ENDLOOP.
ENDMETHOD.
METHOD if_cpf_data_source~get_value.
DATA: lv_component_name TYPE cpf_parameter_name,
lv_length TYPE I.
FIELD-SYMBOLS: <fs_param> TYPE cpfs_dtsrc_parameter,
<fs_vbak> TYPE vbak,
<fv_value> TYPE any,
<fs_name> TYPE any.
DATA(lr_data) = cl_sd_sls_va_factory=>get_reqd_deliv_date( )->get_source_data( ).
CHECK lr_data IS BOUND.
ASSIGN lr_data->* TO <fs_vbak>.
LOOP AT it_dtsrc_param ASSIGNING <fs_param>.
CASE <fs_param>-parameter_name.
WHEN ‘ZSOLDTOPARTY’.
ASSIGN <fs_param>-parameter_value->* TO <fv_value>.
<fv_value> = <fs_vbak>-KUNNR.
ENDCASE.
APPEND <fs_param> TO et_dtsrc_param.
ENDLOOP.
ENDMETHOD.
Then, you can use the sales document header fields as input parameters in your CPF implementations.
For more details on the implementation, see the following topics:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
8 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |