Skip to Content
avatar image
Former Member

Creation of Service Notification No for SO.

Hi everyone,

I am working on the User Exit for the first time. Kindly help me out with the following requirement.

When a sales order is saved, create a service notification and link to the sales order header.

To fulfill this requirement we need to use the following:

Program SAPMV45A, Include MV45AFZZ, USEREXIT_SAVE_DOCUMENT

BAPI to create service Notification is : BAPI_ALM_NOTIF_CREATE

When the service notification is created, the following fields should be populated in the notification as the end result:

1. Sales Organization (VIQMEL-VKORG)

2. Distribution Channel (VIQMEL-VTWEG)

3. Division (VIQMEL-SPART)

4. Sales office (VIQMEL-VKBUR)

5. Sales Group (VIQMEL-VKGRP)

6. Notification short text should contain the sales order number (VIQMEL-QMTXT)

7. Sales Order (VIQMEL-VBELN)

The following fields should be updated in the sales order as the end result:

1. Notification number (VBAK-QMNUM)

I need to check if notification no. needs to be created or not. Also, the notification type should be valid. If not I need to throw a warning mess. but SO no. should be saved. if the condition is satisfied then BAPI should be called and notification no. should be created.

In case if BAPI fails then handling should be done with the help of the transaction SLG1.

Please provide me technical help.

Regards,

Ayushi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 16, 2011 at 01:52 PM

    Hi Ayushi,

    In the Include MV45AFZZ you need to write you code.

    First check for whcih service notification. I mean Notification Type.

    Then use you BAPI if it is correct for the notification type.

    CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'

    EXPORTING

    notif_type = p_header-tables-mnmisc-notif_type

    notifheader = p_header-tables-mnhead

    task_determination = p_header-tables-task_determination

    orderid = p_header-tables-mnmisc-orderid

    IMPORTING

    notifheader_export = l_head

    TABLES

    notitem = l_it_item " Since you dont have any items to create leave it blank.

    notifcaus = l_it_caus " Since you dont have any causes to create leave it blank.

    notifactv = l_it_act " Since you dont have any activities to create leave it blank.

    notiftask = l_it_task " Since you dont have any tasks to create leave it blank.

    notifpartnr = l_it_part "etc ditto

    longtexts = l_it_text

    return = l_it_return.

    read table it_return index 1 / read table it_return TYPE = 'S'

    if sy-subrc = 0.

    lv_notNumber = MESSAGE_V1 / MESSAGE_V2 .

    message 'Notification created' with lv_notnumber type 'S'.

    endif.

    The above logic is a Psuedo or a hint only. Hope this helps.

    Thanks & regards,

    Bhargav.

    Finally in the user exit give the message

    Add comment
    10|10000 characters needed characters exceeded