Sie sind auf Seite 1von 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.

Das könnte Ihnen auch gefallen