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

Code in View?

Former Member
0 Likes
1,050

Hi,

I created a dictionary view based on a Z table that has these fields:

MATNR, WERKS_C, WERKS_F, LGORT, STAT_KANB, LIM_MIN, LIM_MAX, LAEDA, UZEIT, AENAM.

I created also a transaction code (SM30) for this view for user update those fields. However the user couldn't update LAEDA, UZEIT, AENAM that should be read only and also updated automatically by SAP (sydatum, syuzei and syunam).

Is it possible? If yes, how?

Points will be rewarded.

Thanks,

Michel Khouri

3 REPLIES 3
Read only

Former Member
0 Likes
466

Hi Michel,

This is indeed possible. Go into the table maintenance generator screen, and then use the menu (Environment->modification->Events).

In here, you could specify an event and create your own subroutine in the function group (which is already created for your maintenance view) to populate the LAEDA, UZEIT, and AENAM fields.

I would suggest that you first create a maintenance view based on your z-table (not a dictionary view), then create the table mainentance on top of that. Also in the view, you could specify the fields you want as read only (use the maintenance flag).

Refer to this document to find out about the different events you can use.

http://help.sap.com/saphelp_nw04/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/content.htm

You would probably use Event 01.

Read only

0 Likes
466

Hi Daniel,

I built the Maintain view as you suggested, based on Z-table and with read only fields (UZEIT, LAEDA and AENAM).

Now, I'm trying to load these information automatically via event. I created a new include, put the code bellow but it doesn't work.

In fact, I don't get to save a new entry in this view. It only shows me the content of Z-table. When I try to include a new register in this view it doesn't save.

What happens?

FORM abc.

DATA: F_INDEX LIKE SY-TABIX. "Index to note the lines found

LOOP AT TOTAL.

IF <ACTION> = AENDERN.

READ TABLE EXTRACT WITH KEY <vim_xtotal_key>.

IF SY-SUBRC EQ 0.

F_INDEX = SY-TABIX.

ELSE.

CLEAR F_INDX.

ENDIF.

MODIFY TOTAL.

CHECK F_INDX GT 0.

EXTRACT = TOTAL.

MODIFY EXTRACT INDEX F_INDX.

ENDIF.

ENDLOOP.

SY-SUBRC = 0.

ENDFORM.

Thanks again.

Michel Khouri

Read only

Former Member
0 Likes
466

Hi freind just now i testing an Maintanice view i can able to decide the field whether it should be display or it should be enable ...

if you goto view fields in the maintance view ...

first <b>view fields</b> , second <b>table</b> , third <b>fields</b> , in fourth there will be<b> "P" </b> here you have to give <b>'R' </b> you can do<b> f4</b> ..... so that you can understand .

save and activate .

after creating the view <b> goto-> Utilities -> maintance Generator </b> ... there itself in menu .

there just give <b>Authorisation group </b> it is must and <b>function group</b> also .

then the maintaince type <b> two steps -> check box</b>

go to main.screen no <b>overview screen 01 , single screen 02 </b> .

<b>save </b>

come back , activate your Maintainance view ,, display the data .. now try to edit so that the<b> 'R' indicated </b> fields are in <b> display mode</b> only ....

if it is use full reward points.....

Girish