Quantcast
Channel: SCN : All Content - SAP ERP Financials - Treasury Applications
Viewing all articles
Browse latest Browse all 2236

Custom tab for Class master data.

$
0
0

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

characteristics.jpg

 

 

 

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.

include.jpg

 

include2.jpg

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.

element.jpg

Don't forget to enter labels (Field label tab) for data element.

element2.jpg

Now you have to enter parameters for domain.

domain.jpg

domain2.jpg

Create data elements and domain for each field. Follow the table below.

 

DomainData typeNumber characters /
Output length
Data
ZPRIORITYCHAR7
JUN/SUBJunior or Subordinated
SEN/SUBSenior or Subordinated
ZISSUERCHAR4
CORPCorporation
MUNIMunicipal
GOVGovernment
INTInternational
ZCOUPONRATECHAR2
FIFixed income
FLFloater
IFInverse floater
ZCZero coupon
ZREDEMFEATURESCHAR3
CALCallabel
CONConvertable
PUTPuttable

 

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

append1.jpg

And add our structure ZCUSTOM_TAB_INCL as include into append structure ZZCUSTOM_TAB

append2.jpg

 

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*

pool.jpg

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

screen1.jpg

Then press the buttonlayout.jpg

 

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.

fields123.jpg

 

 

 

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.

1. create_implem.jpg

Enter Enchancement implementation Id and text.

2. create_implem_2.jpg

3. create_implem_3.jpg

 

In the "Screen Enchancement" menu enter Program Id and Subscreen from step 3 - Program SAPLZCUSTOM_TAB, screen 0100

screenencha.jpg

 

In the "Implementation class" menu you can find all BADI methods.

Make a double click to any of it and you'll get message

6. create method.jpg

Press "Yes" to create implementation of the method.

 

For each method enter the following code.

 

method INITIALISE

 

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

 

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

 

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

 

CALL FUNCTION 'ZSAVE_CUST_DATA'     EXPORTING       IM_SECURITY       = im_security.

 

method DATA_DELETE

 

CALL FUNCTION 'ZDELETE_CUST_DATA'     EXPORTING       IM_SECURITY_ID       = im_security_id.

 

method GET_TABNAME

 

CALL FUNCTION 'ZGET_CUST_TAB_NAME'     IMPORTING       IM_TAB_NAME       = im_tab_name.

 

method PUT_DATA_TO_SCREEN

 

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

 

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

 

CALL FUNCTION 'ZCHANGED_DATA'     IMPORTING       EX_CHANGED       = ex_changed.

 

method 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 BADI implementation.

 

 

Step 5. Additional configuration

 

5.1. Tab text can be entered through view /TRMKR/TB_NAME_V

13. view name.jpg

 

14. tab name.jpg

 

5.2. Only one active implementation must exsist. You can swithc 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

 

Uncheck "Active (IMG)" checkmark for active badi implementation

23. how deactivate std badi.jpg

Quit from configuration. Open transaction once again and you will see that only your implementation is active

24. active.jpg

 

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.

tab.jpg

Enjoy!

P.S. I will be very glad to hear all your comments and suggestions.


Viewing all articles
Browse latest Browse all 2236

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>