[SAP Abap] X-DOC: SE11 - Create configuration table and assign transaction code

1. Create a custom table

SE11, create a custom table. If you want to make a configuration table, be sure to set the properties: allow display/maintenance.
Insert image description here
Note:
The editing mode of the general application table remains the default.
After setting "Allow display/maintenance", SE16N editing can be supported. Generally, this permission will not be granted, and a separate configuration table is required.

The table fields are as follows:
Insert image description here
save, activate table.

2. Create table maintenance function

Menu: Utilities → Table Maintenance Generator, or: SE54
Insert image description here
Insert image description here
Description: If the maintenance type selects one step, data maintenance does not require transmission.
Insert image description here
Insert image description here
Insert image description here
Insert image description here
You can also drag the width of the edit box below the field name on the layout page.
Insert image description here
Transformation: Change the field editing style.
Insert image description here
Settings: Field is not editable.
Insert image description here
After adjusting the field properties (column width, column title, editing style, etc.), save and activate.

3. Function verification

Execute SM30, enter the table name, and click Edit:
Insert image description here
Enter the table editing state, you can edit the fields allowed to be maintained, and save it after updating.
Insert image description here
Click on the new entry to enter the row insertion state:
Insert image description here
fill in the data and click Save to save the data.

4. Set transaction code

Generally, SM30 permissions will not be opened, and additional transaction codes need to be set.

Execute SE93 and enter the transaction code you want to set:
Insert image description here
Insert image description here
Insert image description here
Description:
VIEWNAME, specify the table or view to be maintained;
UPDATE, specify to enter the editing state directly, SHOW, specify to enter the viewing state.

After saving, the transaction code is created successfully.
Execute ZBCEH to enter the table maintenance interface.

5. Bring out the default value of the field

For non-editable fields that need to be automatically assigned values, you can use SE54 table maintenance events or screen events, which are demonstrated below.

(1) Method 1: Table maintenance event

In the table maintenance interface: Menu, Environment → Modify → Event
Insert image description here
Add event: 21-Fill the hidden field, customize the FORM name: FRM_FILL_DATA.
Insert image description here
Click the code editor, select the included file, and add the following FORM code:
Insert image description here

form frm_fill_data.
  IF ztbcehlist-erdat IS INITIAL.
    ztbcehlist-erdat = sy-datum.
    ztbcehlist-uzeit = sy-uzeit.
    ztbcehlist-ernam = sy-uname.
  ELSE.
    ztbcehlist-lstdate = sy-datum.
    ztbcehlist-lsttime = sy-uzeit.
    ztbcehlist-lstuser = sy-uname.
  ENDIF.
ENDFORM.

Save and activate to realize automatic generation of new information and maintenance information.

(2) Method 2: Screen events

In the table maintenance interface, double-click the screen number, enter the Screen-Logical Flow tab, and
add the following code in the screen flow logic:
Insert image description here
Double-click the MODULE name zset_date_time, create the MODULE
Insert image description here
and select the included file, and add the following MODULE code:
Insert image description here

MODULE zset_date_time INPUT.
  IF ztbcehlist-erdat IS INITIAL.
    ztbcehlist-erdat = sy-datum.
    ztbcehlist-uzeit = sy-uzeit.
    ztbcehlist-ernam = sy-uname.
  ELSE.
    ztbcehlist-lstdate = sy-datum.
    ztbcehlist-lsttime = sy-uzeit.
    ztbcehlist-lstuser = sy-uname.
  ENDIF.
ENDMODULE.

Save and activate to realize automatic generation of new information and maintenance information.

Original article, please indicate the source when reprinting - X-Files

Guess you like

Origin blog.csdn.net/XLevon/article/details/129017243