Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table maintenance generator

manubhutani
Active Contributor
0 Likes
3,006

Hi Guru's

I have created a Z table and have a requirement that if user enters a particular field in a field

then message shud appera that this value is not allowed

other wise it shud get saved, where is the coding needs to be done?

I tried opening the PAI event but dont know where to code

Please help,its urgent. will reward max point.

Please dont copy paste, please explain in brief

Thanks and Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,393

You can add value table for the field for this requirement if the required values are available in any table. Else you can do coding in table maintenance genrator. For details, have a look at below link which gives details with screen shots:

[Events in Table Maintenance|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/how%20to%20implement%20events%20in%20table%20maintenance.doc]

Let me know if any doubts.

Best Regards,

Vibha

Please mark all the helpful answers

16 REPLIES 16
Read only

Former Member
0 Likes
2,394

You can add value table for the field for this requirement if the required values are available in any table. Else you can do coding in table maintenance genrator. For details, have a look at below link which gives details with screen shots:

[Events in Table Maintenance|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/how%20to%20implement%20events%20in%20table%20maintenance.doc]

Let me know if any doubts.

Best Regards,

Vibha

Please mark all the helpful answers

Read only

0 Likes
2,393

Hi

thanks for ur reply.

I tried that link..

but that code is not working in my case.

Read only

0 Likes
2,393

Can you please give details about the code that you have written? It should definately work.

Read only

0 Likes
2,393

Hi

for event 05 create a new entry

I wanted to put default value .

form at_newentry.

Ztable-name = ‘abc’.

endform.

Read only

0 Likes
2,393

Hi

even i faced such problems the first time i was working with "Events". it was the issue of activation for me. i came out of the application, activated everything at Function Group level. then it worked for me.

Try it. Might help.

Deepti

Read only

0 Likes
2,393

Hi Manu,

While using the EVENT05, you will have to identify the global structure variable containing your new record details, and update the field(s) accordingly.

As given in the Help portal document for View Maintenance events, make sure you call and use the global variables like EXTRACT correctly to get and set your values.

But apart from that, if you wish to restrict the entry values at table level itself, then a check table or a Value table restriction is best. Why do you want to implement a manual code in form of View Maintenance event? Anyways, please refer to the document (I think one of the people above have already given the link)

Regards,

Rekha

Read only

0 Likes
2,393

Can u tell me

how to use extract?

Read only

0 Likes
2,393

Hi Manu,

Extract is an internal table which is system generated.

In other words:

"An extract dataset, or short extract, is a dataset in the internal session of an ABAP program that is not handled as a data object and therefore has no data type. There is only one extract dataset for every ABAP program. It can be filled will ABAP statements and read. The content of the extract dataset cannot be explicitly deleted. "

This extract if used in SM30 screen, will list all the entries visible in the screen(hence in the DB). You can perform any action on it like :Loop at Extract.. Endloop.

or use it against any string functions like STRLEN(extract) (inside loop or anything).

Hope it helps

Do revert back,if not clear

Deepti

Read only

0 Likes
2,393

Hi Manu,

Plz go through the link which explains the events of Table Maintenance Generator, and it also gives you the usage of the global variables and internal tables like EXTRACT.

EXTRACT is the internal table which contains the table/view records as displayed on the screen.

[TME Events|http://help.sap.com/saphelp_47x200/helpdata/en/91/ca9f32a9d111d1a5690000e82deaaa/frameset.htm]

This link gives you a sample usage of how you can use the EXTRACT table and other global variables to read and modify the View data.

[Global Variables of Overview screen|http://help.sap.com/saphelp_47x200/helpdata/en/91/ca9f32a9d111d1a5690000e82deaaa/frameset.htm]

Best Regards,

Rekha

Read only

Former Member
0 Likes
2,393

Hi Manu,

I think ur problem can be solved using the Table maintenance generator events.

In the table maintenance geberator screen, Use the Path:

Environment>Modification> Events

We are taken to a screen which prompts us to enter the form routines.

Click on the new entries. Select a desired dialog event. in ur case, seems that you have to provide validations on entering new values. hence choose the event "05". and give a form name.

On clicking on the editor , a new include name is proposed. Select the desired one and you can insert your lines of code here.

Write the code inside a “FORM…. ENDFORM”, since these routines are dynamically called corresponding to the dialog events we have specified.

The main advantage of this is that, this routinne gets called for each record created.

Hope this helps.

Do get back if you want more info.

Deepti.

Read only

0 Likes
2,393

Hi

thanks for ur reply..

I tried putting the code in event 05 - create a new entry

form z_default.

ztable-name = 'abc'. " default

endform.

but this is not working

please help

Read only

0 Likes
2,393

Hi

Now i am not allowed to got events

its saying func group cannot be processed please help.

Read only

0 Likes
2,393

Hi Manu

Is it possible for you to create an additional table with the set of values you want to get saved in your original table .If the answer is yes ,create the new table as your check table in se11 field level

I can be reached +919902617006,if require call me.

kind regards

Manoj

Read only

0 Likes
2,393

Hi Deepti

Can u send me ur code which u wrote in any event

i am not able to understand how to use extract and total

what are their structure.?

Read only

0 Likes
2,393

Hi Manu,

Extract doesnt have a structure explicitly, it adopts the structure during the course of the program. To understand it better, lets take an example with a table. Declare a table and then generate the table maintenance screen.Go to SM30 and after entering new values or any other action, switch on the debugger. now give "Extract" and see how it is. Generally it will have 1 field with 128 char, which gives

1. Client

2. The values in the table in a single line for each record.

Example: 100Deepti Trial (taken from debugging)

From here you can seperate the values required using any string functions. .

Data:len_src TYPE i,

len_src2 TYPE i.

Loop at extract.

len_src = STRLEN( extract ).

len_src2 = len_src - 15.

extract+len_src2(14) = lv_timestamp.

MODIFY extract.

endloop.

This specific requirement was for modifying an existing value in extract.

Let me know any specific requirement of yours. May be i can take that up and explain better.

Deepti

Read only

Former Member
0 Likes
2,393

Hi,

Take a look at my code which will update the user and date for any new record or a modified record.This I have achieved my changing the contents of Extract and Total Tables which is given below.

I have written this in event '01'

FORM update_user_date_time.

DATA: f_index LIKE sy-tabix.

DATA: BEGIN OF l_total.

INCLUDE STRUCTURE zztable.

INCLUDE STRUCTURE vimtbflags.

DATA END OF l_total.

DATA: s_record TYPE zztable.

LOOP AT total INTO l_total.

IF l_total-vim_action = aendern OR

l_total-vim_action = neuer_eintrag.

MOVE-CORRESPONDING l_total TO s_record.

s_record-zz_user = sy-uname.

s_record-zz_date = sy-datum.

s_record-zz_time = sy-uzeit.

READ TABLE extract WITH KEY l_total.

IF sy-subrc EQ 0.

f_index = sy-tabix.

ELSE.

CLEAR f_index.

ENDIF.

MOVE-CORRESPONDING s_record TO l_total.

MODIFY total FROM l_total.

CHECK f_index GT 0.

MODIFY extract INDEX f_index FROM l_total.

ENDIF.

ENDLOOP.

ENDFORM. " UPDATE_USER_DATE_TIME[/code]

Here ZZTABLE is the Z table and ZZ_USER, ZZ_DATE, and ZZ_TIME are the fields that are updated.

Please reward if found helpful.