我目前正在为 SAP Fiori 应用程序开发 OData 服务。当我尝试编写 BAPI 以将通知插入数据库时,它不起作用,我不知道为什么。我的同事告诉我这是因为缺少强制性参数,但我也填写了它们,但没有结果。这是代码:
METHOD avisset_create_entity.
DATA: ls_data TYPE zcl_zpm_avis_mpc=>ts_avis.
DATA: l_notif TYPE bapi2080_nothdre-notif_no,
l_notif_type TYPE bapi2080-notif_type,
l_notif_hd_exp TYPE bapi2080_nothdre,
l_notif_header TYPE bapi2080_nothdri,
i_return TYPE TABLE OF bapiret2.
io_data_provider->read_entry_data( IMPORTING es_data = ls_data ).
IF ls_data IS NOT INITIAL.
l_notif_type = 'S3'.
l_notif_header-equipment = ls_data-equnr.
l_notif_header-reportedby = sy-uname.
l_notif_header-short_text = ls_data-qmtxt.
* l_notif_header-notif_date = ls_data-qmdat.
l_notif_header-CODE_GROUP = 'MAINDIAG'.
l_notif_header-CODING = 'desi'.
* l_notif_header-CODING = ls_data-IWERK.
* FUNCT_LOC
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
* EXTERNAL_NUMBER =
notif_type = l_notif_type
notifheader = l_notif_header
* SENDER =
* ORDERID =
IMPORTING
notifheader_export = l_notif_hd_exp
TABLES
* notitem = i_notitemi
* notifcaus = i_notcausi
* notifactv = i_notactvi
* notiftask = i_nottaski
* notifpartnr = i_notpartnri
* longtexts = i_notfulltxti
* key_relationships = i_notkeye
return = i_return.
l_notif = l_notif_hd_exp-notif_no.
CALL FUNCTION 'BAPI_ALM_NOTIF_SAVE'
EXPORTING
number = l_notif.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
ENDMETHOD.