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

RFC Model with a structure in import parameter

Hi all,

I need to execute a RFC model which has a structure as an import parameter. How can I populate this structure in WD? The fact is that I have some input fields on my WD View, their values must populate the structure so that at the end I have some rows in my structure. This structure is the input parameter of RFC model (a bapi in ABAP).

Can you help me?

Thank you very much,

Antonio

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2005 at 10:52 PM

    Hi Antonio,

    When u import a RFC model there will be a class which contains the structure along with the input rfc and the output rfc classes.You can declare an object the class containing the structure and set the values to that and bind the object to the input object of the model. You can go through the following link which contains an example:

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/web dynpro tutorial and sample applications.faq#q-4

    Hope this helps

    Regards

    Prakash

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 13, 2005 at 09:59 AM

    Hallo Antonio,

    parameters in AdaptiveRFC can be either scalar, structures, or tables. If e.g. an import parameter is a structure, then a getter/setter Method will be provided on the parent class allowing setting the parameter. If the structure itself contains structured fields, these can also be accessed by further setter/getter meth-ods.

    <b>NOTE:</b>

    <i>Most application developers initially attempt to set the structured parameters in the Web Dynpro context. This IS NOT a successful approach. The problem is, that adding an element to a ModelNode will not fully update the modelObject's parent in the underlying RFC Layer, if the ModelNode has a parentNode.

    Simply speaking, don't use the context to set complex input parameters (structures or tables) of RFC objects.</i>

    Here is a short example:

    <u>Context:</u>

    Bapi_Flight_Getlist_Input (Independent node, Cardinality 1:1; ModelClass: Bapi_Flight_Getlist_Input)

    Date_Range (dependent node, Cardinality 1:N; ModelClass: Bapisfldra)

    Destination_From (dependent node, Cardinality 1:1; ModelClass: Bapisfldst)

    Output (dependent node, Cardinality 1:1; ModelClass: Bapi_Flight_Getlist_Output)

    <u>Code snippet:</u>

     ...
    Bapi_Flight_Getlist_Input input = 
      wdContext.currentBapi_Flight_Getlist_InputElement().modelObject();
    Bapisfldra dateRange   = new Bapisfldra();
    Bapisfldst destination = new Bapisfldst();
    
    /* DON'T DO IT LIKE THIS
    
    wdContext.nodeDate_Range().addElement(
      wdContext.createDate_RangeElement(dateRange));
    wdContext.nodeDestination_From().addElement(
      wdContext.createDestination_FromElement(destination)); */
    		
    /* DO IT LIKE THIS */ 
    input.addDate_Range(dateRange);
    input.setDestination_From(destination);
    /* this is necessary to resynch the context with the model: */
    wdContext.nodeDate_Range().invalidate(); 
    /* this is necessary to resynch the context with the model: */
    wdContext.nodeDestination().invalidate();
    ... 

    After having done the above, all UIElements bound to the above context will automatically display the data in the modelObjects, and changes in the UI will automatically be transported into the above modelObjects. Therefore, when executing the RFC with the following code, all the above input parame-ters will also be included in the RFC call:

    ...
    try {
      wdContext.currentBapi_Flight_Getlist_InputElement().modelObject().execute();
      wdcontext.nodeOutput().invalidate(); /*this is necessary to resynch the context */
    }
    catch (WDDynamicRFCExecuteException ex)
    {
        /* Error handling... */
    }
    ... 

    Regards, Bertram

    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.