Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
Several Business requirements require some Z table or view to be created on Accounts or contacts page or in any Assignment block like relationship block in Accounts page. On create of new record in or change of the new record if you need to display some information or you need to capture some change time or created time. This document is meant for guiding the users to achieve the functionality.
Requirement
In the relationship Block of Account page, AET generated Table or view is placed with 4 fields in it
1. Wscode
2. Default(flag)
3. Created date
4. Created Time
When a Record is inserted the created date should be captured automatically.
When a Record is changed the changed date should be captured automatically.
When Record is created and no value is given in the field WScode an error message should populate.
Relationship Assignment Block:
View Name: Test (AET Generated)
Underlying Table Generated: ZATAB00000N
AET generated Component: ZDEX/test_MAIN
You can achieve the functionality by 2 ways

Approach 1:
(Using the BADI) (Best Approach)
Enhancement Spot: AXT_RT_TABLES
BADI: AXT_RT_TABLES.
Create your own implementation 'Z' class and BADI:
Give the table name in the filter value. (The BADI should only trigger for this AET table and not others)
Now click on insert button, so new record or row gets generated, enter the value of wscode and enter or press on done.
The value of the field created on should automatically get triggered as todays date sy-datum.
Go to the Method:
IF_EX_AXT_RT_TABLES_API~ON_CREATE :
Define the field symbol for the wscode and created date and assign them to the respective fields.
Now check if the wscode is not initial and then assign the field symbol for the created date to sy-datum.
Now in Web UI:
External Break Point:
Created date Populated.
Underlying Table will have the record value:
Code in the Interface IF_EX_AXT_RT_TABLES_API~ON_CHANGE:
Underlying table has the changed date value stored and the change method of the BADI gets triggered.
Code in the Interface IF_EX_AXT_RT_TABLES_API~ON_CHANGE:
If you want to display error, if the wscode value is NULL, then code in method.
IF_EX_AXT_RT_TABLES_API~CHECK.
Output on UI:
2nd approach:
Using the SET and GET methods.
You can create an event on select and try to caputure date and time.
Best way is to use the BADI and its always easy.
4 Comments
Labels in this area