無名经验总结与分享(SAP)            十年树木,百年树人

WMS函数组:22. VL10B. BDC

FUNCTION ZRFC_WMS_VL10B .
*"----------------------------------------------------------------------
*"*"Local interface:
*"  EXPORTING
*"     VALUE(EX_VBELN) LIKE  LIKP-VBELN
*"     VALUE(EP_SUBRC) LIKE  SY-SUBRC
*"  TABLES
*"      ET_LOG STRUCTURE  BAPIRET2 OPTIONAL
*"      IP_INPUT STRUCTURE  ZWMS_VL10B_INPUT OPTIONAL
*"----------------------------------------------------------------------
DATA:
  CTU               LIKE  APQI-PUTACTIVE VALUE 'X',
UPDATE            LIKE  APQI-PUTACTIVE VALUE 'L',
  I_ERROR_MESSAGES  LIKE  ARRANG_ERR,
  ET_MESSTAB        LIKE  BDCMSGCOLL   OCCURS 0  WITH  HEADER   LINE,
GROUP             LIKE  APQI-GROUPID,
  USER              LIKE  APQI-USERID,
  KEEP              LIKE  APQI-QERASE,
  HOLDDATE          LIKE  APQI-STARTDATE,
  NODATA            LIKE  APQI-PUTACTIVE VALUE '/',
  SUBRC             LIKE  SY-SUBRC,
MODE              LIKE  APQI-PUTACTIVE VALUE  'N',
  I_LOG             LIKE  BAPIRETURN1 OCCURS 0 WITH HEADER LINE.
PERFORM BDC_NODATA   USING NODATA.
PERFORM OPEN_GROUP   USING GROUP USER KEEP HOLDDATE CTU.
PERFORM BDC_DYNPRO   USING 'RVV50R10C'      '1000'.
PERFORM BDC_FIELD    USING 'BDC_CURSOR'     'ST_VSTEL-LOW'.
PERFORM BDC_FIELD    USING 'BDC_OKCODE'     '=S0S_TAB5'.
DATA: sDATE TYPE D, eDATE TYPE D.
      sDATE = SY-DATUM - 100.
      eDATE = SY-DATUM + 1 .
*  PERFORM BDC_FIELD    USING 'ST_VSTEL-LOW'   IP_INPUT-ST_VSTEL_LOW.
PERFORM BDC_FIELD    USING 'ST_LEDAT-LOW'   sDATE."IP_INPUT-ST_LEDAT_LOW.
PERFORM BDC_FIELD    USING 'ST_LEDAT-HIGH'  eDATE."IP_INPUT-ST_LEDAT_HIGH.
PERFORM BDC_FIELD    USING 'P_LERUL'        ' '.
PERFORM BDC_DYNPRO   USING 'RVV50R10C'      '1000'.
PERFORM BDC_FIELD    USING 'BDC_OKCODE'     '=ONLI'.
PERFORM BDC_FIELD    USING 'ST_VSTEL-LOW'   ' '.
PERFORM BDC_FIELD    USING 'ST_LEDAT-LOW'   sDATE."IP_INPUT-ST_LEDAT_LOW.
PERFORM BDC_FIELD    USING 'ST_LEDAT-HIGH'  eDATE."IP_INPUT-ST_LEDAT_HIGH.
PERFORM BDC_FIELD    USING 'P_LERUL'        ' '.
PERFORM BDC_FIELD    USING 'BDC_CURSOR'     'ST_RESWK-LOW'.
***  订单号
PERFORM BDC_FIELD    USING 'ST_EBELN-LOW'   IP_INPUT-ST_EBELN_LOW.
PERFORM BDC_FIELD    USING 'ST_EBELN-HIGH'  IP_INPUT-ST_EBELN_HIGH.
PERFORM BDC_FIELD    USING 'ST_RESWK-LOW'   IP_INPUT-ST_RESWK_LOW.
PERFORM BDC_FIELD    USING 'ST_RESWK-HIGH'  IP_INPUT-ST_RESWK_HIGH.
PERFORM BDC_DYNPRO   USING 'SAPLSLVC_FULLSCREEN' '0500'.
PERFORM BDC_FIELD    USING 'BDC_OKCODE'     '=&ALL'.
PERFORM BDC_DYNPRO   USING 'SAPLSLVC_FULLSCREEN' '0500'.
PERFORM BDC_FIELD    USING 'BDC_OKCODE'     '=SAMD'.
PERFORM BDC_DYNPRO   USING 'SAPLSLVC_FULLSCREEN' '0500'.
PERFORM BDC_FIELD    USING 'BDC_OKCODE'     '=&F12'.
PERFORM BDC_DYNPRO   USING 'RVV50R10C'      '1000'.
PERFORM BDC_FIELD    USING 'BDC_OKCODE'     '/EECAN'.
PERFORM BDC_FIELD    USING 'BDC_CURSOR'     'ST_VSTEL-LOW'.
PERFORM BDC_TRANSACTION TABLES ET_MESSTAB
USING 'VL10B'  CTU  MODE  UPDATE.
PERFORM CLOSE_GROUP USING CTU.
COMMIT WORK.
  EP_SUBRC = '-1' .
*  ET_LOG-NUMBER           = '-1'.
*  ET_LOG-MESSAGE          = 'NO DATA FOUND!'.
*  APPEND ET_LOG.
DATA S(200).
LOOP  AT   ET_MESSTAB.
*    CONCATENATE     ' ET_MESSTAB-MSGID :'   ET_MESSTAB-MSGID    INTO S. WRITE /  S.
*    CONCATENATE     ' ET_MESSTAB-MSGTYP: '  ET_MESSTAB-MSGTYP   INTO S. WRITE /  S.
*    CONCATENATE     ' ET_MESSTAB-MSGNR : '  ET_MESSTAB-MSGNR    INTO S. WRITE /  S.
*    CONCATENATE     ' ET_MESSTAB-MSGV1 : '  ET_MESSTAB-MSGV1    INTO S. WRITE /  S.
*    CONCATENATE     ' ET_MESSTAB-MSGV2 : '  ET_MESSTAB-MSGV2    INTO S. WRITE /  S.
*    CONCATENATE     ' ET_MESSTAB-MSGV3 : '  ET_MESSTAB-MSGV3    INTO S. WRITE /  S.
*    CONCATENATE     ' ET_MESSTAB-MSGV4 : '  ET_MESSTAB-MSGV4    INTO S. WRITE /  S.
*    CLEAR ET_LOG[].
    ET_LOG-TYPE             = ET_MESSTAB-MSGTYP.
    ET_LOG-ID               = ET_MESSTAB-MSGID.
    ET_LOG-NUMBER           = ET_MESSTAB-MSGNR.
CALL FUNCTION 'MM_ARRANG_GET_MESSAGE_TEXT'
EXPORTING
        I_ERROR_MESSAGES = I_ERROR_MESSAGES
        I_LANGU          = SY-LANGU
IMPORTING
        E_TEXT           = ET_LOG-MESSAGE
EXCEPTIONS
        PARAMETER_ERROR  = 1
OTHERS           = 2.
CONCATENATE     ET_LOG-MESSAGE  ET_MESSTAB-MSGV1    INTO ET_LOG-MESSAGE.
APPEND    ET_LOG.
IF ET_MESSTAB-MSGNR = '311'.
      EX_VBELN                = ET_MESSTAB-MSGV2.
      EP_SUBRC                = 0.
ENDIF.
ENDLOOP.
ENDFUNCTION.



image

posted @ 2021-01-25 21:29  無名  阅读(141)  评论(0编辑  收藏  举报
Twttafku@163.com
十年树木,百年树人