08-22-2016 11:30 AM
Hai,
I am new to Abap.
I need to create a notification, all the fields i am inputting from a screen and using a BDC function module i needto save it and generate a notifcation in the database table using Tcode IW21. But its getting dump. Plz provide me the Sample code for the same .
Thanks in Advance
Renjith
08-22-2016 2:06 PM
Dear Renjith,
Please use the BAPI Notification not BDC like the below :
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
* EXTERNAL_NUMBER =
notif_type = lv_notif_type
notifheader = lw_notifheader
* TASK_DETERMINATION = ' '
* SENDER =
* ORDERID =
IMPORTING
notifheader_export = lw_notifheader_export
TABLES
* NOTITEM =
* NOTIFCAUS =
* NOTIFACTV =
* NOTIFTASK =
* NOTIFPARTNR =
longtexts = lt_lines
* KEY_RELATIONSHIPS =
return = lt_return
.
IF LINES( lt_return ) > 0.
READ TABLE lt_return INTO lw_return INDEX 1.
IF sy-subrc = 0.
ge_message_error = lw_return-message.
ENDIF.
ROLLBACK WORK.
EXIT.
ELSE.
REFRESH lt_return.
CALL FUNCTION 'ALM_PM_NOTIFICATION_SAVE'
EXPORTING
number = lw_notifheader_export-notif_no
IMPORTING
notifheader = lw_nothdre
TABLES
return = lt_return.
IF LINES( lt_return ) > 0.
READ TABLE lt_return INTO lw_return INDEX 1.
IF sy-subrc = 0.
ge_message_error = lw_return-message.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
return = lw_return.
EXIT.
ELSE.
CLEAR lw_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = lw_return.
ENDIF.
ENDIF.
May be you can search another link for your reference.
Regards,
Yance
08-22-2016 9:35 PM
You'd better be taught and understand why it dumps and how to solve it, instead of just asking a "working" code