Skip to Content
1

Check original language of repository objects when creating

Apr 09 at 08:10 AM

56

avatar image

In our company, repo objects must be created with original language EN. Is there a way to check the logon language in case of creating a new object in the ABAP repository?

Desired behaviour: SE80 - create program/class/data element/table/....

--> user exit/badi checks the logon language. When it is not 'EN', the creation will be refused.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Sandra Rossi Apr 10 at 05:52 AM
2

Although your requirement is fully justified, a user exit probably doesn't exist, so you'll be the first one to do a modification of the standard (enhancement framework). Almost every ABAP Workbench action is initiated through the CL_WB_REQUEST class, so you could do something around it. But you must be very careful with any modification in the ABAP workbench, you could put down the whole system if your code has a syntax error one day (installation of support package or upgrade, SAP note, etc.), so if you do anything at all, I advise you to take all possible precautions : dynamic linking of your modification to the code (call method ('CLASS')=>('NAME'))+ restriction of your modification to only the developers + assigning the modification to the + option to switch it off at any time (switch framework, reversible business function).

Show 4 Share
10 |10000 characters needed characters left characters exceeded
  data zz_lv_oper_failed type abap_bool.
    try.
        call method ('ZCL_DV07_WB_REQUEST_ENH')=>('OPERATION_NOT_VALID')
          exporting iv_operation = p_operation
          receiving rv_failed = zz_lv_oper_failed.
        if zz_lv_oper_failed = abap_true.
          message id sy-msgid type 'I' number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            display like 'E'.
          return.
        endif.
      catch CX_SY_DYN_CALL_ERROR.
        " do nothing.
    endtry.

This is what I implemented as an enhancement in two positions:

1. method constructor of CL_WB_REQUEST

2. FORM CREATE_PROGRAM of SAPLWBABAP (SE38 does not call CL_WB_REQUEST when creating a report)

both at the implicit enh point at the beginning

The class ZCL_DV07_WB_REQUEST_ENH reads an own DB table where workbench actions are flagged with "check logon language". Based on this settings, a check of sy-langu is being performed and in case of the wrong language, RV_FAILED is set to ABAP_TRUE.

Thanks for your help!

2

Thanks for sharing your solution. :-)

0

Well done and thanks for the feedback :)

As I had a bad experience, I recommand again to have the minimal code inside the enhancement, only a CALL METHOD + CATCH cx_root. Do the MESSAGE inside your method.

Don't forget to limit to a subset of users.

Don't forget to assign your enhancement to a switchable package ("disaster-driven development" ;-))

0

Good suggestions. I now stripped it down to

  data zz_lv_oper_failed type abap_bool.
  try.
      call method ('ZCL_DV07_WB_REQUEST_ENH')=>('OPERATION_NOT_VALID')
        exporting iv_operation = 'CREATE'
        receiving rv_failed = zz_lv_oper_failed.
      if zz_lv_oper_failed = abap_true.
        return.
      endif.
    catch CX_SY_DYN_CALL_ERROR.
      " do nothing.
  endtry.<br>

The rest is done in the called method:

  method operation_not_valid.
      if so_dp is not bound.<br>        " create a static data provider that contains all SEU operations
        " with additional checks (stored in a customizing table)
        so_dp = new #( ).  " see data provider class
      endif.
      try.
          " get the action from the data provider
          data(ls_action) = so_dp->mt_settings[ id = iv_operation ].
        catch cx_sy_itab_line_not_found.
          " no checks for this action set - leave
          return.
      endtry.
      if ls_action-langu_check = abap_true.  " logon language check active
        if sy-langu <> 'E'.  " English is mandatory
          message i001(zm_dv07) display like 'E'. " show a message
          rv_failed = abap_true. " return the failed-flag
        endif.
      endif.
  endmethod.

*--------- the data provider class ------------------<br>class lcl_dp_settings definition final.
  public section.
    types gty_t_settings type standard table of zdb_dv07_001 with default key.
    data mt_settings type gty_t_settings.
    methods constructor.
endclass.

class lcl_dp_settings implementation.
  method constructor.
    select * from zdb_dv07_001
      into table @mt_settings.
  endmethod.
endclass.

*------------ the customizing table ZDB_DV07_001
|ID         |LANGU_CHECK |
+-----------+------------+
|CREANOEDIT |X           |
|CREATE     |X           |
|CREATE_CPT |X           |
|CREATE_DMD |X           |
|CREATE_OBJ |X           |
|CREATE_OP  |X           |
|CREATE_PRP |X           |
|CREATE_REF |X           |
|CREATE_REL |X           |
|CREATE_SOB |X           |
|EDIT       |X           |




1
Matthew Billingham
Apr 09 at 09:50 AM
0

I don't think there is. You could however put a check at transport release time in an implementation of BADI CTS_REQUEST_CHECK.


Show 1 Share
10 |10000 characters needed characters left characters exceeded

At transport release would be too late for the objects are already created with the wrong language. But I already put a check at the creation of work bench requests. But one colleague has created placeholder requests with english logon and uses them instead of creating new ones....

1