07-29-2008 12:02 PM
Hello.
I create a Notification (IW51). Also I create a suitable Sales Order when the user assigned a Service Oder.
Of course I want to insert the Sales Order Number in the Notification (Field: VIQMEL-VBELN) now.
I try bapis - without success.
I thought on transaction SHDB but I'm not able to insert a sales order number manually. I can only press the button to create a sales order.
Is there any possibility to insert the Sales Order Number in Notifitcation afterwords?
Thanks for help,
Andrea
07-30-2008 10:07 AM
hi,
tel me the process whether notification is created first or sales order.
07-30-2008 10:16 AM
Hi.
First the notification is being created. When I get the message, that the notification is successfully created and assigned to a customer service order (I have to do that) then my coding starts. I use the follow-up action of a task I insert in the notification with User-Exit before.
So when my coding runs, the notification is created and committed.
I use the function modules
BAPI_ALM_NOTIF_DATA_MODIFY
BAPI_ALM_NOTIF_SAVE
and BAPI_TRANSACTION_COMMIT now. I am able to change different fields eg Code Group but I'm not able to change the Sales Order No.
My coding at the moment, perhaps it will help you:
REPORT zanx_notification_test.
DATA: lv_qmnum TYPE qmnum,
ls_header TYPE bapi2080_nothdri,
ls_header_x TYPE bapi2080_nothdri_x,
lt_return TYPE STANDARD TABLE OF bapiret2.
ls_header-doc_number = '0000002049'.
ls_header-itm_number = 1.
ls_header-code_group = 'VW1'.
ls_header-coding = '0001'.
ls_header-division = '00'.
ls_header-sales_org = '0039'.
ls_header-distr_chan = '00'.
ls_header_x-doc_number = ls_header_x-itm_number
= ls_header_x-code_group
= ls_header_x-coding
= ls_header_x-division
= ls_header_x-sales_org
= ls_header_x-distr_chan
= 'X'.
lv_qmnum = '000300000471'.
CALL FUNCTION 'BAPI_ALM_NOTIF_DATA_MODIFY'
EXPORTING
number = lv_qmnum
notifheader = ls_header
notifheader_x = ls_header_x
* IMPORTING
* NOTIFHEADER_EXPORT =
TABLES
* NOTIFITEM =
* NOTIFITEM_X =
* NOTIFCAUS =
* NOTIFCAUS_X =
* NOTIFACTV =
* NOTIFACTV_X =
* NOTIFTASK =
* NOTIFTASK_X =
* NOTIFPARTNR =
* NOTIFPARTNR_X =
return = lt_return
.
READ TABLE lt_return
WITH KEY type = 'E'
TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
* IMPORTING
* RETURN =
.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
* IMPORTING
* RETURN =
.
REFRESH lt_return.
CALL FUNCTION 'BAPI_ALM_NOTIF_SAVE'
EXPORTING
number = lv_qmnum
* IMPORTING
* NOTIFHEADER =
TABLES
return = lt_return
.
READ TABLE lt_return
WITH KEY type = 'E'
TRANSPORTING NO FIELDS.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
* IMPORTING
* RETURN =
.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
* IMPORTING
* RETURN =
.
ENDIF.
ENDIF.
Thanks!
Andrea
Edited by: Andrea Salzwedel on Jul 30, 2008 11:16 AM
07-30-2008 12:37 PM
07-30-2008 1:12 PM
Hi PeteA.
I add the notification number in field QMNUM when I create the sales order.
Without any success.
The documentflow is missing and the sales order number doesn't stand in VIQMEL-VBELN.
Any others ideas?
Andrea
07-30-2008 6:05 PM
Andrea,
Where in the notification are you expecting to see the list of sales orders?
PeteA
07-30-2008 6:12 PM
PeteA,
Excuse me, I didn't mean a list of sales orders.
If you go in transaction IW51/IW53 you will see the Sales Order Button above the textfields.
If you press this button, a Sales Order will be created and after saving Notification you can see the number of the generated Sales Order in that field.
Andrea
07-31-2008 8:14 AM
I see now..
Have a look at function module QM06_FM_TASK_RMA_ORDER_CREATE to see how its done there.
This FM is used in the Action Box functionality
PeteA
07-31-2008 1:50 PM
PetaA,
I'm not sure which transaction do you use.
I try your given function module.
[http://www.bilder-space.de/show.php?file=unCTW7NyckIDxC1.jpg]
Now I get this error, because the function module isn't suitable to my wanted Notification Type "S1".
Please help me I become desperated.
Andrea
Edited by: Andrea Salzwedel on Jul 31, 2008 2:50 PM
Edited by: Andrea Salzwedel on Jul 31, 2008 2:51 PM
07-31-2008 6:11 PM
Andrea,
Replace ZLB1 with the standard repair order RA or RAS
What I meant was, look at this function module and see how it creates a sales order with reference to a notification. Then copy the logic in this FM into your own program.
PeteA
08-01-2008 1:26 PM
Hi.
The Notification Update is successfull now, but only in a report.
When i try to run it in my function module it doesn't work.
Coding:
CALL FUNCTION 'IWOC_POST_NOTIFICATION' IN UPDATE TASK
EXPORTING
indupd = lv_indupd | lv_indupdp = 'U'
viqmel_new = i_viqmel
* VIQMEL_OLD = ' '
TABLES
* O_IQMFE =
n_iqmfe = lt_iqmfe
* O_IQMUR =
n_iqmur = lt_iqmur
* O_IQMMA =
n_iqmma = lt_iqmma
* O_IQMSM =
n_iqmsm = lt_iqmsm
* O_IHPA =
n_ihpa = lt_ihpa
.
COMMIT WORK.
Neither Commit Work nor IN UPDATE TASK works.
Any tipps?
Thanks,
Andrea
Edited by: Andrea Salzwedel on Aug 1, 2008 2:26 PM
News:
I call 'IWOC_POST_NOTIFICATION' without "IN UPDATE TASK"-add-on now. I place the coding in an Inlcude and call this subroutine during my function module. ("follow-up Action" of the notification-task).
Successfull now.
Many Thanks,
Andrea
Edited by: Andrea Salzwedel on Aug 4, 2008 1:40 PM
10-01-2008 12:49 PM
Hello, Andrea,
I'm trying to do the same task as yours, and the problem is as follows.
In transaction IW52, after you have created the sales order for a notification, the system automatically sets additional status 'SOAS' (I0380' - Sales order assigned), but if I call the above mentioned FM - IWOC_POST_NOTIFICATION in my program, it does not.
I've tried using BAPI_ALM_NOTIF_CHANGEUSRSTAT for this purpose, but without success - the error is User status I0380 is not allowed (QM000300000033). I guess it's because this is not a user status, but the system one.
Have you managed to set this status programmatically?
Thanks in advance for your help,
Andrey
UPDATE: I solved this issue by using FM STATUS_CHANGE_FOR_ACTIVITY with VRGNG = 'PMMB'.
08-30-2012 10:34 AM