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

How to prevent view table source code being replaced

Former Member
0 Likes
1,062

Hi Gurus,

I want to add some coding to table maintanence generator generated source code (SE56) but if regenerate the view table, the programmed code will get replaced, can anyone tell me how to prevent the source code being replaced?

Thanks & regards,

Esther

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,030

Hello Esther

Are you using the standard [events |http://help.sap.com/saphelp_nw2004s/helpdata/EN/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm]in order to modify your maintenance view? Neither these events nor the coding in there should be touched by any regeneration of the view.

Regards

Uwe

8 REPLIES 8
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,031

Hello Esther

Are you using the standard [events |http://help.sap.com/saphelp_nw2004s/helpdata/EN/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm]in order to modify your maintenance view? Neither these events nor the coding in there should be touched by any regeneration of the view.

Regards

Uwe

Read only

0 Likes
1,030

Hi Gurus,

I would like to add authorisation check to control who can maintain the view table by company code level, can I use event 25?

I am unfamiliar with "Event" in table view maintanence, do you have any sample code?

Pls advise.

Thanks & regards,

Esther

Read only

0 Likes
1,030

Hello Esther

Event 25 (At the Start of the Maintenance Dialog) appears to be the right one for your purpose.

When you are in the maintenance dialog of your view choose menu Environment -> Modification -> Events.

Add event number 25 and the name or the FORM routine (e.g. 25_CHECK_AUTH_BY_BUKRS). Double-click on the routine. The system should propose an include which is added to the function group holding the maintenance views.

Now simply add some mock coding into this routine, e.g.:


FORM 25_CHECK_AUTH_BY_BUKRS.

  MESSAGE 'Event 25 triggered' TYPE 'I'.
  VIM_AUTH_RC = 4.  " go to display mode
 
ENDFORM.

The effect should be that you can only display your maintenance view.

Now you can add the required coding to evaluate the user's authority.

For sample coding you may have a look at [Event 01: Before Saving the Data in the Database|http://help.sap.com/saphelp_nw2004s/helpdata/EN/91/ca9f0ba9d111d1a5690000e82deaaa/frameset.htm]. Using this coding you can manipulate the maintained data.

Regards

Uwe

Read only

0 Likes
1,030

Dear Gurus,

I would like to manipulate on data to be displayed in view table by authorised company code after checking the authorisation, can you provide me the sample code? Can I use Event 26?

Many thanks for help.

Regards,

Esther

Read only

0 Likes
1,030

Hello Esther

It depends on what kind of change you would like make to the displayed data.

Could you be a bit more verbose about this?

Regards

Uwe

Read only

0 Likes
1,030

Dear Gurus,

In my view table created, there are the following key fields:

1) BUKRS : Company Code

2) CCGRP: Cost Center Group

3) PRTYP: Product Type

4) KOSTL : Cost Center

Scenario:

1) When user want to maintain this view table, I need to get the input of company code. By then, I can only check for this user's authorisation to maintain for the input company code. => Event 25

2) If authorisation check is successful, I should display only the record which belongs to the input company code for them to maintain. Other record should not be displayed.

3) Besides that, I need to build-in the code to check if the new entries is allowed before save by checking the Company code entered.

May I know the "Event" to use and it would appreciate if there is any sample code as a guideline.

Thanks & regards,

Esther

Read only

0 Likes
1,030

Hello Esther

In order to "capture" the company code I would make field BUKRS a mandatory SELECTION input for your maintenance view. This means when the user calls the view a poup appear where he or she must enter the company code. Next you execute your AUTH_CHECK routine (event 25). If the user is authorized the data will be displayed and can be maintained (but only for BUKRS = <input value>). Otherwise the user will not get into the maintenance dialog at all meaning he or she will not see any records of other company codes.

Where to set this SELECTION option? In the table control displaying the view field choose maintenance property = 'S' (fourth column).

Regards

Uwe

Read only

0 Likes
1,030

Dear Gurus,

Thanks for your help. I manage to solve my problem.

Regards,

Esther