Jens stellt fest/ hat geschrieben:Ist Euch schon mal augefallen, das Regeln immer von Menschen gemacht werden, die Diese nicht zu befolgen haben ? ( findet meine Tochter übrigens auch .... ???? )
Code: Alles auswählen.
SCAN ABAP-SOURCE itab WITH DECLARATIONS
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report ZATC_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
* method if_Satc_Result_Access_Svc~select_All_In_Ext_Field_List.
*
* data:
* l_Desc type ref to cl_Abap_Structdescr,
* l_Comp type abap_Componentdescr.
*
* field-symbols <l_Comp> type any.
*
* l_Desc ?= cl_Abap_Typedescr=>describe_By_Data( c_Ext_Field_List ).
*
* loop at l_Desc->get_Components( ) into l_Comp.
* assign component l_Comp-name of structure c_Ext_Field_List to <l_Comp>.
* <l_Comp> = 'X'.
* endloop.
*
* endmethod.
REPORT zatc_test.
DATA:
gv_fm_name TYPE rs38l_fnam, "@TC corr:L_FM_NAME
gv_formname TYPE fpname VALUE 'ZSD_MARK_PDF', "@TC corr:L_FORMNAME
gs_docparams TYPE sfpdocparams, "@TC corr:FP_DOCPARAMS
gs_formoutput TYPE fpformoutput, "@TC corr:FP_FORMOUTPUT
gs_outputparams TYPE sfpoutputparams. "@TC corr:FP_OUTPUTPARAMS
CONSTANTS gc_xcon(1) VALUE 'X'."@TC corr:XCON(1)
DATA git_txtable TYPE TABLE OF vbak."@TC corr:TXTABLE
DATA git_sxstru TYPE vbak."@TC corr:SXSTRU
DATA zgit_txtable TYPE TABLE OF vbak WITH HEADER LINE."@TC corr:TXTABLE
DATA gv_opt TYPE vbak-vbeln."@TC corr:R_OPT
FIELD-SYMBOLS <gfs_p> TYPE vbak-vbeln."@TC corr:<P>
RANGES git_trang FOR gv_opt."@TC corr:TRANG"@TC corr:R_OPT
PARAMETERS p_vbeln TYPE likp-vbeln DEFAULT '65809588'.
SELECT-OPTIONS so_s_opt FOR gv_opt."@TC corr:R_OPT"@TC corr:S_OPT
START-OF-SELECTION.
PERFORM f_get_function_module."@TC corr:GET_FUNCTION_MODULE
*&---------------------------------------------------------------------*
*& Form F_GET_FUNCTION_MODULE"@TC corr:GET_FUNCTION_MODULE
*&---------------------------------------------------------------------
FORM f_get_function_module ."@TC corr:GET_FUNCTION_MODULE
gs_outputparams-nodialog = 'X'."@TC corr:FP_OUTPUTPARAMS
gs_outputparams-preview = 'X'."@TC corr:FP_OUTPUTPARAMS
gs_outputparams-dest = 'LOCL'."@TC corr:FP_OUTPUTPARAMS
gs_outputparams-pdfchangesrestricted = 'F'."@TC corr:FP_OUTPUTPARAMS
* fp_outputparams-copies = '4'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = gs_outputparams "@TC corr:FP_OUTPUTPARAMS
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN OTHERS.
ENDCASE. " CASE sy-subrc
ENDIF.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = gv_formname "@TC corr:L_FORMNAME
IMPORTING
e_funcname = gv_fm_name. "@TC corr:L_FM_NAME
DATA:
document_output_info TYPE ssfcrespd,
job_output_info TYPE ssfcrescl,
job_output_options TYPE ssfcresop.
CALL FUNCTION gv_fm_name "@TC corr:L_FM_NAME
EXPORTING
* /1BCDWB/DOCPARAMS =
i_vbeln = p_vbeln
* IMPORTING
* /1BCDWB/FORMOUTPUT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN OTHERS.
ENDCASE. " CASE sy-subrc
ENDIF. " IF sy-subrc <> 0
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT = result
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN OTHERS.
ENDCASE. " CASE sy-subrc
ENDIF. " IF sy-subrc <> 0.
ENDFORM. " F_GET_FUNCTION_MODULE"@TC corr:GET_FUNCTION_MODULE
Folgende Benutzer bedankten sich beim Autor DeathAndPain für den Beitrag:
Tron
Folgende Benutzer bedankten sich beim Autor black_adept für den Beitrag (Insgesamt 2):
ewx • Tron
Die Prüfung CL_CI_TEST_ABAP_NAMING prüft leider nur, ob z.B. Daten lokal oder global sind und in die entsprechende typunabhängige Vorgabe passen.
Code: Alles auswählen.
" Locally start ATC for list of objects with standard check variant and retrieve all findings
FORM local_run_with_objects USING i_keys TYPE if_satc_object_set=>ty_object_keys
CHANGING i_msg TYPE string.
DATA:
l_factory TYPE REF TO cl_satc_api_factory,
"l_keys TYPE if_satc_object_set=>ty_object_keys,
l_object_set TYPE REF TO if_satc_object_set,
l_configuration TYPE REF TO if_satc_run_configuration,
l_controller TYPE REF TO if_satc_run_controller,
l_result_access TYPE REF TO if_satc_result_access,
l_findings TYPE scit_rest,
s_findings TYPE LINE OF scit_rest,
l_findings_extension TYPE satc_ci_findings_extension,
"l_msg TYPE string,
l_cx TYPE REF TO cx_root,
s_data TYPE ty_data ##NEEDED.
.
CREATE OBJECT l_factory.
* l_keys = VALUE #( ( obj_type = 'PROG' obj_name = 'Z_SD_SOS2' )
* ( obj_type = 'FUGR' obj_name = 'ZGOSUTILS2' ) ).
TRY.
l_object_set = cl_satc_object_set_factory=>create_for_object_keys( i_keys ).
CATCH cx_satc_empty_object_set INTO l_cx.
MESSAGE l_cx TYPE 'E'. " Object set contains no checkable objects
ENDTRY.
l_configuration = l_factory->create_run_configuration(
i_object_set = l_object_set
i_description = 'MY_RUN' ).
l_controller = l_factory->create_run_controller( l_configuration ).
TRY.
l_controller->run( IMPORTING e_result_access = l_result_access ).
CATCH cx_satc_failure INTO l_cx.
MESSAGE l_cx TYPE 'E'. " ATC check run failed (no authorization, etc.)
ENDTRY.
TRY.
l_result_access->get_findings(
IMPORTING
e_findings = l_findings
e_findings_extension = l_findings_extension ).
CATCH cx_satc_failure INTO l_cx.
MESSAGE l_cx TYPE 'E'. " Result access failed (no authorization, etc.)
ENDTRY.
DATA s_ext TYPE satc_ci_finding_extension.
DATA i TYPE i.
DATA s_line TYPE string.
DATA s_text1 TYPE string.
LOOP AT l_findings INTO s_findings.
i = sy-tabix.
MOVE-CORRESPONDING s_findings TO s_data.
READ TABLE l_findings_extension INTO s_ext INDEX i.
MOVE-CORRESPONDING s_ext TO s_data.
CLEAR s_text1.
LOOP AT s_ext-description_lines INTO s_line.
CONCATENATE s_text1 s_line INTO s_text1 SEPARATED BY '+'.
ENDLOOP.
i = strlen( s_text1 ).
IF i > 0.
IF i > 128.
s_data-text1 = s_text1+1(128).
s_data-text2 = s_text1+129.
ELSE.
s_data-text1 = s_text1+1.
ENDIF.
ENDIF.
APPEND s_data TO it_data.
ENDLOOP.
i_msg = 'Number of Findings / Extensions: &1 / &2'(002).
REPLACE ALL OCCURRENCES OF '&1' IN i_msg WITH |{ lines( l_findings ) }|.
REPLACE ALL OCCURRENCES OF '&2' IN i_msg WITH |{ lines( l_findings_extension ) }|.
CONCATENATE text-001 i_msg INTO i_msg SEPARATED BY ' '.
ENDFORM.
Code: Alles auswählen.
REPORT.
END-OF-SELECTION.
PERFORM analyzer.
FORM test .
DATA: x TYPE mara.
TYPES: ty LIKE x-matnr.
DATA: x2 LIKE x.
DATA: x3 LIKE x2.
DATA: x4 LIKE x3.
DATA: y LIKE x.
DATA: y3 LIKE y-mtart.
data: lt_tab type STANDARD TABLE OF mara.
data: begin of deep,
t_deep like lt_tab,
end of deep.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form ANALYZER
*&---------------------------------------------------------------------*
FORM analyzer .
DATA(compiler) = cl_abap_compiler=>create( p_name = sy-repid ).
compiler->get_complete_refs( IMPORTING
p_refs = DATA(lt_refs) ).
DATA: lo_data_comp_data TYPE REF TO cl_abap_comp_data,
lo_data_type TYPE REF TO cl_abap_comp_type.
LOOP AT lt_refs ASSIGNING FIELD-SYMBOL(<ls_ref>) WHERE ref-full_name CS '\FO:TEST\'.
DATA(lo_symbol) = compiler->get_symbol_entry( <ls_ref>-ref-full_name ).
DATA(lv_classname) = cl_abap_classdescr=>get_class_name( lo_symbol ).
CASE lv_classname.
WHEN '\CLASS=CL_ABAP_COMP_DATA'.
FORMAT COLOR OFF.
lo_data_comp_data ?= lo_symbol.
WRITE :/ <ls_ref>-ref-full_name,
AT 40 lv_classname,
AT 80 lo_data_comp_data->type->full_name,
AT 160 lo_data_comp_data->type->atyp.
WHEN OTHERS.
FORMAT COLOR 7.
WRITE :/ <ls_ref>-ref-full_name,
AT 40 lv_classname.
ENDCASE.
ENDLOOP.
ENDFORM.