Zsap Check Notes Pix
Zsap Check Notes Pix
Zsap Check Notes Pix
CONSTANTS:
gc_version TYPE string VALUE '10', "version of the 3127880
gc_version_date TYPE date VALUE '20230127'.
*----------------------------------------------------------------------*
* CLASS lcl_protocol DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_protocol DEFINITION.
PUBLIC SECTION.
METHODS constructor.
METHODS add_header
IMPORTING iv_header TYPE string.
METHODS add_item
IMPORTING iv_item TYPE string
iv_msgty TYPE symsgty OPTIONAL.
METHODS add_instruction
IMPORTING iv_item TYPE string.
METHODS finish.
PRIVATE SECTION.
DATA mo_header_no TYPE int1 VALUE 0.
*----------------------------------------------------------------------*
* CLASS lcx_message DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcx_message DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES if_t100_message.
CONSTANTS:
BEGIN OF gc_message,
msgid TYPE symsgid VALUE '01',
msgno TYPE symsgno VALUE '666',
END OF gc_message.
DATA:
mv_msgv1 TYPE symsgv,
mv_msgv2 TYPE symsgv,
mv_msgv3 TYPE symsgv,
mv_msgv4 TYPE symsgv,
severity TYPE symsgty VALUE 'W'.
CLASS-METHODS create_message
IMPORTING
iv_msgty TYPE symsgty OPTIONAL
iv_msgv1 TYPE string OPTIONAL
iv_msgv2 TYPE string OPTIONAL
iv_msgv3 TYPE string OPTIONAL
iv_msgv4 TYPE string OPTIONAL
RETURNING value(rx_error) TYPE REF TO lcx_message.
CLASS-METHODS create_message_sy
IMPORTING
iv_msgty TYPE symsgty OPTIONAL
iv_msgv1 TYPE symsgv OPTIONAL
iv_msgv2 TYPE symsgv OPTIONAL
iv_msgv3 TYPE symsgv OPTIONAL
iv_msgv4 TYPE symsgv OPTIONAL
RETURNING value(rx_error) TYPE REF TO lcx_message.
METHODS constructor
IMPORTING
i_textid LIKE if_t100_message~t100key OPTIONAL
i_previous LIKE previous OPTIONAL
i_severity TYPE symsgty OPTIONAL.
METHODS output
IMPORTING
io_protocol TYPE REF TO lcl_protocol.
PRIVATE SECTION.
TYPES:
t_note_seq TYPE i,
t_obj_type TYPE string,
tt_cvers TYPE STANDARD TABLE OF cvers WITH NON-UNIQUE KEY component,
BEGIN OF t_note,
note_seq TYPE t_note_seq,
note_no TYPE string,
note_vr TYPE cwbntvers,
obj_check TYPE t_obj_type,
objname TYPE string,
objname2 TYPE string,
objname3 TYPE string,
objname4 TYPE string,
repid TYPE string,
deimpl TYPE abap_bool, "Obsolete
cvers_min TYPE tt_cvers,
cvers_max TYPE tt_cvers,
END OF t_note,
CONSTANTS:
BEGIN OF gc_note_seq,
business_func TYPE t_note_seq VALUE 025, "business function
ddic TYPE t_note_seq VALUE 100, "DDIC
exception TYPE t_note_seq VALUE 200, "exception class
snote TYPE t_note_seq VALUE 300, "SNOTE
prereq TYPE t_note_seq VALUE 310, "Recommended prerequisite notes
for PIX
pix TYPE t_note_seq VALUE 320, "PIX notes
END OF gc_note_seq.
CONSTANTS:
BEGIN OF gc_obj_type,
* ddic_repid TYPE t_obj_type VALUE 'DDIC_REPID',
* doma TYPE t_obj_type VALUE 'DOMA',
field TYPE t_obj_type VALUE 'FIELD',
prog_text TYPE t_obj_type VALUE 'REPT',
message TYPE t_obj_type VALUE 'MESSAGE',
tabu TYPE t_obj_type VALUE 'TABU',
business_func TYPE t_obj_type VALUE 'BF',
END OF gc_obj_type.
METHODS constructor
IMPORTING iv_version TYPE string
iv_date TYPE date.
METHODS process
IMPORTING it_notes TYPE tt_note
iv_note_disp_lvl TYPE i DEFAULT 0
iv_note_disp_help TYPE abap_bool DEFAULT abap_false.
PRIVATE SECTION.
DATA:
mo_message TYPE REF TO lcx_message,
mo_protocol TYPE REF TO lcl_protocol,
mv_note_disp_lvl TYPE i.
METHODS handle_note_seq
IMPORTING iv_note_seq TYPE t_note_seq
RAISING lcx_message.
METHODS check_note
IMPORTING iv_note TYPE string
iv_vers TYPE cwbntvers
iv_cvers_min TYPE tt_cvers OPTIONAL
iv_cvers_max TYPE tt_cvers OPTIONAL
iv_deimpl TYPE abap_bool
RETURNING value(state) TYPE char1
RAISING lcx_message.
METHODS check_note_components
IMPORTING iv_note TYPE string
iv_cvers_min TYPE tt_cvers
iv_cvers_max TYPE tt_cvers
RETURNING VALUE(rv_relevant) TYPE abap_bool.
METHODS check_note_help.
METHODS check_report
IMPORTING is_note TYPE t_note
RETURNING value(state) TYPE char1
RAISING lcx_message.
METHODS check_struct_field
IMPORTING is_note TYPE t_note
RETURNING value(state) TYPE char1
RAISING lcx_message.
METHODS check_message
IMPORTING is_note TYPE t_note
RETURNING value(state) TYPE char1
RAISING lcx_message.
METHODS check_tabu
IMPORTING is_note TYPE t_note
RETURNING value(state) TYPE char1
RAISING lcx_message.
METHODS check_prog_text
IMPORTING is_note TYPE t_note
RETURNING value(state) TYPE char1
RAISING lcx_message.
METHODS check_bf
IMPORTING is_note TYPE t_note
RETURNING value(state) TYPE char1
RAISING lcx_message.
*----------------------------------------------------------------------*
* CLASS lcl_protocol IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_protocol IMPLEMENTATION.
METHOD constructor.
NEW-PAGE WITH-TITLE LINE-SIZE 132.
ENDMETHOD. "constructor
METHOD add_header.
ADD 1 TO mo_header_no.
ULINE.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE: / sy-vline,
mo_header_no LEFT-JUSTIFIED,
AT 5 iv_header,
AT 132 sy-vline.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
ULINE.
ENDMETHOD. "add_header
METHOD add_item.
DATA:
lv_icon_text(4) TYPE c.
CASE iv_msgty.
WHEN 'W'.
WRITE icon_led_yellow AS ICON TO lv_icon_text.
WHEN 'E'.
WRITE icon_led_red AS ICON TO lv_icon_text.
WHEN 'S'.
WRITE icon_led_green AS ICON TO lv_icon_text.
WHEN 'I'.
WRITE icon_led_green AS ICON TO lv_icon_text.
ENDCASE.
*----------------------------------------------------------------------*
* CLASS lcl_processor IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_processor IMPLEMENTATION.
METHOD constructor.
DATA:
l_title TYPE string.
CONCATENATE
'Report Version: '
iv_version
' ('
iv_date+6(2)
'.'
iv_date+4(2)
'.'
iv_date+0(4)
')'
INTO l_title RESPECTING BLANKS.
mo_protocol->add_header( l_title ).
ENDMETHOD. "constructor
METHOD process.
DATA:
lo_exception TYPE REF TO lcx_message,
lv_seq_error TYPE xfeld.
me->mv_note_disp_lvl = iv_note_disp_lvl.
IF iv_note_disp_help EQ abap_true.
check_note_help( ).
ENDIF.
ENDMETHOD. "handle_note_seq
METHOD check_report.
"Main check: Last changed by SAP -> Report came via SP / Upgrade
"==> no execution anymore.
DATA ls_d010sinf TYPE d010sinf.
ENDMETHOD. "check_report
METHOD check_bf.
DATA:
lv_tadir TYPE tadir,
lv_bf TYPE sfw_bf.
ls_note-key-numm = iv_note.
IF iv_deimpl EQ abap_true.
* Notes to be deimplemented
CASE ls_note-customer_attributes-prstatus.
WHEN 'E' OR 'U' OR 'V'.
l_symsgty = 'E'.
WHEN '-'.
RETURN.
WHEN OTHERS.
l_symsgty = 'I'.
ENDCASE.
CONCATENATE
'SAP Note '
iv_note
INTO l_text1 RESPECTING BLANKS.
mo_message = lcx_message=>create_message(
iv_msgv1 = l_text1
iv_msgv2 = l_text2
iv_msgv3 = l_text3
iv_msgv4 = l_text4
iv_msgty = l_symsgty ).
RAISE EXCEPTION mo_message.
ELSE.
* Notes to be implemented
CASE ls_note-customer_attributes-prstatus.
* Obsolete (O)
* - After you implemented the corrections in the Note, you imported a Support
Package that also contains these corrections.
WHEN 'O'.
IF me->mv_note_disp_lvl GE 1.
CONCATENATE
'version '
ls_note-key-versno
INTO l_text3 RESPECTING BLANKS.
mo_message = lcx_message=>create_message(
iv_msgv1 = 'SAP Note'
iv_msgv2 = iv_note
iv_msgv3 = l_text3
iv_msgv4 = 'is obsolete (correction already delivered in SP)'
iv_msgty = 'I' ).
RAISE EXCEPTION mo_message.
ENDIF.
CONCATENATE
'SAP Note '
iv_note
INTO l_text1 RESPECTING BLANKS.
IF ls_note-key-versno GE iv_vers.
l_symsgty = 'W'.
CLEAR l_text4.
ELSE.
l_symsgty = 'E'.
CONCATENATE
', but obsolete version '
ls_note-key-versno
' downloaded, exp: '
iv_vers
INTO l_text4 RESPECTING BLANKS.
ENDIF.
mo_message = lcx_message=>create_message(
iv_msgv1 = l_text1
iv_msgv2 = l_text2
iv_msgv3 = l_text3
iv_msgv4 = l_text4
iv_msgty = l_symsgty ).
RAISE EXCEPTION mo_message.
* ------
FIELD-SYMBOLS: <ls_corr> TYPE bcwbn_corr_instruction.
LOOP AT ls_note-corr_instructions ASSIGNING <ls_corr>.
CALL FUNCTION 'SCWB_CINST_CHECK_VALID'
IMPORTING
ev_valid = l_valid
CHANGING
cs_corr_instruction = <ls_corr>
EXCEPTIONS
corr_inst_not_found = 1
inconsistent_delivery_data = 2
undefined = 3
OTHERS = 4.
IF sy-subrc <> 0.
mo_message = lcx_message=>create_message_sy(
iv_msgv1 = sy-msgv1
iv_msgv2 = sy-msgv2
iv_msgv3 = sy-msgv3
iv_msgv4 = sy-msgv4 ).
RAISE EXCEPTION mo_message.
ENDIF.
IF NOT l_valid IS INITIAL.
EXIT.
ENDIF.
ENDLOOP.
IF l_valid IS INITIAL.
MESSAGE e666(01) WITH 'Manual changes cannot be applied;' 'Correction
instruction invalid' 'for current patch level' INTO sy-lisel. "#EC *
mo_message = lcx_message=>create_message(
iv_msgv1 = 'SAP Note'
iv_msgv2 = iv_note
iv_msgv3 = 'has invalid correction instructions.'
iv_msgv4 = ' Check if you have the newest version of the note' ).
RAISE EXCEPTION mo_message.
ENDIF.
ENDCASE.
ENDIF.
ENDMETHOD. "check_note
METHOD check_note_components.
DATA:
l_text4 TYPE string,
ls_note TYPE bcwbn_note,
ls_cvers TYPE cvers,
ls_cvers_req TYPE cvers,
lt_cvers TYPE tt_cvers.
rv_relevant = abap_true.
ENDMETHOD. "check_note_components
METHOD check_note_help.
mo_protocol->add_instruction('IMPLEMENTATION STATUS DESCRIPTION:').
mo_protocol->add_instruction('- Completely implemented: The corrections
in the SAP Note have been implemented completely in the system. ').
mo_protocol->add_instruction('- Incompletely implemented: Not all the
relevant correction instructions have been implemented or some have been
implemented').
mo_protocol->add_instruction(' only in part.').
mo_protocol->add_instruction('- Can be implemented: The Note contains
correction instructions that might be needed to be implemented in the system.').
mo_protocol->add_instruction('- Obsolete version implemented: SAP has corrected
a Note that contained errors. A newer version of the Note is ready.').
IF me->mv_note_disp_lvl GE 1.
mo_protocol->add_instruction('- Cannot be implemented: The Note does
not contain any correction instructions that can be implemented in the system.').
mo_protocol->add_instruction('- Obsolete: After an
implementation of the corrections in the Note, a Support Package was imported that
also').
mo_protocol->add_instruction(' contains these
corrections.').
ENDIF.
ENDMETHOD. "check_note_help
METHOD check_struct_field.
DATA:
lo_struct_descr TYPE REF TO cl_abap_structdescr,
lt_components TYPE abap_component_tab.
FIELD-SYMBOLS:
<ls_component> TYPE abap_componentdescr.
METHOD check_prog_text.
lv_progname = is_note-objname.
IF is_note-objname2 IS NOT INITIAL.
lv_langu = is_note-objname2.
ENDIF.
ENDMETHOD. "check_prog_text
METHOD check_tabu.
ENDMETHOD. "check_tabu
*----------------------------------------------------------------------*
* CLASS lcx_message IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcx_message IMPLEMENTATION.
METHOD create_message.
DATA:
ls_textid LIKE if_t100_message~t100key.
ls_textid-msgid = gc_message-msgid.
ls_textid-msgno = gc_message-msgno.
ls_textid-attr1 = 'MV_MSGV1'.
ls_textid-attr2 = 'MV_MSGV2'.
ls_textid-attr3 = 'MV_MSGV3'.
ls_textid-attr4 = 'MV_MSGV4'.
ls_textid-msgid = gc_message-msgid.
ls_textid-msgno = gc_message-msgno.
ls_textid-attr1 = 'MV_MSGV1'.
ls_textid-attr2 = 'MV_MSGV2'.
ls_textid-attr3 = 'MV_MSGV3'.
ls_textid-attr4 = 'MV_MSGV4'.
rx_error->mv_msgv1 = iv_msgv1.
rx_error->mv_msgv2 = iv_msgv2.
rx_error->mv_msgv3 = iv_msgv3.
rx_error->mv_msgv4 = iv_msgv4.
ENDMETHOD. "create_message_sy
METHOD constructor.
CALL METHOD super->constructor
EXPORTING
previous = i_previous.
CLEAR me->textid.
IF i_textid IS INITIAL.
if_t100_message~t100key = if_t100_message=>default_textid.
ELSE.
if_t100_message~t100key = i_textid.
ENDIF.
IF i_severity IS INITIAL.
severity = 'E'.
ELSE.
severity = i_severity.
ENDIF.
ENDMETHOD. "constructor
METHOD output.
DATA l_text TYPE string.
MESSAGE ID if_t100_message~t100key-msgid
TYPE severity
NUMBER if_t100_message~t100key-msgno
WITH mv_msgv1 mv_msgv2 mv_msgv3 mv_msgv4
INTO l_text.
*&---------------------------------------------------------------------*
*& Form add_ddic_note_field
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UV_NOTE_NO text
* -->UV_TABNAME text
* -->UV_FIELDNAME text
* -->UV_REPID text
* -->CT_NOTES text
*----------------------------------------------------------------------*
FORM add_ddic_note_field
USING
uv_note_no TYPE string
uv_tabname TYPE string
uv_fieldname TYPE string
uv_repid TYPE string
CHANGING ct_notes TYPE lcl_processor=>tt_note.
ls_note-note_seq = lcl_processor=>gc_note_seq-ddic.
ls_note-note_no = uv_note_no.
ls_note-obj_check = lcl_processor=>gc_obj_type-field.
ls_note-objname = uv_tabname.
ls_note-objname2 = uv_fieldname.
ls_note-repid = uv_repid.
ENDFORM. "add_ddic_note_field
*&---------------------------------------------------------------------*
*& Form add_ddic_note_rept
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UV_NOTE_NO text
* -->UV_PROGNAME text
* -->UV_LANGU text
* -->UV_ID text
* -->UV_KEY text
* -->UV_REPID text
* -->CT_NOTES text
*----------------------------------------------------------------------*
FORM add_ddic_note_rept
USING
uv_note_no TYPE string
uv_progname TYPE string
uv_langu TYPE string
uv_id TYPE string
uv_key TYPE string
uv_repid TYPE string
CHANGING ct_notes TYPE lcl_processor=>tt_note.
ENDFORM. "add_ddic_note_rept
*&---------------------------------------------------------------------*
*& Form add_ddic_note_message
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UV_NOTE_NO text
* -->UV_MSGID text
* -->UV_MSGNO text
* -->UV_LANGU text
* -->UV_TEXT text
* -->UV_REPID text
* -->CT_NOTES text
*----------------------------------------------------------------------*
FORM add_ddic_note_message
USING
uv_note_no TYPE string
uv_msgid TYPE string
uv_msgno TYPE string
uv_langu TYPE string
uv_text TYPE string
uv_repid TYPE string
CHANGING ct_notes TYPE lcl_processor=>tt_note.
ls_note-note_seq = lcl_processor=>gc_note_seq-ddic.
ls_note-note_no = uv_note_no.
ls_note-obj_check = lcl_processor=>gc_obj_type-message.
ls_note-objname = uv_msgid.
ls_note-objname2 = uv_msgno.
ls_note-objname3 = uv_langu.
ls_note-objname4 = uv_text.
ls_note-repid = uv_repid.
ENDFORM. "add_ddic_note_rept
*&---------------------------------------------------------------------*
*& Form add_ddic_note_tabu
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UV_NOTE_NO text
* -->UV_TABNAME text
* -->UV_WHERE text
* -->UV_COUNT text
* -->UV_REPID text
* -->CT_NOTES text
*----------------------------------------------------------------------*
FORM add_ddic_note_tabu
USING
uv_note_no TYPE string
uv_tabname TYPE string
uv_where TYPE string
uv_count TYPE string
uv_repid TYPE string
CHANGING ct_notes TYPE lcl_processor=>tt_note.
ls_note-note_seq = lcl_processor=>gc_note_seq-ddic.
ls_note-note_no = uv_note_no.
ls_note-obj_check = lcl_processor=>gc_obj_type-tabu.
ls_note-objname = uv_tabname.
ls_note-objname2 = uv_where.
ls_note-objname3 = uv_count.
ls_note-repid = uv_repid.
ENDFORM. "add_ddic_note_tabu
*&---------------------------------------------------------------------*
*& Form add_business_func
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->UV_BF text
* -->UV_CLASS text
* -->UV_METHOD text
* -->CT_NOTES text
*----------------------------------------------------------------------*
FORM add_business_func
USING
uv_bf TYPE string
CHANGING ct_notes TYPE lcl_processor=>tt_note.
ls_note-note_seq = lcl_processor=>gc_note_seq-business_func.
ls_note-obj_check = lcl_processor=>gc_obj_type-business_func.
ls_note-objname = uv_bf.
ENDFORM. "add_business_func
*==============================================================================
*==============================================================================
SELECTION-SCREEN BEGIN OF BLOCK block WITH FRAME.
SELECTION-SCREEN COMMENT /1(50) vers_no.
SELECTION-SCREEN COMMENT /1(50) vers_dt.
SELECTION-SCREEN ULINE /1(50).
AT SELECTION-SCREEN OUTPUT.
CONCATENATE:
'Report version: '
gc_version
INTO vers_no RESPECTING BLANKS.
CONCATENATE:
'From: '
gc_version_date+6(2)
'.'
gc_version_date+4(2)
'.'
gc_version_date+0(4)
INTO vers_dt RESPECTING BLANKS.
*==============================================================================
START-OF-SELECTION.
DATA:
ls_note TYPE lcl_processor=>t_note,
lt_notes TYPE lcl_processor=>tt_note,
lo_processor TYPE REF TO lcl_processor,
lv_note_disp_lvl TYPE i,
ls_cvers TYPE cvers.
*==============================================================================
ls_cvers-component = 'SAP_BASIS'.
ls_cvers-release = '731'.
CLEAR: ls_note-cvers_min, ls_note-cvers_max.
ls_note-note_no = '1668882'. ls_note-note_vr = '036'. APPEND ls_cvers TO
ls_note-cvers_min. APPEND ls_note TO lt_notes.
ls_cvers-release = '730'.
CLEAR: ls_note-cvers_min, ls_note-cvers_max.
ls_note-note_no = '0875986'. ls_note-note_vr = '121'. APPEND ls_cvers TO
ls_note-cvers_max. APPEND ls_note TO lt_notes.
CLEAR: ls_note-cvers_min, ls_note-cvers_max.
CLEAR ls_note.
ls_note-deimpl = abap_false.
ls_note-note_seq = lcl_processor=>gc_note_seq-prereq.
CLEAR ls_note.
ls_note-deimpl = abap_false.
ls_note-note_seq = lcl_processor=>gc_note_seq-pix.
ENDIF.