on 10-25-2012 8:58 AM
Hi Gurus
For a Change Request we have added a custom button, which if clicked will result in the immediate change to the Status of the Transaction.
However the code we've implemented does not appear to be working, the status is not getting saved.
I suspect we need to update the "In Memory" values of the current transaction and then perform a save which will then update the "In Memory" and "Database Values"
Currently we're using CRM_ORDER_MAINTAIN and then CRM_ORDER_SAVE
Would anyone have a sample piece of code with the function modules I should be using.
Many Thanks in advance
Panduranga
Hi Pandurang,
If you are coding in WEB UI Component, i.e in the event hadnler of your button on click on which you want to change the status then
1) Do not use CRM_ORDER_MAINTAIN and related FM. Because they deal directly on Database layer whereas you need to work on Database Buffer layer.
2) Your solution is simple. You can change the status within your entitty using BOL programming. That is a lengthy process but not difficult. You can find a HOW TO guide on BOL programming in WiKi area and learn to do it. The other simple solution i am gonna give is use following code in you button click event handler :
DATA : lr_current TYPE REF TO if_bol_bo_property_access.
CONSTANTS : lc_my_new_status TYPE CRM_J_STATUS VALUE 'E0013' ,
* Get the Header instance
lr_current = me->typed_context->BTAdminH->collection_wrapper->get_current( ). " assuming you are working in oneorder framework and wanna change " header status
CHECK lr_current IS BOUND.
* Trigger the Status change Process by changing status
lr_current->get_property_as_value( EXPORTING IV_ATTR_NAME = 'GUID' IMPORTING EV_RESULT = lv_guid ) .
CALL FUNCTION 'CRM_STATUS_CHANGE_EXTERN_OW'
EXPORTING
objnr = lv_guid
user_status = lc_my_new_status
iv_no_1o_maintain = 'X'
EXCEPTIONS
OBJECT_NOT_FOUND = 1
STATUS_INCONSISTENT = 2
STATUS_NOT_ALLOWED = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
It is safe to use the above function module as it is OW so it acts in buffer layer.
Hope this helps you.
Thanks & Regards
Suchita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to use BOL programming, simple back-end API's won't change the status in CRM UI level.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try using this FM "CRM_STATUS_SET_INTERN".
If you are doing the development in the genil class level, then you can use the CRM _ORDER_MAINTAIN FM, but you need not call the CRM_ORDER_SAVE FM.
IF you coding in the event method on the UI, then use the BOL programming to set the attribute.
Thanks,
Bhargava.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kumar,
A couple of things from you issue is that you don't want to commit the changes in the database but you want the 'In Memory' or Buffer to be in sync with the database. I guess you are executing the changes from the SAP CRM Web UI in the real time.
Also, ideally you should avoid making application layer calls in the UI Layer ( Web UI Framework - Presentation Layer). But if that is unavoidable then you need to call only the sub object API (in this case - Status Change API) only instead of full ORDER Maintain. You can also use the ORDER_SAVE BadI provided by SAP to handle your scenario.
In the current issue, the full flow of ORDER Maintain includes a call to BAPI_TRANSACTION_COMMIT or some kind of commit as this will persist the data from the Buffer to the database.
Let me know if you still have some doubts with the technical objects and then I can provide the Status change API for your requirement.
Hope this helps.
Thanks,
Samantak.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Panduranga,
you will have to use BAPI_TRANSACTION_COMMIT to make the changes persistent.
Reward points if this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.