ABAP读取工单状态 STATUS_READ
*&---------------------------------------------------------------------* *& Report YDEMO_013 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT YDEMO_013 MESSAGE-ID ZTEST_001. TABLES:AUFK. DATA:LT_STATUS LIKE TABLE OF JSTAT WITH HEADER LINE. DATA:GS_LAYOUT TYPE LVC_S_LAYO. *PARAMETERS:P_CLIENT LIKE PARAMETERS:P_AUFNR LIKE AFKO-AUFNR, P_OBJNR LIKE JSTO-OBJNR, P_ONLY LIKE JEST-INACT. PARAMETERS:RB_01 RADIOBUTTON GROUP G1 DEFAULT 'X', RB_02 RADIOBUTTON GROUP G1. PARAMETERS:P_OBTYP LIKE JSTO-OBTYP, P_STSMA LIKE JSTO-STSMA, P_STONR LIKE TJ30-STONR. INITIALIZATION. *IF START-OF-SELECTION. SELECT SINGLE OBJNR INTO P_OBJNR FROM AUFK WHERE AUFNR = P_AUFNR. IF SY-SUBRC NE 0. MESSAGE I002."WITH '没有找到对象号!'. CALL TRANSACTION 'ABAPDOCU'. STOP. ELSE. CLEAR:LT_STATUS,LT_STATUS[]. CALL FUNCTION 'STATUS_READ' EXPORTING * CLIENT = SY-MANDT OBJNR = P_OBJNR * ONLY_ACTIVE = ' ' IMPORTING OBTYP = P_OBTYP STSMA = P_STSMA STONR = P_STONR TABLES STATUS = LT_STATUS * EXCEPTIONS * OBJECT_NOT_FOUND = 1 * OTHERS = 2 . IF SY-SUBRC <> 0. * Implement suitable error handling here ENDIF. ENDIF. IF RB_02 EQ 'X'. LOOP AT LT_STATUS. WRITE:/(10) LT_STATUS-STAT, (20) LT_STATUS-INACT. ENDLOOP. ELSE. GS_LAYOUT-CWIDTH_OPT = 'X'. GS_LAYOUT-SEL_MODE = 'A'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING I_STRUCTURE_NAME = 'JSTAT' I_CALLBACK_PROGRAM = SY-REPID I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS' I_CALLBACK_USER_COMMAND = 'ALV_USER_COMMAND' * IS_LAYOUT_LVC = GS_LAYOUT TABLES T_OUTTAB = LT_STATUS. ENDIF. *&---------------------------------------------------------------------* *& Form SET_PF_STATUS *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM SET_PF_STATUS USING UT_EXCLUDE TYPE SLIS_T_EXTAB. SET PF-STATUS 'ALV_STATUS'. ENDFORM. "SET_PF_STATUS *&---------------------------------------------------------------------* *& Form ALV_USER_COMMAND *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM ALV_USER_COMMAND USING UV_UCOMM TYPE SYUCOMM US_SELFIELD TYPE SLIS_SELFIELD. DATA:LO_GRID TYPE REF TO CL_GUI_ALV_GRID. CASE UV_UCOMM. WHEN 'ADD'. INSERT INITIAL LINE INTO LT_STATUS INDEX 1. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING E_GRID = LO_GRID. CALL METHOD LO_GRID->REFRESH_TABLE_DISPLAY . WHEN 'EXIT'. LEAVE TO LIST-PROCESSING. WHEN '&F03' OR '&F12' OR '&F15'. LEAVE TO SCREEN 0. WHEN OTHERS. ENDCASE. ENDFORM. "ALV_USER_COMMAND * CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' * EXPORTING ** I_INTERFACE_CHECK = ' ' ** I_BYPASSING_BUFFER = ** I_BUFFER_ACTIVE = ** I_CALLBACK_PROGRAM = ' ' ** I_CALLBACK_PF_STATUS_SET = ' ' ** I_CALLBACK_USER_COMMAND = ' ' ** I_CALLBACK_TOP_OF_PAGE = ' ' ** I_CALLBACK_HTML_TOP_OF_PAGE = ' ' ** I_CALLBACK_HTML_END_OF_LIST = ' ' ** I_STRUCTURE_NAME = ** I_BACKGROUND_ID = ' ' ** I_GRID_TITLE = ** I_GRID_SETTINGS = ** IS_LAYOUT_LVC = ** IT_FIELDCAT_LVC = ** IT_EXCLUDING = ** IT_SPECIAL_GROUPS_LVC = ** IT_SORT_LVC = ** IT_FILTER_LVC = ** IT_HYPERLINK = ** IS_SEL_HIDE = ** I_DEFAULT = 'X' ** I_SAVE = ' ' ** IS_VARIANT = ** IT_EVENTS = ** IT_EVENT_EXIT = ** IS_PRINT_LVC = ** IS_REPREP_ID_LVC = ** I_SCREEN_START_COLUMN = 0 ** I_SCREEN_START_LINE = 0 ** I_SCREEN_END_COLUMN = 0 ** I_SCREEN_END_LINE = 0 ** I_HTML_HEIGHT_TOP = ** I_HTML_HEIGHT_END = ** IT_ALV_GRAPHICS = ** IT_EXCEPT_QINFO_LVC = ** IR_SALV_FULLSCREEN_ADAPTER = ** IMPORTING ** E_EXIT_CAUSED_BY_CALLER = ** ES_EXIT_CAUSED_BY_USER = * TABLES * T_OUTTAB = ** EXCEPTIONS ** PROGRAM_ERROR = 1 ** OTHERS = 2 * . * IF SY-SUBRC <> 0. ** Implement suitable error handling here * ENDIF.
本人常年接收SAP运维和远程项目,ECC,S/4HANA,CRM,WDA.
远程人天可谈,终身售后,有活请联系V信:18925782767(问问题免费,欢迎交流!)
!!请关注本人技术分享公众号:SAP翔子(可扫头像二维码)
每天分享新知识,博客文章也会陆续整理并迁移至公众号,与您一起共同学习