0% found this document useful (0 votes)
318 views5 pages

Table Events 1. Create A Database Table YTEST - CUSTOMER

The document describes how to create a table event in SAP that automatically populates a full name field when a first and last name are entered upon saving a new record in a database table. The steps are: 1. Create a database table 2. Create a table maintenance event 3. Select the "before saving data" event 4. Write ABAP code in a subroutine to concatenate the first and last name fields into the full name field.

Uploaded by

Debesh Swain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
318 views5 pages

Table Events 1. Create A Database Table YTEST - CUSTOMER

The document describes how to create a table event in SAP that automatically populates a full name field when a first and last name are entered upon saving a new record in a database table. The steps are: 1. Create a database table 2. Create a table maintenance event 3. Select the "before saving data" event 4. Write ABAP code in a subroutine to concatenate the first and last name fields into the full name field.

Uploaded by

Debesh Swain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Table Events

1. Create a database table YTEST_CUSTOMER

2. Create a table maintenance for the same table


3. Now goto events from TMG

4. Choose the appropriate event. Here I want to fill the full name once first name
and last name are entered in the table so I have choosen event 1 i.e. before saving
the data.
5. Create a subroutine from the custom code and click on the editor button to write
your code.
6. In the new include explicitly write FORM.ENDFORM and your code in between.

<vim_total_struc> holds the new entry and total[] holds the whole table.

*----------------------------------------------------------------------*
***INCLUDE LYTEST_CUSTOMERF01 .
*----------------------------------------------------------------------*
FORM yfill_complete_name .
DATA : ls_customer TYPE ytest_customer.
DATA : lt_customer TYPE STANDARD TABLE OF ytest_customer.

MOVE-CORRESPONDING <vim_total_struc> TO ls_customer.

IF <action> = 'N'.

lt_customer[] = total[].

READ TABLE lt_customer WITH KEY cnumber = ls_customer-cnumber


TRANSPORTING NO FIELDS.
IF sy-subrc IS INITIAL.
CONCATENATE ls_customer-fname ls_customer-lname INTO
ls_customer-cname SEPARATED BY space.

MODIFY lt_customer FROM ls_customer INDEX 1.


total[] = lt_customer[].
MODIFY ytest_customer FROM ls_customer.

ENDIF. ENDIF. ENDFORM. "YFILL_COMPLETE_NAME

Remember you need to activate the functiongroup.

7. Now create a new entry , and the full name should get autopopulated upon save.

You might also like