FORM GET_SESSION_STATE . *--------------------------Variables-----------------------------------* CONSTANTS: LC_GROUP TYPE C LENGTH 12 VALUE 'INTERNAL_ORD'. *----------------------------Logic-------------------------------------* REFRESH:GT_FMESG. SELECT MAX( M~CREDATE ) AS CREDATE, MAX( M~CRETIME ) AS CRETIME, I~MART, I~MID, I~MNR, I~MSGV1, I~MSGV2, I~MSGV3, I~MSGV4 FROM APQI AS M INNER JOIN APQLE AS I ON M~QID = I~QID INTO CORRESPONDING FIELDS OF TABLE @GT_FMESG WHERE M~GROUPID = @LC_GROUP AND I~TCODE = @GC_MM02 AND I~MID <> @GC_NULL GROUP BY I~MART, I~MID, I~MNR, I~MSGV1, I~MSGV2, I~MSGV3, I~MSGV4. IF SY-SUBRC NE 0. "Session尚未运行完成,请等待 MESSAGE S000 WITH TEXT-E04 DISPLAY LIKE GC_E. IF GV_RUNFLAG IS INITIAL. GV_RUNFLAG = GC_X."仅执行一次的标记 WAIT UP TO 5 SECONDS. PERFORM GET_SESSION_STATE. ELSE. "Session运行异常 MESSAGE S000 WITH TEXT-E05 DISPLAY LIKE GC_E. EXIT. ENDIF. ENDIF. ENDFORM.
*--------------------------Variables-----------------------------------* "全局变量定义 DATA: BEGIN OF GS_FMESG, "Session日志的Message结构 MART LIKE APQLE-MART, MID LIKE APQLE-MID, MNR LIKE APQLE-MNR, MSGV1 LIKE APQLE-MSGV1, MSGV2 LIKE APQLE-MSGV2, MSGV3 LIKE APQLE-MSGV3, MSGV4 LIKE APQLE-MSGV4, END OF GS_FMESG, GS_MESSAGEP TYPE ESP1_MESSAGE_WA_TYPE."最后弹框展示Message的结构
DATA: GT_FMESG LIKE TABLE OF GS_FMESG, GT_MESSAGEP TYPE ESP1_MESSAGE_TAB_TYPE. *----------------------------Logic-------------------------------------* FORM SET_MESSAGE_VALUE . CHECK GT_FMESG IS NOT INITIAL. REFRESH: GT_MESSAGEP. CLEAR: GS_MESSAGEP,GS_FMESG. LOOP AT GT_FMESG INTO GS_FMESG. GS_MESSAGEP-LINENO = SY-TABIX. GS_MESSAGEP-MSGID = GS_FMESG-MID. GS_MESSAGEP-MSGNO = GS_FMESG-MNR. GS_MESSAGEP-MSGTY = GS_FMESG-MART. GS_MESSAGEP-MSGV1 = GS_FMESG-MSGV1. GS_MESSAGEP-MSGV2 = GS_FMESG-MSGV2. GS_MESSAGEP-MSGV3 = GS_FMESG-MSGV3. GS_MESSAGEP-MSGV4 = GS_FMESG-MSGV4. INSERT GS_MESSAGEP INTO TABLE GT_MESSAGEP. CLEAR: GS_FMESG,GS_MESSAGEP. ENDLOOP.
FREE: GT_FMESG. ENDFORM.
(2)调用Message弹框
1 2 3 4 5 6 7
FORM DISPLAY_RESULT . CHECK GT_MESSAGEP IS NOT INITIAL. CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP' TABLES I_MESSAGE_TAB = GT_MESSAGEP. FREE: GT_MESSAGEP. ENDFORM.