Extract fields from the SOAP body during mapping

Hi all,
I have an Abap Proxy to SOAP scenario with a main payload and an attachment. During mapping I need the reference of the attachment to store the reference in the main payload. I don't need the attachment itself.
SOAP-Body:
  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--  Eingangs-Message
  -->
- <SAP:Manifest xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:wsu="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="wsuid-manifest-5CABE13F5C59AB7FE10000000A1551F7">
- <SAP:Payload xlink:href="cid:payload-E742FF47D930DE5CE1000000C107826A @sap.com">
  <SAP:Name>MainDocument</SAP:Name>
  <SAP:Description />
  <SAP:Type>Application</SAP:Type>
  </SAP:Payload>
- <SAP:Payload xlink:href="cid:payload-EE42FF47D930DE5CE1000000C107826A @sap.com">
  <SAP:Name>hugo.txt</SAP:Name>
  <SAP:Description />
  <SAP:Type>ApplicationAttachment</SAP:Type>
  </SAP:Payload>
  </SAP:Manifest>
I need the attachment reference as string inside my main payload: cid:payload-EE42FF47D930DE5CE1000000C107826A @sap.com
I wrote an user defined function to select the MessageId, but the MessageId is only part of the reference to the main payload.
String constant;
java.util.Map map;
map = container.getTransformationParameters();
constant = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
return constant;
Has anybody an idea to get the reference of the attachment from the SOAP body with an user defined function or an adapter module?
Thanks and kind regards
Frank

Hello,
thank you all for the information. I found a solution for my problem on the sender side. I wrote an own helper class with  the method create_attach_from_txt_withref. This method  build an attachment with an own reference and write the reference back to the payload.
This reference will not be changed within the execute_asynchronous method of the proxy.
Method parameters:
P_DATA        Importing   Type     STRING
P_TYPE        Importing   Type     STRING
P_NAME        Importing   Type     STRING
P_ATTACHMENT  Exporting   Type Ref IF_AI_ATTACHMENT
P_AREF        Exporting   Type     STRING
Method coding:
METHOD create_attach_from_txt_withref.
  DATA: lo_attachment TYPE REF TO cl_ai_attachment,
        l_payload     TYPE REF TO if_xms_payload,
        l_pref        TYPE        sxms_mf_s,
        l_guid        TYPE        guid_32,
        l_aref        TYPE        string.
  CLASS cl_ai_factory DEFINITION LOAD.
" create the attachment
  p_attachment = cl_ai_factory=>create_attachment_from_text(
                p_data = p_data             " attachment data
                p_type = p_type             " attachment type
                p_name = p_name ).          " attachment name
" we need an implementing class of the interface if_ai_attachment
  lo_attachment ?= p_attachment.
" get the new payload
  l_payload = lo_attachment->get_payload( ).
" get the reference of the payload
  l_pref = l_payload->getreference( ).
" build an own reference
  CALL FUNCTION 'GUID_CREATE'
    IMPORTING
      ev_guid_32 = l_guid.
  CONCATENATE 'payload-' l_guid '@sap.com' INTO l_aref.
  CONCATENATE 'cid:'     l_aref            INTO l_pref-href.
" set our own reference
  l_payload->setreference( reference = l_pref ).
" write back the modified payload
  lo_attachment->set_payload( p_payload = l_payload ).
" return of the reference
  p_aref = l_aref.
ENDMETHOD.
If anybody has an idea how to read the soap body within an adapter module please let me know.
Regards
Frank

