普通报表带功能码
*&---------------------------------------------------------------------*
*& Report ZSDR0124
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZSDR0124.
TABLES:ZTSD0169 ,SSCRFIELDS,ZTSD0167.
TYPES:BEGIN OF TY_ALV.
INCLUDE TYPE ZTSD0169.
TYPES: WHED TYPE ZTSD0110-SXED, "已维护额度
HKED TYPE WRBTR, "回款释放额度
SYED TYPE WRBTR, "剩余可维护维度
DJTXT(3) TYPE C,
SFGMTXT(5) TYPE C,
END OF TY_ALV.
DATA: E_RTYPE TYPE BAPI_MTYPE,
E_RTMSG TYPE BAPI_MSG.
DATA:LV_WRBTR TYPE WRBTR.
DATA:T_OUT TYPE STANDARD TABLE OF ZSSD0209 WITH HEADER LINE.
DATA: GT_ALV TYPE STANDARD TABLE OF TY_ALV,
GS_ALV TYPE TY_ALV.
DATA: GT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
GS_FCAT TYPE SLIS_FIELDCAT_ALV,
GS_FIELD TYPE SLIS_T_FIELDCAT_ALV,
LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA:FUNCTXT TYPE SMP_DYNTXT,
FUNCTXT1 TYPE SMP_DYNTXT,
FUNCTXT2 TYPE SMP_DYNTXT.
DEFINE MACRO_APPEND_FIELDCAT.
CLEAR:GS_FCAT.
GS_FCAT-FIELDNAME = &1.
GS_FCAT-KEY = &2.
GS_FCAT-SELTEXT_S = &3.
GS_FCAT-SELTEXT_M = &3.
GS_FCAT-SELTEXT_L = &3.
GS_FCAT-REF_TABNAME = &4.
* GS_FCAT-NO_ZERO = &5. "不显示前导0
APPEND GS_FCAT TO GT_FCAT.
END-OF-DEFINITION.
*&---------------------------------------------------------------------*
*& 选择屏幕
*&---------------------------------------------------------------------*
SELECTION-SCREEN:FUNCTION KEY 1.
INITIALIZATION.
FUNCTXT-ICON_ID = ICON_EXPORT.
FUNCTXT-QUICKINFO = '【信用证保险额度维护】'.
FUNCTXT-ICON_TEXT = '【信用证保险额度维护】'.
SSCRFIELDS-FUNCTXT_01 = FUNCTXT.
SELECT-OPTIONS:S_KZH FOR ZTSD0169-KZH .
AT SELECTION-SCREEN.
PERFORM FRM_BEFORE_EXECUTE.
START-OF-SELECTION.
DATA(L_GUID) = ZCL_UTIL_LOG=>CREATE_LOG( ).
PERFORM FRM_GET_DATA.
ZCL_UTIL_LOG=>SAVE_LOG( L_GUID )."保存日志到数据库
PERFORM FRM_ALV_DISPLAY .
END-OF-SELECTION.
FORM FRM_GET_DATA.
*总表
SELECT *
FROM ZTSD0169
INTO TABLE @DATA(LT_ZTSD0169)
WHERE KZH IN @S_KZH
AND BDH IN @S_BDH
AND BXDH IN @S_BXDH .
LOOP AT LT_ZTSD0169 INTO DATA(LS_ZTSD0169).
MOVE-CORRESPONDING LS_ZTSD0169 TO GS_ALV.
APPEND GS_ALV TO GT_ALV.
CLEAR:GS_ALV,LS_ZTSD0169,LV_WRBTR,T_IN ,T_OUT.
FREE:T_IN[],T_OUT[].
ENDLOOP.
ENDFORM.
FORM FRM_ALV_DISPLAY.
LAYOUT-COLWIDTH_OPTIMIZE = ABAP_TRUE.
MACRO_APPEND_FIELDCAT 'KZH' ABAP_TRUE '开证行' SPACE .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
* i_callback_pf_status_set = 'FRM_SET_pf_STATUS'
* i_callback_user_command = 'FRM_USER_COMMNAD'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = GT_FCAT "LT_FIELDCAT
I_DEFAULT = 'X'
I_SAVE = ABAP_TRUE
TABLES
T_OUTTAB = GT_ALV
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_BEFORE_EXECUTE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM FRM_BEFORE_EXECUTE .
CASE SSCRFIELDS-UCOMM.
WHEN 'FC01'.
CALL TRANSACTION 'ZSD123'.
EXIT.
WHEN OTHERS.
ENDCASE.
ENDFORM.