开发:报表公共单元(一)常用函数
*&---------------------------------------------------------------------*
*& Include ZRPT_FUN
* 共用函数
*
*
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT MODIF ID PVR.
SELECTION-SCREEN END OF BLOCK B3.
*按描述隐藏选择屏幕上组件
FORM P_NO_VAR .
LOOP AT SCREEN.
IF SCREEN-NAME = 'P_VARI'
OR SCREEN-NAME = '%_P_VARI_%_APP_%-TEXT'. "前面描述 lab签
SCREEN-ACTIVE = '1'.
SCREEN-INVISIBLE = '1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
*AT SELECTION-SCREEN OUTPUT .
*
* PERFORM P_NO_VAR.
ENDFORM.
*单位转换
FORM F_GET_UNIT USING MUNT.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
EXPORTING
INPUT = MUNT
LANGUAGE = SY-LANGU
IMPORTING
OUTPUT = MUNT.
IF SY-SUBRC > 0.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
EXPORTING
INPUT = MUNT
LANGUAGE = '1'
IMPORTING
OUTPUT = MUNT.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& 补零功能
*&---------------------------------------------------------------------*
FORM F_ADD_ZERO USING VI_INPUT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = VI_INPUT
IMPORTING
OUTPUT = VI_INPUT.
ENDFORM. " f_add_zero
*&---------------------------------------------------------------------*
*& Form F_CUT_ZERO
*&---------------------------------------------------------------------*
* 去零功能
*----------------------------------------------------------------------*
* -->VI_OUTPUT text
*----------------------------------------------------------------------*
FORM F_CUT_ZERO USING VI_OUTPUT .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = VI_OUTPUT
IMPORTING
OUTPUT = VI_OUTPUT.
ENDFORM. "f_cut_zero
*&---------------------------------------------------------------------*
*& Form SHOWPB
*&---------------------------------------------------------------------*
* 任务栏显示信息
*----------------------------------------------------------------------*
* -->MTEXT text
*----------------------------------------------------------------------*
FORM SHOWPB USING MTEXT.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = MTEXT.
ENDFORM. "ShowPB
*IF not ( SY-UNAME = 'FANXZ' OR SY-UNAME = 'LIUYL' OR SY-UNAME = 'BI01').
* CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
* EXPORTING
* TITEL = '警告'
* TEXTLINE1 = '系统资源不足,请稍候再试!'.
* RETURN.
*ENDIF.
**产生GUID
FORM GET_GUID USING AGUID.
DATA: GD TYPE GUID_32.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
EV_GUID_32 = GD.
MOVE GD TO AGUID.
ENDFORM. "ShowPB
**显示ALV数据
FORM SHOW_ALV TABLES ITAB USING TITLE STR .
CALL FUNCTION 'ZLXS_ALV'
EXPORTING
I_TITLE = TITLE
FIELD_LIST = STR
IS_VARI = P_VARI
TABLES
I_ITAB = ITAB.
ENDFORM.
**显示ALV数据
FORM GET_ALV_STR USING STRUC_NAME STR.
DATA BEGIN OF TABLE_STRUCTURE OCCURS 10.
INCLUDE STRUCTURE DFIES.
DATA END OF TABLE_STRUCTURE.
DATA TABLE_TYPE TYPE DD02V-TABCLASS.
DATA: QUERY_TABLE LIKE DD02L-TABNAME.
MOVE STRUC_NAME TO QUERY_TABLE.
* DATA: QUERY_FIELD LIKE DD02L-TABNAME.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = QUERY_TABLE