04-18-2016 4:23 PM
Hi,
I need to update the status of Internal orders (Closed,Teco). I checked FM STATUS_CHANGE_INTERN this looks ok for status update.
The problem with this FM is it updates the status of orders in JEST table but not in database table AUFK or COAS.
When i check the status for Internal orders in KO03 the status is changed but in COAS it is not updating the status, Field PHAS0 to PHAS3 which identofies the statuses created, Released, Teco and Closed are not updating.
I am not sure whether it is correct or not to use this FM in this case. I can see it is being used in many other custom programs also in the same way as i am using in my program.
Does anyone faced the same issue?
Regards,
Kamlesh
04-18-2016 4:39 PM
Please try using STATUS_CHANGE_FOR_ACTIVITY function module, passing the appropriate activity type.
Thanks,
Juwin
04-18-2016 4:39 PM
Please try using STATUS_CHANGE_FOR_ACTIVITY function module, passing the appropriate activity type.
Thanks,
Juwin
04-18-2016 4:42 PM
Hi Juwin,
I checked this FM,I did not find any option to pass the required status to this FM also my requirement is not related to any activity type .
Thanks,
Kamlesh
04-18-2016 4:47 PM
Technically Closing an Order is an activity in SAP.
You do not explicitly pass the status to this function module. The new status is determined by the function module, based on the activity you are asking it to perform.
Please do the following. Place a break-point in this STATUS_CHANGE_FOR_ACTIVITY function module. Open an order and press the TECO, then save the order. During the process, you will see that STATUS_CHANGE_FOR_ACTIVITY is getting called with the activity.
Please pass this activity from your Z program and see if the TECO is set on order.
Thanks,
Juwin
04-18-2016 5:17 PM
Hi Juwin,
I tried using the FM STATUS_CHANGE_FOR_ACTIVITY with the way you suggested. I passed the activity BTAB(Teco), It changed the status in JEST and KO03 but again not in AUFK and COAS so this FM also behaves same as STATUS_CHANGE_INTERN.
Thanks,
Kamlesh
04-18-2016 6:08 PM
OK, I did some search on SCN regarding this. It seems that you can TECO an order using the BAPI BAPI_PRODORD_COMPLETE_TECH or by BAPI_ALM_ORDER_MAINTAIN. Can you please check this?
Thanks,
Juwin
04-18-2016 6:39 PM
I can check bapi_prodord_complete_tech but it looks that is only to teco an order, i need to update multiple statuses including teco,close. I think status_change_intern is perfect for this requirement but i an not able to understand why the tables are not updating.
Even i am able to see the change logs for the status in ko03. Only problem is Aufk an coas tables are not updating.
Thanks
Kamlesh
04-18-2016 7:13 PM
OK.. here is the complete method to set TECO and CLSD on the internal order:
data:1_afko like afko,
1_afpo like afpo,
1_coas like coas,
1_kauf like kauf,
1_coas_old like coas,
2_coas type coas,
2_kauf type kauf,
3_coas type coas,
3_kauf type kauf.
*Read the Order into buffer
call function 'KAUF_ORDER_READ'
exporting
i_actvt = '02'
i_aufnr = '000007100021'
importing
e_afko = 1_afko
e_afpo = 1_afpo
e_coas = 1_coas
e_kauf = 1_kauf
e_coas_old = 1_coas_old
exceptions
error_message = 1
others = 2.
*Set TECO Status on Order
call function 'KAUF_ORDER_ACTIVITY'
exporting
i_coas = 1_coas
i_kauf = 1_kauf
i_vrgng = 'BTAB'
importing
e_coas = 2_coas
e_kauf = 2_kauf.
*Set CLSD Status on Order
call function 'KAUF_ORDER_ACTIVITY'
exporting
i_coas = 2_coas
i_kauf = 2_kauf
i_vrgng = 'BABS'
importing
e_coas = 3_coas
e_kauf = 3_kauf.
*Save Order
call function 'KAUF_ORDER_STORE'
exporting
i_check = abap_true
i_coas = 3_coas
i_kauf = 3_kauf
i_save_flag = abap_true
exceptions
error_message = 1
others = 2.
*Commit changes
commit work and wait.
This method will TeCo and Close the Internal Order. Please let me know if you face any issues.
04-19-2016 11:49 AM
Hi Juwin,
This worked perfect for Teco and Closed.Thanks for the solution.
Just to know do we have any other FMs also for other statuses?
Thanks,
Kamlesh Thakur
04-19-2016 1:40 PM
Hi Kamlesh,
You can call KAUF_ORDER_ACTIVITY, passing the appropriate ACTIVITY, to set other statuses. You can use the method mentioned above, to find what is the ACTIVITY to be used.
Kindly close the discussion, if the issue is resolved.
Thanks,
Juwin
04-20-2016 11:10 AM
KAUF_ORDER_ACTIVITY is not released, so beware, you can mess with the database in case of wrong usage, perform some where-used search, some FM like KAUF_ORDER_SUBSTITUTE or KAUF_ORDER_STORE may be required. Look at a standard report like RKOLIS00 mass update of internal orders
But, for internal orders, there is an available BAPI: BAPI_INTERNALORDER_SAVEREPLICA which has a table parameter to change statuses.
Regards,
Raymond
04-20-2016 12:44 PM
Hi Raymond,
This BAPI is an RFC FM, I tried using this but i am not sure whether this can be used for the status change or not. When i tried to execute this BAPI i am getting the errors 'Master date of distributed order is not correct'.
Thanks,
Kamlesh
04-20-2016 2:43 PM
Try to first call BAPI_INTERNALORDER_GETDETAIL, then use its result to call the change BAPI.
PS: A BAPI implementing FM is always RFC enabled els it is not a BAPI.
04-20-2016 2:48 PM
Do you have any idea how to us it to change the status.
Thanks,
Kamlesh
04-20-2016 2:58 PM
Look for parameter OBJECTSTATUS of BAPI_INTERNALORDER_SAVEREPLICA (read documentation, only avaibility/budget statuses cannot be changed)
Feel free to read the source of the BAPi it's easy to understand.
Regards,
Raymond
04-20-2016 3:36 PM
Hi Raymond,
The BAPI suggested, has hardcoded checks using Logical system, that allows only Replicated Orders to be changed using the BAPI. IOs which are directly created in the system, couldn't be updated using this BAPI.
I looked at RKOLIS00 which you suggested. That looks promising.
Thanks,
Juwin
Message was edited by: Juwin Pallipat Thomas
04-20-2016 4:17 PM
Hi Juwin,
Even this report uses the FM's KAUF_ORDER_READ and KAUF_ORDER_STORE which are not released so why we cant use them standalone.
Thanks,
Kamlesh
04-21-2016 1:59 PM
Mostly because people may misuse it and then complain to SAP that their system is corrupt. It will be a headache for SAP support to come and investigate the issue.
These non-released function modules are not documented enough to tell clearly their functionality and behavior.
The functions may be deleted or changed with a new update/release from SAP. So, custom programs which are using them will have to be adjusted every time there is a change.
The changes to these functions are not documented in any release notes, hence custom programs may start dumping if in case the functions are changed.
so on and on.....
Thanks,
Juwin
04-21-2016 2:50 PM
So shall i use it or not as report RKOLIS00 is also standard one and still using the FMs.
Also as the suggested BAPI is not working the only solution is to use the Fms suggested by you.
Thanks.
Kamlesh
04-21-2016 2:55 PM
I would suggest you to give a try on RKOLIS00 and if it doesn't work then use the function modules.
Thanks,
Juwin
04-21-2016 3:22 PM
I cant use this program as i need to change the status in a custom proxy interface so i cant use the program.
Thanks,
Kamlesh
04-21-2016 3:37 PM
You will just need to create a wrapper function module for that.
Thanks, Juwin
07-26-2016 7:52 AM
Hi Kamlesh,
The appropriate approach for changing the status of the internal order is to use report RKOLIS00. To have a sample code you could have a look at this report RKOREO01 which created by SAP to set the deletion flag.