Skip to Content
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)
/wp-content/uploads/2013/07/1_244253.jpg
Underlying Table Generated: ZATAB00000N
/wp-content/uploads/2013/07/2_244254.jpg
AET generated Component: ZDEX/test_MAIN
/wp-content/uploads/2013/07/3_244255.jpg
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:
/wp-content/uploads/2013/07/4_244256.png
Give the table name in the filter value. (The BADI should only trigger for this AET table and not others)/wp-content/uploads/2013/07/5_244257.jpg
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.
/wp-content/uploads/2013/07/6_244258.jpg
Now in Web UI:
/wp-content/uploads/2013/07/7_244259.png
External Break Point:
/wp-content/uploads/2013/07/9_244260.jpg
/wp-content/uploads/2013/07/10_244261.png
Created date Populated.
Underlying Table will have the record value:
/wp-content/uploads/2013/07/11_244262.png
Code in the Interface IF_EX_AXT_RT_TABLES_API~ON_CHANGE:
/wp-content/uploads/2013/07/12_244263.png
Underlying table has the changed date value stored and the change method of the BADI gets triggered.
/wp-content/uploads/2013/07/13_244264.png
Code in the Interface IF_EX_AXT_RT_TABLES_API~ON_CHANGE:
/wp-content/uploads/2013/07/15_244265.png
If you want to display error, if the wscode value is NULL, then code in method.
IF_EX_AXT_RT_TABLES_API~CHECK.
/wp-content/uploads/2013/07/16_244266.png
Output on UI:
/wp-content/uploads/2013/07/17_244267.png
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.
To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply