10-01-2009 4:21 PM
I need to create a service notification.
I have found 2 BAPIs.
BAPI_SERVICENOTIFICAT_CREATE
BAPI_SERVNOT_CREATE
The code below using the second BAPI is not creating a notification and the return parm does not have any errors.
You can see it does a call to commit after the BAPI call
Perhaps I am missing something critical in the parms.
We are trying to creat a service type notification using equipment.
-
DATA ls_notif_h TYPE bapi2080_nothdri.
data ls_notif_e type BAPI2080_NOTHDRE.
DATA lt_return TYPE STANDARD TABLE OF bapiret2.
DATA ls_return LIKE LINE OF lt_return.
ls_notif_h-equipment = '10000044'.
CALL FUNCTION 'BAPI_SERVNOT_CREATE'
EXPORTING
EXTERNAL_NUMBER =
notif_type = 'S3'
notifheader = ls_notif_h
TASK_DETERMINATION = ' '
SENDER =
ORDERID =
IMPORTING
NOTIFHEADER_EXPORT = ls_notif_e
TABLES
NOTITEM =
NOTIFCAUS =
NOTIFACTV =
NOTIFTASK =
NOTIFPARTNR =
LONGTEXTS =
KEY_RELATIONSHIPS =
return = lt_return
.
IF lt_return IS INITIAL.
COMMIT WORK AND WAIT.
write: / ls_notif_e-NOTIF_NO.
ELSE.
LOOP AT lt_return INTO ls_return.
WRITE:/ 'errors'.
ls_return.
ENDLOOP.
-
Thanks.
Scott
10-01-2009 4:55 PM
Try this way
CALL FUNCTION 'BAPI_SERVNOT_CREATE'
EXPORTING
* EXTERNAL_NUMBER =
notif_type = 'S3'
notifheader = ls_notif_h
* TASK_DETERMINATION = ' '
* SENDER =
* ORDERID =
IMPORTING
NOTIFHEADER_EXPORT = ls_notif_e
TABLES
* NOTITEM =
* NOTIFCAUS =
* NOTIFACTV =
* NOTIFTASK =
* NOTIFPARTNR =
* LONGTEXTS =
* KEY_RELATIONSHIPS =
return = lt_return
.
* IF lt_return IS INITIAL. " <<< Comment this lie
read table lt_return into ls_return with key type = 'E'. " << Change
if sy-subrc ne 0. " << Change
COMMIT WORK AND WAIT.
write: / ls_notif_e-NOTIF_NO.
ELSE.
LOOP AT lt_return INTO ls_return.
WRITE:/ 'errors'.
* ls_return.
ENDLOOP.
endif.
a®
10-01-2009 6:20 PM
Nope - no change but i did get it to work.
I used the BAPI called BAPI_SERVICENOTIFICAT_CREATE and it works.
But thanks for your suggestion.
Scott
10-01-2009 6:21 PM
10-01-2009 10:11 PM
10-01-2009 10:13 PM
I was calling the correct FM but you must follow it up with calls to 2 more FM to get the data into SAP.
After calling BAPI_SERVNOT_CREATE you MUST call BAPI_SERVNOT_SAVE and then BAPI_TRANSACTION_COMMIT to get it to work.
10-02-2009 1:02 AM
Thank you Scott for writing the solution, because, generally, many people do not write the resolution, How they achieved it.....its so useful, while doing Google.
10-02-2009 1:02 AM
Thank you Scott for writing the solution, because, generally, many people do not write the resolution, How they achieved it.....its so useful, while doing Google.