FUNCTION ZIF_GET_WBS_STATE.
*”———————————————————————-
*”*”Local interface:
*” TABLES
*” INPUT STRUCTURE ZIF_GET_WBS_STATE_INPUT OPTIONAL
*” OUTPUT STRUCTURE ZIF_GET_WBS_STATE_OUTPUT OPTIONAL
*”———————————————————————-
*状态表
TYPES:BEGIN OF stat_itab,
objnr TYPE jest-objnr, “PROJ-OBJNR
istat TYPE tj02t-istat,
estat TYPE tj30t-estat,
txt30 TYPE tj02t-txt30,
END OF stat_itab.
DATA:sstat_tab TYPE TABLE OF stat_itab WITH HEADER LINE.
DATA:ustat_tab TYPE TABLE OF stat_itab WITH HEADER LINE.
DATA:m_OBJNR TYPE PRPS-OBJNR.
DATA:m_PSPEL TYPE AUFK-PSPEL.
DATA:m_COUNT TYPE I.
LOOP AT INPUT.
MOVE-CORRESPONDING INPUT TO OUTPUT.
REFRESH sstat_tab.
CLEAR sstat_tab.
REFRESH ustat_tab.
CLEAR ustat_tab.
CLEAR m_COUNT.
SELECT SINGLE
COUNT(*)
INTO m_COUNT
FROM PRPS
WHERE POSID = INPUT-POSID.
IF m_COUNT > 0.
* 删除前面的0
SHIFT INPUT-POSID LEFT DELETING LEADING ‘0’.
CLEAR m_PSPEL.
CALL FUNCTION ‘CONVERSION_EXIT_KONPR_INPUT’
EXPORTING
INPUT = INPUT-POSID
IMPORTING
OUTPUT = m_PSPEL.
ENDIF.
CLEAR m_OBJNR.
SELECT SINGLE
OBJNR
INTO m_OBJNR
FROM PRPS
WHERE PSPNR = m_PSPEL.
SELECT b~objnr
a~istat
a~txt04 as txt30
FROM tj02t AS a INNER JOIN jest AS b ON a~istat = b~stat
INTO CORRESPONDING FIELDS OF TABLE sstat_tab
WHERE b~objnr = m_OBJNR
AND a~spras = sy-langu
AND b~inact <> ‘X’.
DELETE ADJACENT DUPLICATES FROM sstat_tab.
SELECT b~objnr
a~estat
a~txt04 as txt30
FROM tj30t AS a INNER JOIN jest AS b ON a~estat = b~stat
INTO CORRESPONDING FIELDS OF TABLE ustat_tab
WHERE b~objnr = m_OBJNR
AND a~spras = sy-langu AND
a~stsma = ‘ZPS001’
AND b~inact <> ‘X’.
DELETE ADJACENT DUPLICATES FROM ustat_tab.
LOOP AT sstat_tab WHERE objnr = m_OBJNR.
IF sstat_tab-istat CS ‘I’.
CONCATENATE OUTPUT-SYSSTA sstat_tab-txt30 INTO OUTPUT-SYSSTA SEPARATED BY SPACE.
* OUTPUT-SYSSTA = sstat_tab-txt30.
ENDIF.
ENDLOOP.
LOOP AT ustat_tab WHERE objnr = m_OBJNR.
IF ustat_tab-estat CS ‘E’.
CONCATENATE OUTPUT-USRSTA ustat_tab-txt30 INTO OUTPUT-USRSTA SEPARATED BY SPACE.
* OUTPUT-USRSTA = ustat_tab-txt30.
ENDIF.
ENDLOOP.
APPEND OUTPUT.
CLEAR OUTPUT.
ENDLOOP.
ENDFUNCTION.
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/20040.html