Automatic Population of Values during Table Maintenance

Automatic Population of Values during Table Maintenance

Let’s learn the Automatic Population of Values during Table Maintenance . At the point when we really want to keep up with values for a custom table in a table support generator, certain circumstances might emerge where we really want to consequently populate one more field in a table contingent upon the worth of one field. Or on the other hand we might have some custom necessity like approving a specific section before it is saved. There can be different necessities which we might confront when we are keeping up with information a custom table. Automatic Population of Values during Table Maintenance.

For instance say we have a custom table ZTEST_MAT.

Post-1-Pic-1


Presently we can all make the table upkeep generator for this table utilizing menu Way Utilities – > Table Support Generator.

After the TMG is effectively made, open it again in show mode and get the source code name for the TMG. It will be a module pool program.

Post-1-Pic-2


Open the source code SAPLZTEST_MAT. What’s more, open the screen stream rationale.

Put your custom module in the PAI Module. Here MODULE MODIFY_RECORD is the module where we have put our code.

In this custom module we can compose our code to, say, consequently populate the material depiction when the material number is placed.

In the example code, you would see we have the inside table ‘Absolute’ which contains every one of the table records and furthermore in ‘Concentrate’, we have the chosen records which are being shown as of now. The field contains the key.

For changing the ongoing record, we want to adjust both the comparing Concentrate and Complete table qualities.

The <ACTION> field indicates the current user action for that field – INSERT, UPDATE, DELETE.

*& Code for automatic population of values ***

module MODIFY_RECORD input.
DATA: l_index TYPE sytabix, " Index to note the lines found
l_tabix TYPE sytabix. " Index of total table

DATA: l_matnr TYPE matnr.
FIELD-SYMBOLS: <record> TYPE ANY. " Work area for table

* Modify changed by and changed on fields for any updates
LOOP AT total.
l_tabix = sy-tabix.
* Assign the table header line to the work area
ASSIGN total TO <record>.
IF sy-subrc = 0. " If assigning is successful.
* Check if data was changed and get the corresponding line index
IF <action> = 'U' " Updated entry
OR <action> = 'N'. " New entry

READ TABLE extract WITH KEY <vim_xtotal_key>. " Key field

IF sy-subrc = 0.
* Clears the variables after updation.
l_index = sy-tabix.

SELECT SINGLE maktx
FROM makt
INTO <record>+21(40)
WHERE matnr = <record>+3(18).

* Modify total table
MODIFY total FROM <record> INDEX l_tabix.

CHECK l_index > 0.
extract = <record>.

* Modify extract table
MODIFY extract INDEX l_index.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.

endmodule. " MODIFY_RECORD INPUT

We have likewise made the material text field show as it were. Presently in SM30, when we attempt to keep up with new material number. in the table, the relating text gets pulled in naturally. Add new sections to the table.

Post-1-Pic-3


Now when we press Enter.

Post-1-Pic-4


The material text is populated naturally. This is a straightforward illustration of how we can add valuable elements to the standard table upkeep.

Much thanks for your time!!

 

YOU MAY BE INTERESTED IN

A to Z of OLE Excel in ABAP 7.4

ABAP on SAP HANA. Part III. Debugging in ADT

ALE and IDoc in SAP ABAP: A Deep Dive

 

WhatsApp WhatsApp us