If our interest is to implement any master data activates using Enterprise portal, it is very much important to make sure that user enters correct data in his request for any activity - especially when the request under goes many approval levels using BPM.
in above 2 lines:
Master Data : Customer master / Material Master / Vendor Master / GL Account.
Activities : Creation / Change / Delimit / Deletion / Block / Extend.
Requirement:
We need GET_LIST or GET_DETAIL function modules to fetch the data from ECC, to display it as drop down in EP - Which makes sure that user enters valid data in his/her request.
Standard Example:
BAPI_BANK_GETLIST
BAPI_CUSTOMER_GETDETAIL1
BAPI_CUSTOMER_GETDETAIL2
ISP_REASONABLE_OFFICE_GET
FI_PAYMENT_METHOD_LIST_GET
Problem Domain:
If there is no GET_LIST or GET_DETAILS or any other alternative function module to get the details of an object (sales orgs, distribution channels, division - for example), are we going to write one RFC function module for each object??
Solution:
Generic RFC Function module to fetch data from given table / data base view.
Scope:
The scope of this FM is to fetch 2 fields mentioned in FILEDS_LISTseparated by space (Preferably a code and its description) from the table or data base view mentioned at TABLE filtered with additional conditions mentioned in the FETCH_COND field.Exports the code at FIELD1, description at FIELD2 and Code, description concatenated and separated by ‘-‘ in FIELD3 of export table.
Key design points:
1. This is an application of dynamic internal table creation using Fields symbols, dynamic templates and classes.
- Importing:
TABLE -
FIELD_LIST -
MAXLINES -
FETCH_COND -
- Exporting:
TDATA TYPE LIKE ZEP_STRING
Where ZEP_STRING is a structure
FIELD1 CHAR 10 Table Record
FIELD2 CHAR 50 Description of the Code
FIELD3 CHAR 65 Code - Description
2. The same FM can be used in case if code and descriptions are available in two or more different tables. Create one Data base view (not maintenance view in SE11 using appropriate tables) and use the same in TABLE import parameter.
3. Each line in the Function module code should be under at least one more than one TRY... CATCH Statements, to avoid technical errors .
Advantages:
- Avoid unnecessary RFC function modules by using single generic function module.
- Easy maintenance, which means, when ever there is a change in requirement it is very easy do change and deploy into EP as a model.
- Can be easily extended for multiple fields fetch.
Examples:
- Fetch with complex Fetch condition.
- Fetch data from more than one table.
Example 1:
Fetch Sales District details:
Result in EP:
Example 2:
Fetch data from more than one table.
This test data set is to fetch Reconciliation (MITKZ = ‘D') GL Accounts for the given company code (BUKRS) and COA (KTOPL) in given language (SPRAS) - English.
The GL Account, Reconciliation Check and Description will be available in 2 different tables. Hence Create a table view ZEPV_RECONACNT, This is a database view for multiple tables as depicted below.
Tables : SKB1 & SKAT. And Join condition.
ABAP Development:
Click here.
Thanks for reading, do not forget to leave your constructive comments, please.