Table maintenance - autorization check on field level

Dear all,
I generated a table maintenance view for a custom table via SE11 --> Utilities --> Table maintenance generator.
The table for which the maint. view was generated has a field bukrs. When a user enters a company code via table maintenance in SM30, i want to check if he has the right authorizations for that company code. This check, is this something i have to implement in the modification events or are there other alternatives?
Suppose i want a non-key field to be unique, is there a way to automatically check this, or has this to be done via implementation of the same events?
Kind regards,
J

Hi,
You can do it via the events.
There is one more alternative also.
Create a Z report with the plant as parameter or select-options.
Do an authorisation check on it using the authority object.
Then call the FM of SM30.
The FM of SM30 is 'VIEW_MAINTENANCE_CALL'
See the following code
PARAMETERS: y_p_lgnm TYPE lgnum.
DATA : y_v_string   TYPE string.
CONSTANTS: y_k_u        TYPE char1   VALUE 'U',
           y_k_x        TYPE char1   VALUE 'X',
           y_k_lgnum    TYPE char7   VALUE 'LGNUM',
           y_k_lgtyp    TYPE char5   VALUE 'LGTYP',
           y_k_eq       TYPE char2   VALUE 'EQ',
           y_k_viewname TYPE tabname VALUE 'YLOMANAGTROL'.
*                   INTERNAL TABLE DECLARATION.
DATA: y_i_seltab TYPE STANDARD TABLE OF vimsellist.
*                   WORKAREA DECLARATION.
DATA: y_wa_seltab TYPE vimsellist.
START-OF-SELECTION.
*authority check for warehouse number
  AUTHORITY-CHECK OBJECT 'L_LGNUM'
              ID y_k_lgnum FIELD y_p_lgnm
              ID y_k_lgtyp FIELD '*'.
  IF sy-subrc NE 0.
* user not authorised
    CONCATENATE y_p_lgnm text-003 INTO y_v_string SEPARATED BY space.
    MESSAGE s015(ylo1) WITH text-001
                            sy-uname
                            text-002
                            y_v_string.
  ELSE.
*Clear Internal Table
    CLEAR y_i_seltab.
    CLEAR y_wa_seltab.
*passing the selection parameters to the function module
*view_maintenance_call.
    y_wa_seltab-viewfield = y_k_lgnum.
    y_wa_seltab-value     = y_p_lgnm.
    y_wa_seltab-operator  = y_k_eq.
    APPEND y_wa_seltab TO y_i_seltab.
    CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
      EXPORTING
        action               = y_k_u
        view_name            = y_k_viewname
        show_selection_popup = y_k_x
      TABLES
        dba_sellist          = y_i_seltab.
  ENDIF.
In my case i had a table YLOMANAGTROL with field LGNUM.
So i put an authority check on LGNUM.
Regards,
Ankur Parab

