WorkFlow BADI : Get Responsi From R/3 for given WBS

Hi,
Scenario:
I am developing a Workflow BADI in SRM5.0.
For all cost centers I am getting approvers based on Z-table values.
But then for WBS... i have to get the list of approvers from R/3.
I created a Function module in R/3 dev which gets me Responsible person.
Issue:
While calling the RFC function module... by giving destination name, the Function module is working fine.
But I dont want to Hardcode Destination name.
Can I get the Destination name in some other manner ?
Helpful Answers will be rewarded.
Regards,
Ashwin.

Hi,
Please follow this logic:
1) Function Module BBP_GET_BACKEND_SYSTEMS  will provide you the backend system detail (logical system name).
2) Then use the FM BBP_LOGICAL_SYSTEM_GETDETAIL to get the RFC destination of the backend system which can be used to make teh RFC call.
This would avoid hard coding and will work fine.
Sample Code:
*& Report  ZKB_BACKEND_SYS
REPORT  zkb_backend_sys.
DATA: lt_log_sys     TYPE TABLE OF bbps_logical_system.
DATA: lt_messages    TYPE TABLE OF balmi.
DATA: ls_log_sys     TYPE bbps_logical_system.
DATA: lv_destination TYPE rfcdest.
CALL FUNCTION 'BBP_GET_BACKEND_SYSTEMS'
  TABLES
    et_logical_systems = lt_log_sys
    et_messages        = lt_messages.
CLEAR ls_log_sys.
READ TABLE lt_log_sys INTO ls_log_sys INDEX 1.
CHECK sy-subrc EQ 0.
CALL FUNCTION 'BBP_LOGICAL_SYSTEM_GETDETAIL'
  EXPORTING
    logical_system = ls_log_sys-logsys
  IMPORTING
    destination    = lv_destination
  EXCEPTIONS
    not_found      = 1
    OTHERS         = 2.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WRITE:/ 'RFC Destination is:', lv_destination.
Regards
Kathirvel
Edited by: Kathirvel Balakrishnan on Feb 25, 2008 1:23 PM

