类:ZCL_IFLOG_UTILITIES
属性:AUTH_RESULTS_LIST
类型:
TY_AUTH_RESULT Private
受保护部分:
PRIVATE SECTION.TYPES: BEGIN OF ty_auth_result,funcname TYPE ztall_logcfg-funcname,pass TYPE abap_bool,END OF ty_auth_result.CLASS-DATA: auth_results_list TYPE HASHED TABLE OF ty_auth_result WITH UNIQUE KEY funcname.
方法:
RE_PROCESS Static Method Public
IS_PRD Static Method Public
GET_DISTINCT_COUNT Static Method Public
FM_AUTHORITY_CHECK Static Method Public
方法:RE_PROCESS
参数:
UUID Importing Type SYSUUID_C32
METHOD re_process.DATA: data_ref TYPE REF TO data.SELECT SINGLE uuid, funcname, import, change_in, table_inFROM ztall_iflogWHERE uuid = @uuidINTO @DATA(record).IF sy-subrc <> 0.RETURN.ENDIF.SELECT funcname, paramtype, pposition, parameter, structureFROM fupararefWHERE funcname = @record-funcnameINTO TABLE @DATA(parameters_tab).IF sy-subrc <> 0.RETURN.ENDIF.DATA: temp_dd04l TYPE STANDARD TABLE OF dd04l.LOOP AT parameters_tab ASSIGNING FIELD-SYMBOL(<ptab>).IF strlen( <ptab>-structure ) > 30.CONTINUE.ENDIF.temp_dd04l = VALUE #( BASE temp_dd04l ( domname = <ptab>-structure ) ).ENDLOOP.IF temp_dd04l IS NOT INITIAL.SELECT domname FROM dd04lFOR ALL ENTRIES IN @temp_dd04lWHERE domname = @temp_dd04l-domnameINTO TABLE @DATA(data_elements).ENDIF.DATA: func TYPE string,ptab TYPE abap_func_parmbind_tab,ptab_line TYPE abap_func_parmbind,etab TYPE abap_func_excpbind_tab,etab_line TYPE abap_func_excpbind.LOOP AT parameters_tab ASSIGNING FIELD-SYMBOL(<parameter>).CLEAR ptab_line.ptab_line-name = <parameter>-parameter.ptab_line-kind = COND #( WHEN <parameter>-paramtype = 'E' THEN abap_func_importingWHEN <parameter>-paramtype = 'I' THEN abap_func_exportingWHEN <parameter>-paramtype = 'T' THEN abap_func_tablesWHEN <parameter>-paramtype = 'C' THEN abap_func_changingELSE '').DATA(json_field_name) = COND string( WHEN ptab_line-kind = abap_func_exporting THEN 'IMPORT'WHEN ptab_line-kind = abap_func_tables THEN 'TABLE_IN'WHEN ptab_line-kind = abap_func_changing THEN 'CHANGE_IN'ELSE '').IF json_field_name IS INITIAL.CONTINUE.ENDIF.ASSIGN COMPONENT json_field_name OF STRUCTURE record TO FIELD-SYMBOL(<json_raw>).IF sy-subrc <> 0 OR <json_raw> IS INITIAL.CONTINUE.ENDIF.DATA(json_data) = zcl_iflog_json=>generate_new( json = <json_raw> ).ASSIGN json_data->* TO FIELD-SYMBOL(<json_data>).ASSIGN COMPONENT <parameter>-parameter OF STRUCTURE <json_data> TO FIELD-SYMBOL(<parameter_val>).IF sy-subrc <> 0.CONTINUE.ENDIF.IF ptab_line-kind = abap_func_exporting OR ptab_line-kind = abap_func_changing.CREATE DATA data_ref TYPE (<parameter>-structure).FIELD-SYMBOLS: <temp> TYPE any.ASSIGN <parameter_val>->* TO <temp>.ENDIF.IF ptab_line-kind = abap_func_tables."不知道为什么,如果是表类型的时候会报错,改成和changing一样的方式试运行一下DATA(structure_type) = CAST cl_abap_structdescr( cl_abap_datadescr=>describe_by_name( <parameter>-structure ) ).DATA(table_type) = CAST cl_abap_tabledescr( cl_abap_tabledescr=>create( structure_type ) ).CREATE DATA data_ref TYPE HANDLE table_type.ASSIGN <parameter_val>->* TO <temp>.* CREATE DATA data_ref TYPE (<parameter>-structure).
* ASSIGN <parameter_val>->* TO <temp>.ENDIF.IF data_ref IS BOUND.ASSIGN data_ref->* TO FIELD-SYMBOL(<data_ref>).ENDIF.IF line_exists( data_elements[ domname = <parameter>-structure ] ).<data_ref> = <temp>.ELSE.DATA(json_temp) = zcl_iflog_json=>serialize( data = <parameter_val> ).zcl_iflog_json=>deserialize( EXPORTING json = json_temp CHANGING data = <data_ref> ).ENDIF.GET REFERENCE OF <data_ref> INTO ptab_line-value.INSERT ptab_line INTO TABLE ptab.ENDLOOP.etab_line-name = 'OTHERS'.etab_line-value = 2.INSERT etab_line INTO TABLE etab.CALL FUNCTION record-funcnamePARAMETER-TABLEptabEXCEPTION-TABLEetab.ENDMETHOD.
方法:IS_PRD
参数:RESULT Returning Type ABAP_BOOL
METHOD is_prd.DATA: role TYPE t000-cccategory.CALL FUNCTION 'TR_SYS_PARAMS'IMPORTINGsystem_client_role = roleEXCEPTIONSno_systemname = 1no_systemtype = 2OTHERS = 3.IF sy-subrc <> 0.
* Implement suitable error handling hereENDIF.IF role = 'P'.result = abap_true.ENDIF.ENDMETHOD.
方法:GET_DISTINCT_COUNT
参数:
TAB_DATA Importing Type ANY TABLE
FIELD_NAME Importing Type CLIKE
COUNT Returning Type INT4
METHOD get_distinct_count.TYPES: BEGIN OF ty_temp,field TYPE string,END OF ty_temp.DATA: count_table TYPE HASHED TABLE OF ty_temp WITH UNIQUE KEY field,count_wa LIKE LINE OF count_table.LOOP AT tab_data ASSIGNING FIELD-SYMBOL(<wa>).ASSIGN COMPONENT field_name OF STRUCTURE <wa> TO FIELD-SYMBOL(<field>).IF sy-subrc <> 0.RETURN.ELSE.count_wa-field = <field>.INSERT count_wa INTO TABLE count_table.ENDIF.ENDLOOP.count = lines( count_table ).ENDMETHOD.
方法:FM_AUTHORITY_CHECK
参数:
FM_NAME Importing Type RS38L_FNAM
BUFFER Importing Type ABAP_BOOL ABAP_TRUE
PASS Returning Type ABAP_BOOL
METHOD fm_authority_check.DATA: auth_result LIKE LINE OF auth_results_list.IF buffer = abap_true.auth_result = VALUE #( auth_results_list[ funcname = fm_name ] OPTIONAL ).IF auth_result IS NOT INITIAL.pass = auth_result-pass.RETURN.ENDIF.ENDIF.IF auth_result IS INITIAL.DELETE auth_results_list WHERE funcname = fm_name.SELECT SINGLE no_auth_check FROM ztall_logcfg WHERE funcname = @fm_nameINTO @DATA(no_auth_check) BYPASSING BUFFER.IF no_auth_check = abap_true.auth_result = VALUE #( funcname = fm_name pass = abap_true ).ELSE.DATA: wa_tadir TYPE tadir,area TYPE sobj_name.SELECT SINGLE area FROM enlfdir WHERE funcname = @fm_name INTO @area.IF sy-subrc <> 0.RETURN.ENDIF.CALL FUNCTION 'TR_TADIR_INTERFACE'EXPORTINGwi_test_modus = ' 'wi_read_only = 'X'wi_tadir_pgmid = 'R3TR'wi_tadir_object = 'FUGR'wi_tadir_obj_name = areaIMPORTINGnew_tadir_entry = wa_tadirEXCEPTIONSOTHERS = 1.IF sy-subrc <> 0 OR wa_tadir-devclass IS INITIAL.AUTHORITY-CHECK OBJECT 'S_DEVELOP'ID 'DEVCLASS' DUMMYID 'OBJTYPE' FIELD 'FUGR'ID 'OBJNAME' FIELD areaID 'P_GROUP' DUMMYID 'ACTVT' FIELD '16'.ELSE.AUTHORITY-CHECK OBJECT 'S_DEVELOP'ID 'DEVCLASS' FIELD wa_tadir-devclassID 'OBJTYPE' FIELD 'FUGR'ID 'OBJNAME' FIELD areaID 'P_GROUP' DUMMYID 'ACTVT' FIELD '16'.ENDIF.IF sy-subrc = 0.auth_result = VALUE #( funcname = fm_name pass = abap_true ).ELSE.auth_result = VALUE #( funcname = fm_name pass = abap_false ).ENDIF.ENDIF.ENDIF.pass = auth_result-pass.INSERT auth_result INTO TABLE auth_results_list.ENDMETHOD.