cancel
Showing results for 
Search instead for 
Did you mean: 

How to make all views display only based on user status

Former Member
0 Kudos
217

Hi all,

I have a requirement to make all views (in a complaint) transaction display only the moment the user / system status is set to Completed.

Using BADI CRM_ORDER_FIELDCHECK I can control which fields to make display only but this BADI only does the work partially because the buttons to edit and subsequently insert new items still work.

I basically want to ensure that nothing else can get changed the moment the document status is set to 'Completed'.

Thanks,

John

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You will have to enhance the UI component.

The idea woudl be to use the btstatush Object fro the current btadminh entity to get the status of the document.

You can do this using the corresponding relation ie

1)get the btadminh entity using

lr_adminh ?= me->typed_context-><btadminh context node name>->collection_wrapper->get_current()

2)lr_status ?= lr_adminh->get_related_entities(iv_relation_name = <statush relation>)

3)now from here get the attribute which has the currenty staus value fo the document in a variable say lv_status = lr_status->get_property_as_string ( iv_attribute = '<attribute name>')

4)in your do_prepare output,or wherever teh buttons are defined and gt_buttoons table is filled,there would be a code line which would define whether the button us to be enabled.here you can add your code and set the button enable to true if your lv_status value is "completed"

5)for the view,you need to call the set_view_editable() method based on the lv_status value.

Suvidha

Former Member
0 Kudos

Thanks Suvidha...I understand all that but its also exactly what I was trying to avoid.

Based on your suggestion I would have to enhance every component / usage (i.e. assignment block) in the complaint transaction which is alot of work and probably not the best way to do it.

I was hoping there is a better way. Ie. for example control the display / read only setting in the GENIL or something like that so that all elements of the transactions are "informed" its a read only transaction.

Cheers,

Patrick

Former Member
0 Kudos

John,

This case is already taken care by the UI and genil,and you need not even call the BADI to explicitly disable the fields.

in the event handler where you want to do this,you just need to ensure and check that the parent (btorder) is not locked and is in display mode.Once the parent entity is lockes,the child locks will automatically be released,and all the enitties will cmoe into display mode.Also,all the buttons which should be enabled only in display mode will be enabled,because the button enabling is based on the entity lock already.So you would not have to do anythign extra here.

Just check the entity->is_locked() method or entity->is _changeable() to see if the entity is locked.

If it is ,you need to release the lock depending on your txn ie,either by saving the changes or by cancelling the changes.

Once the lock is lreleased ,the views will automatically come in display mode.

Suvidha