Similar Messages

  • How to get response from an asynchronous BPEL process in Java

    I'm experimenting with BPEL and doesn't seem to be able to get response from an asynchronous BPEL process. Here's the deal:
    I have a BPEL process that takes a string as input, and gives another string as output. This is a asyncronous process.
    I want to initiate this BPEL process as a web service so I generate a Webservice Proxy in JDeveloper 10g (10.1.3.0.4). The function to call the process is now called "initiate" and takes three arguments: the input string, a "org.xmlsoap.schemas.ws._2003._03.addressing.EndpointReferenceType replyTo" and a
    "org.xmlsoap.schemas.ws._2003._03.addressing.AttributedURI messageID".
    HTTP-Analyzer shows that invoking the BPEL process with initiate("somestring", null, null) results in sending a SOAP message to the BPEL process, which returns a "202 Accepted". How do I get the response from the process? My intuition tells me that I have to use that second argument, that EnpointReferenceType thing. How do I use that?
    Another question: If a asynchronous BPEL process does not exists (so the endpoint does not exist) the Java proxy does not throw an error when runned. It does not even sends a message. It exits with status 0! (This happens for example when deploying a new version of a process and when the "old" version is undeployed). Calling a non-existing synchronous BPEL process, the Java proxy DOES throw an error.

    Clemens,
    That all sounds logical. But somehow it is still a mystery for me ... Somehow I don't see what should be done.
    To call the async BPEL process I have the following procedure:
    initiate(String input, org.xmlsoap.schemas.ws._2003._03.addressing.EndpointReferenceType replyTo, org.xmlsoap.schemas.ws._2003._03.addressing.AttributedURI messageID)
    The first argument is the input for my BPEL process. The second is the address to a webservice that should handle the callback, right? The third is a messageID (makes sense, but why of the type AttributedURI?).
    Here lies my problem. It is not clear to me how these EndpointReferenceType & AttributedURI work. I can't find anything on the net about it. The AXIS examples as where mentioned earlier use other types (namely the "org.xmlsoap.schemas.ws.addressing.MessageID" and "org.xmlsoap.schemas.ws.addressing.ReplyTo") which are completely different.
    What I did so far:
    - I created an webservice proxy that listens on the onResult endpoint of the BPEL process.
    - I created an webservice proxy that calls the BPEL process through the initiate procedure, but it is not completely clear to me how to construct the EndPointreferenceType replyTo, and the MessageID. I did something like this:
    EndpointReferenceType replyTo = new EndpointReferenceType();
    // callback service running on local machine
    // This URI class is the java.net's version
    URI replyToURI = new URI("http://vaccinatie:8988/syncro-callback-context-root/stringconcatCallbackBindingPort");
    // This AttributedURI is the org.xmlsoap.schemas.ws._2003._03.addressing's version
    AttributedURI address = new AttributedURI();
    // the only public methos that made sense to me:
    address.set_value(replyToURI);
    replyTo.setAddress(address);
    // call the BPEL process
    myPort.initiate("test123", replyTo, address);
    But the above doesn't work (largely because I don't know what I'm doing here prob.:-) ) It does send the "test123" message, and the BPEL process does process it, but I don't seem to get the callback right.
    I hope this makes my problems somewhat clearer. I hope someone can help me, because I'm just a beginner in this whole "web service area" and seems to do something terribly wrong here, because it should be very simple. Thx.

  • Not getting Response from RFC

    Hi,
        I am doing RFC to File. I could generate the FILE successfully. But I am not getting Response from RFC. I am getting empty payload. I am doing with out BPM. I did succesfully File-RFC-File. but here RFC is the sender. I have some doubts  in defining Interface mapping and Message Mapping. Is this a Syscronous scenario by default ?
    If I want to get the resonse of RFC to a file. How many Receivers and Senders do i need to create?
    Regards,
    Varun
    Edited by: Varun on Sep 9, 2008 1:00 PM

    hi,
    Map Rfc.response to the File; hence rfc sender adapter and file receiver adapter..one sender n 1 receiver.Remember:
      1. In the report that makes the call to XI , make sure that you use call RFC in a background task.
      2. Make sure you use Commit Work at the end of the report.
    Follow:
    Send RFC to SAP XI – Asynchronous
    Also pls visit
    Re: RFC to FILE
    for the same scenario.
    Thanks,
    Durga
    Edited by: NagaDurga Nannapaneni on Sep 9, 2008 10:55 AM

  • Reservation not getting created from shopping cart for stores order.

    Hi experts,
    Reservation not getting created from shopping cart for stores order,process used is some custom BADI.Extended classic scenario is the procrss .
    Please help me
    Thanks in  advance.

    Hello,
    please check below wiki:
    Determination of the follow-on document type
    Regards.
    Laurent.

  • How  to get  response from such a  function

    How  to get  response from such a  function (in MODULE USER_COMMAND_0010 INPUT I get "ODGOVOR" 'X'
    FUNCTION Z_SEENKRAT.
    ""Local Interface:
    *"  EXPORTING
    *"     REFERENCE(ODGOVOR) TYPE  MSEG-KZEAR
    DATA ok_code LIKE sy-ucomm.
    DATA: test like mseg-kzear.
    BREAK-POINT.
    call screen 10.
    test = ODGOVOR.
    ENDFUNCTION.
    *&      Module  CLEAR_OK_CODE  OUTPUT
          text
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.                 " CLEAR_OK_CODE  OUTPUT
    *&      Module  USER_COMMAND_0010  INPUT
          text
    MODULE USER_COMMAND_0010 INPUT.
    DATA odgovor LIKE mseg-KZEAR.
    CASE ok_code.
        WHEN 'DA'.
        ODGOVOR = 'X'.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0010  INPUT

    Hi,
    You need to declare the ODGOVOR variable in the TOP include, then you will get the value
    Regards
    Sudheer

  • Get table partition name dynamically for given date range

    Dear All,
    Could you please tell me how to get the partition name dynamicaly for given date range ?
    Thank you.

    SQL> select table_name,
           partition_name,
           to_date (
              trim (
                 '''' from regexp_substr (
                              extractvalue (
                                 dbms_xmlgen.
                                 getxmltype (
                                    'select high_value from all_tab_partitions where table_name='''
                                    || table_name
                                    || ''' and table_owner = '''
                                    || table_owner
                                    || ''' and partition_name = '''
                                    || partition_name
                                    || ''''),
                                 '//text()'),
              'syyyy-mm-dd hh24:mi:ss')
              high_value_in_date_format
      from all_tab_partitions
    where table_name = 'SALES' and table_owner = 'SH'
    TABLE_NAME                     PARTITION_NAME                 HIGH_VALUE_IN_DATE_FORMAT
    SALES                          SALES_1995                     01-JAN-96               
    SALES                          SALES_1996                     01-JAN-97               
    SALES                          SALES_H1_1997                  01-JUL-97               
    SALES                          SALES_H2_1997                  01-JAN-98               
    SALES                          SALES_Q1_1998                  01-APR-98               
    SALES                          SALES_Q2_1998                  01-JUL-98               
    SALES                          SALES_Q3_1998                  01-OKT-98               
    SALES                          SALES_Q4_1998                  01-JAN-99               
    SALES                          SALES_Q1_1999                  01-APR-99               
    SALES                          SALES_Q2_1999                  01-JUL-99               
    SALES                          SALES_Q3_1999                  01-OKT-99               
    SALES                          SALES_Q4_1999                  01-JAN-00               
    SALES                          SALES_Q1_2000                  01-APR-00               
    SALES                          SALES_Q2_2000                  01-JUL-00               
    SALES                          SALES_Q3_2000                  01-OKT-00               
    SALES                          SALES_Q4_2000                  01-JAN-01               
    SALES                          SALES_Q1_2001                  01-APR-01               
    SALES                          SALES_Q2_2001                  01-JUL-01               
    SALES                          SALES_Q3_2001                  01-OKT-01               
    SALES                          SALES_Q4_2001                  01-JAN-02               
    SALES                          SALES_Q1_2002                  01-APR-02               
    SALES                          SALES_Q2_2002                  01-JUL-02               
    SALES                          SALES_Q3_2002                  01-OKT-02               
    SALES                          SALES_Q4_2002                  01-JAN-03               
    SALES                          SALES_Q1_2003                  01-APR-03               
    SALES                          SALES_Q2_2003                  01-JUL-03               
    SALES                          SALES_Q3_2003                  01-OKT-03               
    SALES                          SALES_Q4_2003                  01-JAN-04               
    28 rows selected.

  • Getting 400 Bad Request response from Beehive SOAP API

    Hi,
    I'm trying to consume beehive web services via SOAP, more specifically I'm trying to upload a file into a workspace however at this point of the implementation I'm stuck getting 400 responses from the server.
    I'm trying to upload a file using the createDocument() method that's located on the contentManagementService, indeed in the line that I call to that method is in which my app stops and returns the exception of error 400
    I'm attaching a sample of the message I'm sending, at this point I understand every parameter that it's being sent except for the contentStreamId parameter, I don't know what it means, the documentation doesn't explain it either.
    Does anyone has an idea of what's that paremeter for and how to use it properly?
    Here's a sample of code I'm using:
    // add new document
    String str = "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r" +
    "Test body.Test body.Test body.Test body.Test body.Test body.\r";
    byte[] docContent = str.getBytes("UTF8");
    DocumentCreator docCreator = new DocumentCreator();
    docCreator.setConflictResolutionMode(ConflictResolutionMode.OVERWRITE);
    docCreator.setName("File" + System.currentTimeMillis()%10000 + ".txt");
    docCreator.setParent(teamWksp.getDefaultDocumentsFolder().getCollabId());
    IdentifiableSimpleContentUpdater iscu = new IdentifiableSimpleContentUpdater();
    iscu.setContentStreamId(docContent.toString());
    DocumentUpdater docUpdater = new DocumentUpdater();
    docUpdater.setContentUpdater(iscu);
    docCreator.setUpdater(docUpdater);
    Document doc = contentMgmtServiceSoap.createDocument(docCreator, docContent,projFull);
    here's the message being sent:
    <S:Envelope>
         <S:Body>
              <ns3:createDocument>
                   <creator>
                        <ns2:conflictResolutionMode>OVERWRITE</ns2:conflictResolutionMode>
                        <ns2:name>File8692.txt</ns2:name>
                        <ns2:parent>
                             <ns2:id>334B:3BF0:afrh:38893C00F42F38A1E0404498C8A6612B00023FF3F175</ns2:id>
                             <ns2:resourceType>afrh</ns2:resourceType>
                        </ns2:parent>
                        <ns2:updater>
                             <ns2:contentUpdater xsi:type="ns2:identifiableSimpleContentUpdater">
                                  <ns2:contentStreamId>[B@70751932</ns2:contentStreamId>
                             </ns2:contentUpdater>
                        </ns2:updater>
                   </creator>
                   <dhandler>VGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuDVRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5Lg1UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS4NVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuDVRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5Lg1UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS4NVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuDVRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5Lg1UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS4NVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuDVRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5Lg1UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS4NVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuDVRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5Lg1UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS4NVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuDVRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5Lg1UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS5UZXN0IGJvZHkuVGVzdCBib2R5LlRlc3QgYm9keS4N</dhandler>
                   <projection value="FULL" xsi:type="ns2:projection"/>
              </ns3:createDocument>
         </S:Body>
    </S:Envelope>

    Did you manage to successfully upload the file? If you did, please give solution.
    Thanks

  • One socket and two ports, not getting response from the server

    Hi everyone,
    I am working on device which communicate through Tcp sockets, It has an IP address and one port for listening and another for sending the response.
    Problem is that I am able to create a connection to Device ip+port, and i am trying to listen on the same port while the device is sending the response on other port. My problem is that i can't create another socket using this port and therefore not getting the response from the device.
    Can you people tell me how to handle such socket communication in java ?
    Thanks in advance.

    I am working on device which communicate through Tcp sockets, It has an IP address and one port for listening and another for sending the response.Are you sure? That's not usual. It would be usual for it to use the same port for listening, reading, and writing.
    Problem is that I am able to create a connection to Device ip+port, and i am trying to listen on the same port while the device is sending the response on other port.I would try just reading from the same socket you are sending on. I suggest you have misunderstood how the device works.

  • Why im getting too long time in getting response from server in RMI???

    I'm using RMI architecture. On my server side I put this method getRubricHierarchy() which returns the ArrayList of Test class objects. everything is working properly fine.
    Im getting response properly, problem is its taking very long time in getting the response. method populate and create ArrayList in 0 second at server side but its taking more than 20 seconds to get response at client side.
    My arraylist size is 30,000.
    Any suggestions to reduce the time.
    below you can see the code.
    public List<Test> getRubricHierarchy(String strTree,String gblCombinedRepSectionID,String gblCompleteRepSectionID,String gblCompleteRepertoryID,Map authMap) {
            Connection con=null;
              ResultSet rs = null;
              List<Test> l = new ArrayList<Test>();
              List allList = new ArrayList();
              con = createDBCon();
              rs = con.createStatement().executeQuery("select * from rubric where sectionid='"+gblCombinedRepSectionID+"' order by orders");
              Map parentMap = new HashMap();
              while (rs.next()) {
                   Test rNode = new Test();
                String rubrid = rs.getString("id");
                   final String desc = rs.getString("name");
                   rNode.setRubricName(desc);
                   rNode.setRubricID(rubrid);
                   rNode.setAuthor(rs.getString("repid"));
                   final int levlId = rs.getInt("levelid");
                   rNode.setRubLevel(levlId);
                   rNode.setCrossRef(rs.getString("CROSSREFERENCE"));
                   final String parentID = rs.getString("PARENTID");
                   rNode.setParentID(parentID);
                   rNode.setSectionID(rs.getString("sectionid"));
                   if (parentID.equals("0")) {
                        l.add(rNode);
                   allList.add(rNode);
                   List rmdyLst = (List) parentMap.get(parentID);
                   if (rmdyLst == null) {
                        rmdyLst = new ArrayList();
                        parentMap.put(parentID, rmdyLst);
                   rmdyLst.add(rNode);
              rs.close();
              for (Iterator iterator = allList.iterator(); iterator.hasNext();) {
                   Test rNodes = (Test) iterator.next();
                   List remdyLst = (List) parentMap.get(rNodes.getRubricID());
                   if (remdyLst != null) {
                        rNodes.setChildren(remdyLst);
                        for (Iterator iterator2 = remdyLst.iterator(); iterator2.hasNext();) {
                             Test rn = (Test) iterator2.next();
                             rn.setParent(rNodes);
            }catch(Exception e){
                e.printStackTrace();
              return l;
         }here is my Test Class
    public class Test implements  Serializable,Cloneable , MutableTreeNode{
            private String strRubricID,strOldRubricID,strRubricName,strCrossRef,Author,strParentID,strSectionID;
            private int rubLevel;
            private List remedyList;
            private List children = new ArrayList();
            private Test parent;
            private int order;
            private String AuthorName="";
            private String abbr;
            private String treeType="";
            private int noRem=-1;
            private boolean isAddAsChild=false;
            private String strRubricHie="";
            private String user="";
            public static final Enumeration<TreeNode> EMPTY_ENUMERATION = new Enumeration() {
                public boolean hasMoreElements() {
                    return false;
                public TreeNode nextElement() {
                    throw new NoSuchElementException("No more elements");
            public Test(){
            public void setUser(String user){
                this.user = user;
            public String getUser(){
                return user;
            public void setRubricHierarchy(String s){
                this.strRubricHie=s;
            public String getRubricHierarchy(){
                return strRubricHie;
            public Test(String treeType){
                this.treeType = treeType;
            public void setAddAsChild(boolean b){
                this.isAddAsChild=b;
            public boolean isAddAsChild(){
                return isAddAsChild;
            public Test getUserObject(){
                return this;
            public  void setRubricID(String id){
                this.strRubricID = id;
            public  String getRubricID(){
                return strRubricID ;
            public  void setOldRubricID(String id){
                this.strOldRubricID = id;
            public  String getOldRubricID(){
                return strOldRubricID ;
            public  void setParent(Test r){
                this.parent = r;
            public  Test getParent(){
                return parent;
            public  void setParentID(String id){
                this.strParentID = id;
            public  String getParentID(){
                return strParentID;
            public  void setSectionID(String id){
                this.strSectionID= id;
            public  String getSectionID(){
                return strSectionID;
            public  void setRubricName(String name){
                this.strRubricName = name;
            public  String getRubricName(){
                return strRubricName;
            public  void setAuthorName(String name){
                this.AuthorName = name;
            public  String getAuthorName(){
                return AuthorName;
            public  void setAuthorAbbrivation(String a){
                this.abbr = a;
            public  String getAuthorAbbrivation(){
                return abbr;
            public void setRubLevel(int rubLevel) {
                this.rubLevel = rubLevel;
            public int getRubLevel() {
                return rubLevel;
            public void setCrossRef(String strCrossRef) {
                this.strCrossRef = strCrossRef;
            public String getCrossRef() {
                return strCrossRef ;
            public void setRemedyList(List remedyList) {
                this.remedyList = remedyList;
            public List getRemedyList() {
                return remedyList;
            public void setAuthor(String Author) {
                this.Author = Author;
            public String getAuthor() {
                return Author;
            public void setChildren(List list) {
                this.children = list;
            public List getChildren() {
                return children;
            public void setOrder(int o){
                this.order = o;
            public int getOrder(){
                return order;
            public void setNumberOfRemedies(int no)
                this.noRem = no;
            public int getNumberOfRemedies()
                return noRem;
            public String toString() {
                String value="";
                value=strRubricName+ " ("+abbr+")";
                return value;
            public Object clone(){
                Test rubric = new Test();
                rubric.Author = Author;
                rubric.children = children;
                rubric.order = order;
                rubric.parent = parent;
                rubric.remedyList = remedyList;
                rubric.rubLevel = rubLevel;
                rubric.strCrossRef = strCrossRef;
                rubric.strParentID = strParentID;
                rubric.strRubricID = strRubricID;
                rubric.strRubricName = strRubricName;
                rubric.strSectionID = strSectionID;
                return rubric;
         @Override
         public TreeNode getChildAt(int paramInt) {
              if (this.children == null) {
                   throw new ArrayIndexOutOfBoundsException("node has no children");
              final TreeNode node = (TreeNode) children.get(paramInt);
              return node;
         @Override
         public int getChildCount() {
              if (this.children == null) {
                   return 0;
              return children.size();
         @Override
         public int getIndex(TreeNode paramTreeNode) {
              // TODO Auto-generated method stub
              return 0;
         @Override
         public boolean getAllowsChildren() {
              return true;
         @Override
         public boolean isLeaf() {
              return children.isEmpty();
         @Override
         public Enumeration children() {
              if (this.children == null) {
                   return EMPTY_ENUMERATION;
              Vector v = new Vector(this.children);
              return v.elements();
         @Override
         public void insert(MutableTreeNode newChild, int paramInt) {
              if (newChild == null) {
                   throw new IllegalArgumentException("new child is null");
              MutableTreeNode oldParent = (MutableTreeNode) newChild.getParent();
              if (oldParent != null) {
                   oldParent.remove(newChild);
              newChild.setParent(this);
              if (children == null) {
                   children = new ArrayList();
              children.add(paramInt, newChild);
         @Override
         public void remove(int childIndex) {
              MutableTreeNode child = (MutableTreeNode) getChildAt(childIndex);
              children.remove(childIndex);
              child.setParent(null);
         @Override
         public void remove(MutableTreeNode aChild) {
              if (aChild == null) {
                   throw new IllegalArgumentException("argument is null");
              if (!isNodeChild(aChild)) {
                   throw new IllegalArgumentException("argument is not a child");
              remove(getIndex(aChild)); // linear search
         public boolean isNodeChild(TreeNode aNode) {
              boolean retval;
              if (aNode == null) {
                   retval = false;
              } else {
                   if (getChildCount() == 0) {
                        retval = false;
                   } else {
                        retval = (aNode.getParent() == this);
              return retval;
         @Override
         public void setUserObject(Object paramObject) {
              // TODO Auto-generated method stub
         @Override
         public void removeFromParent() {
              MutableTreeNode parent = (MutableTreeNode) getParent();
              if (parent != null) {
                   parent.remove(this);
         @Override
         public void setParent(MutableTreeNode paramMutableTreeNode) {
              parent = (Test) paramMutableTreeNode;
          * Returns the path from the root, to get to this node. The last element in
          * the path is this node.
          * @return an array of TreeNode objects giving the path, where the first
          *         element in the path is the root and the last element is this
          *         node.
         public TreeNode[] getPath() {
              return getPathToRoot(this, 0);
          * Builds the parents of node up to and including the root node, where the
          * original node is the last element in the returned array. The length of
          * the returned array gives the node's depth in the tree.
          * @param aNode
          *            the TreeNode to get the path for
          * @param depth
          *            an int giving the number of steps already taken towards the
          *            root (on recursive calls), used to size the returned array
          * @return an array of TreeNodes giving the path from the root to the
          *         specified node
         protected TreeNode[] getPathToRoot(TreeNode aNode, int depth) {
              TreeNode[] retNodes;
               * Check for null, in case someone passed in a null node, or they passed
               * in an element that isn't rooted at root.
              if (aNode == null) {
                   if (depth == 0)
                        return null;
                   else
                        retNodes = new TreeNode[depth];
              } else {
                   depth++;
                   retNodes = getPathToRoot(aNode.getParent(), depth);
                   retNodes[retNodes.length - depth] = aNode;
              return retNodes;
        }

    You have an O(N**2) algorithm at the end that is rather ill-considered. It seems to me at first glance that it could be combined int the previous loop.

  • Getting response from a server

    im working on a simple smtp mail sender and i want to get responses to the commands that i post to the DataOutputStream. in all examples on java.sun.com and the net, there is a while block used for reading response from the server.
    while((c=is.read()) != -1)
    sb.append((char)c);
    this code did not work on my application, i changed a bit like below:
    /**Get a response from server */
    private String getResponse() throws IOException {
    int CR = 0, LF = 0;
    int c;
    char ch;
    int count = 0;
    StringBuffer sb = new StringBuffer();
    while (true) {
    c = is.read();
    count++;
    ch = (char) c;
    if (c == -1) {
    break;
    else if (ch == '\r') {
    CR = count;
    else if (ch == '\n') {
    LF = count;
    if (LF - 1 == CR) { //CRLF seen
    sb.append(ch);
    break;
    sb.append(ch);
    return sb.toString();
    and i use this function in my code as
    os.write( ("QUIT\r\n").getBytes());
    System.out.println("QUIT : " + getResponse());
    this works, because it returns a single line that has a CRLF at the and of line, but if i want to read multi-line responses like greeting messages, i tried to change the code as on the examples like:
    /**Get a response from server */
    private String getResponse() throws IOException {
    int c;
    StringBuffer sb = new StringBuffer();
    while((c=is.read()) != -1)
    sb.append((char)c);
    return sb.toString();
    this code does not work, because i cannot reach the end of stream. i want to post one command and get one response for that command.
    how an algorithm i can develop to solve this problem?
    thanks for all help.

    i changed the code and it's working well now:
    /**Get a response from server */
    private String getResponse() throws IOException {
    int c;
    if((c=is.read()) != -1) {
    byte[] b = new byte[is.available()];
    StringBuffer sb = new StringBuffer();
    is.read(b);
    sb.append((char)c);
    for(int i=0; i<b.length; i++) {
    sb.append((char)b);
    return sb.toString();
    return "";
    if you directly use is.available() when there is no response currently available, it returns 0. we wait for the first character of server response, and then use is.available(). thanks to Kay_Kadner for the idea.
    (im a newbie, and dont know how to convert byte[] to String, tried b.toString() but only got meaningless values)

  • Socket Programming-Not getting response from server.

    Hi,
    I am trying to communicate with server using java socket programming, I am getting the response for first two times third time when I am trying to write some thing I am not getting any response from the server,
    I am writing to migrate the vb code to Java the vb is using a c++ dll to communicate with the server and we tried accessing the dll from java using JNI then it is working fine, this dll is dependent on windows so we want to avoid the dependency with windows that is why we are going for socket programming, Please help on this.

    Hi,
    I am writing the data in forms of string
    like
    Socket sockt = new Socket(ipAddress, portNo);     
    out= new DataOutputStream(sockt.getOutputStream());
    in = new DataInputStream(sockt.getInputStream());
    out.writeBytes("Serv");
    out.writeBytes("Serv,32");
    out.writeBytes("home,serv32,run.prg,sucess");
    these are the strings to communicate with server.
    I am trying to read the same
    StringBuffer buf = new StringBuffer();
              byte b = '\0';
                        try {
                   while ((b = in.readByte()) != '\0')
                        char ch = (char) b;
                        buf.append(ch);
              } catch (Exception e) {
                   System.out.println(e.getStackTrace());
    we are getting the response for the first two strings, but for the third string it is getting stucked for some time and returing some junk values like '???' we are sending the same string using JNI and it is working.

  • In oracle B2B multiple files are getting picked from SFTP location for one file in custer environment

    Flow is like :
    REST ENDPOINT->OSB PROXYSERVICE->BUSINESS SERVICE->B2B SFTP LOCATION->B2B->SOA JMS Queue->SOA COMPOSITE-
    Due to cluster environment, there is issue when B2B picks the file from SFTP location for Custom protocol using sftp listening channel. Sometimes B2B picks multiple files from SFTP location for just one copy of file. It is happening because of cluster environment 4 instances of server is looking into the SFTP location for picking the file and sometime 2 or more instances of server are reading same file and sending the copy to B2B.
    Please let me know , how can I stop this behavior

    All QFE's have been applied we are building the image so we have some control.
    I have build an image which used the debug DLL's of the FATFS and I have enabled all of the DebugZones.  The problem is still happening. From the timings in the debug logs and the timestamps in the data which corrupts the test file I have been able
    to see that the file is corrupted AFTER the write is complete. Or at least that's how it seems.
    We finished writing the file and closed the handle. Then more data is written to other files. When we get around to verifying the file it now contains data from the files that were subsequently written.
    What I think I need to do is figure out in detail how the two files were "laid down" onto the SDCard.  If the system used the same cluster to write the 2 files then that would explain the issue.

  • Not getting response from Client Proxy

    Hi,
    We are developing a scenario - File->PI->Proxy using ABAP Proxies.We are posting a file thru PI 7.0 to R/3 .In R/3 the server proxy(Inbound Asynchronous) will receive the message and BAPI will be called. The response from the BAPI will be reaching the server proxy and passed to the client proxy(Outbound Asynchronous).
       Server Proxy(request) --> BAPI --> Server Proxy(response) --> Client Proxy(response)
    The response from the client proxy has to be send to PI and a file will be generated as the output.
    Can anyone provide me suggestions to call client proxy from a server proxy by passing the response message to client proxy???
    Thanks in advance.
    Regards,
    Dibyajyoti

    Hi,
    I hope, you are done till the Implementation of Server Proxy, where you are calling a Bapi and passing the Input variables the Interface received and BAPI is giving a response back.
    Now your question, how to send the response back Asynchronously.
    I think, you have to do the same, what you do for a client proxy  and at last  call the method EXECUTE_ASYNCHRONOUS before the Final Commit Staement. I think this should work.
    But using Synchronous Interface in such cases is always a handy and easier option.
    Regards,
    Subhendu

  • How to get data from the user for an Insert Trigger ?

    Hi all and thanks in advance, I need to get some values from the user for a child table when a row inserted into the parent table, is that possible to use ampersand inside an "Insert Trigger" to let the user for inserting some values ?
    Edited by: user9942078 on 17-Dec-2008 16:35

    In a different words,
    When a virus attacked your body your blood cells instantly goes into operation. Just like that -> your trigger activated as a result of your DB operation on objects. So, here also you have no option to manually intervene anything.
    Hmm... Looks like some science fiction movies ultimately pays some price... ;)
    So, trigger basically fires implicitly as a result of any database operation on objects or even on user.
    So, that has to be automatic. And, when you are using & it will ask for some input value - which cannot be done in case of triggers.
    For details please refer the oracle docs.
    Regards.
    Satyaki De.

  • Getting response from a Web Service

    Hello, everyone,
    I want MII to show the response from a Web Service it is calling through the Web Service action.
    But when this Web Service return an error (as a Soap Fault response), MII simply does not show the response. It show it truncated, such as
    "<?xml version="1.0" encoding="UTF-8"?>
    <ReceiveMessageFromMESResponse xmlns="http://tempuri.org/"/>"
    It prevents me from showing the error message to the user.
    What can I do to have MII show me the complete response received from the called Web Servce?
    Thanks in advance!

    Hi, SB!
    Yes, this would solve the problem, but it would require changes on already-implemented, working external Web Services, which should be avoided by all means.
    SOAP Fault responses are part of the SOAP protocol. I expected MII to understand it.
    Thanks a lot for your answer!

Maybe you are looking for