cancel
Showing results for 
Search instead for 
Did you mean: 

How can i know the system variable for checking the MA mode (display or change)?

Former Member
0 Kudos

Dear all,

    How can i know the system variable for checking the MA mode (display or change)?

Best regards,

phan

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member190023
Contributor
0 Kudos

Hi Phan,

This is available in Reference Guide. It is method retrieveCurrentEditorInfo, which returns object IapiEditorInfoIfc.

From the object you can use method isBeingEdited().

Bogdan

Former Member
0 Kudos

Hi Bogdan Toma,

I tested this code but it error.


blMode = doc.isBeingEdited();

What is the correct syntex ?

Best regards,

Sujirach

Former Member
0 Kudos

Dear Bogdan  ,

   Thanks a lot for your suggestion . it is very helpful. However i tried to program the code by the below .  it always return as blank value . please kindly guide if i do anything wrong.

import com.sap.odp.api.ibean.AbsDocIBeanIfc;

obj = doc.retrieveCurrentEditorInfo();

mode= obj.isBeingEdited();

Best regards,

Phan

Former Member
0 Kudos

Hey Guys,

I think the following methods can suffice your requirements.

isObjectAccessModeEdit()

isObjectAccessModeView()

These methods return boolean true or false.

Cheers

Devesh

former_member190023
Contributor
0 Kudos

Hi guys,

@Devesh: The methods you mentioned will only work for the current editor; aka only for the user that has actually opened the document. To check if any other user is editing the document you will have to use the method provided in IapiEditorInfoIfc.

@Phan: I'm not sure what is the problem on your side. I have just tested using the code below and it works fine.

var = doc.retrieveCurrentEditorInfo().isBeingEdited();

throw new ApplicationException(session, String.valueOf(var));


PS: this method is returning a primitive type boolean ... so it's impossible to be 'blank'.


Regards,

Bogdan

Former Member
0 Kudos

Hey Bogdan,

I am not sure on this but I think the system doesn't allow most documents to be edited concurrently. I remember seeing "Currently being edited by...." on some of the documents. Can you tell me a little more about this?

As you correctly said, the methods I mentioned work for the current document/user only but I think it should suffice Phan's requirements.

In any case, he has two ways to go about his requirement now.

Thanks

Devesh

former_member190023
Contributor
0 Kudos

Hi Devesh,

For concurrent editing:

  1. Indeed, only one user can edit the document. But this is only within the UserInterface.
  2. If the 'second' edit action is executed via script, then it will disregard the user lock. Consider below scenarios (both encountered in many projects):
    • Scheduled task script that periodically executes updates to some documents
      • task script can update a document while an user is editing it
    • MA parent-child relationship where some data is pushed from parent to child
      • user A can update a parent MA while user B is editing the child

In both scenarios above the unlucky user will be presented with a message like 'Document has been changed by ***. You cannot save your changes'; forcing the user to cancel and rollback all his hard work .

For methods isObjectAccessMode* ... honestly I can't imagine why they are even exposed, as I don't see any possible scenario where they might be useful. Let me know if I'm missing something here ...

Because of this I didn't even consider these methods, given the fact that the initial inquiry from Phan is a bit ambiguous.

Bogdan

Former Member
0 Kudos

Hello Bogdan,

Your explanation is bang on. In fact, now I remember such scenarios from few of my earlier assignments and using the IapiEditorInfoIfc APIs to circumvent it. I specifically faced this problem when I modified a Contract Document from workflow postscript and there were modification that happened in Validate script as well.

I will still be honest and say that I have used isObjectAccessMode() more than once after that and it has worked without any glitches. I think it is useful when we don't have concurrent editing of the same document, in other words - for simple implementations.

However, I cannot come up with any particular advantage of using these methods.

Thanks

Devesh