Skip to Content
author's profile photo Former Member
Former Member

SAP GP: Deleting Content of a step

Hi All,

I need help for the following problem:

I use guided procedures for implementing a workflow.

To create User interfaces I use the visual composer.

I had created a workflow and add an info callable object to the process template.

The problem arises when I do inputs in the actual step, and then open the info callable object. All inputs I have done are deleted, when I go back to the normal view.

Is there an explanation for that?

Thanks for helping me

Steve

Add a comment
10|10000 characters needed characters exceeded

Related questions

11 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2006 at 11:24 AM

    I did not mean to change GP input parameters at runtime, I just offered to store current state in application session.

    For example, your callable object view contains some input field which value is already changed by user. Create private String variable in component controller in the "//@@begin others" section. When method wdDoBeforeNavigation() is called you need to get the input field value from context attribute and store it to this private variable. When your callable object component is destroying the "wdExit()" method is called. You need to cache the private variable value to application scope:

    WDScopeUtil.put(WDScopeType.APPLICATION_SCOPE, "input_field_value", the_private_variable).

    After this GP recreates your callable object component with the empty input field. So, you need to setup it with value stored in application scope. Do it in wdInit() method: userInputElement.setInputFieldAttributeValue(WDScopeUtil.get(WDScopeType.APPLICATION_SCOPE, "input_field_value")) ;

    After CO component is rendered you'll see that input field value is the same as typed by user.

    You can find all the mentioned methods in component controller. Also it will be good if you store composed value like this: <current_action_guid>;<input_field_value> in order to be sure that you handle the same action. In this case you need restore cached values when "execute(IGPExecutionContext)" interface controller method is called and check that restored values belongs to the same action. Delegate the "execute" method to component controller.

    Best regards,

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Aliaksei,

      the last problem I solved my own.

      Problem was that I saved the content in the application (in the variable strSubject). When the application starts the next time the context was empty, nd that craetes an empty UI-content.

      In my mind the GP-Runtime Frame works in to ways:

      • when adding an File, the application doesnt stop

      --> result is geeting the content of the variable

      • when navigate on the Navigation View, the application starts a second time --> result is an empty variable

      Following the Code:

      public void wdDoInit(){
          	wdContext.getCurrentElement().setAttributeValue("Subject", WDScopeUtil.get(WDScopeType.APPLICATION_SCOPE , "inputSubject")) ;
        }
      
      public void wdDoExit(){
         	WDScopeUtil.put(WDScopeType.APPLICATION_SCOPE, "inputSubject", (String)wdContext.getCurrentElement().getAttributeAsText("Subject") ); //strSubject);	
      
        }
      
      public void wdDoBeforeNavigation(boolean isCurrentRoot){
        //empty
      }
      
      

      But thanks to Aliaksei for helping me the hole time

      Steve

      @All: Ask me for more or detailed informations

  • author's profile photo Former Member
    Former Member
    Posted on Jul 26, 2006 at 04:51 PM

    When you come back, your input data was not saved in any local cache or server as you din't tell the system to do so. Every time you go in and out of a GP screen, the GP context for that screen gets loaded as per the GP interface implementation.

    One way for you to deal with this problem could be to save your input first and get to your info callable object in the next step.

    Anyway, this problem is ui-independent. If you need such feature of saving or caching temporary input data, you'll need to implement it. I'm not sure if GP development team is going to take care of this.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      That doesnt help anymore, because only when you press on a navigation-button in the GP-Frame, like "Attachements", the content of the document will be deleted.

      I think thats a big problem and I dont know how to solve this problem. There must be a solution, i cannot imagine that SAP did not remember this.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2006 at 12:43 PM

    Just reviewing the thread...

    Unfortunately, wd callable object interface does not provide additional event or method which allows notify user about data loss or navigation to another view.

    In my view it's a bug, because it's a common practice to put in wd interface "boolean isDirty()" method which says to embedding component that embedded component data is changed but not saved and as result user sees the message that data can be lost.

    As variant you can use the following workaround:

    1. In component controller of your callable object component, cache the context values which are changed but not saved. It should be perfromed in "wdDoBeforeNavigation(boolean isCurrentRoot)" method.

    2. When you click on task again GP internals delete old callable object component and create a new one. In this moment component context is destroyed and you need to put cached values to application scope. It should be perfromed in the "wdDoExit()" method.

    To put values in scope:

    WDScopeUtil.put(WDScopeType.APPLICATION_SCOPE, "test_attr", "test_value")

    3. When component is created values can be retrieved from the scope and setup to context back. The method is: "wdDoInit()"

    Best regards,

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Aliaksei,

      meanwhile I work with Web Dynpro, and the problem is still the same. You handed me a workaround, which I want to implement at the moment.

      Before that I have a question. In the interface controller there is the method wdDoExit() --> Is there a way to change the actual input-parameters at that time?

      --> Result is that the Callable Object starts with the change input parameters.

      My problem is that i found no way (seraching in the API) to change the input-Parameters, getting is no problem.

      Is there an generally way to set Input-Parameters???

      Thanks for your treasury minds

      Steve

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2006 at 03:45 AM

    Hi Steve,

    I'm also currently in vacancy :).

    I reproduced this problem some time ago. Actually we don't use attachments and info COs in our flows what's why it's not critical for us.

    I believe that it's a bug, because user's data loss is very very important problem and it should be properly handled. You can create according CSN but I think it will be difficult to fix that because it involves changes of the web dynpro CO interface. As variant, GP can fix that by introducing more advanced embedded components handling logic(creation/deletion) - in this case it does not require the interface changes.

    Best regards,

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2006 at 10:01 AM

    Hi Steve,

    Why do you need to change parameters when interface controller's wdExit() method called ? At this time you can not even access wd context. Change them when component controller's wdInit() method is called.

    Possible I don't completely understand the problem.

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Aliaksei,

      the problem is always the same: Web Dynpo doesnt cache the content automatically.

      My intention is to write an application with manually caching. Hope the summary helps.

      It was only an intention, that I am able to set (or change) the inputparameter when leaving (wdDoExit) the application, an so the new called Callable Object was opened with the actual contexts.

      Is it possible to do that, can I change the input parameter, at runtime? I didnt found a way in the API? There are no setting-Methods.

      Helps when you can explain how.

      I undertstand that a caching is only possible within the methods of the component controller, not in the interface controller! But how cn i get the input-structure of my wd-application.

      Bye Steve

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2006 at 05:15 PM

    Steve,

    To access UI element values use context attributes which are bound to these elements. Check the http://help.sap.com/saphelp_nw2004s/helpdata/en/12/47b0617750c84bb3c98ec5da8b49ee/content.htm.

    http://help.sap.com/saphelp_nw2004s/helpdata/en/ad/c19e586b7e5d488b06030ae37db4ef/content.htm

    For context programming technique check the

    http://help.sap.com/saphelp_nw2004s/helpdata/en/97/6063ed47b63b439fb4980542fb3c81/content.htm

    Additionaly, you need to create nodes/attributes mapping from your component controller to your view.

    Best regards,

    Aliaskei

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi ALiaksei,

      can you say more about this. I do not understand when I need it, or how I implement this exactly.

      <i>You can find all the mentioned methods in component controller. Also it will be good if you store composed value like this: <current_action_guid>;<input_field_value> in order to be sure that you handle the same action. In this case you need restore cached values when "execute(IGPExecutionContext)" interface controller method is called and check that restored values belongs to the same action. Delegate the "execute" method to component controller.</i>

      Thansk Steve

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2006 at 11:26 AM

    Lest's imagine the case when you assign an action to a block twice. In this case the second action will display data which was typed for the first one. In this case data must be cached with some certain action characteristic, for example action guid. You can retrieve GUID from callable object execution context.

    Best regards,

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Aliaksei,

      I think thats very clever.

      I'm going to implement this in my application.

      Second question: Do you know a way to clear the WDSCope after completing sthe action?

      Thanks Steve

      Message was edited by: Steve Mussdorf

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2006 at 12:08 PM

    It seems that's impossible.

    Before caching values you can:

    compose key as "actionGUID + propertyName"

    or

    compose value as "actionGUID + value"

    in this case you can unique identify which value belongs to certain action. To retrieve action GUID use

    executionContext.getTaskId() ;
    

    Best regards,

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2006 at 08:52 AM

    It's not really important where you do this in wdInit() or execute(excutioncontext) method. Anyway rendering performed after both methods are executed. Just relocate your coding from wdInit() method to execute(excutioncontext) method.

    Create execute(executioncontext) method in component controller, call it from the interface controller and relocate your coding to this delegated method.

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Aliaksei,

      to displace from init() is a good idea. Thanks

      I dont have any code in the component controlle, only in the interface controller --> works fine.

      1.Question: What is the benefit to place some code in the component contorller?

      2.Question: Do you have a clever solution, to check if the application is cached (then take the values from the Scope) or not (the show the inputpars)

      Thanks steve

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2006 at 09:50 AM

    Typically, it's common practice to delegate interface methods to component or custom controller. Especially for complex components. It's not good to put all component logic to interface controller.

    Why you don't you like proposed by me variant combine cached value key as <actionGUID>+<attrName>?

    Imagine the case that user opens the first action, then clicks on Attachments link and then open the second action. In this case the wdInit() method will be called not for first action but for second one only. In this case you even don't have possibility to clear cached values for previous action because second action does not know anything about first action. So my proposal is to cache values with composed key <actionGUID>+<attrName> and when you need to retrieve cached values you compose this key again for current action and if returned cached value is null you don't need to initilize value for according control.

    Also you can add additional cached flag for example: <actionGuid> + "isCached" and with values "true" or "false". If "true" you should retrieve cached values from scope if "false" do not do that.

    Aliaksei

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.