mb51通过配置SM30配置MMIM_REP_CUST字段信息,mb51无法生效或者程序语法错误。
notes:215435 - MB51: Procedure for regeneration
Solution
Create the report ZRM07DOCS_GENERATED_EMERGENCY as an executable test program with the title = "ZRM07DOCS_GENERATED_EMERGENCY". The source code for this report is attached to this SAP Note. This report generates the emergency source text for the include report RM07DOCS_GENERATED, which means that regeneration of the MB51 takes place automatically at the next start. The report can only be started by users who have the system authorization for debugging.
*&---------------------------------------------------------------------*
*& Report ZRM07DOCS_GENERATED_EMERGENCY *
*& *
*&---------------------------------------------------------------------*
*& *
*& This report creates the emergency source code for include report *
*& RM07DOCS_GENERATED according note 215435. *
*& *
*& Run this report in the case transaction MB51 cannot run due syntax *
*& error in include report RM07DOCS_GENERATED. Then check the settings *
*& in customizing view V_MMIM_REP_CUST and correct then if necessary. *
*& *
*& !!! Do not delete or change comment lines !!! *
*& *
*&---------------------------------------------------------------------*
REPORT ZRM07DOCS_GENERATED_EMERGENCY.
types : begin of stype_code,
line(72) type c,
end of stype_code,
stab_code type standard table of stype_code
with default key.
DATA : g_s_code type stype_code,
g_t_code type stab_code.
types : begin of stype_fields,
tabname like mmim_rep_cust-tabname,
fieldname like mmim_rep_cust-fieldname,
counter type i,
end of stype_fields,
stab_fields type standard table of stype_fields
with default key.
data : g_s_fields type stype_fields,
g_t_fields type stab_fields,
g_s_fields_short type stype_fields,
g_t_fields_short type stab_fields.
*----------------------------------------------------------------------*
at selection-screen.
* Check that the current user has debug authorization.
AUTHORITY-CHECK OBJECT 'S_DEVELOP'
ID 'DEVCLASS' DUMMY
ID 'OBJTYPE' FIELD 'DEBUG'
ID 'OBJNAME' DUMMY
ID 'P_GROUP' DUMMY
ID 'ACTVT' FIELD '03'.
if sy-subrc <> 0.
message e895(m7) with 'Sorry, no authorization'.
endif.
*----------------------------------------------------------------------*
start-of-selection.
* check whether report RM07DOCS_GENERATED is available
READ REPORT 'RM07DOCS_GENERATED' INTO g_t_code.
if sy-subrc <> 0.
message e895(m7)
with 'Error during reading report RM07DOCS_GENERATED'.
else.
refresh g_t_code.
endif.
* read source code of this report into working table
READ REPORT 'ZRM07DOCS_GENERATED_EMERGENCY' INTO g_t_code.
if sy-subrc <> 0.
message e895(m7)
with 'Error during reading source code'.
endif.
* extract the source code for report RM07DOCS_GENERATED
* only the line who contain "*/" will be inserted into the
* source
* the leading digits "*/" will be deleted
loop at g_t_code into g_s_code.
if g_s_code-line+0(02) = '*/'.
shift g_s_code-line by 2 places.
modify g_t_code from g_s_code-line.
else.
delete g_t_code.
endif.
endloop.
if g_t_code[] is initial.
message e895(m7)
with 'No new source code available for insert'.
endif.
* insert the emergency coding into report
INSERT REPORT 'RM07DOCS_GENERATED' FROM g_t_code.
if sy-subrc is initial.
message s895(m7) with 'Report RM07DOCS_GENERATED updated'.
else.
message e895(m7)
with 'Error during insert report RM07DOCS_GENERATED'.
endif.
* check the field names for selection whether there are ducplicates
* when the long fieldnames are
select tabname fieldname from mmim_rep_cust
into corresponding fields of table g_t_fields
where selpos <> space.
if sy-subrc is initial.
loop at g_t_fields into g_s_fields.
move : g_s_fields-tabname
to g_s_fields_short-tabname,
g_s_fields-fieldname(08)
to g_s_fields_short-fieldname,
1 to g_s_fields_short-counter.
collect g_s_fields_short
into g_t_fields_short.
endloop.
loop at g_t_fields_short into g_s_fields_short.
check g_s_fields_short-counter > 1.
write : /1 'Table =', g_s_fields_short-tabname,
'Duplicate short fieldname =',
g_s_fields_short-fieldname.
write : / 'Please check and correct entries in view',
'V_MMIM_REP_CUST'.
skip 1.
endloop.
endif.
* the following lines with "*/" will be inserted into the source
* code of RM07DOCS_GENERATED
*/*99999999999999 <- Timestamp
*/********************************************************************
*/*
*/* Emergency restart coding for the generated part of RM07DOCS.
*/*
*/* Only needed to ensure an initial compilability.
*/*
*/********************************************************************
*/*
*/* The ranges need to be there for the call to MMIM_ENTRYCHECK_MAIN
*/*
*/RANGES:
*/ matnr FOR mseg-matnr,
*/ werks FOR mseg-werks,
*/ lgort FOR mseg-lgort,
*/ lifnr FOR mseg-lifnr,
*/ kunnr FOR mseg-kunnr,
*/ bwart FOR mseg-bwart,
*/ sobkz FOR mseg-sobkz,
*/ vgart FOR mkpf-vgart,
*/ usnam FOR mkpf-usnam.
*/*
*/DATA: BEGIN OF itab OCCURS 0.
*/* The entire MSEG and some additional fields from the header
*/* which are accessed literally in the coding.
*/ INCLUDE STRUCTURE mseg.
*/ DATA: budat LIKE mkpf-budat.
*/DATA: END OF itab.
*/*
*/*
*/selection-screen begin of block mkpf with frame title text-002.
*/ select-options BUDAT for MKPF-BUDAT.
*/selection-screen end of block mkpf.
*/*
*/* Form routines just to be there
*/*
*/FORM data_selection_new.
*/ENDFORM.
*/*
*/FORM data_selection_via_matnr.
*/ENDFORM.
*/*
*/FORM data_selection_via_budat.
*/ENDFORM.
*/*
*/FORM data_selection.
*/ENDFORM.
*/*
*/FORM shortdocument_read.
*/ENDFORM.
*/*
*/FORM archive_check_selections CHANGING rc.
*/ENDFORM.
*/*
*/FORM build_runtimetable.
*/ENDFORM.
*/*
*/FORM fill_frange.
*/ENDFORM.
*/*
*/FORM check_select_mkpf.
*/ENDFORM.
*/*
*/FORM check_select_mseg.
*/ENDFORM.
*/*
*/FORM check_restrictions.
*/ENDFORM.
*/*
*/FORM select_maa_data.
*/ENDFORM.
*/*
*/FORM select_single_mm_doc_item.
*/ENDFORM.
*/*
*/FORM check_restrictions_maa.
*/ENDFORM.