由於單據報銷電子簽核時,有要求資產必須先進SAP建檔才可進財務請款,
因此就需要寫個SAP RFC來檢查報銷單據所輸入的資產編碼是否有在SAP當中輸入完成
FUNCTION Z_RFC_ASSETCHECK.
*"----------------------------------------------------------------------
*"*"區域介面:
*" IMPORTING
*" VALUE(IANLN1) TYPE ANLN1
*" VALUE(IANLN2) TYPE ANLN2
*" EXPORTING
*" VALUE(STATUS) TYPE CHAR1
*" VALUE(MESSAGE) TYPE TEXT300
*"----------------------------------------------------------------------
DATA : wa_ANLA TYPE ANLA.
IF ianln1 IS INITIAL.
status = 'E'.
message = '資產編號不得為空值'.
RETURN.
ENDIF.
IF ianln2 IS INITIAL.
status = 'E'.
message = '資產子編號不得為空值'.
RETURN.
ENDIF.
SELECT SINGLE *
FROM ANLA
INTO wa_ANLA
WHERE anln1 EQ ianln1
AND anln2 EQ ianln2.
IF sy-subrc NE 0.
status = 'E'.
message = '查無此資產'.
ELSE.
status = 'O'.
message = wa_ANLA-TXT50.
ENDIF.
RETURN.
ENDFUNCTION.
沒有留言:
張貼留言