FUNCTION ZCMMV_DELETE_SPECIAL_NAME.
*"----------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_TEXT) TYPE CHAR35
*" EXPORTING
*" REFERENCE(E_TEXT) TYPE CHAR35
*"----------------------------------------------------------------------
DATA : lv_text40 type char35.
CLear: lv_text40.
lv_text40 = I_TEXT.
"REPLACE ALL OCCURRENCES OF REGEX '[`~!@#$%^&*()-_=+;:",.?/<>]' IN lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '`' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '~' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '!' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '@' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '#' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '$' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '%' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '^' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '&' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '*' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '(' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF ')' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '-' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '_' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '+' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '=' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '<' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '>' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '?' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '/' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF ',' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '.' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF ':' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF ';' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '"' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '{' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '}' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '|' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '[' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF ']' in lv_text40 WITH space.
REPLACE ALL OCCURRENCES OF '\' in lv_text40 WITH space.
E_TEXT = lv_text40.
ENDFUNCTION.
-----------------------------------------------------------------------------------
CLEAR: lv_key,lv_techkey ,lv_gl_table1.
CALL METHOD cl_usmd_model_ext=>get_instanceEXPORTING
i_usmd_model = lc_bp
IMPORTING
eo_instance = lo_model.
CALL METHOD lo_model->read_entity_data_all
EXPORTING
i_fieldname = lc_bp_header1
if_active = lv_active
i_crequest = iv_cr_number
IMPORTING
et_data_entity = lt_data_entity.
IF lt_data_entity[] IS NOT INITIAL.
READ TABLE lt_data_entity INTO DATA(ls_data_entity) WITH KEY usmd_entity = lc_bp_header2
" usmd_entity_cont = lc_bp_centrl
struct = lc_kattr.
IF sy-subrc IS INITIAL.
CLEAR lt_data.
MOVE ls_data_entity-r_t_data TO lt_data.
ASSIGN lt_data->* TO <lt_data>.
LOOP AT <lt_data> ASSIGNING FIELD-SYMBOL(<ls_data>).
IF <ls_data> IS ASSIGNED AND <ls_data> IS NOT INITIAL.
ASSIGN COMPONENT lc_bp_num OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<lv_key>).
IF <lv_key> IS ASSIGNED AND <lv_key> IS NOT INITIAL.
lv_key = <lv_key>.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
IF lv_key IS NOT INITIAL.
*!-- To get MDG table name
REFRESH: lt_emessage,lt_log_phys_name.
CALL METHOD cl_usmd_adapter_provider=>get_model_generation_adapter " To get MDG table ZSMART
EXPORTING
i_usmd_model = lc_bp
IMPORTING
eo_model_gen_adapter = lo_model_gen_adapter1
et_message = lt_emessage.
CALL METHOD lo_model_gen_adapter1->get_generated_objects
EXPORTING
if_former_versions = lv_former_versions
if_sid_tab = lv_sid
IMPORTING
et_message = lt_emessage
et_log_phys_name = lt_log_phys_name.
IF lt_log_phys_name IS NOT INITIAL.
CLEAR : ls_log_phys_name , ls_log_phys_typ, lv_gl_tabletyp .
CLEAR : lv_gl_table.
READ TABLE lt_log_phys_name INTO ls_log_phys_name WITH KEY sub_kind = lc_c
entity = lc_bp_header1.
IF sy-subrc IS INITIAL AND ls_log_phys_name IS NOT INITIAL.
lv_gl_table = ls_log_phys_name-phys_name. " MDG Table
IF lv_gl_table IS NOT INITIAL .
SELECT SINGLE usmdkbpbp_header
FROM (lv_gl_table)
INTO @lv_techkey
WHERE /1md/bpbp_header EQ @lv_key.
IF lv_techkey IS NOT INITIAL.
READ TABLE lt_log_phys_name INTO ls_log_phys_name1 WITH KEY sub_kind = lc_o
entity_cont = 'BP_CENTRL'
entity = lc_bp_header1.
IF ls_log_phys_name1 IS NOT INITIAL.
lv_gl_table1 = ls_log_phys_name1-phys_name. " MDG Table
DATA: r_table TYPE REF TO data.
FIELD-SYMBOLS: <tab> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <wa_tab> TYPE data.
CREATE DATA r_table TYPE TABLE OF (lv_gl_table1).
ASSIGN r_table->* TO <tab>.
CREATE DATA r_table LIKE LINE OF <tab>.
ASSIGN r_table->* TO <wa_tab>.
SELECT SINGLE * FROM (lv_gl_table1)
INTO @<wa_tab> WHERE usmdkbpbp_header EQ @lv_techkey.
IF <wa_tab> IS NOT INITIAL AND <wa_tab> IS ASSIGNED.
ASSIGN COMPONENT lc_/1md/bpmcname1 OF STRUCTURE <wa_tab> TO FIELD-SYMBOL(<lfv_name1>).
IF <lfv_name1> IS ASSIGNED AND <lfv_name1> IS NOT INITIAL.
CLEAR: lv_name1c.
lv_name1c = <lfv_name1>.
CLEAR: <lfv_name1>.
CALL FUNCTION 'ZCMMV_DELETE_SPECIAL_NAME'
EXPORTING
i_text = lv_name1c
IMPORTING
e_text = lv_name1c.
<lfv_name1> = lv_name1c.
ENDIF.
ASSIGN COMPONENT lc_/1md/bpmcname2 OF STRUCTURE <wa_tab> TO FIELD-SYMBOL(<lfv_name2>).
IF <lfv_name2> IS ASSIGNED AND <lfv_name2> IS NOT INITIAL.
CLEAR:lv_name2c.
lv_name2c = <lfv_name2>.
CALL FUNCTION 'ZCMMV_DELETE_SPECIAL_NAME'
EXPORTING
i_text = lv_name2c
IMPORTING
e_text = lv_name2c.
CLEAR <lfv_name2>.
<lfv_name2> = lv_name2c.
ENDIF.
ASSIGN COMPONENT lc_/1md/bpname_org1 OF STRUCTURE <wa_tab> TO FIELD-SYMBOL(<lfv_org1>).
IF <lfv_org1> IS ASSIGNED AND <lfv_org1> IS NOT INITIAL.
CALL FUNCTION 'ZCMMV_DELETE_SPECIAL_CHAR'
EXPORTING
i_text = <lfv_org1>
IMPORTING
e_text = <lfv_org1>.
ENDIF.
ASSIGN COMPONENT lc_/1md/bpname_org2 OF STRUCTURE <wa_tab> TO FIELD-SYMBOL(<lfv_org2>).
IF <lfv_org2> IS ASSIGNED AND <lfv_org2> IS NOT INITIAL.
CALL FUNCTION 'ZCMMV_DELETE_SPECIAL_CHAR'
EXPORTING
i_text = <lfv_org2>
IMPORTING
e_text = <lfv_org2>.
ENDIF.
MODIFY (lv_gl_table1) FROM <wa_tab>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
No comments:
Post a Comment