Technical Articles
Flexible Proposal of Requested Delivery Dates or Pricing Dates: Enabling Sales Document Header Fields as Input Parameters
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.
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
-
-
In transaction SE24, create a class by inheriting from interface IF_CPF_DATA_SOURCE.
-
-
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.
-
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.
-
-
-
Create your BAdI implementation.
- In transaction SE18, navigate to the enhancement implementation:
- For the implementation of flexible proposal for pricing dates, open enhancement spot ES_SDOC_CPF_S03, and then open in enhancement implementation EI_SDOC_CPF_S03.
- 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_S03_DATA_SOURCE
- In the newly created BAdI implementation, edit filter values by add a filter combination for filter CPF_ROUNTINE.
For example, add filter combination ‘3=CPF_ROUTINE’ so that the data source routine is ‘3’.
- In transaction SE18, navigate to the enhancement implementation:
-
Create your data source.
- In transaction code SM34, maintain view cluster CPFVC_DS_ROUTINE and choose a usage
-
For the implementation of flexible proposal for pricing dates, choose usage
- In the data source routine, create a new data source by choosing the newly created BAdI implementation from the value help (F4).
- In transaction code SM34, maintain view cluster CPFVC_DS_ROUTINE and choose a usage
- 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 under Sales > Configurable Parameters and Formulas in Sales > Requested Delivery Date in Sales Documents.
Example:
- For the flexible proposal of pricing dates, add input parameters in the Customizing activity Define Parameter Catalog for Pricing Date under Sales > Configurable Parameters and Formulas in Sales > Pricing Date in Sales Documents.
- For the flexible proposal of requested delivery dates, add input parameters in the Customizing activity Define Parameter Catalog for Requested Delivery Date under Sales > Configurable Parameters and Formulas in Sales > Requested Delivery Date in Sales Documents.
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:
- Implementing Flexible Proposal of Requested Delivery Dates
- Implementing Flexible Proposal of Pricing Dates
If you have any questions about SAP S/4HANA, please submit them via Ask a Question.
Hi
Can I also use the item table vbap in the custom routine. My requirement is for billing.
Suggest
Thanks
Ashok
Hi Ashok,
Item table vbap is not supported in this case.
Best,
Autumn