cancel
Showing results for 
Search instead for 
Did you mean: 

CRM SAP UI - Force Order Save

Former Member
0 Kudos

Hi,

Im doing some modifications to a order using a custom action, that invokes a method call.

This method is changing the system and the user status to a "disabled status".

This disabled status does not allow the "change document" transaction so the user cannot change anything in the order.

Im currently using the following functions/methods:

  • lcl_action_execute -> get object reference
  • CRM_ORDER_MAINTAIN to change system status
  • lcl_action_execute -> register_for_save
  • CRM_STATUS_CHANGE_EXTERN
  • BAPI_TRANSACTION_COMMIT
  • COMMIT WORK.

Basicly i want to disable edit mode when i click on the action.

At this moment if i click on the action, the input fields remain visible. But if i leave the order (Back button says the object is not saved so i either save or leave without saving (the result is the same) ) and enter again on the order, the fields are disabled and edit mode is not allowed.

Any suggestion?

I have tried to change "register for save" with CRM_STATUS_CHANGE" in terms of execution order but the result is equivalent.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks for the replies

my logic seems fine to our business scenario the real problem is that the screen is not getting updated on action click (im using SAP CRMD_ORDER UI).

I am clicking on the action, and invoking my method call. The Screen remains the same (Message "Action Performed" appears) but this action changed the document to a disabled state (the input fields are still editable because the screen wasnt updated).

If i leave the transaction and enter on it again the screen shows the data up to date

juergenbaur
Active Participant
0 Kudos

You can try to force a reread of the BOL with entity->reread( ).

br

Jürgen

Former Member
0 Kudos

Thanks for the replies,

I am Using SAP UI, for now as a temporary solution i am executing the action only on order save, but i will give it a go to use BOL methods you have specified.

Thanks

juergenbaur
Active Participant
0 Kudos

What CRM release do you use?

You don't use the WebUI?

br

Jürgen

juergenbaur
Active Participant
0 Kudos

You can use BAdI CRM_ORDER Method ENQUEUE to prevent the change of the order by your own logic.

Here you can check system or user status for example. To set a specific status - you can use an action or BAdI ORDER_SAVE.

By the way, if you are working with WebUI - you should not execute any commit work at all.

Use the BOL to save changes:

    DATA: lr_core    TYPE REF TO cl_crm_bol_core,
        lr_entity  TYPE REF TO cl_crm_bol_entity,
        lr_tx      TYPE REF TO if_bol_transaction_context.

  lr_entity ?= me->typed_context->btadmini->collection_wrapper->get_current( ).
  lr_tx ?= lr_entity->get_transaction( ).
  IF lr_tx IS NOT BOUND.
    lr_core = cl_crm_bol_core=>get_instance( ).
    lr_tx = lr_core->begin_transaction( ).
  ELSE.
    IF lr_tx->check_save_possible( ) = abap_true.
      CHECK lr_tx->save( ) EQ abap_true.
      lr_tx->commit( ).
    ENDIF.
  ENDIF.
  me->view_group_context->reset( ).

br

Jürgen

former_member184067
Active Contributor
0 Kudos

Hi Felipe,

try to call FM CRM_ORDER_SAVE after calling FM CRM_STATUS_CHANGE_EXTERN_OW and before call BAPI_TRANSACTION_COMMIT.

hopes it helps

cheers

eddhie kurnianto

Former Member
0 Kudos

Hi Filipe ,

You can use CRM_ORDER_MAINTAIN  to change user status . If system status is related to the user status then you need not change it explicitly. You can remove change_extern FM and directly use CRM_ORDER_SAVE ,unless your action doesn't not trigger on save condition .

Regards,

Nithish