Extracting data in Table maintenance

Extracting data in Table maintenance
Sudheer Cheedella
Business Card
Company: Intelligroup Asia Pvt Ltd
Posted on Feb. 20, 2006 11:50 PM in ABAP , Beginner

Table Maintenance
Maintaining Custom subroutine in view V_TVIMF for extracting data while creating table entries thru transaction SM30.


Generally for inserting new records into custom table thru transaction SM30, we need to enter all the values manually and save the record.
When certain data for the key fields needs to be populated automatically while creating entries, the steps involved are:
  1. Maintaining the subroutine in view V_TVIMF for a particular custom table.
  2. Logic for extracting relevant data for the fields entered, when user press enter button.

Steps Involved
As an example, let's create a Custom table with fields related to customer master using transaction SE11 and maintenance of that table by transaction SM30.
In this example we will consider 3 fields.
KUNNR – Customer number
NAME1 – Customer name
LAND1 – Country key

1 .Create Table ZCUST with these fields
image

2. Generate table maintenance for this table.
image

3 For maintaining data in this table we need to do thru transaction SM30.
Creating routine for Custom table ZCUST.
Logic to extract customer name and country key for the customer needs to be written in the subroutine maintained in view V_TVIMF.

4. Go to SE11 – Enter View V_TVIMF .
Utilities – Contents – Enter (table name) (Table name for which subroutine to be maintained) In this case table ZCUST. Press enter.
image

Following screen appears – Press New entries.
image

5. We need to maintain two fields in this screen
1.Table maintenance dialog event
2.FORM Routine name
Table maintenance dialog event
Key for a pre-defined time within extended table maintenance. The key is defined in the domain and is displayed with the possible entries
(F4). Use of this field :
If this pre-defined time is reached in extended table maintenance, the FORM routine specified for the current view and for this time is processed. This is useful, for example, for performing consistency checks before saving or specific actions when creating new entries.
The view, time and FORM routine are set in table TVIMF, which must currently be maintained directly using transaction SM30 (view name: V_TVIMF). Key for a pre-defined time within extended table maintenance. The key is defined in the domain and is displayed with the possible entries (F4).
FORM Routine
Name of FORM routine (extended table maintenance)
Name of the FORM routine, which is processed at particular pre-defined times during extended table maintenance.
Dependencies
The FORM routine must belong to the function group, to which the maintenance modules for the view are assigned.

6. Enter Table maintenance dialog event = ’05’ (Here we are writing logic when new entries are created) Depending upon the requirement other events can be used, which are available in F4 values with relevant description.

7. Enter Subroutine name as GET_CUSTOMER_DATA as shown in the screen and press enter. Select the line and press icon available in the editor field.
image

8. Enter new include LZCUSTF01 and press enter, an entry with this include will get inserted in the function group main program.
image

9. Write following code in the routine. Activate program and go to transaction SM30 for maintaining records for customer.
Code to be written in the subroutine
*---------------------------------------------------------*
***INCLUDE LZCUSTF01 .
*---------------------------------------------------------*
FORM GET_CUSTOMER_DATA.
* Get customer name
select single name1 land1
into (zcust-name1,zcust-land1)
from kna1
where kunnr = zcust-kunnr.
ENDFORM. "GET_CUSTOMER_DATA

Output Result
10. Now, if you enter customer number in transaction SM30 and press enter it will extract Customer name and Country key from the custom routine (GET_CUSTOMER_DATA) maintained in view V_TVIMF and displays on the screen.
image

Conclusion
From the above example we will be able to extract description or any other information thru the custom subroutine and populate fields in the custom table while creating entries thru SM30 transaction.

Sudheer Cheedella is a Sr.Systems Analyst for Intelligroup Asia Pvt.Ltd

 

Add to: del.icio.us | Digg | Reddit


Comment on this articleIf you have any questions or suggestions,please drop a line.
Comment on this weblog

Showing messages 1 through 7 of 7.

Titles Only Main Topics Oldest First

  • Coding instead of using standard SAP
    2008-01-28 03:32:34 Tony Shearsby Business Card [Reply]

    As an example of Table Maintenanc events I think this blog is useful.
    However, the same results can be achieved through the correct use of Foriegn Key checks and a Table Maintenance View. By using these 2 techniques no ABAP coding is required, and uses only tools SAP has already delivered to satisfy this sort of requirements. By sticking with SAP tools you will need less time to develop, less time to test, no errors and upgrade assurance.
  • But how to inherit key fiends in maitenance clusters?
    2006-09-13 04:11:35 RIMI Functional Consultant Business Card [Reply]

    Hi,


    I have a cluster with two tables (header & item). When I create new entries in the items table, I would like the fields from the header table to be automatically filled in.


    I tried to follow your example but unfortunately the working area of my header table contains the first record instead of the currently selected record.


    Maybe there is an easier way to do this but I don't know.


    Any ideas on how to inherit values in clusters?


    Thanks!


    Regards,
    Nuno

  • Extracting data in Table maintenance
    2006-07-19 07:58:31 Jim Jackson Business Card [Reply]

    This was a great help in getting behind SM30 etc. I now have a new file for Annual Customer Revenue targets with 4 fields in it i.e. mandt, kunnr, name1 and target_val. When originally created, the name field was not included and all worked well.


    I wanted to include the customer name mainly for user reference in SM30 other than just using the customer code so I followed your example. (I don't want to update that field though via SM30 so I will need to uncheck the field from input somehow). Now I can update the name field via the code shown and the file is updated OK with the name and the user entered fields of code and value.


    BUT SM30->Maintain or Display does not show the name field - yet via SE16 I can see the name field and it is OK with the correct customer name in it. What have I not done ??


    Regards


    Jim

    • Extracting data in Table maintenance
      2006-07-20 02:49:36 Jim Jackson Business Card [Reply]

      Actually, I've managed to find the route within SE11 -> Table maintenance Gen -> Environment -> Modification -> Maint Screens and then untick the relevant field to prohibit input during SM30.


      But thanks again for the detailed help above and it was good to see a very relevant example with it rather than just the usual "use SE54" or similar.


      Jim

  • V_TVIMF
    2006-03-04 07:06:27 Günter Stück Business Card [Reply]

    Just a little remark: Instead of directly entering data into the view V_TVIMF, you could do this inside of the "Generate table maintenance dialog" (SE54) - just click Environment - Modification - Events.
  • Good example!
    2006-02-22 12:41:28 Alvaro Tejada Business Card [Reply]

    Great Sudheer:


    Your example is very usefull because more than once i have need something like. I dind't know it was that easy. Thanx for sharing.


    Greetings,


    Blag.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我! 毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip毕设新项目-基于Java开发的智慧养老院信息管理系统源码+数据库(含vue前端源码).zip
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值