Similar Messages

  • Extract cdata from the soapenv:Body

    If I log $body, I am seeing the below.
    <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><Customer><name>aaa</name>...</Customer>]]></soapenv:Body>
    How to extract <?xml version="1.0" encoding="UTF-8"?><Customer><name>aaa</name>...</Customer> from the above soapenv:Body? Xml is inside the CDATA section.
    Basically i want to extract all the xml that is in between CDATA section
    Edited by: user10367892 on Jan 12, 2010 10:34 AM

    hmm... finally solved... in assign action, assign value $body/text() to any variable and use that. No need to convert it into a XML node as it is already a XML.
    For e.g. - if the SOAP envelope being received is below -
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
    </soap:Header>
    <soap:Body>
    <![CDATA[<?xml version="1.0" encoding="UTF-8"?><Customer/>closeing brackets for CDATA here***
    </soap:Body>
    </soap:Envelope>
    Then assign action would return you below -<?xml version="1.0" encoding="UTF-8"?><Customer/>However I would like to know that what do you want to do further (operations), on this xml.Regards,AnujEdited by: Anuj Dwivedi, Infosys on Jan 13, 2010 6:42 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to extract data from the XL sheet for mapping

    Hello all,
    I have a scenario of file to idoc, where in the source file contains the information in XL sheet. Can we access the XL sheet data for mapping ? if so can anyone helpme providing the procedure.

    Hi,
    For reading an XL file u need to write an java code.
    refer the below weblog for more help:
    SAP Network Blog: XI: Generating Excel files without the Java nor the Conversion agent not possible?
    /people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
    SAP Network Blog: Read Excel instead of XML through FileAdapter
    /people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter
    Thnx
    Chirag

  • How to extract data from the fields present in two or three tables

    Hi Experts,
          I have a scenario where i have to extract data from the fields of different tables. e.g. let there 2 tables which have some number of fields . I want the data of 3 fields each from these 2 tables. How can i get that??
    Sam

    Hi
    You can create view in tcode se11..
    here you include all tables from which you want to fetch the data..
    you need to give selection condition here
    eg..
    say select empname from table A, select empadd from table B.. where empno(from A)=empno(from B)
    (note that you dont need to write queries like this.. i have just given u the example)
    After creating the view you can create datasource in RSO2..
    Regards
    Swati

  • Extracting Year from the date field

    Hi,
    I want to extract year from the date field... I've tried following code but got the error
    SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A a
    Please advice
    Thanks in advance

    user12863454 wrote:
    SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A aThis should work and returns a string.
    What error did you get?
    maybe your column name is wrong? Is it really A_somthing? This is possible but slightly unusual.
    also possible
    select extract(Year from sysdate) from dual;
    /* with your table and column */
    SELECT extract(year from a.A_EXPIRY_DATE) as EXP_YEAR from Table_A a;Edited by: Sven W. on Aug 18, 2010 6:41 PM

  • Need to know how to iterate a list of field from the req xml in page servic

    Hi All,
    Please help me out with java code in which i am able to iterate a list of field coming in the request xml to my page service class under read(Pageheader header) method of mine queryPagemaintenace class.
    package com.splwg.cm.domain.pageService;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.List;
    import com.ibm.icu.math.BigDecimal;
    import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
    import com.splwg.base.api.businessObject.BusinessObjectInstance;
    import com.splwg.base.api.businessObject.COTSInstanceListNode;
    import com.splwg.base.api.datatypes.Date;
    import com.splwg.base.api.lookup.BusinessObjectActionLookup;
    import com.splwg.base.api.service.DataElement;
    import com.splwg.base.api.service.ItemList;
    import com.splwg.base.api.service.PageHeader;
    import com.splwg.shared.common.ApplicationError;
    import com.splwg.shared.environ.FieldDefinition;
    import com.splwg.shared.environ.ListDefinition;
    import com.splwg.shared.logging.Logger;
    import com.splwg.shared.logging.LoggerFactory;
    * @author
    @QueryPage (program = CMUSER, service = CMUSER,
    * body = @DataElement (contents = { @ListField (name = USER_GROUP_LIST)
    * , @ListDataField (name = USR_GRP_ID)
    * , @DataField (name = MESSAGE_TEXT)
    * , @DataField (name = USER_ID)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)}),
    * actions = { "add"
    * ,"read"
    * , "delete"
    * , "change"},
    * header = { @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)},
    * headerFields = { @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = USR_GRP_ID)
    * , @DataField (name = EMAILID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)},
    * lists = { @List (name = USER_GROUP_LIST, size = 100, includeLCopybook = false,
    * body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))},modules = {})
    public class CMUSER extends CMUSER_Gen {
    public static final Logger logger = LoggerFactory.getLogger(CMUSER.class);
         DataElement root = new DataElement();
         PageHeader page = new PageHeader();
         protected DataElement read(PageHeader header) throws ApplicationError{
    I want to know how can i iterate this USER_GROUP_LIST in my read method and get the USR_GRP_ID field data from it.
    A Prompt reply from your end will help me to resolve this issue

    Guru Sir,
    i tried to override the add() method of the framework in that i was able to iterate the field from the list. But now the i am facing there is that i am not able to send back the response to the external system in XML format. I am getting a blank response in my SOAP UI Tool while testing here is the code:
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.List;
    import com.ibm.icu.math.BigDecimal;
    import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
    import com.splwg.base.api.businessObject.BusinessObjectInstance;
    import com.splwg.base.api.businessObject.COTSInstanceListNode;
    import com.splwg.base.api.datatypes.Date;
    import com.splwg.base.api.lookup.BusinessObjectActionLookup;
    import com.splwg.base.api.service.DataElement;
    import com.splwg.base.api.service.ItemList;
    import com.splwg.base.api.service.PageHeader;
    import com.splwg.shared.common.ApplicationError;
    import com.splwg.shared.logging.Logger;
    import com.splwg.shared.logging.LoggerFactory;
    * @author
    @QueryPage (program = CMUSER4, service = CMUSER4,
    * body = @DataElement (contents = { @DataField (name = MESSAGE_TEXT)
    * , @DataField (name = PASSWORD)
    * , @DataField (name = USER_ID)
    * , @DataField (name = LAST_NAME)
    * , @DataField (name = FIRST_NAME)
    * , @DataField (name = USER_TYPE_FLG)
    * , @DataField (name = EMAILID)
    * , @ListDataField (name = USR_GRP_ID)
    * , @ListField (name = USER_GROUP_LIST)}),
    * actions = { "add"
    * , "delete"
    * , "change"
    * , "read"},
    * header = { @DataField (name = USER_ID)
    * , @DataField (name = MESSAGE_TEXT)},
    * headerFields = { @DataField (name = USER_ID)
    * , @DataField (name = MESSAGE_TEXT)},
    * lists = { @List (name = USER_GROUP_LIST, size = 100,
    * body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))}, modules = {})
    public class CMUSER4 extends CMUSER4_Gen {
         public static final Logger logger = LoggerFactory.getLogger(CMUSER4.class);
         DataElement root = new DataElement();
         PageHeader page = new PageHeader();
         protected PageHeader add(DataElement item) throws ApplicationError{
              BusinessObjectInstance boInstance = BusinessObjectInstance.create("CM-USER");
              String USR_GRP_ID = null;
              try{
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.USER_ID));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.FIRST_NAME));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.LAST_NAME));
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.EMAILID));
              // logger.info("Data coming from the Service into the Application is :"+getInputHeader().getString(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID));
              // Iterator it = STRUCTURE.
              ItemList sourceList = item.getList(STRUCTURE.list_USER_GROUP_LIST.name);
              List userGrpID = new ArrayList();
              logger.info("The Size of the User Group List here is :"+sourceList.size());
              Iterator iter;
              if ((sourceList != null) &&
              (sourceList.size() > 0)) {
              for (iter = sourceList.iterator(); iter.hasNext(); ) {
              DataElement myItem = (DataElement)iter.next();
              USR_GRP_ID = myItem.get(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID);
              logger.info("The User Group Id coming in the List here is :"+USR_GRP_ID);
              logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.PASSWORD));
              boInstance.set("user", item.get(STRUCTURE.USER_ID));
              boInstance.set("firstName", item.get(STRUCTURE.FIRST_NAME));
              boInstance.set("lastName", item.get(STRUCTURE.LAST_NAME));
              boInstance.set("emailAddress", item.get(STRUCTURE.EMAILID));
              // COTSInstanceList userGrpList = boInstance.getList("userGroupUser");
              // COTSInstanceListNode userGroupList = userGrpList.newChild();
              COTSInstanceListNode userGroupList = boInstance.getList("userGroupUser").newChild();
              userGroupList.set("userGroup", USR_GRP_ID);
              logger.info("Data coming from the Service into the Application is :"+userGroupList.toString());
              /*boInstance.set
              boInstance.set("userGroup", getInputHeader().getString(STRUCTURE.HEADER.USR_GRP_ID));*/
              // UserTypeLookup.constants.TEMPLATE_USER
              //if(element.get(STRUCTURE.USER_TYPE_FLG))
              //boInstance.set("user", element.get(STRUCTURE.));
              boInstance.set("dashboardWidth","200");
              boInstance.set("homeNavigationOption","CI0000000574");
              boInstance.set("language","ENG");
              boInstance.set("toDoEntriesAge1", new BigDecimal(50));
              boInstance.set("toDoEntriesAge2",new BigDecimal(100));
              boInstance.set("displayProfileCode", "NORTHAM");
              String expirationDate = "2100-12-31";
              String[] array = expirationDate.split("-");
              userGroupList.set("expirationDate",new Date(Integer
                             .parseInt(array[0]), Integer
                             .parseInt(array[1]), Integer
                             .parseInt(array[2])));
              //boInstance.set("userGroupUser", userGroupList);
              COTSInstanceListNode roleUserList = boInstance.getList("roleUser").newChild();
              roleUserList.set("toDoRole","F1_DFLT");
              COTSInstanceListNode dataAccessList = boInstance.getList("dataAccessUser").newChild();
              dataAccessList.set("dataAccessRole","***");
              String expiryDate = "2100-01-01";
              String[] array1 = expiryDate.split("-");
              dataAccessList.set("expireDate",new Date(Integer
                             .parseInt(array1[0]), Integer
                             .parseInt(array1[1]), Integer
                             .parseInt(array1[2])));
              BusinessObjectDispatcher.execute(boInstance,
                             BusinessObjectActionLookup.constants.FAST_ADD);
              page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "User Added Successfully");
              page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
              }catch(Exception e){
                   e.printStackTrace();
                   page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "Caught Exception in the ORMB System. Please reach out to the Admin"+e.getMessage());
                   page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
              return page;
    If you can help me to find out what went wrong here while sending the response back it can close my issue.

  • OdiReadMail  - extract field from and subject in file

    Tool odiReadMail extract the body of the message in to file.
    I wont extract in this file fields form e-mal "from" and "subject". How i can do it?

    Yes. I want to extract fields "subject", "sender" and body mail message and place them in a file.
    I think, that it is necessary to change odiReadMail. But I do not know where to find source codes of this ODI tools.
    Message was edited by:
    RAD

  • Read data from Table at XI during Mapping

    Hi experts
    How we can pick data from one database table during Mapping, the table is at XI system.
    when we are picking data from table at R/3, we are using RFC Function Module/ BPM, can we pick data from XI database table during mapping ?
    what will be the steps to pick it ?
    Please Help.
    Regards,
    Study SAP

    hi Study Sap
    You may use RFC lookup
    kindly follow these links for RFC lookup
    RFC Lookup.
    Look ups.
    /people/francesco.bersani/blog/2007/03/05/data-lookup-optimized
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
    Use this crazy piece for any RFC Mapping Lookups!
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    SAP XI Lookup API
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    Lookup’s in XI made simpler
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    regards
    Sandeep Sharma
    PS if helpful kindly reward points

  • Content of the soap body

    I've this wsdl taken from the wsdl specification documentation.
    <?xml version="1.0"?>
    <definitions name="StockQuote"
    targetNamespace="http://example.com/stockquote.wsdl"
    xmlns:tns="http://example.com/stockquote.wsdl"
    xmlns:xsd1="http://example.com/stockquote.xsd"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns="http://schemas.xmlsoap.org/wsdl/">
    <types>
    <schema targetNamespace="http://example.com/stockquote.xsd"
    xmlns="http://www.w3.org/2000/10/XMLSchema">
    <element name="TradePriceRequest">
    <complexType>
    <all>
    <element name="tickerSymbol" type="string"/>
    </all>
    </complexType>
    </element>
    <element name="TradePrice">
    <complexType>
    <all>
    <element name="price" type="float"/>
    </all>
    </complexType>
    </element>
    </schema>
    </types>
    <message name="GetLastTradePriceInput">
    <part name="body" element="xsd1:TradePriceRequest"/>
    </message>
    <message name="GetLastTradePriceOutput">
    <part name="body" element="xsd1:TradePrice"/>
    </message>
    <portType name="StockQuotePortType">
    <operation name="GetLastTradePrice">
    <input message="tns:GetLastTradePriceInput"/>
    <output message="tns:GetLastTradePriceOutput"/>
    </operation>
    </portType>
    <binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetLastTradePrice">
    <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    <service name="StockQuoteService">
    <documentation>My first service</documentation>
    <port name="StockQuotePort" binding="tns:StockQuoteBinding">
    <soap:address location="http://example.com/stockquote"/>
    </port>
    </service>
    </definitions>
    I developed the service implementation and a service client using wsimport, jaxb, jaxws.
    Trying running the client I get the exception:
    Cannot find dispatch method for {http://example.com/stockquote.xsd}TradePriceRequest
    Running the message request generated by soapUI has the same effect.
    The soap message request generated by soapUI, given the above WSDL, is:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stoc="http://example.com/stockquote.xsd">
    <soapenv:Header/>
    <soapenv:Body>
    <stoc:TradePriceRequest/>
    </soapenv:Body>
    </soapenv:Envelope>
    but in the wsdl spec it should be:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <m:GetLastTradePrice xmlns:m="Some-URI">
    <m:tickerSymbol>DIS</m:tickerSymbol>
    </m:GetLastTradePrice>
    </soapenv:Body>
    </soapenv:Envelope>
    In other word, the content of the soap body should be the wsdl operation or the complex type representing the input part?

    I am a newbie, so I don't know if my reply will be helpful.
    Reading the fault "Cannot find dispatch method for {http://example.com/stockquote.xsd}TradePriceRequest", I think the problem is that TradePriceRequest is a type for a message and it is treated as an operation. The content of the SOAP message should be the operation (GetLastTradePrice) and nested inside the operation should be the parameters for the operation (the complex type...). So the answer is probably "both", one inside the other.
    I think that the message as you wrote it:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <m:GetLastTradePrice xmlns:m="Some-URI">
    <m:tickerSymbol>DIS</m:tickerSymbol>
    </m:GetLastTradePrice>
    </soapenv:Body>
    </soapenv:Envelope>
    is correct.

  • Error_: ACS10002: An error occurred while processing the SOAP body

    Hi all,
    We have problem to connect MSCRM online via SDK since yesterday.   All of our MSCRM Online organizations have this issue.  Anyone has the same issue?  
    Error : ACS10002: An error occurred while processing the SOAP body. ACS50000: There was an error issuing a token. ACS50005: Token encryption is required but no encrypting certificate is configured for the relying party.
    Gary

    This is a server side webcache from the OTN site. Not anything client-related. Its a bug that cannot be fixed at this time as OTN is on an EOL version of software. The good news is that most of OTN is moving to a new CMS on the 19th and these errors will disappear.
    In the meantime, if you add a parameter refresh to the URL you get the error on, most of the time, you can get the page back. Parameter refresh is done by adding ?a=b to the end of the URL. You can keep changing the combo too. (i.e. ?c=d)

  • Getting Error while deleting a field from the 'Z' Structure

    Hi All,
    I have created a 'z' structure in which i have 5 fields, now i want to delete one field from the structure, but it is giving me error like Invalid Change.
    Its a structure so i cant activate and adjust as we do for Tables.(se14)
    So pls help me out asap.
    thanks & Regards,
    Dhruv Shah

    Thanks for Quick Reply.
    I have not used this field in any FM/ Report.
    I have tried log off and then log on. but it make no difference.
    Now the Other scenario is that i want to change the datatype of this field to TEXT25.
    But it is also not allowing me to change because currently datatype is TEXT20.
    So now how can i change the length from 20 to 25.
    Regards,
    Dhruv Shah

  • How can I get the "text" field from the actionEvent.getSource() ?

    I have some sample code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.ArrayList;
    public class JFrameTester{
         public static void main( String[] args ) {
              JFrame f = new JFrame("JFrame");
              f.setSize( 500, 500 );
              ArrayList < JButton > buttonsArr = new ArrayList < JButton > ();
              buttonsArr.add( new JButton( "first" ) );
              buttonsArr.add( new JButton( "second" ) );
              buttonsArr.add( new JButton( "third" ) );
              MyListener myListener = new MyListener();
              ( (JButton) buttonsArr.get( 0 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 1 ) ).addActionListener( myListener );
              ( (JButton) buttonsArr.get( 2 ) ).addActionListener( myListener );
              JPanel panel = new JPanel();
              panel.add( buttonsArr.get( 0 ) );
              panel.add( buttonsArr.get( 1 ) );
              panel.add( buttonsArr.get( 2 ) );
              f.getContentPane().add( BorderLayout.CENTER, panel );
              f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              f.setVisible( true );
         public static class MyListener  implements ActionListener{
              public MyListener() {}
              public void actionPerformed( ActionEvent e ) {
                   System.out.println( "hi!! " + e.getSource() );
                   // I need to know a title of the button (which was clicked)...
    }The output of the code is something like this:
    hi! javax.swing.JButton[,140,5,60x25,alignmentX=0.0,alignmentY=0.5,
    border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1ebcda2d,
    flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,
    disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,
    right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,
    rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=first,defaultCapable=true]
    I need this: "first" (from this part: "text=first" of the output above).
    Does anyone know how can I get the "text" field from the e.getSource() ?

    System.out.println( "hi!! " + ( (JButton) e.getSource() ).getText() );I think the problem is solved..If your need is to know the text of the button, yes.
    In a real-world application, no.
    In a RW application, a typical need is merely to know the "logical role" of the button (i.e., the button that validates the form, regardless of whether its text is "OK" or "Save", "Go",...). Text tends to vary much more than the structure of the UI over time.
    In this case you can get the source's name (+getName()+), which will be the name that you've set to the button at UI construction time. Or you can compare the source for equality with either button ( +if evt.getSource()==okButton) {...}+ ).
    All in all, I think the best solution is: don't use the same ActionListener for more than one action (+i.e.+ don't add the same ActionListener to all your buttons, which leads to a big if-then-else series in your actionPerformed() ).
    Eventually, if you're listening to a single button's actions, whose text change over time (e.g. "pause"/"resume" in a VCR bar), I still think it's a bad idea to rely on the text of the button - instead, this text corresponds to a logical state (resp. playing/paused), it is more maintainable to base your logic on the state - which is more resilient to the evolutions of the UI (e.g. if you happen to use 2 toggle buttons instead of one single play/pause button).

  • How to get additional field from the second list base on lookup information column ?

    Hi everyone,
    Currently I created a SharePoint hosted Apps project and I need to know how can I get additional field from the second list base on lookup information column. example List1 Have 2 columns column1 and column2(Lookup Information from list2 (category)),
    List2 have 3 columns title, and category, and color.  so how can get the title and color from list2 base on this lookup information column (SharePoint Hosted apps and Javascript code)? that is possible?
    Best regards,
    ------------------------------------------------------------ ---Tola---

    You can build one custom lookup control. Refer to the following post
    http://www.stuartroberts.net/index.php/2012/10/03/enhanced-lookup-field-part-1/
    Alternatively, try the following solution from codeplex
    http://sp2010filteredlookup.codeplex.com/
    http://filteredlookup.codeplex.com/
    --Cheers

  • How to hide the field from the view in the webdynpro application?

    Hi Gurus,
    I got a requirement where in which ,default layout has the field name Time.......To......... which is (2 input box ) and one lable assigned to the container.........
    Now my requirement is to hide this field from the layout for all cases of leave......(all types of leave)....
    I got a few inputs from forum that we can achieve this by implementing the following steps..........
    Create In context => Value attribute => Say Visibility
    Go to its properties
    Select com.sap.ide.webdynpro.uielementdefinitions.Visibility
    In View Layout
    Select UI Element Set Visible property to this context variable Visibility.
    In wdDoModifyView() You can set this property to false
    wdContext.currentContextElement().setVisibility(false);
    Can you people tell me where to create the value attribute........
    In the view context or in the component context...........
    and field that am talking about is assign to the container you want me to assign this context variable property to all ......Like to input box ,label and the container..........
    Please calrify this ASAP...........
    Thanks in Advance,
    Dharani

    Hi Manoj......
    Hi Murutuza,
    As per your guidelines I have created the value attribute in View context (which has the field..... which needs to be hide)inside the value node say FieldVisibility.......and attribute name OldTimeDuration......and I set this value with uidefeneitions Visibility .......
    and I bind this vaule with the field property visible(Time.......To..........)which I need to hide...........
    Now in the view implementation tab ..........I have coded in the doinit method(since my requirement to hide the field from the layout in all cases).........
    wdContext.currentFieldVisibilityElement().setOldTimeDuration(WDVisibility.NONE);
    But if I deploy the application and see still am getting the same field dispalying in the screen.........
    I even tried putting this code in wdmodifyview method.........same results........
    Kindly tell me how to hide the field permenantly from the screen............(without any conditions.)
    Thanks in Advance,
    Dharani

  • "An error occurred while extracting files from the package "BaseSystem.pkg".

    Hello!
    I have a
    MacBookPro5,5
    Prozessortyp:Intel Core 2 Duo
    Prozessorgeschwindigkeit:2.26 GHz
    Anzahl der Prozessoren:1
    Gesamtzahl der Kerne:2
    L2-Cache:3 MB
    Speicher:2 GB
    Busgeschwindigkeit:1.07 GHz
    Boot-ROM-Version:MBP55.00AC.B03
    SMC-Version (System):1.47f2
    Hardware-UUID:A2DD27C4-9829-5A4D-854B-485EF8A6B20F
    Problem:
    I upgraded Leopard to Snow Leopard. Everything worked fine for a month. To free up disk space I deleted some of the iPhoto flders (modfied and original images). Everything worked still fine. Shut down the computer. Next day it was incredibly slow. At the same time the indexing was running. I stopped indexing, but stll slow. Every operation took minutes. I tried all the tricks that I found in the internet (repaired file permissions, repaired disk, cleared PRAM , moved big filed from desktop, etc.). After 24 full hours of trying all this I decided to erase the hard drive and reinstall, directly from the Snow Leopard Install disk, but it fails after downloading the packages. Below is the part of the log. Then I tried to use the old Leopard install DVD to reinstall Leopard, it then sais estimated time 12 hours or so and eventually crashed, spitting out a lot of "reportcrash" in the log. What is going on? I'm running out of options. Any advice? Would zeroing the hard drive help? If nothing else I plan to buy a new hard drive, since the only explanation I have is that there is a problem with the hard driven although the disk utility says it is OK. I need a bigger one anyway. Any ideas? Thank you!
    Aug 16 05:17:31 localhost OSInstaller[139]: IFPKInstallElement (191 packages)
    Aug 16 05:17:35 localhost OSInstaller[139]: PackageKit: ----- Begin install -----
    Aug 16 05:17:35 localhost OSInstaller[139]: PackageKit: request=PKInstallRequest <191 packages, destination=/Volumes/Macintosh HD>
    Aug 16 05:17:36 localhost OSInstaller[139]: PackageKit: Extracting /Volumes/Macintosh HD/Mac OS X Install Data/BaseSystem.pkg (destination=/Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root, uid=0)
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/DataPool.c:116 : Error: finished pool without filling it
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/commonUtils.c: 315: Error: fh_pread -1
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/StreamCompress or.c:236: Error: write failed for /Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root//System/Library/Frameworks/OpenCL.framework/Versi ons/A/Resources/runtime.amdil.bc: Invalid argument
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/StreamCompress or.c:260: Error: futimes failed for /Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root//System/Library/Frameworks/OpenCL.framework/Versi ons/A/Resources/runtime.amdil.bc: Invalid argument
    Aug 16 05:31:59 localhost Unknown[80]: /SourceCache/AppleFSCompression/AppleFSCompression-24.0.1/Common/StreamCompress or.c:829: Error: returning errno 22 from FinishStreamCompressorQueue
    Aug 16 05:32:10 localhost OSInstaller[139]: PackageKit: Install Failed: PKG: extracting "com.apple.pkg.BaseSystem"\nError Domain=PKInstallErrorDomain Code=110 UserInfo=0x12c8366a0 "An error occurred while extracting files from the package “BaseSystem.pkg”." Underlying Error=(Error Domain=BOMCopierFatalError Code=22 UserInfo=0x12e703300 "The operation couldn’t be completed. FinishStreamCompressorQueue error") {\n    NSFilePath = "/Volumes/Macintosh HD/.OSInstallSandbox-tmp/Root";\n    NSLocalizedDescription = "An error occurred while extracting files from the package \U201cBaseSystem.pkg\U201d.";\n    NSURL = "BaseSystem.pkg -- file://localhost/Volumes/Macintosh%20HD/Mac%20OS%20X%20Install%20Data/index.pro duct";\n    NSUnderlyingError = "Error Domain=BOMCopierFatalError Code=22 UserInfo=0x12e703300 \"The operation couldn\U2019t be completed. FinishStreamCompressorQueue error\"";\n    PKInstallPackageIdentifier = "com.apple.pkg.BaseSystem";\n}
    Aug 16 05:32:10 localhost OSInstaller[139]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=110 UserInfo=0x12c8366a0 "An error occurred while extracting files from the package “BaseSystem.pkg”." Underlying Error=(Error Domain=BOMCopierFatalError Code=22 UserInfo=0x12e703300 "The operation couldn’t be completed. FinishStreamCompressorQueue error")
    Aug 16 05:32:11 localhost OSInstaller[139]: Install failed: Die Installation ist aufgrund eines Fehlers fehlgeschlagen. Wenden Sie sich an den Hersteller der Software.
    Aug 16 05:32:13 localhost OSInstaller[139]: Allowing machine sleep.
    Aug 16 05:32:15 localhost OSInstaller[139]: Memory statistics for 'Installation ist fehlgeschlagen' pane:
    Aug 16 05:32:15 localhost OSInstaller[139]: Physical Memory Allocation:   139 MB wired,   259 MB trapped,   397 MB active,     7 MB inactive,  1246 MB free,  1650 MB usable,  2048 MB total

    It sounds to me like your Internal Hard Drive is failing.
    I recommend you buy a new one, that is a good candidate for replacing the old one, but install it in an External enclosure and Install a fresh Mac OS X on it from the DVD. You can boot your Mac from any attached drive.
    The new System can be used to get some work done, check your emails, and takes the pressure off resolving this immediately. You can also attempt to salvage files off the old drive if needed.
    Once things seem to be working, then move the new drive inside the computer. Failures at this point may be due to bad cable, which has been a problem in some of these MacBooks.
    Use security erase, write Zeroes, one pass, to re-write every block on the old drive. Any block discovered to be bad will be replaced with spares the drive holds in reserve for this purpose. If more than 10 blocks are pared on one pass, "Initialization Failed!" will be the result. Although you can try the erase again, there is some question whether you want to trust this drive with your precious data.

Maybe you are looking for

  • Help for on mapping - Std function or UDF?

    Hi All, I am working on DELVRY03 Idoc (outbound) n doing mapping betweeb Idoc and legacy structure. In delivery line item we have lineitem quantity field E1EDL24-LFIMG. Let say if we have 3 line items with LFIMG values 5,10,15...we need add up all th

  • $PROFILES$.FILENAME, $PROFILES$.PRINTER and $PROFILES$.CONC_COPIES

    Hello All, I am developing BI Publisher reports. One of my requests is to auto print the generated output(PDF) file. When I asked the client to use normal printing functionality from concurrent manager, they said it requires user level profile option

  • How do i get the volume to change

    I just unplugged my headphones and now i can't change the volumen. Sound is only emitted when headphones are plugged in. When they are not and i try to change the volume, the is a prohibition symbol  (crossed circle) under de Sound icon. What do i do

  • How I met your mother Intro Effect

    Hi, I used this forum last time for asking help in a tutorial and it was extraordinary help. This time I would like to ask you if you can help me, in a easy way of explaining, how to make a video like the HIMYM intro: Thank you!

  • Can't add SQLite DB fields to NetBeans 6.8 and iReport 3.7.1 NB plugin

    I can setup driver for SQLite & DB Connection... Problem : When I try to add db fields to the report (I can see tables and fields in the Services window) it doesn't let me do it. I drag fields to report and putting them is forbidden... What can I do?