Get the return value of an RFC function / BAPI

Hello,
I'm a Web Dynpro Java beginner and I try to get the return value (domain: NUMC6) of an RFC function without success.
Here is what I do, could you please tell me what is wrong?
First, here is my context:
Context
|
|---- ZMy_Bapi
     |
     |---- MyOutputResult
     |     |
     |     |---- MyReturnValue
     |
     |---- MyInput
My model:
MyModel
|
|---- ZMy_Bapi_Input
     |
     |---- Output
     |     |
     |     |---- ZMy_Bapi_Output
     |          |
     |          |---- Return_Value
     |
     |---- Input_Value
The mapping between them:
- MyInput is mapped to Input_Value
- MyReturnValue is mapped to Return_Value
And my code:
ZMy_Bapi_Input bapiInput = new ZMy_Bapi_Input();
wdContext.nodeZMy_Bapi().bind(bapiInput);
bapiInput.setInput_Value("A value");
executeZMy_Bapi();
ZMy_Bapi_Output bapiOutput = new ZMy_Bapi_Output();
wdContext.nodeMyOutputResult().bind(bapiOutput);
IMyOutputResultElement outputElement = wdContext.nodeMyOutputResult().currentMyOutputResultElement();
String result = outputElement.getMyReturnValue();
Finally, here is the code of the executeZMy_Bapi() function:
try {
     wdContext.currentZMy_BapiElement().modelObject().execute();
     wdContext.nodeMyOutputResult().invalidate();
} catch (Exception ex) {
     ex.printStackTrace();
My problem is that "result" keeps being empty
Thanks in advance for your help!

It still doesn't work, I'm gonna turn crazy!
But there is one good point: I get the method you mentioned: getZMy_Bapi_OutputElementAt and getMyReturnValue without casting, just as you said first.
Here are the updated context, model, mapping and code.
Context:
MyContext
|
|---- ZMy_Bapi
     |
     |---- MyOutputResult
     |     |
     |     |---- ZMy_Bapi_Output
     |          |
     |          |---- MyReturnValue
     |
     |---- MyInput
Model:
MyModel
|
|---- ZMy_Bapi_Input
|     |
|     |---- Output
|     |     |
|     |     |---- ZMy_Bapi_Output
|     |          |
|     |          |---- Return_Value
|     |
|     |---- Input_Value
|
|
|---- ZMy_Bapi_Output
     |
     |---- Return_Value
Mapping
ZMy_Bapi     --> ZMy_Bapi_Input
MyOutputResult     --> Output
ZMy_Bapi_Output     --> ZMy_Bapi_Output
MyReturnValue     --> Return_Value
MyInput          --> Input_Value
Code
ZMy_Bapi_Input bapiInput = new ZMy_Bapi_Input();
wdContext.nodeZMy_Bapi().bind(bapiInput);
bapiInput.setInput_Value("A value");
executeZMy_Bapi();
ZMy_Bapi_Output bapiOutput = new ZMy_Bapi_Output();
wdContext.nodeMyOutputResult().bind(bapiOutput);
String result = "";
for (int i = 0; i < wdContext.nodeZMy_Bapi_Output().size(); i++) {
     IZMy_Bapi_OutputElement resultElem = wdContext.nodeZMy_Bapi_Output().getZMy_Bapi_OutputElementAt(i);
     if (resultElem.getMyReturnValue() != "" && resultElem.getMyReturnValue() != null) {
          result = resultElem.getMyReturnValue();
Edited by: Franis Pignon on Oct 17, 2008 11:16 PM

Similar Messages

  • How to get the return values from a web page

    Hi all :
       how to get the return values from a web page ?  I mean how pass values betwen webflow and web page ?
    thank you very much
    Edited by: jingying Sony on Apr 15, 2010 6:15 AM
    Edited by: jingying Sony on Apr 15, 2010 6:18 AM

    Hi,
    What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
    Regards,
    Karri

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • LiveCycle DS , can't get the return value of fill( arg) from Assembler class

    Hi all!
    I'm a have small problem , can any one help me? Please
    I make a project which very similar to Product project(in
    example).
    1) Have Assembler class: I work correctly
    package flex.samples.stock;
    import java.util.List;
    import java.util.Collection;
    import java.util.Map;
    import flex.data.DataSyncException;
    import flex.data.assemblers.AbstractAssembler;
    public class StockAssembler extends AbstractAssembler {
    public Collection fill(List fillArgs) {
    StockService service = new StockService();
    System.out.print(fillArgs.size());
    return service.getStocks();
    public Object getItem(Map identity) {
    StockService service = new StockService();
    return service.getStock(((Integer)
    identity.get("StockId")).intValue());
    public void createItem(Object item) {
    StockService service = new StockService();
    service.create((Stock) item);
    public void updateItem(Object newVersion, Object
    prevVersion, List changes) {
    StockService service = new StockService();
    boolean success = service.update((Stock) newVersion);
    if (!success) {
    int stockId = ((Stock) newVersion).getStockId();
    throw new DataSyncException(service.getStock(stockId),
    changes);
    public void deleteItem(Object item) {
    StockService service = new StockService();
    boolean success = service.delete((Stock) item);
    if (!success) {
    int stockId = ((Stock) item).getStockId();
    throw new DataSyncException(service.getStock(stockId),
    null);
    some require class is ok.
    2) I configure in data-management-config.xml
    <destination id="stockinventory">
    <adapter ref="java-dao" />
    <properties>
    <source>flex.samples.stock.StockAssembler</source>
    <scope>application</scope>
    <metadata>
    <identity property="StockId"/>
    </metadata>
    <network>
    <session-timeout>20</session-timeout>
    <paging enabled="false" pageSize="10" />
    <throttle-inbound policy="ERROR" max-frequency="500"/>
    <throttle-outbound policy="REPLACE"
    max-frequency="500"/>
    </network>
    </properties>
    </destination>
    3) My client app:
    I use :
    <mx:ArrayCollection id="stocks"/>
    <mx:DataService id="ds" destination="stockinventory"/>
    ds.fill(stocks); --> Problem here
    When I run this app, The StockAssembler on the server work
    correctly (i use printout to debug) . But variable stocks can't get
    the return value,it is a empty list.
    Please help me!

    Hi,                                                             
    The executeQueryAsync method is “asynchronous, which means that the code will continue to be executed without waiting for the server to
    respond”.
    From the error message “The collection has not been initialized”, which suggests that the object in use hadn’t been initialized after the execution of the executeQueryAsync method.
    I suggest you debug the code in browser to see which line of code will throw this error, then you can reorganize the logic of the code to avoid using the uninitialized object.
    A documentation from MSDN about Using the F12 Developer Tools to Debug JavaScript Errors
    for your reference:
    http://msdn.microsoft.com/en-us/library/ie/gg699336(v=vs.85).aspx
    Best regards
    Patrick Liang
    TechNet Community Support

  • Select_list_from_lov, cant get the returning value

    Hi
    I try to use a apex_item.select_list_from_lov in a wizard. The LOV that I have is a dynamic list.
    everything works fine, only I cant get the return value of the selected items.
    multi select list
    htp.p(apex_item.SELECT_LIST_FROM_LOV
    ( 2,
    'MOS_ROL_OMSCHRIJVING',
    ' MULTIPLE HEIGHT=5',
    'NO',
    null,
    null,
    null,
    null,
    'NO')
    trying to see what the return values are, but got nothing.
    :p12_test := :f02;
    (p12_test is a textfield)
    any assistance would be greatly appreciated.
    Thanks
    using apex 4.0.

    >
    trying to see what the return values are, but got nothing.
    :p12_test := :f02;
    (p12_test is a textfield)
    >
    f02 is an associative array. See Referencing Arrays in the APEX API Reference for information on how to access values of items created using apex_item methods.

  • Not getting the return value of a program though it has no  errors

    public static String giroReturnFileDate(String strType)throws IOException{
              try{
                   SimpleDateFormat getFormatDate = new SimpleDateFormat("yyMM");
                   Date date = new Date();
                   String str = getFormatDate.format(date);
                   System.out.println("Current Date is : "+ str);
                   System.out.println("Fetching the Giro file now");
                   if(strType.equalsIgnoreCase("WPD") || strType.equalsIgnoreCase("ISTD")) {
                   FileReader inputFileReader = new FileReader("giro2itcs_"+strType+".txt");
                   ArrayList list = new ArrayList();
                   ArrayList list1 = new ArrayList();
                   System.out.println("Reading the file");
                   BufferedReader inputStream = new BufferedReader(inputFileReader);
                   String inLine = null;
                   String str1 = null;
                   while((inLine = inputStream.readLine()) != null && inLine.length() < 2)
                        list.add(inLine);
                   System.out.println("Control Record for giro2itcs_"+strType+"is:"+ inLine);
                   inputFileReader.close();
                   inputStream.close();
                   for (int i=0; i<inLine.length(); i++ )
                        str1 = inLine.substring(19,23);
                   System.out.println("date of the transaction is:"+str1);
                   if (str .equals(str1)){
                        System.out.println("giro2itcs_"+strType+".txt file is created today");
                        return "true";
                   else{
                        System.out.println("giro2itcs_"+strType+".txt file is not created today");
                        return "false";
                   }// end of if
                   return "test";
              }// end of try
              catch(Exception e) {
              System.out.println("The Exception is ::::::::::::::"+e);
    return "one";
    }//end of giroReturnFileDate(...) method
    }//end of of the class
    main method is seperate. this program compiles fine but am not getting the return value for this. none of the return values. plzzz help me.

    can you send me the code complete one ...
    i will debug and solve the problem
    [email protected]
    By publishing your email address you are likely to get loads of spam.

  • Unable to retreive the return value of pl/sql function using DB Adapter

    Dear Experts,
    I am using DB Adapter in my BPEL Process. Using DB Adapter I am invoking a PL / SQL function. I am able to send two input parameters for the pl/sql function. But I dont know how to retrieve the return value from the function. Please suggest me.
    Thanks,
    Rajesh

    Yes I am returning a value from PL/SQL function.
    Please see the code segments below,
    FUNCTION "TD_INSERT" (a TDINIT_TYPE, stops TDDETAIL_TABLE )
    RETURN VARCHAR2
    AS
    td_no Number;
    td_id Number;
    stop TDDETAILFULL_TYPE;
    length number;
    BEGIN
    insert into TD_INIT values( ----passing all the values here --------- );
    select max(tdno) into td_no from TD_INIT ;
    length := stops.count;
    for i in 1.. length loop
    stop := stops(i);
    insert into TD_DETAIL_FULL values(
    td_no, ------- );
    end loop;
    commit;
    RETURN td_no;
    END;
    Thanks,
    Rajesh

  • How to get the return value of a method

    hi there
    here is the code i write a method
    public void time(int x,int y){
    int xx;
    int yy;
    xx++;
    yy++;
    x=xx;
    y=yy;
    i want to use the return value of x and y at another place,who can tell if it is possible. thank u very much

    You declare the return type of the method, and then use the return keyword to return a value which you can assign to a variable.
    As the other respondent said, you cannot return more than one value from a function. If you need to return two related values, you may want to enclose them in a class and return an instance of that class. For instance:
    class TimeValue {
       final int x;
       final int y;
    public TimeValue(int x, int y) {
       this.x = x;
       this.y = y;
    }Then your method could create a new TimeValues and return it:
    public TimeValue time(int x,int y){
       int xx = x;
       int yy = y;
       ++xx;
       ++yy;
       return new TimeValue(xx, yy);
    }

  • Calling the DTExec from Perl Script and need to get the Return Value (Sucess or Failure)

    I am able to execute the SSIS Package from Perl Script using DTExec. But i need to get the return code of the SSIS Execution. Is their any option available to get the Success or Failure information from Perl ?

    Exit codes returned from dtexec utility             
    When a package runs, dtexec can return an exit code. The exit code is used to populate the ERRORLEVEL variable, the value of which can then be tested in conditional statements or branching logic within a batch file. The following table lists
    the values that the dtexec utility can set when exiting.
    http://technet.microsoft.com/en-us/library/hh231187.aspx
    There's a wrinkle if the package is running in the SSIS Catalog:
    http://www.mattmasson.com/2012/02/exit-codes-dtexec-and-ssis-catalog/
    David
    David http://blogs.msdn.com/b/dbrowne/

  • How to get the return value of a LOV item using javascript

    Hello,
    I am trying to put an onchange attribute in the HTML Form Element Attributes field of a LOV item. The javascript should access the new return value of the item. How is this done ? All the methods I have tried give only the display value, not the return value. For example $v() returns the display value.
    Tiina

    If your item is called P1_ITEM this will give you the return value of a popup (displays description,returns key value)
    alert($x('P1_ITEM_HIDDENVALUE').value)
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to get the returned value from Functions with Callable statement?

    I was glad to find that stored procedures can be invoke with Java class code by the object of Callable statement like :
    String stmt = "BEGIN departments_pkg.do_select(?,?,?); END;";
    and getting the output variables by
    populateAttribute(DEPARTMENTNAME,st.getString(2),true,false);
    But i would like to get values returned from FUNCTION other than stored procedure, how can i achieve it? Thanks a lot!

    Here is  my code
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_1202.
      MODULE subscreen_find.
      CALL SUBSCREEN SUBSEARCH INCLUDING sy-cprog dynnr.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_1202.
      CALL SUBSCREEN SUBSEARCH.
    MODULE subscreen_find.
      case sy-ucomm.
        when 'SELECTED'.             "fcode
          case 'ZSKILL_SEARCH'.     "data element
            when '01'.                       " value range
              dynnr = 0110.
            when '02'.
              dynnr = 0111.
          endcase.
      endcase.
    ENDMODULE.
    kindly tell me what is wrong
    Edited by: Raji Thomas on Feb 8, 2010 10:20 AM

  • !!! I need to get the return value from a PL/SQL in Java.. How??? !!!

    Hi
    -- I have a PL/SQL in which it return an array value and I need to get the value using Java.... any idea how?
    thanks

    Check out CallableStatement:
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/CallableStatement.html

  • How do I get the return value from an executable?

    I'm running an external executable from dbms_scheduler but how do I get the exit code from the program run or any screen output?

    Hi,
    In the additional_info column of schedulerjob_run_details there should be something like
    job of type EXECUTABLE failed with exit code: Operation not permitted
    "Operation not permitted" is the error code (as translated by the errors header file for that platform).
    In releases 10.2 and up there may also be a line in the additional_info
    STANDARD_ERROR="Error text here"
    This gives the standard error messages output by the application. There is no way to get the standard output of the application.
    Hope this helps,
    Ravi.

  • Executing unix script within java and getting the return value

    Hi
    I am executing a unix script from within java which will return me a value. Is there a way I get this value and use it inside my java code without doing this:
    BufferedReader in = new BufferedReader( new InputStreamReader( ls_proc.getInputStream() ));
    //readLine reads in one line of text
    int k = 1, i = 0;
    while (( ls_str = in.readLine()) != null)
    --kirk123                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I was hoping to get what I want in one or two line codes.
    --kirk123                                                                                                                                                                                           

  • How to return 2 value to a method and how can i get the return value?

    hi guys, this is my problem.
    private void one(){
    two();
    private Vector, Vector two(){
    return(row, column);
    the problem is that I don't know how to call the two() method and return from two() to one().
    please help me, i'm very new to programming........
    liml

    the problem is that I don't know how to call the two()
    method and return from two() to one()You can doprivate Vector[] two () {
        return new Vector[] {
            row,
            column
    } // as suggested
    private void one () {
        Vector[] rowAndColumn = two ();
        Vector row = rowAndColumn[0];
        Vector column = rowAndColumn[1];
    }You should consider replacing your Vector with an ArrayList, btw.
    Kind regards,
      Levi

Maybe you are looking for