If SAP Class system for Securities & Listed Derivatives is not enough for you and you still need some custom fields to classify your Securities and to store some data - starting from ERP6.0 Enhancement Package 5 you have such possibility.
Badi TPM_SEC_CUST_DATA will help you. (Not to be confused with TPM_SEC_ADD_DATA)
Let's create simple characteristics of the bond
Step 1. Create structure according to our scheme.
tr. SE11 -> Data type: ZCUSTOM_TAB_INCL -> Button "Create".
You'll be asked to enter Package and transport request.
You have to create Data elements and domains. You can do it right from structure screen.
Enter data element ZPRIORITY in "Component type" field of the structure and double click on it. You'll be asked to save structure and whether you want to create data element. Save and Create.
Now enter Domain ZPRIORITY into you data element and double click on it. You'll be asked to save data element and whether you want to create domain. Save and Create.
Don't forget to enter labels (Field label tab) for data element.
Now you have to enter parameters for domain.
Create data elements and domain for each field. Follow the table below.
Domain | Data type | Number characters / Output length | Data | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ZPRIORITY | CHAR | 7 |
| ||||||||
ZISSUER | CHAR | 4 |
| ||||||||
ZCOUPONRATE | CHAR | 2 |
| ||||||||
ZREDEMFEATURES | CHAR | 3 |
|
Don't forget to activate each domain, each data element and the structure.
Let's add our structure to SECURITYV structure.
First of all create Append structure ZZCUSTOM_TAB
And add our structure ZCUSTOM_TAB_INCL as include into append structure ZZCUSTOM_TAB
Repeat the same for VWPT_FREE_ATTR table.
Step 2. Let's make a copy of FunctionPool /TRMKR/SAPLSEC_CUST_DATA
tr. SE38
Don't forget to copy all function modules in Z*
You will find SAPLZCUSTOM_TAB program and ZCUSTOM_TAB function group. But nevertheless it's absolutely the same.
We have to make corrections to our copied function group:
1. Look through all function modules and correct all /TRMKR/* function modules to Z*
2. FM ZINITIALISE_CUST_DATA: replace code
SECURITYV-COVERAGE_ELIG = im_security-COVERAGE_ELIG .
SECURITYV-EMBD_DERIVATIVE = im_security-EMBD_DERIVATIVE .
SECURITYV-ORIG_ISSUE_CURR = im_security-ORIG_ISSUE_CURR .
SECURITYV-QUOT_BREAKDOWN = im_security-QUOT_BREAKDOWN .
with your code
SECURITYV-ZZPRIORITY = im_security-ZZPRIORITY .
SECURITYV-ZZISSUER = im_security-ZZISSUER .
SECURITYV-ZZCOUPONRATE = im_security-ZZCOUPONRATE .
SECURITYV-ZZREDEMFEATURES = im_security-ZZREDEMFEATURES .
3. You can add code to ZCHECK_CUST_DATA function module if you want to check something.
Step 3. Add fields to screen
tr. SE51 -> Program SAPLZCUSTOM_TAB, screen 0100
Then press the button
Add (as on the screen below):
1. Box. Enter the name of the box - Characteristics
2. Four text fields. Enter the names of the fields - Priority, etc.
3. Input field. Use structure SECURITYV to enter fields data. You'll be asked: Do you want the element to refer to the dictionary definition? Agree and press "Yes" button.
4. Activate the screen.
Step 4. Create implementation for BADI TPM_SEC_CUST_DATA
Start tr. SE19. In "Create implementation" block in "New BADI, enchancement spot" field enter BADI TPM_SEC_CUST_DATA and press "Create implementation" button.
Enter Enchancement implementation Id and text.
In the "Screen Enchancement" menu enter Program Id and Subscreen from step 3 - Program SAPLZCUSTOM_TAB, screen 0100
In the "Implementation class" menu you can find all BADI methods.
Make a double click to any of it to implement method and you'll get message
Press "Yes" to create implementation of the method.
For each method enter the following code.
method INITIALISE (Initialize Local Structures)
CALL FUNCTION 'ZINITIALISE_CUST_DATA'
EXPORTING
IM_SECURITY = im_security
IMPORTING
EX_MESSAGE = ex_message
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 1.
raise NO_CUST_DATA_FOUND.
ENDIF.
method DATA_EDIT (Change Additional Data)
if im_mode = 'DISP'.
CALL FUNCTION 'ZDISPLAY_CUST_DATA'
EXPORTING
IM_SECURITY = im_security
IMPORTING
EX_MESSAGE = ex_message
EXCEPTIONS
DATA_ERROR = 1
others = 9.
else.
CALL FUNCTION 'ZEDIT_CUST_DATA'
EXPORTING
IM_SECURITY = im_security
IMPORTING
EX_MESSAGE = ex_message
EXCEPTIONS
DATA_ERROR = 1
DAtA_DELETED = 2
others = 9.
endif.
case sy-subrc.
when 1. RAISE DATA_ERROR.
when 2. RAISE DATA_DELETED.
endcase.
method DATA_CHECK (Check Data)
function module ZCHECK_CUST_DATA is empty. But you can write your code there in order to check some data.
CALL FUNCTION 'ZCHECK_CUST_DATA'
EXPORTING
IM_SECURITY_ID = im_security_id
IMPORTING
EX_MESSAGE = ex_message.
method DATA_SAVE (Save Data)
CALL FUNCTION 'ZSAVE_CUST_DATA'
EXPORTING
IM_SECURITY = im_security.
method DATA_DELETE (Delete Data)
CALL FUNCTION 'ZDELETE_CUST_DATA'
EXPORTING
IM_SECURITY_ID = im_security_id.
method GET_TABNAME (Get Name for Additional Tab Page)
You can set tab name in 5.1.
CALL FUNCTION 'ZGET_CUST_TAB_NAME'
IMPORTING
IM_TAB_NAME = im_tab_name.
method PUT_DATA_TO_SCREEN (Transfer Data to Subscreen)
here you have to Add you custom fields.
*MOVE-CORRESPONDING CUST_SECURITYV TO SECURITYV.
In our case the code will be:
ATTR_SECURITYV-ZZPRIORITY = CUST_SECURITYV-ZZPRIORITY.
ATTR_SECURITYV-ZZISSUER = CUST_SECURITYV-ZZISSUER.
ATTR_SECURITYV-ZZCOUPONRATE = CUST_SECURITYV-ZZCOUPONRATE.
ATTR_SECURITYV-ZZREDEMFEATURES = CUST_SECURITYV-ZZREDEMFEATURES.
method GET_DATA_FROM_SCREEN (Get Data from Subscreen)
the same as method PUT_DATA_TO_SCREEN
here you have to Add you custom fields.
*MOVE-CORRESPONDING ATTR_SECURITYV TO CUST_SECURITYV.
CUST_SECURITYV-ZZPRIORITY = ATTR_SECURITYV-ZZPRIORITY.
CUST_SECURITYV-ZZISSUER = ATTR_SECURITYV-ZZISSUER.
CUST_SECURITYV-ZZCOUPONRATE = ATTR_SECURITYV-ZZCOUPONRATE.
CUST_SECURITYV-ZZREDEMFEATURES = ATTR_SECURITYV-ZZREDEMFEATURES.
method DATA_CHANGED (Check for New Entry)
CALL FUNCTION 'ZCHANGED_DATA'
IMPORTING
EX_CHANGED = ex_changed.
method FILL_NEW_FIELDS_DATA (Fill New Fields Data)
here you have to Add you custom fields.
*MOVE-CORRESPONDING IM_SECURITYV_FROM TO C_SECURITYV.
C_SECURITYV-ZZPRIORITY = IM_SECURITYV_FROM-ZZPRIORITY.
C_SECURITYV-ZZISSUER = IM_SECURITYV_FROM-ZZISSUER.
C_SECURITYV-ZZCOUPONRATE = IM_SECURITYV_FROM-ZZCOUPONRATE.
C_SECURITYV-ZZREDEMFEATURES = IM_SECURITYV_FROM-ZZREDEMFEATURES.
When all code entered into method - activate each method and BADI implementation.
Step 5. Additional configuration
5.1. Tab text can be entered through view /TRMKR/TB_NAME_V
5.2. Only one active implementation must exsist.
Somtimes when you begin creating your custom tab, standart implementation is active and you are not able to activate yours.If you don't turn off standard implementation and do not activate yours - custom tab and data won't be available.
You can switch between active implementation in IMG.
IMG -> Financial Supply Chain Management -> Treasury and Risk Management -> Transaction Manager -> Securities -> Master Data -> Specific Class Data -> Additional Tab Pages in Class Data -> User-Defined Tab Page -> BAdI: Additional Tab Page in Class Data (tr. S_E5V_35000103)
Uncheck "Active (IMG)" checkmark for active badi implementation
Quit from configuration. Open transaction once again and you will see that only your implementation is active
5.3. If you want to manipulate the status of your custom fields - apply note 1911821
-----------------------------------------------------------------------------------
As the result in FWZZ transaction you will find custom tab "Additional data" with custom fields: Priority, Issuer, Coupon rate and Redempton feature.
Enjoy!
P.S. I will be very glad to hear all your comments and suggestions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |