技术接口:日志程序(hand)

2024-08-30 22:52
文章标签 接口 技术 日志 程序 hand

本文主要是介绍技术接口:日志程序(hand),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.技术需求

        接口或者BAPI传输数据日志保存。

2.技术实现

确认系统内有没有下列对象:

  R3TR         PROG        ZFMPARAVALDELETE

  R3TR         PROG        ZFMPARAVALREAD

  R3TR         PROG        ZFMPARAVALSAVE

  R3TR         TABL          ZFMPARAVALSAVE

  R3TR         TABL          ZFMPARAVALSAVEL

如果有,请不要进行下面的步骤,否则将被覆盖。(程序和表格再后面附上)

修改需要添加Log的函数,普通函数或者Remote函数都可以。

2.1 在函数的TOP文件添加语句: INCLUDE zfmparavalsave.

2.2  在函数内添加语句:

.

后面为本函数的函数名,每个函数在最上面只需定义一次。

Zfmparavalsave2后面为备注,放到程序中每个需要记录数据的位置,记录数据即为程序执行到这个点的时候各个参数的值。

可以有多个zfmparavalsave2 语句

RTYPE和RTMSG为两个特殊参数,值会反应到查看程序的抬头上。

所以如果有返回状态和返回文本,请用RTYPE和RTMSG命名。

2.3完整的测试程序:

ZFMPARAVALREAD读取Log程序(内有彩蛋一枚)

函数名+日期+时间戳 相同的为一次调用,计数器标明此行数据为函数内的第几次保存数据,备注的值即为zfmparavalsave2后面的值,一般B代表函数的开始,参数数据为传入数据,R代表函数执行完毕返回。

如果需要内表数据,可以点击“下载”下载为制表符分隔的文本文件

如果要搜索指定参数的值(支持内表内任何字段包含此字符串):

如果不想记录某个函数的数据,请SM30维护表:ZFMPARAVALSAVEL

函数名+备注

如图,ZTEST02的zfmparavalsave2 ‘R’. 不再记录数据。

但是zfmparavalsave2 ‘B’ .还是记录数据。

删除Log程序:ZFMPARAVALDELETE

3.附件-程序

3.1  R3TR         TABL                   ZFMPARAVALSAVE

3.2  R3TR         TABL                   ZFMPARAVALSAVEL

 

3.3    R3TR         PROG        ZFMPARAVALDELETE
*& Report ZFMPARAVALSAVE_DEL
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZFMPARAVALSAVE_DEL.
tables:ZFMPARAVALSAVE.SELECT-OPTIONS S_ERDAT FOR ZFMPARAVALSAVE-ERDAT.START-OF-SELECTION.
delete from ZFMPARAVALSAVE where erdat IN S_ERDAT.
commit work.
3.4  ZFMLOGC
*&---------------------------------------------------------------------*
*& REPORT ZFMLOGC
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*REPORT ZFMLOGC.
TABLES:ZFMPARAVALSAVE.SELECTION-SCREEN BEGIN OF BLOCK TEXT WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:S_ERDAT FOR ZFMPARAVALSAVE-ERDAT,S_NAME  FOR ZFMPARAVALSAVE-NAME .
SELECTION-SCREEN END OF BLOCK TEXT.IF SY-BATCH = ''."前台IF S_ERDAT IS INITIAL.MESSAGE '请选择需要删除的日期' TYPE 'E'.ENDIF.
ELSE."后台CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'EXPORTINGDATE      = SY-DATUMDAYS      = '0'MONTHS    = '2'SIGNUM    = '-'YEARS     = '0'IMPORTINGCALC_DATE = S_ERDAT-HIGH.S_ERDAT-LOW = '20160101'.S_ERDAT-SIGN = 'I'.S_ERDAT-OPTION = 'BT'.APPEND S_ERDAT.
ENDIF.DELETE FROM ZFMPARAVALSAVE WHERE ERDAT IN S_ERDAT AND NAME IN S_NAME.
3.5  R3TR         PROG        ZFMPARAVALREAD
*&---------------------------------------------------------------------*
*& REPORT ZFMLOGA
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZFMLOGA NO STANDARD PAGE HEADING LINE-SIZE 1023..TABLES: ZFMPARAVALSAVE,FUPARAREF,TFDIR,DD40L,USR02.DATA: BEGIN OF IT_OUT OCCURS 0,AREA  LIKE ZFMPARAVALSAVE-AREA,NAME  LIKE ZFMPARAVALSAVE-NAME,ERDAT LIKE ZFMPARAVALSAVE-ERDAT,STAMP LIKE ZFMPARAVALSAVE-STAMP,INDX  LIKE ZFMPARAVALSAVE-INDX,PARA  LIKE ZFMPARAVALSAVE-PARA,ERNAM LIKE ZFMPARAVALSAVE-ERNAM,MEMO  LIKE ZFMPARAVALSAVE-MEMO,RTYPE LIKE ZFMPARAVALSAVE-RTYPE,RTMSG LIKE ZFMPARAVALSAVE-RTMSG,FLAG ,END OF IT_OUT.
DATA: OK_CODE LIKE SY-UCOMM,SAVE_OK LIKE SY-UCOMM.
DATA: GO_GRID       TYPE REF TO CL_GUI_ALV_GRID,GO_CONT       TYPE REF TO CL_GUI_DOCKING_CONTAINER,GRID_FLDCAT   TYPE LVC_T_FCAT WITH HEADER LINE,GRID_VARINT   TYPE DISVARIANT,GRID_LAYOUT   TYPE LVC_S_LAYO,SELECTED_ROWS TYPE LVC_T_ROID WITH HEADER LINE,LS_STABLE     TYPE LVC_S_STBL.
DATA: LIST_LAYOUT TYPE SLIS_LAYOUT_ALV,LIST_PRINT  TYPE SLIS_PRINT_ALV,LIST_STRUC  LIKE DD02L-TABNAME,LIST_FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.DATA: HEADER    TYPE HEADER_FB,TABLES_GD TYPE RSFB_PARA WITH HEADER LINE,IMPORT_GD TYPE RSFB_PARA WITH HEADER LINE,EXPORT_GD TYPE RSFB_PARA WITH HEADER LINE,CHANGE_GD TYPE RSFB_PARA WITH HEADER LINE.
DATA: BEGIN OF KEYSTR,NAME  LIKE ZFMPARAVALSAVE-NAME,ERDAT LIKE ZFMPARAVALSAVE-ERDAT,STAMP LIKE ZFMPARAVALSAVE-STAMP,INDX  LIKE ZFMPARAVALSAVE-INDX,PARA  LIKE ZFMPARAVALSAVE-PARA,END OF KEYSTR.
DATA: DTYPE ,FINDFLAG,STR      TYPE STRING,DDATA    TYPE REF TO DATA,TABIX    LIKE SY-TABIX,DATUM    LIKE SY-DATUM,HIDEPARA LIKE ZFMPARAVALSAVE-PARA.
DATA: BEGIN OF IT_INDX OCCURS 0,INDX LIKE IT_OUT-INDX,END OF IT_INDX.
DATA IT_EXTAB TYPE SLIS_T_EXTAB.
DATA WHERE_TAB(80) OCCURS 0 WITH HEADER LINE.
DATA DYFIELDS LIKE TABLE OF DYNPREAD WITH HEADER LINE.
DATA: BEGIN OF IT_PARA OCCURS 0,PARA LIKE ZFMPARAVALSAVE-PARA,END OF IT_PARA.
FIELD-SYMBOLS: <FS>       TYPE ANY,<FS_TABLE> TYPE STANDARD TABLE,<FS_WA>    TYPE ANY,<FS_FIELD> TYPE ANY.CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED .
DATA: EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.*---------------------------------------------------------------------*
*       CLASS LCL_EVENT_RECEIVER DEFINITION
*---------------------------------------------------------------------*CLASS LCL_EVENT_RECEIVER DEFINITION.PUBLIC SECTION.METHODS HANDLE_DOUBLE_CLICKFOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRIDIMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS. "lcl_event_receiver DEFINITION*---------------------------------------------------------------------*
*       CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
*---------------------------------------------------------------------*CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.METHOD HANDLE_DOUBLE_CLICK.PERFORM ATDOUBLECLICK USING E_ROW E_COLUMN ES_ROW_NO.ENDMETHOD.                    "handle_double_click
ENDCLASS. "lcl_event_receiver IMPLEMENTATIONSELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T1.
SELECT-OPTIONS: S_AREA FOR IT_OUT-AREA ,S_NAME  FOR TFDIR-FUNCNAME,S_ERDAT FOR ZFMPARAVALSAVE-ERDAT,S_STAMP FOR ZFMPARAVALSAVE-STAMP ,S_INDX  FOR ZFMPARAVALSAVE-INDX ,S_MEMO  FOR ZFMPARAVALSAVE-MEMO ,S_ERNAM FOR USR02-BNAME ,S_RTYPE FOR ZFMPARAVALSAVE-RTYPE,S_RTMSG FOR ZFMPARAVALSAVE-RTMSG.
SELECTION-SCREEN END OF BLOCK B1.SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE T2.
PARAMETER: P_NAME LIKE TFDIR-FUNCNAME ,P_PARA LIKE ZFMPARAVALSAVE-PARA,P_VALUE(80).
SELECTION-SCREEN END OF BLOCK B2.INITIALIZATION.T1 = '选择数据'.T2 = '补充选择'.LS_STABLE-ROW = 'X'.LS_STABLE-COL = 'X'.LIST_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.LIST_LAYOUT-LIST_APPEND       = 'X'.LIST_LAYOUT-NO_KEYFIX         = 'X'.LIST_PRINT-NO_NEW_PAGE   = 'X'.GRID_VARINT-REPORT = SY-REPID.GRID_VARINT-HANDLE = 1.DATUM = SY-DATUM  ."默认当天CONCATENATE 'IBT' DATUM SY-DATUM INTO STR.APPEND STR TO S_ERDAT.AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PARA.CLEAR: DYFIELDS[], DYFIELDS.CALL FUNCTION 'DYNP_VALUES_READ'EXPORTINGDYNAME     = SY-CPROGDYNUMB     = SY-DYNNRREQUEST    = 'A'TABLESDYNPFIELDS = DYFIELDS.READ TABLE DYFIELDS WITH KEY FIELDNAME = 'P_NAME'.IF DYFIELDS-FIELDVALUE IS INITIAL.MESSAGE S000(OO) DISPLAY LIKE 'E' WITH '先填写函数名'.EXIT.ENDIF.TRANSLATE DYFIELDS-FIELDVALUE TO UPPER CASE.CLEAR IT_PARA[].SELECT PARAMETER INTO TABLE IT_PARAFROM FUPARAREFWHERE FUNCNAME = DYFIELDS-FIELDVALUE ANDPARAMTYPE <> 'T' ANDR3STATE = 'A'.*    ORDER BY paramtype DESCENDING pposition.SELECT PARAMETER APPENDING TABLE IT_PARAFROM FUPARAREFWHERE FUNCNAME = DYFIELDS-FIELDVALUE ANDPARAMTYPE = 'T' ANDR3STATE = 'A'.*    ORDER BY paramtype pposition.CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'EXPORTINGRETFIELD        = 'PARA'DYNPPROG        = SY-REPIDDYNPNR          = SY-DYNNRDYNPROFIELD     = 'P_PARA'VALUE_ORG       = 'S'TABLESVALUE_TAB       = IT_PARAEXCEPTIONSPARAMETER_ERROR = 1NO_VALUES_FOUND = 2OTHERS          = 3.AT USER-COMMAND.CASE SY-UCOMM.WHEN 'PRE'.SORT IT_INDX BY INDX DESCENDING.LOOP AT IT_INDX WHERE INDX < IT_OUT-INDX.EXIT.ENDLOOP.WHEN 'NEXT'.SORT IT_INDX BY INDX.LOOP AT IT_INDX WHERE INDX > IT_OUT-INDX.EXIT.ENDLOOP.ENDCASE.IF SY-SUBRC = 0.IT_OUT-INDX = IT_INDX-INDX.PERFORM SHOW_DATA USING IT_OUT.PERFORM SET_STATUS.SY-LSIND = 0 .ELSE.MESSAGE S000(OO) WITH '没有找到'.ENDIF.AT LINE-SELECTION.CHECK HIDEPARA IS NOT INITIAL.PERFORM DOWNTABLE.START-OF-SELECTION.IF P_NAME = '' AND P_PARA <> '' ORP_NAME <> '' AND P_PARA = '' .MESSAGE S000(OO) DISPLAY LIKE 'E' WITH '附加条件需输入完整'.RETURN.ENDIF.PERFORM GETDATA.CALL SCREEN 9000.*&---------------------------------------------------------------------*
*&      FORM  GETDATA
*&---------------------------------------------------------------------*FORM GETDATA.CLEAR IT_OUT[].IF P_PARA IS INITIAL.SELECT DISTINCT AREA NAME ERDAT STAMP INDX ERNAM MEMO RTYPE RTMSGINTO CORRESPONDING FIELDS OF TABLE IT_OUTFROM ZFMPARAVALSAVEWHERE RELID = 'FL'     ANDNAME  IN S_NAME  ANDAREA  IN S_AREA  ANDERDAT IN S_ERDAT ANDSTAMP IN S_STAMP ANDINDX  IN S_INDX  ANDERNAM IN S_ERNAM ANDMEMO  IN S_MEMO  ANDRTYPE IN S_RTYPE ANDRTMSG IN S_RTMSG .ELSE.SELECT AREA NAME ERDAT STAMP INDX PARA AS PARAERNAM MEMO RTYPE RTMSGINTO CORRESPONDING FIELDS OF TABLE IT_OUTFROM ZFMPARAVALSAVEWHERE RELID = 'FL'     ANDNAME  IN S_NAME  ANDAREA  IN S_AREA  ANDERDAT IN S_ERDAT ANDSTAMP IN S_STAMP ANDINDX  IN S_INDX  ANDERNAM IN S_ERNAM ANDMEMO  IN S_MEMO  ANDRTYPE IN S_RTYPE ANDRTMSG IN S_RTMSG ANDNAME = P_NAME    ANDPARA = P_PARA.SELECT SINGLE * FROM FUPARAREFWHERE FUNCNAME = P_NAME AND R3STATE = 'A' AND PARAMETER = P_PARA.IF FUPARAREF-STRUCTURE IS INITIAL.FUPARAREF-STRUCTURE = 'CHAR100'.ENDIF.IF FUPARAREF-PARAMTYPE = 'T'.CREATE DATA DDATA TYPE TABLE OF (FUPARAREF-STRUCTURE).ELSE.CREATE DATA DDATA TYPE (FUPARAREF-STRUCTURE).ENDIF.ASSIGN DDATA->* TO <FS>.LOOP AT IT_OUT.CLEAR FINDFLAG.KEYSTR-NAME   = IT_OUT-NAME.KEYSTR-ERDAT  = IT_OUT-ERDAT.KEYSTR-STAMP  = IT_OUT-STAMP.KEYSTR-INDX   = IT_OUT-INDX.KEYSTR-PARA   = IT_OUT-PARA.IMPORT <FS> FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .DESCRIBE FIELD <FS> TYPE DTYPE.IF DTYPE = 'h'.ASSIGN <FS> TO <FS_TABLE>.LOOP AT <FS_TABLE> ASSIGNING <FS_WA>.DO .ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FS_WA> TO <FS_FIELD>.IF SY-SUBRC <> 0.EXIT.ENDIF.STR = <FS_FIELD>.TRANSLATE STR TO UPPER CASE.IF STR CS P_VALUE.FINDFLAG = 'X'.EXIT.ENDIF.ENDDO.IF FINDFLAG = 'X'.EXIT.ENDIF.ENDLOOP.ELSEIF DTYPE = 'u'. "结构ASSIGN <FS> TO <FS_WA>.DO .ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FS_WA> TO <FS_FIELD>.IF SY-SUBRC <> 0.EXIT.ENDIF.STR = <FS_FIELD>.TRANSLATE STR TO UPPER CASE.IF STR CS P_VALUE.FINDFLAG = 'X'.EXIT.ENDIF.ENDDO.ELSEIF DTYPE = 'v'. "深层内表MESSAGE S000(OO) DISPLAY LIKE 'E' WITH '不支持深层内表参数'.STOP.ELSE.STR = <FS>.TRANSLATE STR TO UPPER CASE.IF STR CS P_VALUE.FINDFLAG = 'X'.ENDIF.ENDIF.IF FINDFLAG = ''.DELETE IT_OUT.ENDIF.ENDLOOP.ENDIF.
ENDFORM. "getdata*&---------------------------------------------------------------------*
*&      MODULE  STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*MODULE STATUS_9000 OUTPUT.SET PF-STATUS 'STANDARD'.SET TITLEBAR 'T100' WITH '查看、管理函数的参数数据'.GRID_LAYOUT-ZEBRA      = 'X'.GRID_LAYOUT-SEL_MODE   = 'D'.IF GO_GRID IS INITIAL.GRID_LAYOUT-GRID_TITLE = LINES( IT_OUT ) .CONDENSE GRID_LAYOUT-GRID_TITLE.CONCATENATE  '条目数:' GRID_LAYOUT-GRID_TITLE INTO GRID_LAYOUT-GRID_TITLE.PERFORM FRM_CATLG_SET USING: 'AREA'   '函数组','NAME'   '函数','ERDAT'  '日期','STAMP'  '时间戳','INDX'   '计数器','ERNAM'  '用户','MEMO'   '备注','RTYPE'  'RTYPE','RTMSG'  'RTMSG'.GO_CONT = NEW CL_GUI_DOCKING_CONTAINER(REPID     = SY-REPIDDYNNR     = '9000'EXTENSION = 2050SIDE      = CL_GUI_DOCKING_CONTAINER=>PROPERTY_FLOATING ).CREATE OBJECT GO_GRIDEXPORTINGI_PARENT = GO_CONT.CREATE OBJECT EVENT_RECEIVER.SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR GO_GRID.CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAYEXPORTINGI_SAVE                        = 'A'IS_VARIANT                    = GRID_VARINTIS_LAYOUT                     = GRID_LAYOUTCHANGINGIT_OUTTAB                     = IT_OUT[]IT_FIELDCATALOG               = GRID_FLDCAT[]EXCEPTIONSINVALID_PARAMETER_COMBINATION = 1PROGRAM_ERROR                 = 2TOO_MANY_LINES                = 3OTHERS                        = 4.ENDIF.CALL METHOD CL_GUI_CONTROL=>SET_FOCUSEXPORTINGCONTROL = GO_GRID.
ENDMODULE. " STATUS_0100 OUTPUT*---------------------------------------------------------------------*
*       FORM FRM_CATLG_SET                                            *
*---------------------------------------------------------------------*FORM FRM_CATLG_SET USING P_FIELD P_TEXT .GRID_FLDCAT-FIELDNAME     =  P_FIELD.GRID_FLDCAT-SCRTEXT_L     =  P_TEXT.IF P_FIELD = 'INDX' .GRID_FLDCAT-NO_MERGING = 'X'.ENDIF.APPEND GRID_FLDCAT .CLEAR GRID_FLDCAT.
ENDFORM. " FRM_CATLG_SET*&---------------------------------------------------------------------*
*&      MODULE  USER_COMMAND_9000  INPUT
*&---------------------------------------------------------------------*MODULE USER_COMMAND_9000 INPUT.SAVE_OK = OK_CODE.CLEAR OK_CODE.CASE SAVE_OK.WHEN 'BACK' OR 'CANCEL'.LEAVE TO SCREEN 0 .WHEN 'REFRESH'.PERFORM GETDATA.PERFORM REFRESH_GRID.WHEN 'DEL'.CALL METHOD GO_GRID->GET_SELECTED_ROWSIMPORTINGET_ROW_NO = SELECTED_ROWS[].IF SELECTED_ROWS[] IS INITIAL.MESSAGE S000(OO) WITH '至少选择一行'.ELSE.PERFORM DB_DELETE  .DELETE IT_OUT WHERE FLAG = 'X'.PERFORM REFRESH_GRID.ENDIF.WHEN OTHERS.ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT*&---------------------------------------------------------------------*
*&      FORM  REFRESH_GRID
*&---------------------------------------------------------------------*FORM REFRESH_GRID.GRID_LAYOUT-GRID_TITLE = LINES( IT_OUT ) .CONDENSE GRID_LAYOUT-GRID_TITLE.CONCATENATE  '条目数:' GRID_LAYOUT-GRID_TITLE INTO GRID_LAYOUT-GRID_TITLE.CALL METHOD GO_GRID->SET_FRONTEND_LAYOUTEXPORTINGIS_LAYOUT = GRID_LAYOUT.CALL METHOD GO_GRID->REFRESH_TABLE_DISPLAYEXPORTINGIS_STABLE = LS_STABLEEXCEPTIONSFINISHED  = 1OTHERS    = 2.
ENDFORM. "user_command_0100 INPUT*&---------------------------------------------------------------------*
*&      FORM  DB_DELETE
*&---------------------------------------------------------------------*FORM DB_DELETE .*  LOOP AT it_out.
*    READ TABLE SELECTED_ROWS WITH KEY ROW_ID = SY-TABIX.
*    CHECK SY-SUBRC = 0.
*
*    DELETE FROM ZFMDATA
*      WHERE RELID = 'FL' AND NAME = IT_OUT-NAME AND STAMP = IT_OUT-STAMP.
*    IT_OUT-FLAG = 'X'.
*    MODIFY IT_OUT.
*  ENDLOOP.DATA: TABIX LIKE SY-TABIX.LOOP AT SELECTED_ROWS.READ TABLE IT_OUT INDEX SELECTED_ROWS-ROW_ID.TABIX = SY-TABIX.DELETE FROM ZFMPARAVALSAVEWHERE RELID = 'FL' AND NAME = IT_OUT-NAME ANDSTAMP = IT_OUT-STAMP AND INDX = IT_OUT-INDX.IT_OUT-FLAG = 'X'.MODIFY IT_OUT INDEX TABIX.ENDLOOP.
ENDFORM. "db_delete*&---------------------------------------------------------------------*
*&      FORM  ATDOUBLECLICK
*&---------------------------------------------------------------------*FORM ATDOUBLECLICK USING P_E_ROW TYPE LVC_S_ROW P_E_COLUMN P_ES_ROW_NO.READ TABLE IT_OUT INDEX P_E_ROW-INDEX.CASE P_E_COLUMN.WHEN 'NAME'.PERFORM TO_TESTDATA USING IT_OUT.SELECT SINGLE * FROM TFDIR WHERE FUNCNAME = IT_OUT-NAME .CONCATENATE 'L' IT_OUT-AREA 'U' TFDIR-INCLUDE INTO TFDIR-PNAME.CALL FUNCTION 'EDITOR_PROGRAM'EXPORTINGDISPLAY = 'X'PROGRAM = TFDIR-PNAMEEXCEPTIONSOTHERS  = 1.WHEN 'STAMP' OR 'INDX' OR 'ERNAM' OR 'MEMO' OR 'RTYPE' OR 'RTMSG'.CLEAR IT_INDX[].SELECT INDX INTO TABLE IT_INDXFROM ZFMPARAVALSAVEWHERE RELID = 'FL' AND NAME = IT_OUT-NAME ANDERDAT = IT_OUT-ERDAT AND STAMP = IT_OUT-STAMP.PERFORM SHOW_DATA USING IT_OUT.PERFORM SET_STATUS.LEAVE TO LIST-PROCESSING .SUPPRESS DIALOG.WHEN OTHERS.ENDCASE.
ENDFORM. " atdoubleclick*&---------------------------------------------------------------------*
*&      FORM  READ_DB
*&---------------------------------------------------------------------*FORM SHOW_DATA USING IT_OUT STRUCTURE IT_OUT.HEADER-NAME = IT_OUT-NAME .HEADER-STATE = 'A'.CALL METHOD CL_FB_PARAMETER_DB=>READIMPORTINGTABLES = TABLES_GD[]IMPORT = IMPORT_GD[]EXPORT = EXPORT_GD[]CHANGE = CHANGE_GD[]CHANGINGHEADER = HEADER.KEYSTR-NAME   = IT_OUT-NAME.KEYSTR-ERDAT  = IT_OUT-ERDAT.KEYSTR-STAMP  = IT_OUT-STAMP.KEYSTR-INDX   = IT_OUT-INDX.FORMAT INTENSIFIED OFF.WRITE : '函数:', IT_OUT-NAME, IT_OUT-ERDAT ,IT_OUT-STAMP,IT_OUT-INDX.SKIP .IF IMPORT_GD[] IS NOT INITIAL.WRITE / '导入参数:'.PERFORM OUT_FBPARA TABLES IMPORT_GD USING ''.ENDIF.IF EXPORT_GD[] IS NOT INITIAL.WRITE / '导出参数:'.PERFORM OUT_FBPARA TABLES EXPORT_GD USING ''.ENDIF.IF CHANGE_GD[] IS NOT INITIAL.WRITE / '更改参数:' .PERFORM OUT_FBPARA TABLES CHANGE_GD USING ''.ENDIF.IF TABLES_GD[] IS NOT INITIAL.WRITE: / '内表:' .PERFORM OUT_FBPARA TABLES TABLES_GD USING 'T'.ENDIF.CLEAR HIDEPARA.
ENDFORM. "show_data*&---------------------------------------------------------------------*
*&      FORM  ALLPARA
*&---------------------------------------------------------------------*FORM OUT_FBPARA TABLES INTAB STRUCTURE RSFBPARA USING PTYPE.DATA: CXROOT TYPE REF TO CX_ROOT,EXCMSG TYPE STRING.LOOP AT INTAB.WRITE / INTAB-PARAMETER COLOR 1 .IF PTYPE = 'T'.HIDEPARA = INTAB-PARAMETER.WRITE '下载' HOTSPOT COLOR 1 INVERSE ON .HIDE HIDEPARA.ENDIF.IF INTAB-STRUCTURE IS INITIAL.INTAB-STRUCTURE = 'CHAR100'.ENDIF.IF PTYPE = ''.CREATE DATA DDATA TYPE (INTAB-STRUCTURE).ELSE.CREATE DATA DDATA TYPE TABLE OF (INTAB-STRUCTURE).ENDIF.ASSIGN DDATA->* TO <FS>.CHECK SY-SUBRC = 0.KEYSTR-PARA = INTAB-PARAMETER.TRY.IMPORT <FS> FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .CATCH  CX_ROOT INTO CXROOT.EXCMSG =  CXROOT->GET_TEXT( ).WRITE '参数所存数据与当前定义不同' COLOR 6.CONTINUE.ENDTRY.IF SY-SUBRC <> 0 .WRITE '数据保存时尚无此参数' COLOR 6.CONTINUE.ENDIF.PERFORM WRITE_PARA USING INTAB.ENDLOOP.SKIP.
ENDFORM. "out_fbpara*&---------------------------------------------------------------------*
*&      FORM  OUTLIST
*&---------------------------------------------------------------------*FORM WRITE_PARA USING WA_REFB TYPE RSFBPARA .DESCRIBE FIELD <FS> TYPE DTYPE.CASE DTYPE.WHEN 'v'. "深层内表WRITE '不支持深层内表查看' COLOR 3.WHEN 'u'. "结构PERFORM WRITE_WA USING WA_REFB.WHEN 'h' . "内表SELECT SINGLE * FROM DD40L WHERE TYPENAME = WA_REFB-STRUCTURE.IF SY-SUBRC = 0 . "如果是表格类型LIST_STRUC =  DD40L-ROWTYPE.ELSE.LIST_STRUC =  WA_REFB-STRUCTURE.ENDIF.CLEAR LIST_FLDCAT[].CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'EXPORTINGI_PROGRAM_NAME   = SY-REPIDI_STRUCTURE_NAME = LIST_STRUCCHANGINGCT_FIELDCAT      = LIST_FLDCAT[]EXCEPTIONSOTHERS           = 3.LOOP AT LIST_FLDCAT.LIST_FLDCAT-NO_CONVEXT = 'X'.MODIFY LIST_FLDCAT.ENDLOOP.ASSIGN <FS> TO <FS_TABLE>.CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'EXPORTINGIT_FIELDCAT   = LIST_FLDCAT[]IS_LAYOUT     = LIST_LAYOUTIS_PRINT      = LIST_PRINTTABLEST_OUTTAB      = <FS_TABLE>EXCEPTIONSPROGRAM_ERROR = 1OTHERS        = 2.FORMAT INTENSIFIED OFF.WHEN OTHERS.WRITE <FS> COLOR 2 USING NO EDIT MASK.ENDCASE.
ENDFORM. "write_para*&---------------------------------------------------------------------*
*&      FORM  WRITE_WA
*&---------------------------------------------------------------------*FORM WRITE_WA USING WA_REFB TYPE RSFBPARA.DATA: STR       TYPE STRING,CHAR(256),ULEN      TYPE I.DO .ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FS> TO <FS_FIELD>.IF SY-SUBRC <> 0. EXIT. ENDIF.WRITE <FS_FIELD> TO CHAR LEFT-JUSTIFIED USING NO EDIT MASK .ULEN = ULEN + CL_ABAP_LIST_UTILITIES=>DYNAMIC_OUTPUT_LENGTH( CHAR ) + 1.ENDDO.ULEN = ULEN + 1 .WRITE AT /(ulen) SY-ULINE .  NEW-LINE.DO .ASSIGN COMPONENT SY-INDEX OF STRUCTURE <FS> TO <FS_FIELD>.IF SY-SUBRC <> 0 .EXIT.ELSE.WRITE <FS_FIELD> TO CHAR LEFT-JUSTIFIED USING NO EDIT MASK .STR = CHAR.WRITE : '|' NO-GAP, STR LEFT-JUSTIFIED NO-GAP USING NO EDIT MASK COLOR 2.ENDIF.ENDDO.WRITE '|' NO-GAP.WRITE AT /(ulen) SY-ULINE .
ENDFORM. "write_wa*&---------------------------------------------------------------------*
*&      FORM  WRITE_TESTDATA
*&---------------------------------------------------------------------*FORM TO_TESTDATA USING IT_OUT STRUCTURE IT_OUT.DATA : BEGIN OF TE_DATADIR OCCURS 10,DATAID    LIKE EUFUNC-NUMMER,STEPID(3),SEQID     LIKE EUFUNC-SEQID,DATUM     LIKE SY-DATUM,UZEIT     LIKE SY-UZEIT,TITLE(40),END OF TE_DATADIR.DATA: FT_PROG      TYPE TRDIR-NAME,FT_PARA(100),HEADER       TYPE HEADER_FB.FIELD-SYMBOLS: <LV_PARAFLD> TYPE ANY,<LT_PARAFLD> TYPE ANY TABLE,<LT_PARAVAL> TYPE ANY TABLE,<LT_DATADIR> LIKE TE_DATADIR[],<LS_DATADIR> LIKE TE_DATADIR.HEADER-NAME = IT_OUT-NAME .HEADER-STATE = 'A'.CALL METHOD CL_FB_PARAMETER_DB=>READIMPORTINGTABLES = TABLES_GD[]IMPORT = IMPORT_GD[]EXPORT = EXPORT_GD[]CHANGE = CHANGE_GD[]CHANGINGHEADER = HEADER.KEYSTR-NAME   = IT_OUT-NAME.KEYSTR-ERDAT  = IT_OUT-ERDAT.KEYSTR-STAMP  = IT_OUT-STAMP.KEYSTR-INDX   = IT_OUT-INDX.PERFORM CHECK_REPORT_GENERATE(SAPLSEUJ) USING IT_OUT-NAME. "检查FT程序是否存在FT_PROG = IT_OUT-NAME.TRANSLATE FT_PROG USING ' ='.FT_PROG+30 = 'FT'.PERFORM (SPACE) IN PROGRAM (FT_PROG) IF FOUND.LOOP AT IMPORT_GD .CONCATENATE '(' FT_PROG ')%_I' IMPORT_GD-PARAMETER INTO FT_PARA.ASSIGN (FT_PARA) TO <LV_PARAFLD>.CHECK SY-SUBRC = 0.KEYSTR-PARA = IMPORT_GD-PARAMETER.IMPORT <FS> = <LV_PARAFLD> FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .ENDLOOP.LOOP AT CHANGE_GD .CONCATENATE '(' FT_PROG ')%_I' CHANGE_GD-PARAMETER INTO FT_PARA.ASSIGN (FT_PARA) TO <LV_PARAFLD>.CHECK SY-SUBRC = 0.KEYSTR-PARA = CHANGE_GD-PARAMETER.IMPORT <FS> = <LV_PARAFLD> FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .ENDLOOP.LOOP AT TABLES_GD .CONCATENATE '(' FT_PROG ')%_I' TABLES_GD-PARAMETER '[]' INTO FT_PARA.ASSIGN (FT_PARA) TO <LT_PARAFLD>.CHECK SY-SUBRC = 0.KEYSTR-PARA = TABLES_GD-PARAMETER.IMPORT <FS> = <LT_PARAFLD> FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .ENDLOOP.PERFORM DB_IMPORT_DATADIR(SAPLSEUJ) USING IT_OUT-AREA IT_OUT-NAME '999' 'X'.ASSIGN ('(SAPLSEUJ)TE_DATADIR[]') TO <LT_DATADIR>.LOOP AT <LT_DATADIR> ASSIGNING <LS_DATADIR>.IF TE_DATADIR-DATAID < <LS_DATADIR>-DATAID.TE_DATADIR-DATAID = <LS_DATADIR>-DATAID.ENDIF.ENDLOOP.TE_DATADIR-DATAID = TE_DATADIR-DATAID + 1.CONCATENATE IT_OUT-ERDAT ` ` IT_OUT-STAMP ` ` IT_OUT-INDX ` ` SY-UNAMEINTO TE_DATADIR-TITLE.TE_DATADIR-DATUM  = SY-DATUM.TE_DATADIR-UZEIT  = SY-UZEIT.TE_DATADIR-STEPID = 'PBO'.APPEND TE_DATADIR TO <LT_DATADIR>.CALL FUNCTION 'SFCS_FA_PARAMETER_WRITE'EXPORTINGFUNCTION = IT_OUT-NAMEDATASET  = TE_DATADIR-DATAID.PERFORM DB_EXPORT_DATADIR(SAPLSEUJ) USING IT_OUT-AREA IT_OUT-NAME '999'.
ENDFORM. "to_testdata*&---------------------------------------------------------------------*
*&      FORM  GET_EXTTAB
*&---------------------------------------------------------------------*FORM SET_STATUS.CLEAR IT_EXTAB[].LOOP AT IT_INDX WHERE INDX < IT_OUT-INDX.EXIT.ENDLOOP.IF SY-SUBRC <> 0.APPEND 'PRE' TO IT_EXTAB.ENDIF.LOOP AT IT_INDX WHERE INDX > IT_OUT-INDX.EXIT.ENDLOOP.IF SY-SUBRC <> 0.APPEND 'NEXT' TO IT_EXTAB.ENDIF.SET PF-STATUS 'LIST' EXCLUDING IT_EXTAB .
ENDFORM. "get_exttab*&---------------------------------------------------------------------*
*&      FORM  DOWNTABLE
*&---------------------------------------------------------------------*FORM DOWNTABLE.DATA:FILE TYPE STRING, PATH TYPE STRING .LOOP AT TABLES_GD WHERE PARAMETER = HIDEPARA.CREATE DATA DDATA TYPE TABLE OF (TABLES_GD-STRUCTURE).ASSIGN DDATA->* TO <FS_TABLE>.CHECK SY-SUBRC = 0.KEYSTR-PARA = TABLES_GD-PARAMETER.IMPORT <FS> = <FS_TABLE> FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .IF <FS_TABLE> IS INITIAL.MESSAGE S000(OO) WITH '内表为空'.ELSE.CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOGEXPORTINGDEFAULT_EXTENSION    = 'xls'CHANGINGFILENAME             = PATHPATH                 = PATHFULLPATH             = FILEEXCEPTIONSCNTL_ERROR           = 1ERROR_NO_GUI         = 2NOT_SUPPORTED_BY_GUI = 3OTHERS               = 4.IF FILE IS NOT INITIAL.CALL FUNCTION 'GUI_DOWNLOAD'EXPORTINGFILENAME              = FILEFILETYPE              = 'ASC'WRITE_FIELD_SEPARATOR = 'X'CODEPAGE              = '8401'TABLESDATA_TAB              = <FS_TABLE>EXCEPTIONSOTHERS                = 22.IF SY-SUBRC <> 0.MESSAGE E000(OO) WITH '下载失败'.ENDIF.ENDIF.ENDIF.ENDLOOP.CLEAR HIDEPARA.
ENDFORM. "downtable
3.6  ZFMLOGB
*&---------------------------------------------------------------------*
*& Report ZFMLOGB
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*REPORT ZFMLOGB.TABLES:ZFMPARAVALSAVE,AFPO.*--------------------------------------------------------------------*
*ALV参数声明
*--------------------------------------------------------------------*"ALV参数定义
DATA:T_FIELDCAT TYPE LVC_T_FCAT, "字段目录内表W_FIELDCAT TYPE LVC_S_FCAT, "字段目录工作区W_LAYOUT   TYPE LVC_S_LAYO. "用于定义ALV表单的相关格式、属性FIELD-SYMBOLS: <FS>       TYPE ANY,<FS_TABLE> TYPE STANDARD TABLE,<FS_WA>    TYPE ANY,<FS_FIELD> TYPE ANY..DATA:DDATA  TYPE REF TO DATA,DDATAX TYPE REF TO DATA,INTAB  TYPE RSFB_PARA WITH HEADER LINE,STR    TYPE STRING.DATA: BEGIN OF KEYSTR,NAME  LIKE ZFMPARAVALSAVE-NAME,ERDAT LIKE ZFMPARAVALSAVE-ERDAT,STAMP LIKE ZFMPARAVALSAVE-STAMP,INDX  LIKE ZFMPARAVALSAVE-INDX,
*        MEMO  LIKE ZFMPARAVALSAVE-MEMO,PARA  LIKE ZFMPARAVALSAVE-PARA,END OF KEYSTR.
DATA:GT_FMSAVE TYPE TABLE OF ZFMPARAVALSAVE WITH HEADER LINE.
DATA:L_STRU TYPE DD02L-TABNAME.TYPES:BEGIN OF TY_JKM,JKMC TYPE ZFMPARAVALSAVE-NAME,END OF TY_JKM.
DATA:GT_JKM TYPE TABLE OF TY_JKM,GS_JKM TYPE TY_JKM.DATA:L_NBM TYPE STRING.PARAMETERS:P_NAME LIKE ZFMPARAVALSAVE-NAME OBLIGATORY.
PARAMETERS:P_JG TYPE ZFMPARAVALSAVE-INDX DEFAULT '01' OBLIGATORY.
*PARAMETERS:P_INDX TYPE ZFMPARAVALSAVE-INDX DEFAULT '02' OBLIGATORY .
PARAMETERS:P_MEMO TYPE ZFMPARAVALSAVE-MEMO DEFAULT 'R' OBLIGATORY .
SELECT-OPTIONS:S_DATE FOR ZFMPARAVALSAVE-ERDAT OBLIGATORY.AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_NAME.PERFORM FRM_F4_HELP.START-OF-SELECTION.DATA: DYN_TABLE TYPE REF TO DATA.DATA: DYN_WA TYPE REF TO DATA."DATA: P_NAME1 TYPE ZFMPARAVALSAVE-NAME.FIELD-SYMBOLS: <DYN_TABLE>  TYPE TABLE,<DYN_TABLE1> TYPE TABLE,<DYN_WA>     TYPE ANY.DATA P_NAME2 TYPE ZFMPARAVALSAVE-NAME."P_NAME1 = P_NAME .DATA:GS_ZTFM TYPE  ZTFM.SELECT SINGLE *INTO GS_ZTFMFROM ZTFMWHERE ZFNAME = P_NAMEAND   ZSID   = P_JG .IF GS_ZTFM-ZSNAME IS NOT INITIAL AND GS_ZTFM-ZTNAME IS NOT INITIAL .P_NAME2  = GS_ZTFM-ZSNAME .L_NBM = GS_ZTFM-ZTNAME .ELSE.MESSAGE '接口不支持查询!' TYPE 'E'.ENDIF.*  IF P_NAME = 'ZFTEST1'.                      "因为要生成FIELDCAT,所以,只能根据接口名称来取接口传出的结构字段名称。
*    P_NAME2  = 'ZSTEST'.
*    L_NBM = 'T_OUTPUT'.
*  ELSE.
*    MESSAGE '接口不支持查询!' TYPE 'E'.
*  ENDIF.CREATE DATA DDATA TYPE TABLE OF (P_NAME2).ASSIGN DDATA->* TO <FS>.*创建动态表结构CREATE DATA DYN_TABLE TYPE TABLE OF (P_NAME2).*创建动态内表ASSIGN DYN_TABLE->* TO <DYN_TABLE>.ASSIGN DYN_TABLE->* TO <DYN_TABLE1>.*创建动态工作区结构CREATE DATA DYN_WA LIKE LINE OF <DYN_TABLE>.*创建动态工作区ASSIGN DYN_WA->* TO <DYN_WA>.CONDENSE L_NBM NO-GAPS.CLEAR L_STRU.L_STRU = INTAB-STRUCTURE.IF P_MEMO = 'B' .SELECT *FROM ZFMPARAVALSAVE  "取出所有符合条件的关键字段数据INTO CORRESPONDING FIELDS OF TABLE GT_FMSAVEWHERE NAME = P_NAMEAND ERDAT IN S_DATEAND INDX = '01'
*    AND  MEMO = P_MEMOAND PARA = L_NBM .ELSEIF P_MEMO = 'R'.SELECT *FROM ZFMPARAVALSAVE  "取出所有符合条件的关键字段数据INTO CORRESPONDING FIELDS OF TABLE GT_FMSAVEWHERE NAME = P_NAMEAND ERDAT IN S_DATEAND INDX = '02'
*    AND  MEMO = P_MEMOAND PARA = L_NBM .ENDIF.LOOP AT GT_FMSAVE.CLEAR KEYSTR.KEYSTR-NAME = GT_FMSAVE-NAME.KEYSTR-ERDAT = GT_FMSAVE-ERDAT.KEYSTR-STAMP = GT_FMSAVE-STAMP.IF P_MEMO = 'B'.KEYSTR-INDX = '01'.ELSEIF P_MEMO = 'R' .KEYSTR-INDX = '02'.ENDIF.*    KEYSTR-MEMO = P_MEMO .KEYSTR-PARA = L_NBM.  "IMPORT  <FS>  FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .ASSIGN  <FS> TO <DYN_TABLE1>.*    IMPORT  <FS>  FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .
*    ASSIGN  <FS> TO <DYN_TABLE1>.*    IMPORT  <DYN_WA>  FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .
*    ASSIGN  <DYN_WA> TO <DYN_TABLE1>.APPEND LINES OF <DYN_TABLE1> TO <DYN_TABLE>.CLEAR GT_FMSAVE.ENDLOOP.*显示内表中的数据CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'EXPORTINGI_STRUCTURE_NAME = P_NAME2TABLEST_OUTTAB         = <DYN_TABLE>EXCEPTIONSPROGRAM_ERROR    = 1OTHERS           = 2.IF SY-SUBRC <> 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.*&---------------------------------------------------------------------*
*&      Form  FRM_F4_HELP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*FORM FRM_F4_HELP .*  GS_JKM-JKMC = 'ZFPP_02'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFPP_05'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFPP_06'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFMM_14'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFMM_15'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'EXPORTINGRETFIELD        = 'JKMC' "起作用的字段DYNPPROG        = SY-REPID "接下来连续的三个字段决定DYNPNR          = SY-DYNNR "了返回值放在哪个程序的哪个屏幕DYNPROFIELD     = 'P_NAME' "的哪个字段中VALUE_ORG       = 'S'TABLESVALUE_TAB       = GT_JKMEXCEPTIONSPARAMETER_ERROR = 1NO_VALUES_FOUND = 2OTHERS          = 3.IF SY-SUBRC <> 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.
ENDFORM.**Selection texts
* *----------------------------------------------------------
* * P_JG         显示内表
** P_NAME         接口名称
** S_DATE         查询日期
*
*
**Messages
* *----------------------------------------------------------
* *
* * Message class: Hard coded
* *   接口不支持查询!
3.7  ZFMLOGB1(ZFMLOGB的前版本)
*&---------------------------------------------------------------------*
*& Report ZFMLOGB
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*REPORT ZFMLOGB1.TABLES:ZFMPARAVALSAVE,AFPO.*--------------------------------------------------------------------*
*ALV参数声明
*--------------------------------------------------------------------*"ALV参数定义
DATA:T_FIELDCAT TYPE LVC_T_FCAT, "字段目录内表W_FIELDCAT TYPE LVC_S_FCAT, "字段目录工作区W_LAYOUT   TYPE LVC_S_LAYO. "用于定义ALV表单的相关格式、属性FIELD-SYMBOLS: <FS>       TYPE ANY,<FS_TABLE> TYPE STANDARD TABLE,<FS_WA>    TYPE ANY,<FS_FIELD> TYPE ANY..DATA:DDATA  TYPE REF TO DATA,DDATAX TYPE REF TO DATA,INTAB  TYPE RSFB_PARA WITH HEADER LINE,STR    TYPE STRING.DATA: BEGIN OF KEYSTR,NAME  LIKE ZFMPARAVALSAVE-NAME,ERDAT LIKE ZFMPARAVALSAVE-ERDAT,STAMP LIKE ZFMPARAVALSAVE-STAMP,INDX  LIKE ZFMPARAVALSAVE-INDX,
*        MEMO  LIKE ZFMPARAVALSAVE-MEMO,PARA  LIKE ZFMPARAVALSAVE-PARA,END OF KEYSTR.
DATA:GT_FMSAVE TYPE TABLE OF ZFMPARAVALSAVE WITH HEADER LINE.
DATA:L_STRU TYPE DD02L-TABNAME.TYPES:BEGIN OF TY_JKM,JKMC TYPE ZFMPARAVALSAVE-NAME,END OF TY_JKM.
DATA:GT_JKM TYPE TABLE OF TY_JKM,GS_JKM TYPE TY_JKM.DATA:L_NBM TYPE STRING.PARAMETERS:P_NAME LIKE ZFMPARAVALSAVE-NAME OBLIGATORY.
PARAMETERS:P_JG TYPE ZFMPARAVALSAVE-INDX DEFAULT '01' OBLIGATORY.
*PARAMETERS:P_INDX TYPE ZFMPARAVALSAVE-INDX DEFAULT '02' OBLIGATORY .
PARAMETERS:P_MEMO TYPE ZFMPARAVALSAVE-MEMO DEFAULT 'R' OBLIGATORY .
SELECT-OPTIONS:S_DATE FOR ZFMPARAVALSAVE-ERDAT OBLIGATORY.AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_NAME.PERFORM FRM_F4_HELP.START-OF-SELECTION.DATA: DYN_TABLE TYPE REF TO DATA.DATA: DYN_WA TYPE REF TO DATA."DATA: P_NAME1 TYPE ZFMPARAVALSAVE-NAME.FIELD-SYMBOLS: <DYN_TABLE>  TYPE TABLE,<DYN_TABLE1> TYPE TABLE,<DYN_WA>     TYPE ANY.DATA P_NAME2 TYPE ZFMPARAVALSAVE-NAME."P_NAME1 = P_NAME .DATA:GS_ZTFM TYPE  ZTFM.SELECT SINGLE *INTO GS_ZTFMFROM ZTFMWHERE ZFNAME = P_NAMEAND   ZSID   = P_JG .IF GS_ZTFM-ZSNAME IS NOT INITIAL AND GS_ZTFM-ZTNAME IS NOT INITIAL .P_NAME2  = GS_ZTFM-ZSNAME .L_NBM = GS_ZTFM-ZTNAME .ELSE.*    MESSAGE '接口不支持查询!' TYPE 'E'.ENDIF.*  IF P_NAME = 'ZFTEST1'.                      "因为要生成FIELDCAT,所以,只能根据接口名称来取接口传出的结构字段名称。
*    P_NAME2  = 'ZSTEST'.
*    L_NBM = 'T_OUTPUT'.
*  ELSE.
*    MESSAGE '接口不支持查询!' TYPE 'E'.
*  ENDIF.*  CREATE DATA DDATA TYPE TABLE OF (P_NAME2).
*  ASSIGN DDATA->* TO <FS>.
*
*
*
*
*
**创建动态表结构
*
*
*  CREATE DATA DYN_TABLE TYPE TABLE OF (P_NAME2).
*
*
**创建动态内表
*
*
*  ASSIGN DYN_TABLE->* TO <DYN_TABLE>.
*  ASSIGN DYN_TABLE->* TO <DYN_TABLE1>.
*
*
**创建动态工作区结构
*
*
*  CREATE DATA DYN_WA LIKE LINE OF <DYN_TABLE>.
*
*
**创建动态工作区
*
*
*  ASSIGN DYN_WA->* TO <DYN_WA>.
*  CONDENSE L_NBM NO-GAPS.CLEAR L_STRU.L_STRU = INTAB-STRUCTURE.IF P_MEMO = 'B' .SELECT *FROM ZFMPARAVALSAVE  "取出所有符合条件的关键字段数据INTO CORRESPONDING FIELDS OF TABLE GT_FMSAVEWHERE NAME = P_NAMEAND ERDAT IN S_DATEAND INDX = '01'AND  MEMO = 'I_OUT'
*      AND PARA = L_NBM
.ELSEIF P_MEMO = 'R'.SELECT *FROM ZFMPARAVALSAVE  "取出所有符合条件的关键字段数据INTO CORRESPONDING FIELDS OF TABLE GT_FMSAVEWHERE NAME = P_NAMEAND ERDAT IN S_DATEAND INDX = '02'
*    AND  MEMO = 'I_OUT'AND PARA = 'I_OUT'AND ERNAM = 'HANDWD'..ENDIF.TYPES:BEGIN OF TY_LFB1   ,LIFNR  TYPE STRING       , "供应商代码NAME1  TYPE STRING            , "供应商描述BUKRS  TYPE STRING            , "公司代码LOEVM2 TYPE STRING,ZDEL   TYPE STRING,END OF TY_LFB1.DATA:LT_LFB1 TYPE TABLE OF TY_LFB1.DATA: LRF_DESCR TYPE REF TO CL_ABAP_TYPEDESCR,LV_JSON   TYPE STRING.LOOP AT GT_FMSAVE.CLEAR KEYSTR.KEYSTR-NAME = GT_FMSAVE-NAME.KEYSTR-ERDAT = GT_FMSAVE-ERDAT.KEYSTR-STAMP = GT_FMSAVE-STAMP.IF P_MEMO = 'B'.KEYSTR-INDX = '01'.ELSEIF P_MEMO = 'R' .KEYSTR-INDX = '02'.ENDIF.KEYSTR-PARA = 'I_OUT'.  "CREATE DATA DDATA TYPE STRING.
*  ELSE.
*    CREATE DATA DDATA TYPE TABLE OF (INTAB-STRUCTURE).
*  ENDIF.ASSIGN DDATA->* TO <FS>.IMPORT  <FS>  FROM DATABASE ZFMPARAVALSAVE(FL) ID KEYSTR .
*    ASSIGN  <FS> TO <DYN_TABLE1>.LV_JSON = <FS> ./UI2/CL_JSON=>DESERIALIZE( EXPORTING JSON = LV_JSON PRETTY_NAME = /UI2/CL_JSON=>PRETTY_MODE-CAMEL_CASEASSOC_ARRAYS_OPT = ABAP_TRUE CHANGING DATA = LT_LFB1 ).LRF_DESCR = CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( LT_LFB1 ).*    APPEND LINES OF <DYN_TABLE1> TO <DYN_TABLE>.CLEAR GT_FMSAVE.ENDLOOP.**显示内表中的数据
*
*
*  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
*    EXPORTING
*      I_STRUCTURE_NAME = P_NAME2
*    TABLES
*      T_OUTTAB         = <DYN_TABLE>
*    EXCEPTIONS
*      PROGRAM_ERROR    = 1
*      OTHERS           = 2.
*  IF SY-SUBRC <> 0.
*    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*  ENDIF.
**&---------------------------------------------------------------------*
*&      Form  FRM_F4_HELP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*FORM FRM_F4_HELP .*  GS_JKM-JKMC = 'ZFPP_02'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFPP_05'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFPP_06'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFMM_14'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.
*  GS_JKM-JKMC = 'ZFMM_15'.
*  APPEND GS_JKM TO GT_JKM.
*  CLEAR GS_JKM.CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'EXPORTINGRETFIELD        = 'JKMC' "起作用的字段DYNPPROG        = SY-REPID "接下来连续的三个字段决定DYNPNR          = SY-DYNNR "了返回值放在哪个程序的哪个屏幕DYNPROFIELD     = 'P_NAME' "的哪个字段中VALUE_ORG       = 'S'TABLESVALUE_TAB       = GT_JKMEXCEPTIONSPARAMETER_ERROR = 1NO_VALUES_FOUND = 2OTHERS          = 3.IF SY-SUBRC <> 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.
ENDFORM.**Selection texts
* *----------------------------------------------------------
* * P_JG         显示内表
** P_NAME         接口名称
** S_DATE         查询日期
*
*
**Messages
* *----------------------------------------------------------
* *
* * Message class: Hard coded
* *   接口不支持查询!
3.8  R3TR         PROG        ZFMPARAVALSAVE
*&---------------------------------------------------------------------*
*&  包含                ZFMPARAVALSAVE
*&---------------------------------------------------------------------*DATA: header_gd TYPE header_fb,tables_gd TYPE rsfb_para WITH HEADER LINE,import_gd TYPE rsfb_para WITH HEADER LINE,export_gd TYPE rsfb_para WITH HEADER LINE,change_gd TYPE rsfb_para WITH HEADER LINE,pname_gd  TYPE tfdir-pname.DATA: BEGIN OF keystr,name  LIKE zfmparavalsave-name,erdat LIKE zfmparavalsave-erdat,stamp LIKE zfmparavalsave-stamp,indx  LIKE zfmparavalsave-indx,para  LIKE zfmparavalsave-para,END OF keystr.DATA: wa_data   TYPE zfmparavalsave,wa_datal  TYPE zfmparavalsavel,tsl       TYPE timestampl,tsstr(30),indx      TYPE numc2,fsstr     TYPE string.FIELD-SYMBOLS: <fs> TYPE any .DEFINE zfmparavalsave1.header_gd-name = &1 .GET TIME STAMP FIELD tsl.keystr-name = header_gd-name.
*  tsstr = |{ tsl  TIMEZONE = sy-zonlo }|.WRITE tsl TIME ZONE sy-zonlo TO tsstr .keystr-erdat = sy-datum.keystr-stamp = tsstr+11(15).SELECT SINGLE pname INTO pname_gd FROM tfdirWHERE funcname =  header_gd-name.CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'EXPORTINGprogram   = pname_gdIMPORTINGgroup     = header_gd-areanamespace = header_gd-namespaceEXCEPTIONSothe      = 12.IF sy-subrc = 0.CONCATENATE header_gd-namespace header_gd-areaINTO header_gd-area.CALL METHOD cl_fb_parameter_db=>readIMPORTINGtables = tables_gd[]import = import_gd[]export = export_gd[]change = change_gd[]CHANGINGheader = header_gd.ENDIF.END-OF-DEFINITION.DEFINE zfmparavalsave2.SELECT SINGLE pname INTO pname_gd FROM tfdirWHERE funcname =  header_gd-name.CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'EXPORTINGprogram   = pname_gdIMPORTINGgroup     = header_gd-areanamespace = header_gd-namespaceEXCEPTIONSothe      = 12.IF sy-subrc = 0.CONCATENATE header_gd-namespace header_gd-areaINTO header_gd-area.CALL METHOD cl_fb_parameter_db=>readIMPORTINGtables = tables_gd[]import = import_gd[]export = export_gd[]change = change_gd[]CHANGINGheader = header_gd.ENDIF.SELECT SINGLE * INTO wa_datal FROM zfmparavalsavelWHERE name = header_gd-name ANDmemo = &1 .IF sy-subrc <> 0 AND indx < 99.indx = indx + 1 .keystr-indx = indx.wa_data-area = header_gd-area.wa_data-ernam = sy-uname.wa_data-memo = &1 .wa_data-erdat = sy-datum.ASSIGN ('RTYPE') TO <fs>.IF sy-subrc = 0.wa_data-rtype = <fs>.ENDIF.ASSIGN ('RTMSG') TO <fs>.IF sy-subrc = 0.wa_data-rtmsg = <fs>.ENDIF.LOOP AT import_gd.ASSIGN (import_gd-parameter) TO <fs>.CHECK sy-subrc = 0 .keystr-para = import_gd-parameter.EXPORT <fs> TO DATABASE zfmparavalsave(fl) ID keystr FROM wa_data.ENDLOOP.LOOP AT change_gd.ASSIGN (change_gd-parameter) TO <fs>.CHECK sy-subrc = 0 .keystr-para = change_gd-parameter.EXPORT <fs> TO DATABASE zfmparavalsave(fl) ID keystr FROM wa_data.ENDLOOP.LOOP AT export_gd.ASSIGN (export_gd-parameter) TO <fs>.CHECK sy-subrc = 0 .keystr-para = export_gd-parameter.EXPORT <fs> TO DATABASE zfmparavalsave(fl) ID keystr FROM wa_data.ENDLOOP.LOOP AT tables_gd.CONCATENATE tables_gd-parameter '[]' INTO fsstr.ASSIGN (fsstr) TO <fs>.CHECK sy-subrc = 0 .keystr-para = tables_gd-parameter.EXPORT <fs> TO DATABASE zfmparavalsave(fl) ID keystr FROM wa_data.ENDLOOP.ENDIF.
*    COMMIT WORK.END-OF-DEFINITION.

以上,完毕!

这篇关于技术接口:日志程序(hand)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1122159

相关文章

JAVA智听未来一站式有声阅读平台听书系统小程序源码

智听未来,一站式有声阅读平台听书系统 🌟&nbsp;开篇:遇见未来,从“智听”开始 在这个快节奏的时代,你是否渴望在忙碌的间隙,找到一片属于自己的宁静角落?是否梦想着能随时随地,沉浸在知识的海洋,或是故事的奇幻世界里?今天,就让我带你一起探索“智听未来”——这一站式有声阅读平台听书系统,它正悄悄改变着我们的阅读方式,让未来触手可及! 📚&nbsp;第一站:海量资源,应有尽有 走进“智听

【专题】2024飞行汽车技术全景报告合集PDF分享(附原数据表)

原文链接: https://tecdat.cn/?p=37628 6月16日,小鹏汇天旅航者X2在北京大兴国际机场临空经济区完成首飞,这也是小鹏汇天的产品在京津冀地区进行的首次飞行。小鹏汇天方面还表示,公司准备量产,并计划今年四季度开启预售小鹏汇天分体式飞行汽车,探索分体式飞行汽车城际通勤。阅读原文,获取专题报告合集全文,解锁文末271份飞行汽车相关行业研究报告。 据悉,业内人士对飞行汽车行业

金融业开源技术 术语

金融业开源技术  术语 1  范围 本文件界定了金融业开源技术的常用术语。 本文件适用于金融业中涉及开源技术的相关标准及规范性文件制定和信息沟通等活动。

EMLOG程序单页友链和标签增加美化

单页友联效果图: 标签页面效果图: 源码介绍 EMLOG单页友情链接和TAG标签,友链单页文件代码main{width: 58%;是设置宽度 自己把设置成与您的网站宽度一样,如果自适应就填写100%,TAG文件不用修改 安装方法:把Links.php和tag.php上传到网站根目录即可,访问 域名/Links.php、域名/tag.php 所有模板适用,代码就不粘贴出来,已经打

跨系统环境下LabVIEW程序稳定运行

在LabVIEW开发中,不同电脑的配置和操作系统(如Win11与Win7)可能对程序的稳定运行产生影响。为了确保程序在不同平台上都能正常且稳定运行,需要从兼容性、驱动、以及性能优化等多个方面入手。本文将详细介绍如何在不同系统环境下,使LabVIEW开发的程序保持稳定运行的有效策略。 LabVIEW版本兼容性 LabVIEW各版本对不同操作系统的支持存在差异。因此,在开发程序时,尽量使用

flume系列之:查看flume系统日志、查看统计flume日志类型、查看flume日志

遍历指定目录下多个文件查找指定内容 服务器系统日志会记录flume相关日志 cat /var/log/messages |grep -i oom 查找系统日志中关于flume的指定日志 import osdef search_string_in_files(directory, search_string):count = 0

我在移动打工的日志

客户:给我搞一下录音 我:不会。不在服务范围。 客户:是不想吧 我:笑嘻嘻(气笑) 客户:小姑娘明明会,却欺负老人 我:笑嘻嘻 客户:那我交话费 我:手机号 客户:给我搞录音 我:不会。不懂。没搞过。 客户:那我交话费 我:手机号。这是电信的啊!!我这是中国移动!! 客户:我不管,我要充话费,充话费是你们的 我:可是这是移动!!中国移动!! 客户:我这是手机号 我:那又如何,这是移动!你是电信!!

AI(文生语音)-TTS 技术线路探索学习:从拼接式参数化方法到Tacotron端到端输出

AI(文生语音)-TTS 技术线路探索学习:从拼接式参数化方法到Tacotron端到端输出 在数字化时代,文本到语音(Text-to-Speech, TTS)技术已成为人机交互的关键桥梁,无论是为视障人士提供辅助阅读,还是为智能助手注入声音的灵魂,TTS 技术都扮演着至关重要的角色。从最初的拼接式方法到参数化技术,再到现今的深度学习解决方案,TTS 技术经历了一段长足的进步。这篇文章将带您穿越时

系统架构设计师: 信息安全技术

简简单单 Online zuozuo: 简简单单 Online zuozuo 简简单单 Online zuozuo 简简单单 Online zuozuo 简简单单 Online zuozuo :本心、输入输出、结果 简简单单 Online zuozuo : 文章目录 系统架构设计师: 信息安全技术前言信息安全的基本要素:信息安全的范围:安全措施的目标:访问控制技术要素:访问控制包括:等保

CSP 2023 提高级第一轮 CSP-S 2023初试题 完善程序第二题解析 未完

一、题目阅读 (最大值之和)给定整数序列 a0,⋯,an−1,求该序列所有非空连续子序列的最大值之和。上述参数满足 1≤n≤105 和 1≤ai≤108。 一个序列的非空连续子序列可以用两个下标 ll 和 rr(其中0≤l≤r<n0≤l≤r<n)表示,对应的序列为 al,al+1,⋯,ar​。两个非空连续子序列不同,当且仅当下标不同。 例如,当原序列为 [1,2,1,2] 时,要计算子序列 [