How to get value from Thread Run Method

I want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that it seems that scope of the variable gets lost resulting to null value in the called method/class..
How can I get the variable with the value?
This is sample code:
public class SampleSynchronisation
public static void main(String df[])
sampleThread sathr= new sampleThread();
sathr.start();
System.out.println("This is the value from the run method "+sathr.x);
/* I should get Inside the run method::: But I get only Inside */
class sampleThread extends Thread
     public String x="Inside";
     public void run()
          x+="the run method";

I think this is what you're looking for. I hold up main(), waiting for the results to be concatenated to the String.
public class sampsynch
    class SampleThread extends Thread
     String x = "Inside";
     public void run() {
         x+="the run method";
         synchronized(this) {
          notify();
    public static void main(String[] args) throws InterruptedException {
     SampleThread t = new sampsynch().new SampleThread();
     t.start();
     synchronized(t) {
         t.wait();
     System.out.println(t.x);
}

Similar Messages

  • How can I get the variable with the value from Thread Run method?

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    // I should get Inside the run method::: But I get only Inside
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    We want to access a variable from the run method of a
    Thread externally in a class or in a method. I presume you mean a member variable of the thread class and not a local variable inside the run() method.
    Even
    though I make the variable as public /public static, I
    could get the value till the end of the run method
    only. After that scope of the variable gets lost
    resulting to null value in the called method/class..
    I find it easier to implement the Runnable interface rather than extending a thread. This allows your class to extend another class (ie if you extend thread you can't extend something else, but if you implement Runnable you have the ability to inherit from something). Here's how I would write it:
    public class SampleSynchronisation
      public static void main(String[] args)
        SampleSynchronisation app = new SampleSynchronisation();
      public SampleSynchronisation()
        MyRunnable runner = new MyRunnable();
        new Thread(runner).start();
        // yield this thread so other thread gets a chance to start
        Thread.yield();
        System.out.println("runner's X = " + runner.getX());
      class MyRunnable implements Runnable
        String X = null;
        // this method called from the controlling thread
        public synchronized String getX()
          return X;
        public void run()
          System.out.println("Inside MyRunnable");
          X = "MyRunnable's data";
      } // end class MyRunnable
    } // end class SampleSynchronisation>
    public class SampleSynchronisation
    public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run
    method "+sathr.x);
    // I should get Inside the run method::: But I get
    only Inside
    class sampleThread extends Thread
    public String x="Inside";
    public void run()
    x+="the run method";
    NB: if i write the variable in to a file I am able to
    read it from external method. This I dont want to do

  • How to get value from list item

    Hi all,
    How to get value from list item?
    I have a problem with the List Item object
    in the Oracle forms.
    How can I retrieve the selected item from
    a list ?
    I didn't find any function like 'list.GET_
    SELECTED_ITEM()'...
    thanks
    Bala

    Hello,
    You get the value as for any other Forms item:
    :value := :block.list_tem ;Francois

  • JSF:how to get value from dinamically generated HtmlInputText components�H�H

    <h:panelGroup binding="#{dynamicInputGroupBean.group}"/>
    public HtmlPanelGroup getGroup() {
              if (this.getSelectedComp() == null) {
                   return this.group;
              FacesContext facesContext = FacesContext.getCurrentInstance();
              Application application = facesContext.getApplication();
              this.group = new HtmlPanelGroup();
              Set pSet = this.getSelectedComp().getParameterses();
              int size = pSet.size();
              this.instanceValue = new String[size];
              int i = 0;
              for (Iterator it = pSet.iterator(); it.hasNext();) {
                   Parameters tempP = (Parameters) it.next();
                   HtmlOutputLabel outputLable = new HtmlOutputLabel();
                   HtmlInputText inputText = new HtmlInputText();
                   inputText.setId("p" + i);
                   String valueBindingExpression = "#{dynamicInputGroupBean.instanceValue["+i+ "]}";
                   System.out.println(valueBindingExpression);
                   ValueBinding valueBinding = application
                             .createValueBinding(valueBindingExpression);
                   inputText.setValueBinding("value", valueBinding);
                   outputLable.setFor(inputText.getId());
                   outputLable.setValue(tempP.getParaname() + ": ");
                   group.getChildren().add(outputLable);
                   group.getChildren().add(inputText);
                   i++;
              // group.getChildren().add(new HtmlInputText());
              return group;
         }as codes show above, i successfully genera HtmlInputText dinamicaly�C
    but i got problems while i try to print those values...
    after the the jsp page presents in my browser,
    i input some words in the input components,
    and then click a commandButton hold an action to print their value
    action code :
    String[] tempArray = this.getInstanceValue();
    for (int i = 0; i < tempArray.length; i++) {
    System.out.println(tempArray);
    only NULL has been printed in the consol ....not the word i inputed!!!
    so my question is how can i get values from those
    dinamically generated HtmlInputText ????

    This approach is odd. What's the functional requirement after all? You normally attach the inputtext value to a backing bean property and do the desired command button action which is attached to a backing bean action method. In this method you then use the value for the query.

  • How to get values from an IFrame...

    Hi everyone. I have come to a complete stop i my project and need to ask the following: How do i get the values from an IFrame.
    Situation: I have a main.jsp page that contains an IFrame(data.jsp). Data.jsp is basically made up of a bunch of checkboxes. The state of these boxes(checked or unchecked) is determined and set by a JAVA program and the results are then stored in a StringBuffer. Contents of Stringbuffer could look something like this: <tr><input type='checkbox' name='box0' CHECKED></tr>.
    The StringBuffer in then presented in the IFrame(data.jsp) like so: <%=res.getInfo()%>
    The user should be able to check or uncheck the boxes from the main.jsp page then when pressing a submit button the changes should be stored in a DBase.
    After the submit button have been pressed i go into my Servlet's doPost() method for some basic processing. This is were the problem starts. I usally use HttpServletRequest.getParameter(String param) to get values from the main.jsp page. But these checkboxes are stored in the IFrame, so how do i go about to retrieve the values from data.jsp from the doPost() method or in some other way maybe. This is quite urgent and i hope that i have explained the scenario in enough detail.
    Any help would be greatlly apritiated.
    Best regards
    Peter

    Hello
    Just try this link
    http://www.faqts.com/knowledge_base/view.phtml/aid/13758/fid/53
    HTH

  • How to get values from a stored package variable of type record ?

    Sir,
    In my JClient form, I need to get values from a database stored package variable of type record. And the values are retained in the JClient form for the whole session. The values are copied only once when the form is started.
    What is the best way to do that ?
    Thanks
    Stephen

    Stephen,
    not sure what your model is, but if it is Business Components, I think I would expose the properties as a client method on the application module. This way all JClient panels and frames will have access to it. You could use a HashMap to store the data in teh app module.
    If JDBC supports the record type, then you should be able to call it via a prepared SQL statement. If not, you may consider writing a PLSQL accessor to your stored procedure that returns something that can be handled.
    Steve Muench provides the following examples on his blog page
    http://otn.oracle.com/products/jdev/tips/muench/stprocnondbblock/PassUserEnteredValuesToStoredProc.zip
    http://otn.oracle.com/products/jdev/tips/muench/multilevelstproc/MultilevelStoredProcExample.zip
    Frank

  • How to get values from a table(in jsp) for validation using javascript.

    hi,
    this is praveen,pls tell me the procedure to get values from a table(in jsp) for validation using javascript.
    thank you in advance.

    Yes i did try the same ..
    BEGIN
    select PROD_tYPE into :P185_OFF_CITY from
    magcrm_setup where atype = 'CITY' ;
    :p185_OFF_CITY := 'XXX';
    insert into mtest values ('inside foolter');
    END;
    When i checked the mtest table it shos me the row inserted...
    inside foolter .. Now this means everything did get execute properly
    But still the vallue of off_city is null or emtpy...
    i check the filed and still its empty..
    while mtest had those records..seems like some process is cleaining the values...but cant see such process...
    a bit confused..here..I tried on Load after footer...
    tried chaning the squence number of process ..but still it doesnt help
    some how the session variables gets changed...and it is changed to empty
    Edited by: pauljohny on Jan 3, 2012 2:01 AM
    Edited by: pauljohny on Jan 3, 2012 2:03 AM

  • How to throw Exception in Thread.run() method

    I want to throw exception in Thread.run() method. How can I do that ?
    If I try to compile the Code given below, it does not allow me to compile :
    public class ThreadTest {
         public static void main(String[] args) {
         ThreadTest.DyingThread t = new DyingThread();
         t.start();
         static class DyingThread extends Thread {
         public void run() {
         try {
                   //some code that may throw some exception here
              } catch (Exception e) {
              throw e;//Want to throw(pass) exception to caller
    }

    (a) in JDK 1.4+, wrap your exception in RuntimeException:
    catch (Exception e)
    throw new RuntimeException(e);
    [this exception will be caught by ThreadGroup.uncaughtException() of this thread's parent thread group]
    In earlier JDKs, use your own wrapping unchecked exception class.
    (b) if you know what you are doing, you can make any Java method throw any exception using Thread.stop(Throwable) regardless of what it declares in its "throws" declaration.

  • How to get value from one context node to otehr contect conde in diff views

    Hello Guru's
    We have a rek which is of getting the value from one context node to other context node,
    for example there is Total value in BT111H_OPPT/ITEMLIST (One context node) we need to have the same Total value in the in BT111H_OPPT/DETAILS (other context node) automatically
    Inputs are highly appricated.......

    Hello,
    Thanks for your Reply
    But my rek is i want to get value from different views
    eg BT111H_oppt/itemslist(contex node - BTADMINI) field net value to BT111h_opp/Details(Context node - BTopporth)
    for this which method should i use to chive this.
    Thanks..

  • Getting values from a running window

    has anyone ever used a program that could retrieve values from an opened window? I have this poker calculator program that can get values from an open poker window. It has a list of about 50 different types of windows (exes, iexplorer, different sites etc.).
    Is there any simple way in java of doing something like this?

    its not done by a screenshot, because you just give
    it the window's title. It works even if its
    minimized.At least in Windows, if you have the window's title then you can get a link to the application and you can find out all sorts of information about it. So your conclusion that screenshots aren't involved isn't correct. They may or may not be involved. But this access is done by a native Windows API and Java doesn't support that.

  • How to get value from messageStyledText which is present in other RN

    Hi,
    I have xxcompscore messageStyledText in region 1 (separate controller) and xxobjscore messageStyledText in region2 (separate controller).
    The both values are double.
    My requirement is to get that value from another region (page layout) and add that both values and display in this RN.
    How to do this, i tried lot but i'm getting NullPointerException Error.

    Afridi,
    I tried again by creating new controller, same error.
    I'm trying the following code in the pagelayout controller.
    Code:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    double TotalScore;
    OAMessageStyledTextBean TotalScoreText = (OAMessageStyledTextBean)webBean.findChildRecursive("XXEmployeeTotalScoreText");
    String CompString=(String)pageContext.getSessionValue("CompScoreValue");
    double CompScore=Double.parseDouble(CompString);
    String ObjString=(String)pageContext.getSessionValue("ObjScoreValue");
    double ObjScore=Double.parseDouble(ObjString);
    TotalScore=(CompScore+ObjScore)/2;
    TotalScoreText.setValue(pageContext,TotalScore);
    error:
    oracle.apps.fnd.framework.OAException: java.lang.NullPointerException
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:616)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1182)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:968)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:935)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:659)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:252)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2607)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1940)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:543)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:431)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:734)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:280)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:68)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:214)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:219)
         at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)
         at OA.jspService(_OA.java:221)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:642)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:662)
    ## Detail 0 ##
    java.lang.NullPointerException
    java.lang.NullPointerException

  • How to get values from a TextFiled

    This may be a newbie question, that's okay, because I'm new to JHeadstart.
    I have a page for changing a user's password. The page has 3 fields (userid, oldpassword, newpassword) and a button (save). When the user clicks the button I want to capture the values the user is sending and run a SQL statement against the database with values from the textfields in the SQL statement.
    I have a class that contains a custom method alterUser() that will do the SQL execution. The problem is that my values that show up in create(AttributeList attributeList) in the TextFields are showing up as null. See bottom of code below....
    Suggestions?
    package mil.af.aces.hf.persistence.bc4j;
    import oracle.jbo.server.EntityImpl;
    import oracle.jbo.server.EntityDefImpl;
    import oracle.jbo.server.AttributeDefImpl;
    import oracle.jbo.AttributeList;
    import oracle.jbo.Key;
    import java.sql.Statement;
    import java.sql.SQLException;
    import javax.servlet.ServletRequest;
    import oracle.jbo.JboException;
    import oracle.cle.process.ProcessInfo;
    import oracle.cle.process.ProcessConstants;
    import oracle.clex.process.controller.HttpServletController;
    import mil.af.aces.hf.persistence.bc4j.common.HfJhsApplicationModuleImpl;
    import oracle.jheadstart.persistence.bc4j.common.Bc4jDBTransaction;
    // --- File generated by Oracle Business Components for Java.
    public class VhfChgPswdImpl extends EntityImpl
    implements AttributeList
    protected static final int DBMSID = 0;
    protected static final int OLDPASSWORD = 1;
    protected static final int NEWPASSWORD = 2;
    private static EntityDefImpl mDefinitionObject;
    * This is the default constructor (do not remove)
    public VhfChgPswdImpl()
    * Retrieves the definition object for this instance class.
    public static synchronized EntityDefImpl getDefinitionObject()
    if (mDefinitionObject == null)
    mDefinitionObject = (EntityDefImpl)EntityDefImpl.findDefObject("mil.af.aces.hf.persistence.bc4j.VhfChgPswd");
    return mDefinitionObject;
    * Gets the attribute value for DbmsId, using the alias name DbmsId
    public String getDbmsId()
    return (String)getAttributeInternal(DBMSID);
    * Sets <code>value</code> as the attribute value for DbmsId
    public void setDbmsId(String value)
    setAttributeInternal(DBMSID, value);
    * Gets the attribute value for OldPassword, using the alias name OldPassword
    public String getOldPassword()
    return (String)getAttributeInternal(OLDPASSWORD);
    * Sets <code>value</code> as the attribute value for OldPassword
    public void setOldPassword(String value)
    setAttributeInternal(OLDPASSWORD, value);
    * Gets the attribute value for NewPassword, using the alias name NewPassword
    public String getNewPassword()
    return (String)getAttributeInternal(NEWPASSWORD);
    * Sets <code>value</code> as the attribute value for NewPassword
    public void setNewPassword(String value)
    setAttributeInternal(NEWPASSWORD, value);
    // Generated method. Do not modify.
    protected Object getAttrInvokeAccessor(int index, AttributeDefImpl attrDef) throws Exception
    switch (index)
    case DBMSID:
    return getDbmsId();
    case OLDPASSWORD:
    return getOldPassword();
    case NEWPASSWORD:
    return getNewPassword();
    default:
    return super.getAttrInvokeAccessor(index, attrDef);
    // Generated method. Do not modify.
    protected void setAttrInvokeAccessor(int index, Object value, AttributeDefImpl attrDef) throws Exception
    switch (index)
    case DBMSID:
    setDbmsId((String)value);
    return;
    case OLDPASSWORD:
    setOldPassword((String)value);
    return;
    case NEWPASSWORD:
    setNewPassword((String)value);
    return;
    default:
    super.setAttrInvokeAccessor(index, value, attrDef);
    return;
    * Creates a Key object based on given key constituents
    public static Key createPrimaryKey(String dbmsId)
    return new Key(new Object[] {dbmsId});
    public void alterUser(String dbmsId, String newPassword)
    Statement st = null;
    try {
    String sql = "ALTER USER " + dbmsId + " IDENTIFIED BY " + newPassword + ";";
    Bc4jDBTransaction tr = (Bc4jDBTransaction)getDBTransaction();
    st = tr.createStatement(0);
    int rows = st.executeUpdate(sql);
    System.out.println("Updated Rows="+rows);
    catch (SQLException s) {
    throw new JboException(s);
    finally {
    try {
    if (st != null) st.close();
    catch (SQLException s) { /* ignore */}
    protected void create(AttributeList attributeList) {
    super.create(attributeList);
    System.out.println("In Create Method");
    System.out.println( "Request = " + HttpServletController.HTTPREQUEST.toString()); // = "HTTPREQUEST"
    System.out.println("Posted Attribute 1 = " + this.getPostedAttribute(1).toString() ); // = null
    System.out.println("Posted Attribute 2 = " + this.getPostedAttribute(2).toString() ); // = null
    System.out.println("looping through values");
    // SHOWS THAT THERE ARE 3 OBJECTS, BUT ALL THREE ARE NULL
    String myNames[] = getAttributeNames();
    Object myValues[] = getAttributeValues();
    System.out.println("array sizes");
    System.out.println(" > myNames:" + myNames.length) ;
    System.out.println(" > myValues:" + myValues.length) ;
    for (int i = 0; i < myNames.length; i++) {  // LENGTH IS THREE
    System.out.print( "name: " + myNames);
    if (myValues[i] != null)
    System.out.println(" value= " + myValues[i].toString() );
    else
    System.out.println(" value: is NULL ...:" + myValues[i]); // << PRINTS THIS 3 TIMES

    Hi,
    The BC4J create statement fires when the "New" button is pressed, so when an EMPTY record is created. It's normal that at that point all attributes are null.
    What you probably want to do, is catch the "Save" process. You can do that by overriding the doDML method (menu: Tools - Override Methods). At that point the attributes should not be null anymore.
    Hope this helps,
    Sandra Muller
    JHeadstart Team

  • How to get values from a query string in URL in a jsf page?

    if i have a url, http://my.com/?name=john+smith, how do i get the values from that url in a jsf page and then pass those values to a servlet?
    i know how to do that in jsp using "request.getParamter("name")" and save it in a bean and then forward to a servlet. But what about in jsf?

    Hello,
    Try this:
    Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
    String name = (String) requestMap.get("name");If isn't worked one of these methods probably will solve your problem.
    FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
    FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap();hth.

  • How to get values from workflow to program

    Hello everybody,
    I am stuck with an issue in workflow. I want to know how can I get the values of workflow in Abap program.
    Scenario:
    The workflow is triggered when a user does the transaction MIGO.
    The user gets a workflow in his SAP inbox. He clicks on the link and is able to view details in MIGO.
    I want to get the material number and year in program ( as shown below)
    I am new to workflow, is there any kind of binding to do? And maybe a method or function module which will allow to get these values in program.
    Thanks a lot
    Regards

    Hello,
    With some help here and there, we have been able to set up the workflow. Special thanks to Modak Gupta.
    I'm sharing the steps below. I would be grateful if someone could explain the different binding, what are their purposes depending on the place they are done, etc. I am still not very at ease with the binding. Thanks.
    Requirement:
    Once MIGO is done, the client wishes to do another MIGO. For him to know that the first MIGO has been done, he needs to get it in his SAP Inbox (Workflow). From there, he can just execute the workflow and he will do the second MIGO.
    Steps:
    1. Create a BAPI in SE37 to get the purchase order (we need it because we will open the second MIGO with the purchase order of the first MIGO). We will also call the transaction MIGO in the BAPI (For our requirement, it is ZMIGO, but very similar to MIGO, just some different customizing).
    In the BAPI, use the function module BAPI_GOODSMVT_GETDETAIL to get the purchase order.
    A BDC is also done in the BAPI to open ZMIGO with the purchase order.
    Code:
    FUNCTION zbapi_call_transaction.
    *"*"Interface locale :
    *"  IMPORTING
    *"     VALUE(MATERIALDOCUMENT) TYPE  MBLNR
    *"     VALUE(MATDOCUMENTYEAR) TYPE  MJAHR
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRETURN
    DATA: gt_items TYPE STANDARD TABLE OF bapi2017_gm_item_show,
    gs_items TYPE bapi2017_gm_item_show,
    gt_return TYPE STANDARD TABLE OF bapiret2,
    gs_header TYPE bapi2017_gm_head_02,
    l_materialdocument  TYPE  bapi2017_gm_head_02-mat_doc,
    l_matdocumentyear TYPE  bapi2017_gm_head_02-doc_year.
    DATA: gs_bdcdata  TYPE bdcdata,
    gt_bdcdata  TYPE TABLE OF bdcdata,
    l_opt TYPE ctu_params.
    l_materialdocument       = materialdocument.
    l_matdocumentyear        = matdocumentyear.
    CALL FUNCTION 'BAPI_GOODSMVT_GETDETAIL'
    EXPORTING
    materialdocument = l_materialdocument
    matdocumentyear  = l_matdocumentyear
    IMPORTING
    goodsmvt_header  = gs_header
    TABLES
    goodsmvt_items   = gt_items
    return           = gt_return.
    READ TABLE gt_items INTO gs_items INDEX 1.
    IF sy-subrc EQ 0.
    CLEAR gs_bdcdata.
    gs_bdcdata-program  = 'SAPLMIGO'.
    gs_bdcdata-dynpro   = '0001'.
    gs_bdcdata-dynbegin = 'X'.
    APPEND gs_bdcdata TO gt_bdcdata.
    CLEAR gs_bdcdata.
    gs_bdcdata-fnam = 'BDC_CURSOR'.
    gs_bdcdata-fval = 'GODYNPRO-PO_NUMBER'.
    APPEND gs_bdcdata TO gt_bdcdata.
    CLEAR gs_bdcdata.
    gs_bdcdata-fnam = 'GODYNPRO-PO_NUMBER'.
    gs_bdcdata-fval = gs_items-po_number.
    APPEND gs_bdcdata TO gt_bdcdata.
    CLEAR gs_bdcdata.
    gs_bdcdata-fnam = 'BDC_CURSOR'.
    gs_bdcdata-fval = 'GODEFAULT_TV-BWART'.
    APPEND gs_bdcdata TO gt_bdcdata.
    CLEAR gs_bdcdata.
    gs_bdcdata-fnam = 'GODEFAULT_TV-BWART'.
    gs_bdcdata-fval = '101'.
    APPEND gs_bdcdata TO gt_bdcdata.
    CLEAR gs_bdcdata.
    gs_bdcdata-fnam = 'BDC_CURSOR'.
    gs_bdcdata-fval = 'GODYNPRO-PO_NUMBER'.
    APPEND gs_bdcdata TO gt_bdcdata.
    CLEAR gs_bdcdata.
    gs_bdcdata-fnam = 'BDC_OKCODE'.
    gs_bdcdata-fval = '=OK_GO'.
    APPEND gs_bdcdata TO gt_bdcdata.
    l_opt-dismode = 'E'.
    l_opt-defsize = 'X'.
    CALL TRANSACTION 'ZMIGO' USING gt_bdcdata OPTIONS FROM l_opt.
    ENDIF.
    ENDFUNCTION.
    2. Create a Business Object in SWO1.
    It is a copy of BUS2017, we have added our BAPI and an event. We also modified the program.
    Modify the program by clicking on Program above:
    Add the parameters in the new method (BAPI)
    Add the parameters in the new Event.
    3. Implement the BADI in SE18 / SE19
    BADI: MB_DOCUMENT_BADI -
    Method: MB_DOCUMENT_BEFORE_UPDATE
    Get the purchase order
    Use the function module SAP_WAPI_CREATE_EVENT to pass values from program to workflow.
    Code:
    method IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE.
    DATA : BEGIN OF key,
    mblnr TYPE mkpf-mblnr,
    mjahr TYPE mkpf-mjahr,
    END OF key.
    DATA : event_container TYPE TABLE OF swcont.
    DATA : objkey TYPE sweinstcou-objkey.
    DATA : s_xmkpf TYPE mkpf.
    DATA: l_RETURN_CODE TYPE sy-subrc,
    l_event_id TYPE SWR_STRUCT-EVENT_ID,
    lt_container TYPE STANDARD TABLE OF SWR_CONT,
    ls_container TYPE SWR_CONT.
    data :INPUT_CONTAINE type table of SWR_CONT ,
    x_cont type swr_cont.
    " numéro commande d'achat
    DATA ls_xmseg TYPE mseg.
    CLEAR ls_xmseg.
    READ TABLE xmseg INTO ls_xmseg INDEX 1.
    x_cont-ELEMENT = 'MATERIALDOCUMENT'.
    x_cont-VALUE = ls_xmseg-mblnr.
    APPEND x_cont to INPUT_CONTAINE.
    x_cont-ELEMENT = 'MATERIALDOCYEAR'.
    x_cont-VALUE = ls_xmseg-mjahr.
    APPEND x_cont to INPUT_CONTAINE.
    CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
    EXPORTING
    object_type             = 'ZYBI'
    object_key              = objkey
    event                   = 'EVENT2'
    COMMIT_WORK             = space
    IMPORTING
    RETURN_CODE             = l_RETURN_CODE
    EVENT_ID                = l_event_id
    TABLES
    INPUT_CONTAINER         = INPUT_CONTAINE.
    endmethod.
    4. Create the workflow in SWDD
    Add the Business Object in the container and tick Import.
    Create a task with the following details.
    Click on Binding in the above screen:
    Create an Activity and attach the task to it.
    Affect Agents
    Add a starting event in Basic Data.
    Add a Process Control to end the workflow.
    Workflow Final should look like this:
    I hope it would be helpful to some of you. Sorry about the binding, there might be some issues not correct. But normally, if you follow the steps as they are, and for binding, you do Automatic Binding, it should be ok.
    Thanks

  • How to get values from RT table

    Hello friends ,
    I want to get earned basic from RT table  T-code - pc00_m40_clstr
    how to get that values for wage types
    gaurav

    Hi Gaurav,
    The Function Module u2018 PYXX_READ_PAYROLL_RESULT u2019 generically reads a complete payroll result, that is for all country versions, from file PCL2 or from the buffer. In doing so, the payroll result is transferred to the PAYROLL_RESULT parameter. In the calling system, this must be classified as a complex structure according to the 'PAYxx_RESULT' dictionary structure. u2018 xx u2018 is the ISO code for the country. Now the payroll result is in the parameter FS_PAY99_RESULT. In this parameter the RT table is considered and the required values are moved into a internal table (say  T_RT).
    Regards,
    Swapna.

Maybe you are looking for