Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Autumn_Yu
Advisor
Advisor
2,489

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.

Instruction

  1. Create your class.
    1. In transaction SE24, create a class by inheriting from interface IF_CPF_DATA_SOURCE. For example, create a class "ZCL_SDOC_CPF_S02_BLOGEXAMPLE".
    2. In the newly created class, implement the inherited BAdI method IF_CPF_DATA_SOURCE~GET_VALUE. For example, if you want to add sold-to party (filed KUNNR in table VBAK) as a parameter named 'ZSOLDTOPARTY', you can use the following sample codes:
      • For the implementation of the flexible proposal for requested delivery dates:

 

 

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.​

 

 

  • For the implementation of the flexible proposal for pricing dates:

 

 

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.​

 

 

  1. Create your BAdI implementation.
    1. In transaction SE18, navigate to the enhancement implementation:
      • For the implementation of flexible proposal for requested delivery dates, open enhancement spot ES_SDOC_CPF_S02, and then create your own enhancement implementation.
      • For the implementation of flexible proposal for pricing dates, open enhancement spot ES_SDOC_CPF_S03, and then create your own enhancement implementation.
    2. Create a BAdI implementation and assign the class that you've just created as the implementing class.
      • For the implementation of flexible proposal for requested delivery dates, create the BAdI implementation for BAdI definition BADI_SDOC_CPF_S02_DATA_SOURCE.
      • For the implementation of flexible proposal for requested delivery dates, create the BAdI implementation for BAdI definition BADI_SDOC_CPF_S03_DATA_SOURCE.
    3. In the newly created BAdI implementation, edit filter values by add a filter combination for filter CPF_ROUNTINE.
  1. Create your data source.
    1. In transaction code SM34, maintain view cluster CPFVC_DS_ROUTINE and choose a usage
      • For the implementation of flexible proposal for requested delivery dates, choose usage S02.
      • For the implementation of flexible proposal for pricing dates, choose usage S03
    2. In the data source routine, create a new data source by choosing the newly created BAdI implementation from the value help (F4).
    3. In the newly created data source routine, append data source parameters.
    4. In the Customizing activity for defining parameter catalog, add desired fields that have been defined as your data source parameters by entering the parameter name and reference data type, and choosing your data source routine.
      • For the flexible proposal of requested delivery dates, add input parameters in the Customizing activity Define Parameter Catalog for Requested Delivery Date.
      • For the flexible proposal of pricing dates, add input parameters in the Customizing activity Define Parameter Catalog for Pricing Date.

Then, you can use the sales document header fields as input parameters in your CPF implementations.

Related Links

For more details on the implementation, see the following topics:

2 Comments