Business Requirement
Business needs set of data flows to be executed at the end of the month based on certain configuration parameters value. Data load program / method should have intelligence to decide which data loads to carry out based on set of configuration parameter’s values.
Technical Solution Overview
Technical / Configuration parameters to be created & updated in table TVARV.
Following parameters were created in TVARV
- CORRECT_RUN (Possible Values ‘Y’ ‘N’ ‘ ‘)
- FISCAL_PERIOD
Process chain should execute only when we have “CORRECT_RUN” parameter set as “Y” and then for given “FISCAL_PERIOD” parameter should extract data in corresponding data target. Dynamic determination of “FISCAL_PERIOD” was executed in DTP using filter with Code option.
Technical solution was accomplished using combination of “BADI” and “Decision node” in Process chain. BADI is implemented to create custom function which will read data from TVARV into formula editor and return values from this custom function would be feed into decision node to determine which set of data loads to be continued.
Step by Step Solution
Following is step by step approach of achieving business functionality,
- Go to SE19 -> Input BADI implementation name and click on Create Implementation.
This implementation should be created on definition named “RASR_CONNECTOR”.
2. Double click on “GET” method ,
3. Paste following code in the ABAP Editor ,
*--------------------------------------------------------------------------------------------------------- DATA: L_FUNCTION TYPE SFBEOPRND. CASE I_KEY. WHEN 'CUSTOM'. CLEAR: L_FUNCTION. **Specfiy implementing class name below It can be referred in the screen **above just below “Interface Name” L_FUNCTION-CLASS = 'ZCL_IM_....'. ****Name of the method to be created in the class L_FUNCTION-METHOD = 'SOME_PARA_READ'. ***Technical name of the function , This will be used in the formula builder L_FUNCTION-TECH_NAME = 'PARA_READ'. ***Technical name of the function , This will be used in the formula builder **as text of the function L_FUNCTION-DESCRIPTN = 'Read from TVARV'. APPEND L_FUNCTION TO C_OPERANDS. ENDCASE *---------------------------------------------------------------------------------------------------------
4.Now double click on the implementing class, and following screen will be displayed.
5.Add new method “SOME_PARA_READ” . Specify level as “Static” and Visibility as “Public”.
6.Double click on the method “SOME_PARA_READ” and write code as specified below,
select single low into e_param_value from TVARV where name = i_param_name.
Note : This code is very specific to read data from TVARV table, based on the scenario this may be changed.
7.Activate BADI Implementation by pressing Ctrl + F3 or clicking on highlighted button in the tool bar. Unless activation is done we may not see the functions
in formula editor.
At this step we are through with BADI implementation, now process chain with decision node to be focused on to work upon.
8.Include Decision node in the process chain and following screen will appear. Click on create/ edit formula,
9.Functions defined in the BADI are available only when we click on “User Defined Functions”. Click on “User Defined Functions” and select the functions which have been coded in section above.
10. Following formula should be put in the formula editor to validate values of parameter named “CORRECT_RUN” and “FISCAL_PERIOD”.
(NOT IS_INITIAL( PARA_READ( 'CORRECT_RUN' ) ) AND (NOT IS_INITIAL( PARA_READ( 'FISCAL_PERIOD' ) )
11. Sample process chain looks like as follows with usage of Decision node. Based on parameters specified in TVARV table, decision node will decide which process chain to trigger.