Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create a Notification using BDC For IW21 Tcode

0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

Sandra_Rossi
Active Contributor
0 Kudos

You'd better be taught and understand why it dumps and how to solve it, instead of just asking a "working" code