Similar Messages

  • Problem in creating table maintenance generator for 61 fields in table

    Hi Experts,
    I am facing problem in creating a table maintenance genarator for a ZTABLE which has 61 fields
    i am using below details whicle creating the TMG
    in Maintenance screen
    i am giving maintenance type as two step
    Maint screen no overview screen 2
                              single screen        3
    Dialog Data Transport details
    Recording routine    standard recording routine
    but it is giving following error
    screen SAPL<ZTABLE NAME>    0003 could not be generated
    In DYNPFIELD_ATTR mandatory field LINE has no value
    please let me know how to sort out these errors.
    Is there any limit on the number of fields for which we can create table maintenance generetor.
    Thanks a lot in advance
    Sudipto

    Hi Sudipto,
    There is not limit to the number of fields of the Table which can be used in TMG for generation. But, from the usability point of view this will horrible.
    I created a Z table and added 64 fields and was able to generate the TMG with the screens perfectly. So, I guess there should not be any problem.
    Well, have a look at the Function Group. I guess the screen numbers are already used by some other screens. You can set the system to propose freely available screen numbers from the pool.
    Also, check whether proper authorization is assigned or not.
    And if nothing is working, you can degenerate all the generated screens and then can have a new regeneration of it.
    Hope these tips will work.
    Thanks,
    Samantak

  • Table maintenance - auto-populate description field based on other field

    Hello,
    I have a custom table with 2 fields in it. Customer and Name. For customer field, I am using a standard customer search help. My requirement is when I search for a customer and select a customer, how can the name field be auto populated with customer name? I am looking for a best way to do this.
    Thanks,
    AV

    hi adrian,
    One method to achieve this functionality would be  :
    1. Find out the maintenance screen and function group of the table maintenance generator say 0001 and Z03_PRO_FN. ( u can find out by going into tables - > utilities -> tmg - to find Function group. for screen number- from TMG ->utilites->modifications->maintanence screen -> note the screen number).
    2. Go to SE80 and open Z03_PRO_FN screen number 0001.
    3. For field 1 - create a module in Process on Value Request Event in PAI of the maintenance screen ( Similar to any module pool program)
    call the FM F4IF_INT_TABLE_VALUE_REQUEST( In Process on Value request event of field 1 in PAI)
    4. Use FM DYNP_VALUES_Update to read the value of field 1 on the screen ( Because this is before enter is pressed and field 1 on the module pool porogram would not be populated with value ) and update the field 2.
    Regards,
    Sivaganesh

  • Authority check at field level in sales order

    Dear all, our business requirement is the following:
    only some users should be able to see the prices (including netwr, netpr,...) in the sales order depending on the authority check performed on the sales group field.
    This means that for an order of sales group 'A':
    a user of sales group 'A' can see the prices and change the order, a user of sales group 'B' cannnot see the prices but can change the order, a user of sales group 'C' can display the order but cannnot see the prices.
    I ask you if such a scenario can be realized in SAP.
    We currently run SAP ECC 5.0.
    thx all !
    bye Roberto

    Hi agree with Jan and Auke,
    To my knowledge it is object V_KONH_VKO which you are looking for. See the documentation in SU24 - SD class.
    But whether or not that will influence the visibility / editability of the screen in VA02 etc when turned the check on in SU24, I am not sure.
    If not, search the forum for topics relating to "transaction variants", "variant transactions" and "screen variants" to see whether those solutions will fulfill the requirement.
    Cheers,
    Julius

  • Authority check at field level in the sales order

    Dear all, our business requirement is the following:
    only some users should be able to see the prices (including netwr, netpr,...) in the sales order depending on the authority check performed on the sales group field.
    This means that for an order of sales group 'A':
    a user of sales group 'A' can see the prices and change the order, a user of sales group 'B' cannnot see the prices but can change the order, a user of sales group 'C' can display the order but cannnot see the prices.
    I ask you if such a scenario can be realized in SAP.
    We currently run SAP ECC 5.0.
    thx all !
    bye Roberto

    Hi
    In general different users will be given different authorizations based on their role in the orgn.
    We create ROLES and assign the Authorization and TCODES for that role, so only that user can have access to those T Codes.
    USe SUIM and SU21 T codes for this.
    Much of the data in an R/3 system has to be protected so that unauthorized users cannot access it. Therefore the appropriate authorization is required before a user can carry out certain actions in the system. When you log on to the R/3 system, the system checks in the user master record to see which transactions you are authorized to use. An authorization check is implemented for every sensitive transaction.
    If you wish to protect a transaction that you have programmed yourself, then you must implement an authorization check.
    This means you have to allocate an authorization object in the definition of the transaction.
    For example:
    program an AUTHORITY-CHECK.
    AUTHORITY-CHECK OBJECT <authorization object>
    ID <authority field 1> FIELD <field value 1>.
    ID <authority field 2> FIELD <field value 2>.
    ID <authority-field n> FIELD <field value n>.
    The OBJECT parameter specifies the authorization object.
    The ID parameter specifies an authorization field (in the authorization object).
    The FIELD parameter specifies a value for the authorization field.
    The authorization object and its fields have to be suitable for the transaction. In most cases you will be able to use the existing authorization objects to protect your data. But new developments may require that you define new authorization objects and fields.
    http://help.sap.com/saphelp_nw04s/helpdata/en/52/67167f439b11d1896f0000e8322d00/content.htm
    To ensure that a user has the appropriate authorizations when he or she performs an action, users are subject to authorization checks.
    Authorization : An authorization enables you to perform a particular activity in the SAP System, based on a set of authorization object field values.
    You program the authorization check using the ABAP statement AUTHORITY-CHECK.
    AUTHORITY-CHECK OBJECT 'S_TRVL_BKS'
    ID 'ACTVT' FIELD '02'
    ID 'CUSTTYPE' FIELD 'B'.
    IF SY-SUBRC <> 0.
    MESSAGE E...
    ENDIF.
    'S_TRVL_BKS' is a auth. object
    ID 'ACTVT' FIELD '02' in place 2 you can put 1,2, 3 for change create or display.
    The AUTHORITY-CHECK checks whether a user has the appropriate authorization to execute a particular activity.
    This Authorization concept is somewhat linked with BASIS people.
    As a developer you may not have access to access to SU21 Transaction where you have to define, authorizations, Objects and for nthat object you assign fields and values. Another Tcode is PFCG where you can assign these authrization objects and TCodes for a  profile and that profile in turn attached to a particular user.
    Take the help of the basis Guy and create and use.
    <b><REMOVED BY MODERATOR></b>
    regards
    Anji
    Message was edited by:
            Alvaro Tejada Galindo

  • How to hide a field from table maintenance view?

    Hi,
    How to hide a field from table maintenance view? 
    The field is used for data created date. I need to hide it from display.
    Thanks

    Chk this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/66/33f52010dd11d6999300508b5d5211/frameset.htm
    Maintenance Attributes
    You can assign a maintenance attribute P to individual fields in the maintenance view definition in the Dictionary (SE11). It can be  H (hidden)
    H (hidden)
    A field flagged H is not displayed on the screen. This field must also be filled in the background by a routine at an event.
    The system writes R and H fields to the database like all other fields when a new data record is saved.

  • Table Maintenance - Field Names not appearing

    Hi,
       I given table maintenace for 'Z' table.
       When i went to SM30 transcation, the fields which are taken as Built-in type instead of Data elements are not having caption( Field names ) . It is showing '+' in the place of Fieldname .
       What may be the reason. In table i given short description of the field . Even though it is not displaying.
    Please suggest me.
    Thanks in advance
    Pavan.

    Hi Pavan,
    If you used the built-in types, then that is how it appears in SM30. It will <b>not</b> take the field short descriptions you entered in the table.
    Only way to get around it is to go to the screen of the table maintenance and change the field lables there. Caution though, is that whenever you change the table maintenance, you need to do this screen change again.
    Let me know if you need more info on how to do it.
    Srinivas

  • Addition of a new column in Table Maintenance Generator

    Hi All,
    I have a requirement in which I have to include a new field in Table Maintenance Generator . This field is not present in the table but its data will be fetched from another table . Pls help me in this regard.
    I have little idea of Table control .
    Regards,
    Nibha

    Hi Nibha,
    Table maintenance generator screen is an automatically generated screen. You cannot to any changes in that and neither can you do the changes in the PBO and/or PAI.
    You can do it but it will ask you for SAP key etc. So there's not need to do it that way.
    What you could do is;
    1. Go to the table maintenence generator from SE11, in Change Mode.
    2. Click on change icon. The system will show the 'Change Generation Elements' screen where it sill ask you the resson
        for change.
    3. Click on the New Field/Sec. table in struction (or whichever is appropriate/applicable in your case)
    4. Press Ok (Tick sign).
    5. Then it will show you the ''Change Generation Elements: Detail' screen.Here;
           =>  You will select the maintenance screen that you wish to change( Overview/Single).
           =>   And the Field Type. Whether it is a key field or normal field.
                  Select which ever is applicable.
    6. The system will then re-generate the screen for you and - You'll Smile! - that you got the answer!
    Cheers!
    Sanjiv

  • Quantity in Table Maintenance Generator

    Hi All,
    In my table maintenance, I have quantity field.
    When user does not enter any value in it. It should show blank in quantiy field. Currently its showing 0.000.
    Please help , how to achieve this.
    Thanks
    Jitendra

    HI,
    Since it is a quantity field, it will always show you in decimals (0.00) while maintaining the table via SM30.
    Replace this field by a character field.
    Regards,
    Danish.

  • Problem in updating entries in Table Maintenance of custom table

    Hi Gurus,
    Need help. When I update existing entries in the table maintenance generator, they do not get updated after save. Is there a setting in data dictionary that causes this?

    Just noticed that the field that I'm trying to update is a KEY FIELD.
    Usually, when a table maintenance is generated, key field columns are set to uneditable. But for apparent reason, previous programers set it as editable. Is there a way to edit the Key fields?

  • Open T-code on double click of field in table maintenance

    Hi Gurus,
    I have one scenario, I have to show a transaction on double click event on a field of Table Maintence.
    Please guide me in this .
    Is there is any event in Table Maintenance Events to capture double_click of a field.
    Regards,
    Sowmen

    1. In the field attributes of the particular field there is a chechbox  in display tab which says respond to double click, check that.
    2. Assign the fuction code "PICK" for function code F2 in GUI status.
    3.Now whenver you double click the field function code "PICK" gettes triggeed.
    Now you can wrie yyou code based on this function code.
    CASE sy-comm.
    WHEN 'PICK'.
    *If you want the name of the field and the value in that field use the below code.
    GET CURSOR FIELD gv_field VALUE gv_cursor_value.
    *DO your operation based on the field and the value.
    ENDCASE.
    Regards,
    Smithesh

  • Add field in table maintenance generator screen of maintenance view

    Hi,
    I am having a table with field user-id. I want to generate a maintenance view which will have corresponding user name as input disabled field. Since there are two tables USR21 and ADRP I need to access(not a direct check table) I will have to modify the code generated by the table maintenance generator.
    Problem is that it is having one internal table EXTRACT at table control loop. That internal table cannot be accessed if you write a module inside the table control loop and try to catch. The error coming as EXTRACT is not object of structure and therefore no component. I tried to capture the value of the Loop but could not be successful. Any suggestion please.
    Thanks,
    Atanu

    Hi,
    sample:
          MODULE LISTE_UPDATE_LISTE.
        ENDCHAIN.
    *--->begin of your change
        CHAIN.
          FIELD YTAB1-BILKS .
          FIELD YTAB1-BILKH .
           module check_bewar  ON CHAIN-input. "your checks
        ENDCHAIN.
    *-----> end of your change
      ENDLOOP.
      MODULE LISTE_AFTER_LOOP.
    ->  module check_bewar  is in an includ z123_INCL
    Regards Andreas

  • Error during transport-Structure change at field level (convert table /BIC)

    Hi,
    I am trying to transport from DEV to Test when I encountered this error.
    The tables are both consistent when I checked with SE14.
    Start of the after-import method RS_CUBE_AFTER_IMPORT for object type(s) CUBE (Activation Mode)
    Error/warning in dict. activator, detailed log    > Detail
    Structure change at field level (convert table /BIC/DZCRUSDI026)
    Table /BIC/DZCRUSDI026 could not be activated
    Return code..............: 8
    Following tables must be converted
    DDIC Object TABL /BIC/DZCRUSDI026 has not been activated
    Error when activating InfoCube ZCRUSDI02
    Error/warning in dict. activator, detailed log    > Detail
    Structure change at field level (convert table /BIC/DZCRUSDI023)
    Structure change at field level (convert table /BIC/FZCRUSDI02)
    Table /BIC/DZCRUSDI023 could not be activated
    Table /BIC/FZCRUSDI02 could not be activated
    Return code..............: 8
    Following tables must be converted
    DDIC Object TABL /BIC/DZCRUSDI023 has not been activated
    Error when resetting InfoCube ZCRUSDI02 to the active version
    How do I resolve this
    thanks

    Hi,
    There are no Inactive objects in the cube in DEV system. Also must of the changes I made in Test are already in the cube in TEST But the cube is not active.
    SAP proposed that the cube be activated manually but is not a good procedure to activate in TEST system.
    Error when resetting InfoCube ZCRUSDI02 to the active version
    Message no. RSO410
    Diagnosis
    Errors arose when activating InfoCube ZCRUSDI02. An active version already existed before the activation.
    System Response
    InfoCube ZCRUSDI02 could not be reset to the old active version. Since the generated objects no longer correspond to the old active version, they were reset to inactive.
    Procedure
    The old active version of InfoCube ZCRUSDI02 can no longer be used. Remove the cause of the activation error and activate InfoCube ZCRUSDI02 anew.
    thanks

  • Missing Date fields in table maintenance generation

    I have some non-key date fields in my custom table and have noticed that they do not get generated on the overview screen of my two-step table maintenance dialog. They are present on the detail screen.
    If I change the domain of the fields to CHAR they appear.
    If I change the maintenance type to one-step they appear.
    It seems it is standard behaviour for date fields to be omitted from the overview screen.
    Can anyone confirm that this is standard behaviour or give an explanation for date fields being treated in this manner?...or come up with a way of including the fields on the header screen.
    I already know that I can:
    1. customize the screen to include the fields
    2. create a non-date domain for the fields which uses date-type calendar dropdown
    Thanks,
    Neil

    Thankyou Jonathan, I would have been too lazy to go into debug if I didn't have the form name you supplied! It wasn't the reason you suspected but it was failing the following check in that routine:
    maintenance in list screen required?
          CHECK p_tvdir-type = one_step_maint OR
           ( <w_dfies>-keyflag NE space    "force only keyfields
            OR ( 'CHARNUMC' CS <w_dfies>-datatype     "and view char-fields
             AND p_skip_fields = space )
            OR ( 'CHARNUMC' CS <w_dfies>-datatype     "and view char-fields
             AND <w_dfies>-intlen GE 20 )       "int 3263961/2000
            OR <w_dfies>-rollname = 'BEGDA'    "time dependence
            OR <w_dfies>-rollname = 'ENDDA'    "time dependence
            OR <w_dfies>-tabname NE p_gencb-viewname ). "or text table field
    Because the datatype was DATS.......looks like it will only include key fields and CHAR, NUMC non-key fields or those with a rollname of BEGDA/ENDDA or texttable fields. In debug I changed the datatype to CHAR and it generated with my field included. I think there might be an OSS note to fix this but haven't found it yet.

  • Currency field in Table maintenance generator

    Hi,
    I have created a table with fields amont and currency..When I create generate the table maintenance for this table I am not able to see currency and amounts field on the generated screen. Please do help me whats missing from my end.
    raghu

    make the foriegn key for the currency TCURC
    This was for those whose currency keys are not maintained
    Resaon might be the Currency is not maintained in the table TCURC
    they can be maintained in SPRO
    SAP Netweaver - > General Setting - > Currencies - > Check Currency Codes
    Regards
    - Gopi

Maybe you are looking for