Selcect/ update attribute value using xpath navigator/ linq to xml

Hi Folks,
below is my xml string and the highlighted bold attribute value needs to update. Since this element contains prefix im not able to select teh particular element. if i remove the prefixx im able to select but i need to keep prefix.
    <IOP:MtvnSvcReq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:IOP="mtvnCWExternInteropReq" xmlns:IOP1="mtvnExtInteropReqData" xmlns:PR1="mtvnPRInteropReqData">
                          <IOP:Svc>
                                             <IOP1:PR1>
                                                   <PR1:PRExternSSOReqData>
<PR1:UserId>abcd</PR1:UserId>
                                                   </PR1:PRExternSSOReqData>
                                             </IOP1:PR1>
                            </IOP:Svc>
                    </IOP:MtvnSvcReq>
Thanks 

Hi Pulikk,
Do you mean you want  to change the attribute value(abcd)? If so,
Please try the following code, i tested on my side, it changed successfully.
//Here is the variable with which you assign a new value
string newValue = string.Empty;
XDocument objDoc = XDocument.Load(@"yourdata.xml");
XNamespace IOP = "mtvnCWExternInteropReq";
XNamespace IOP1 = "mtvnExtInteropReqData";
XNamespace PR1 = "mtvnPRInteropReqData";
foreach (var node in objDoc.Descendants(PR1 + "UserId"))
node.Value = newValue;
objDoc.Save(@"yourdata.xml");
Have a nice day!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Update attribute value in xml db in Oracle 10g

    I have a table with XML blob data
    The root element is invoice with an element billInfo and attribute type0
    I'm trying to update the attribute value using the following sql but it is not working.
    the sql goes to sucess but the value is not updated.
    Looking for a solution and I appreciate your help
    update sc.table_name
    set xml_cb= updateXML(xml_cb,'/invoice/billInfo/@type0','A')
    where id = 1 succeeded.
    select id,
    extractValue(xml_cb,'/invoice/billInfo/@type0') type_val
    from sc.table_name
    where id =1;
    ID TYPE_VAL
    1 K

    What database version are you using?
    could you show us the outcome of:
    SQL> select dbms_metadata.get_ddl('TABLE','TABLE_NAME','SC') from dual;
    and/or a
    SQL> describe SC.TABLE_NAME

  • Want to get id's value using xpath.

    Hi all,
    I want to get id attribute's value using xpath.
    my xml file as follows:
    <book>
         <person id="1">
                <first id="2">Kiran</first>
                <last id="3">Pai
                        <name id="4">das</name>
                </last>
                <age id="5">22</age>
         </person>
         <person id="6">
                <first id="7">Bill</first>
                <last id="8">Gates</last>
                <age id="9">46</age>
         </person>
         <person id="10">
                <first id="11">Steve</first>
                <last id="12">Jobs</last>
                <age id="13">40</age>
         </person>
    </book>I want to get the id value of name. using xpath-->//book[0]/person[0]/last[0]/name[0]/[@id]..is this a valid xpath to get the id's value? my java code as follows:
    import java.io.File;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Stack;
    import javax.xml.parsers.*;
    import javax.xml.xpath.*;
    import org.w3c.dom.Document;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    public class Evaluate {
         public static void main(String[] args) {
              String xp = "//book[0]/person[0]/last[0]/name[0]"+"/[@id]";
              String id="";
          try{
               // parse the XML as a W3C Document
              DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();// Create the parser
            Document doc = docBuilder.parse(new File("book.xml"));
             XPath xpath = XPathFactory.newInstance().newXPath();
             doc.getDocumentElement().normalize();
             XPathExpression xPathExpression = xpath.compile(xp);//-->getting error here
             id=xPathExpression.evaluate(xp).toString();
             id=xPathExpression.evaluate("person");
             System.out.println("id=" +id);
                  System.out.println("xp=" +xp);
                  }catch(Exception err){
                    System.out.println("Errpr= "+ err);
    can anyone please help me ?

    No, I believe that XPath indexes begin with 1, not with zero.

  • Change a attribute value with XSLT before importing an XML

    I need change the attribute value with XSLT before importing an XML
    <table class="x" style="width="50pt">...
    I have to divide by 200 the value of "width", and the result multiplied by 100:
    (50/200) * 100
    It's possible with a XLST?

    Hi,
    Yes you can do this via XSLT.
    You can try similar to the one below:
    <table>
       <xsl:attribute name="width">
         <xsl:value-of select="((./width) div 200)*(100)" />
       </xsl:attribute>
    </table>
    I have not tested yet... Try it....
    Green4ever
    (I am back after long time)....

  • Update Attribute values of AR transaction.

    Hi All,
    We have a requirement to update the attribute of the AR transaction and have written the following code:
    DECLARE
       l_msg_count               NUMBER;
       l_msg_data                VARCHAR2 (2000);
       l_return_status           VARCHAR2 (10);
       v_batch_rec               ra_batches_all%ROWTYPE;
       v_header_rec              ra_customer_trx%ROWTYPE;
       v_errors                  arp_trx_validate.message_tbl_type;
       v_lines_tbl               ar_transaction_pub.line_tbl_type;
       v_tax_lines_tbl           ar_transaction_pub.line_tbl_type;
       v_freight_lines_tbl       ar_transaction_pub.line_tbl_type;
       v_salescredit_lines_tbl   ar_transaction_pub.salescredit_tbl_type;
       v_dist_tbl                ar_transaction_pub.dist_tbl_type;
       v_commitment_rec          arp_process_commitment.commitment_rec_type;
       v_date                    DATE;
       out_message               VARCHAR2 (4000);
       l_msg_index_out           INTEGER;
       cursor c_trx is
       select * from ra_customer_trx_all
       where customer_trx_id = 272499;--234915;
    BEGIN
       fnd_msg_pub.initialize;
       fnd_client_info.set_org_context ('328');
       fnd_global.apps_initialize (37850,50261,222, 0);
       v_date := SYSDATE - 30;--This must be a date in the open gl period
       for i in c_trx
       loop
        v_header_rec.interface_header_attribute8:= i.interface_header_attribute8;
        v_header_rec.interface_header_context:= i.interface_header_context;
        v_header_rec.default_ussgl_trx_code_context:= i.default_ussgl_trx_code_context;
        v_header_rec.interface_header_attribute10:= i.interface_header_attribute10;
        v_header_rec.interface_header_attribute11:= i.interface_header_attribute11;
        v_header_rec.interface_header_attribute12:= i.interface_header_attribute12;
        v_header_rec.interface_header_attribute13:= i.interface_header_attribute13;
        v_header_rec.interface_header_attribute14:= i.interface_header_attribute14;
        v_header_rec.interface_header_attribute15:= i.interface_header_attribute15;
        v_header_rec.interface_header_attribute9:= i.interface_header_attribute9;
        v_header_rec.default_ussgl_transaction_code:= i.default_ussgl_transaction_code;
        v_header_rec.recurred_from_trx_number:= i.recurred_from_trx_number;
        v_header_rec.attribute11:= i.attribute11;
        v_header_rec.attribute12:= i.attribute12;
        v_header_rec.attribute13:= i.attribute13;
        v_header_rec.attribute14:= i.attribute14;
        v_header_rec.attribute15:= i.attribute15;
        v_header_rec.interface_header_attribute1:= i.interface_header_attribute1;
        v_header_rec.interface_header_attribute2:= i.interface_header_attribute2;
        v_header_rec.interface_header_attribute3:= i.interface_header_attribute3;
        v_header_rec.interface_header_attribute4:= i.interface_header_attribute4;
        v_header_rec.interface_header_attribute5:= i.interface_header_attribute5;
        v_header_rec.interface_header_attribute6:= i.interface_header_attribute6;
        v_header_rec.attribute_category:= i.attribute_category;
        v_header_rec.attribute1:= i.attribute1;
        v_header_rec.attribute2:= 'NEW';
        v_header_rec.attribute3:= i.attribute3;
        v_header_rec.attribute4:= i.attribute4;
        v_header_rec.attribute5:= i.attribute5;
        v_header_rec.attribute6:= i.attribute6;
        v_header_rec.attribute7:= i.attribute7;
        v_header_rec.attribute8:= i.attribute8;
        v_header_rec.attribute9:= i.attribute9;
        v_header_rec.attribute10:= i.attribute10;
        v_header_rec.customer_trx_id:= i.customer_trx_id;
        v_header_rec.trx_number:= i.trx_number;
        v_header_rec.paying_site_use_id:= i.paying_site_use_id;
        v_header_rec.bill_to_customer_id:= i.bill_to_customer_id;
        v_header_rec.cust_trx_type_id:= i.cust_trx_type_id;
        v_header_rec.reversed_cash_receipt_id:= i.reversed_cash_receipt_id;
        v_header_rec.agreement_id:= i.agreement_id;
        v_header_rec.batch_id:= i.batch_id;
        v_header_rec.status_trx:= i.status_trx;
        v_header_rec.doc_sequence_id:= i.doc_sequence_id;
        v_header_rec.doc_sequence_value:= i.doc_sequence_value;
        v_header_rec.paying_customer_id:= i.paying_customer_id;
        v_header_rec.related_batch_source_id:= i.related_batch_source_id;
        v_header_rec.default_tax_exempt_flag:= i.default_tax_exempt_flag;
        v_header_rec.created_from:= i.created_from;
        v_header_rec.org_id:= i.org_id;
        v_header_rec.request_id:= i.request_id;
        v_header_rec.program_application_id:= i.program_application_id;
        v_header_rec.program_id:= i.program_id;
        v_header_rec.program_update_date:= i.program_update_date;
        v_header_rec.finance_charges:= i.finance_charges;
        v_header_rec.complete_flag:= i.complete_flag;
        v_header_rec.posting_control_id:= i.posting_control_id;
        v_header_rec.bill_to_address_id:= i.bill_to_address_id;
        v_header_rec.ra_post_loop_number:= i.ra_post_loop_number;
        v_header_rec.ship_to_address_id:= i.ship_to_address_id;
        v_header_rec.credit_method_for_rules:= i.credit_method_for_rules;
        v_header_rec.credit_method_for_installments:= i.credit_method_for_installments;
        v_header_rec.receipt_method_id:= i.receipt_method_id;
        v_header_rec.related_customer_trx_id:= i.related_customer_trx_id;
        v_header_rec.invoicing_rule_id:= i.invoicing_rule_id;
        v_header_rec.ship_via:= i.ship_via;
        v_header_rec.ship_date_actual:= i.ship_date_actual;
        v_header_rec.waybill_number:= i.waybill_number;
        v_header_rec.fob_point:= i.fob_point;
        v_header_rec.customer_bank_account_id:= i.customer_bank_account_id;
    --    v_header_rec.printing_option:= i.printing_option;
        v_header_rec.printing_count:= i.printing_count;
        v_header_rec.printing_pending:= i.printing_pending;
        v_header_rec.purchase_order:= i.purchase_order;
        v_header_rec.purchase_order_revision:= i.purchase_order_revision;
        v_header_rec.purchase_order_date:= i.purchase_order_date;
        v_header_rec.customer_reference:= i.customer_reference;
        v_header_rec.customer_reference_date:= i.customer_reference_date;
        v_header_rec.comments:= i.comments;
        v_header_rec.internal_notes:= i.internal_notes;
        v_header_rec.exchange_rate_type:= i.exchange_rate_type;
        v_header_rec.exchange_date:= i.exchange_date;
        v_header_rec.exchange_rate:= i.exchange_rate;
        v_header_rec.territory_id:= i.territory_id;
        v_header_rec.invoice_currency_code:= i.invoice_currency_code;
        v_header_rec.initial_customer_trx_id:= i.initial_customer_trx_id;
        v_header_rec.end_date_commitment:= i.end_date_commitment;
        v_header_rec.start_date_commitment:= i.start_date_commitment;
        v_header_rec.last_printed_sequence_num:= i.last_printed_sequence_num;
        v_header_rec.orig_system_batch_name:= i.orig_system_batch_name;
        v_header_rec.post_request_id:= i.post_request_id;
        v_header_rec.last_update_date:= i.last_update_date;
        v_header_rec.last_updated_by:= i.last_updated_by;
        v_header_rec.creation_date:= i.creation_date;
        v_header_rec.created_by:= i.created_by;
        v_header_rec.last_update_login:= i.last_update_login;
        v_header_rec.trx_date:= i.trx_date;
        v_header_rec.set_of_books_id:= i.set_of_books_id;
        v_header_rec.bill_to_contact_id:= i.bill_to_contact_id;
        v_header_rec.batch_source_id:= i.batch_source_id;
        v_header_rec.reason_code:= i.reason_code;
        v_header_rec.sold_to_customer_id:= i.sold_to_customer_id;
        v_header_rec.sold_to_contact_id:= i.sold_to_contact_id;
        v_header_rec.sold_to_site_use_id:= i.sold_to_site_use_id;
        v_header_rec.bill_to_site_use_id:= i.bill_to_site_use_id;
        v_header_rec.ship_to_customer_id:= i.ship_to_customer_id;
        v_header_rec.ship_to_contact_id:= i.ship_to_contact_id;
        v_header_rec.ship_to_site_use_id:= i.ship_to_site_use_id;
        v_header_rec.shipment_id:= i.shipment_id;
        v_header_rec.remit_to_address_id:= i.remit_to_address_id;
        v_header_rec.term_id:= i.term_id;
        v_header_rec.term_due_date:= i.term_due_date;
        v_header_rec.previous_customer_trx_id:= i.previous_customer_trx_id;
        v_header_rec.primary_salesrep_id:= i.primary_salesrep_id;
        v_header_rec.printing_original_date:= i.printing_original_date;
        v_header_rec.printing_last_printed:= i.printing_last_printed;
        v_header_rec.global_attribute1:= i.global_attribute1;
        v_header_rec.global_attribute2:= i.global_attribute2;
        v_header_rec.global_attribute3:= i.global_attribute3;
        v_header_rec.global_attribute4:= i.global_attribute4;
        v_header_rec.global_attribute5:= i.global_attribute5;
        v_header_rec.global_attribute6:= i.global_attribute6;
        v_header_rec.global_attribute7:= i.global_attribute7;
        v_header_rec.global_attribute8:= i.global_attribute8;
        v_header_rec.global_attribute9:= i.global_attribute9;
        v_header_rec.global_attribute10:= i.global_attribute10;
        v_header_rec.global_attribute11:= i.global_attribute11;
        v_header_rec.global_attribute12:= i.global_attribute12;
        v_header_rec.global_attribute13:= i.global_attribute13;
        v_header_rec.global_attribute14:= i.global_attribute14;
        v_header_rec.global_attribute15:= i.global_attribute15;
        v_header_rec.global_attribute16:= i.global_attribute16;
        v_header_rec.global_attribute17:= i.global_attribute17;
        v_header_rec.global_attribute18:= i.global_attribute18;
        v_header_rec.global_attribute19:= i.global_attribute19;
        v_header_rec.global_attribute20:= i.global_attribute20;
        v_header_rec.global_attribute_category:= i.global_attribute_category;
        v_header_rec.wh_update_date:= i.wh_update_date;
        v_header_rec.edi_processed_flag:= i.edi_processed_flag;
        v_header_rec.edi_processed_status:= i.edi_processed_status;
        v_header_rec.global_attribute21:= i.global_attribute21;
        v_header_rec.global_attribute22:= i.global_attribute22;
        v_header_rec.global_attribute23:= i.global_attribute23;
        v_header_rec.global_attribute24:= i.global_attribute24;
        v_header_rec.global_attribute25:= i.global_attribute25;
        v_header_rec.global_attribute26:= i.global_attribute26;
        v_header_rec.global_attribute27:= i.global_attribute27;
        v_header_rec.global_attribute28:= i.global_attribute28;
        v_header_rec.global_attribute29:= i.global_attribute29;
        v_header_rec.global_attribute30:= i.global_attribute30;
        v_header_rec.payment_server_order_num:= i.payment_server_order_num;
        v_header_rec.approval_code:= i.approval_code;
        v_header_rec.address_verification_code:= i.address_verification_code;
        v_header_rec.old_trx_number:= i.old_trx_number;
        v_header_rec.br_amount:= i.br_amount;
        v_header_rec.br_unpaid_flag:= i.br_unpaid_flag;
        v_header_rec.br_on_hold_flag:= i.br_on_hold_flag;
        v_header_rec.drawee_id:= i.drawee_id;
        v_header_rec.drawee_contact_id:= i.drawee_contact_id;
        v_header_rec.drawee_site_use_id:= i.drawee_site_use_id;
        v_header_rec.drawee_bank_account_id:= i.drawee_bank_account_id;
        v_header_rec.remittance_bank_account_id:= i.remittance_bank_account_id;
        v_header_rec.override_remit_account_flag:= i.override_remit_account_flag;
        v_header_rec.special_instructions:= i.special_instructions;
        v_header_rec.remittance_batch_id:= i.remittance_batch_id;
        v_header_rec.prepayment_flag:= i.prepayment_flag;
        v_header_rec.ct_reference:= i.ct_reference;
        v_header_rec.contract_id:= i.contract_id;
        v_header_rec.bill_template_id:= i.bill_template_id;
        v_header_rec.cc_error_flag:= i.cc_error_flag;
        v_header_rec.cc_error_code:= i.cc_error_code;
        v_header_rec.cc_error_text:= i.cc_error_text;
       dbms_output.put_line(v_header_rec.term_id);
       end loop;
       ar_transaction_pub.update_transaction
                             (p_api_name                   => 'AR_TRANSACTION_PUB',
                              p_api_version                => 1.0,
                              p_init_msg_list              => fnd_api.g_true,
                              p_commit                     => fnd_api.g_true,
                              p_validation_level           => fnd_api.g_valid_level_full,
                              p_batch_rec                  => v_batch_rec,
                              p_header_rec                 => v_header_rec,
                              p_receivable_gl_date         => v_date,
                              p_commitment_rec             => v_commitment_rec,
                              p_lines_tbl                  => v_lines_tbl,
                              p_tax_lines_tbl              => v_tax_lines_tbl,
                              p_freight_lines_tbl          => v_freight_lines_tbl,
                              p_salescredit_lines_tbl      => v_salescredit_lines_tbl,
                              p_dist_tbl                   => v_dist_tbl,
                              p_return_status              => l_return_status,
                              p_msg_count                  => l_msg_count,
                              p_msg_data                   => l_msg_data,
                              p_errors                     => v_errors,
                              p_recalc_tax_flag            => fnd_api.g_true,
                              p_rerun_autoacc_flag         => fnd_api.g_true,
                              p_backout_sc_flag            => fnd_api.g_true,
                              p_backout_dist_flag          => fnd_api.g_true
       IF (fnd_msg_pub.count_msg > 0)
       THEN
          FOR i IN 1 .. fnd_msg_pub.count_msg
          LOOP
             fnd_msg_pub.get (p_msg_index          => i,
                              p_encoded            => 'F',
                              p_data               => out_message,
                              p_msg_index_out      => l_msg_index_out
             DBMS_OUTPUT.put_line ('l_msg_data :' || out_message);
          END LOOP;
       END IF;
    END;However getting the below error:
    l_msg_data :Invalid payment terms id. (TERM_ID: &INVALID_VALUE)
    l_msg_data :Invalid Transaction Status &INVALID_VALUE .
    l_msg_data :Validation error(s) occurred. Rolling back and setting status to ERROR
    This was working fine sometimes back. Can anyone point the right direction. I am able to update the attribute value fron the front end.
    Thanks,
    Subhasish

    Hi All,
    Any thoughts on this ??
    Regards,
    Subhasish

  • To update conditiontype values using change BAPI of sales order

    Hi Gurus,
    i am using the standard bapi 'BAPI_SALESORDER_CHANGE' and i am passing the values for the conditiontypes as follows.......
    vbeln is my sales order number..
    wa_conditions_in-itm_number = '00010'.
    wa_conditions_in-cond_count = '01'.
    wa_conditions_in-cond_type = 'ZCUS'.
    wa_conditions_in-applicatio = 'V'.
    wa_conditions_in-cond_value =  '1000.00'.
    wa_conditions_in-currency = 'INR'.
    wa_conditions_in-cond_p_unt = '1'.
    wa_conditions_inx-itm_number = '00010'.
    wa_conditions_inx-cond_count = '01'.
    wa_conditions_inx-cond_type = 'ZCUS'.
    wa_conditions_inx-updateflag = 'U'.
    wa_conditions_inx-cond_value = 'X'.
    wa_conditions_inx-currency = 'X'.
    wa_conditions_inx-cond_p_unt = 'X'.
        APPEND wa_conditions_in TO conditions_in.
        APPEND wa_conditions_inx TO conditions_inx.
    CLEAR : order_header_in, order_header_inx.
    order_header_in1-purch_no_c = 'Order'.
    order_header_inx1-purch_no_c = 'X'.
    order_header_in1-purch_no_s = 'Order'.
    order_header_inx1-purch_no_s = 'X'.
    order_header_inx1-updateflag = 'U'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = vbeln
        order_header_in             = order_header_in1
        order_header_inx            = order_header_inx1
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      TABLES
        return                      = return
       conditions_in               = conditions_in
       conditions_inx              = conditions_inx
      EXTENSIONIN                 =
    while executing in the order it is not updating the value for the condition type 'ZCUS' and it is inserting as new record.
    Please help me in this regard.
    Thanks & Regards,
    R.P.Sastry

    HI,
    Take the below sample code. for example and try to use like that.
    REPORT ZTEST_BAPI .
    Data: salesd like BAPIVBELN-VBELN.
    data: it_BAPISDH1 type BAPISDH1.
    data: it_BAPISDH1X type BAPISDH1X.
    data: it_BAPIPARNR type BAPIPARNR occurs 0 with header line.
    data: it_BAPIRET2 type BAPIRET2 occurs 0 with header line.
    data: it_BAPIPARNRC type BAPIPARNRC occurs 0 with header line.
    data: it_BAPISDITMX type BAPISDITMX occurs 0 with header line.
    data: it_BAPISDITM type standard table of BAPISDITM with header line.
    constants: c_bp(2) type c value 'BP'.
    it_BAPISDH1X-UPDATEFLAG = 'U'.
    it_BAPISDH1X-SALES_ORG = 'X'.
    it_BAPISDH1X-DISTR_CHAN = 'X'.
    it_BAPISDH1X-DIVISION = 'X'.
    it_BAPISDH1X-PURCH_NO_C = 'X'.
    it_BAPISDH1X-CUST_GROUP = 'X'.
    it_BAPISDH1-SALES_ORG = '1000'.
    it_BAPISDH1-DISTR_CHAN = '01'.
    it_BAPISDH1-DIVISION = '00'.
    it_BAPISDH1-PURCH_NO_C = 'Test1'.
    it_BAPIPARNR-PARTN_ROLE = 'RE'.
    it_BAPIPARNR-PARTN_NUMB = '0000000171'.
    it_BAPIPARNR-ITM_NUMBER = '00000'.
    append it_BAPIPARNR.
    it_BAPIPARNR-PARTN_ROLE = 'RE'.
    it_BAPIPARNR-PARTN_NUMB = '0000000179'.
    it_BAPIPARNR-ITM_NUMBER = '000000'.
    append it_BAPIPARNR.
    it_BAPIPARNRC-DOCUMENT = '000000375'.
    it_BAPIPARNRC-ITM_NUMBER = '000000'.
    it_BAPIPARNRC-UPDATEFLAG = 'U'.
    it_BAPIPARNRC-PARTN_ROLE = 'WE'.
    it_BAPIPARNRC-P_NUMB_OLD = '0000000171'.
    it_BAPIPARNRC-P_NUMB_NEW = '0000000179'.
    it_BAPIPARNRC-ADDRESS = '26324'.
    it_BAPIPARNRC-ADDR_LINK = '0000000003'.
    it_BAPIPARNRC-REFOBJTYPE = 'BUS2032'.
    it_BAPIPARNRC-REFOBJKEY = '000000375'.
    append it_BAPIPARNRC.
    data PARTNERADDRESSES like BAPIADDR1 occurs 0 with header line.
    PARTNERADDRESSES-ADDR_NO = '0000000003'.
    PARTNERADDRESSES-NAME = 'Test Cust'.
    PARTNERADDRESSES-STREET = '222nd AVE'.
    PARTNERADDRESSES-NAME_2 = 'NEW Bldg A2'.
    PARTNERADDRESSES-CITY = 'MILPITAS'.
    PARTNERADDRESSES-REGION = 'CA'.
    PARTNERADDRESSES-POSTL_COD1 = '950351'.
    PARTNERADDRESSES-COUNTRY = 'IN'.
    PARTNERADDRESSES-LANGU = 'E'.
    APPEND PARTNERADDRESSES. CLEAR PARTNERADDRESSES.
    it_BAPISDITMX-ITM_NUMBER = '00010'.
    it_BAPISDITMX-UPDATEFLAG = 'U'.
    it_BAPISDITMX-MATERIAL = 'X'.
    it_BAPISDITMX-CUST_GROUP = 'X'.
    append it_BAPISDITMX.
    it_BAPISDITM-ITM_NUMBER = '00010'.
    it_BAPISDITM-MATERIAL = '946'.
    append it_BAPISDITM.
    break-point.
    salesd = '0000000375'.
    call function 'BAPI_SALESORDER_CHANGE'
    exporting
    salesdocument = salesd
    ORDER_HEADER_IN = it_BAPISDH1
    order_header_inx = it_BAPISDH1X
    SIMULATION =
    BEHAVE_WHEN_ERROR = ' '
    INT_NUMBER_ASSIGNMENT = ' '
    LOGIC_SWITCH =
    tables
    ORDER_ITEM_IN = it_BAPISDITM
    ORDER_ITEM_INX = it_BAPISDITMX
    PARTNERS = it_BAPIPARNR
    return = it_BAPIRET2
    PARTNERCHANGES = it_BAPIPARNRC
    PARTNERADDRESSES = PARTNERADDRESSES
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CFGS_BLOB =
    ORDER_CFGS_VK =
    ORDER_CFGS_REFINST =
    SCHEDULE_LINES =
    SCHEDULE_LINESX =
    ORDER_TEXT =
    ORDER_KEYS =
    CONDITIONS_IN =
    CONDITIONS_INX =
    EXTENSIONIN =
    If sy-subrc = 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN =
    . endif.
    You need to sepaeately use the *Update* and *Change*  and *Insert* flags while filling the data
    Thanks!
    Edited by: Mr. M on Jan 9, 2009 6:23 PM

  • Extract Node Values using XPATH

    This may be a repeat question.
    No offence meant
    I am using XPATH to extract values from the nodes.
    I need to extract the value of i:RequestedBy Node using XPATH
    <?xml version="1.0" encoding="UTF-8"?>
    <i:Interest>
    <i:Status>0</i:Status>
    <i:Generation>2</i:Generation>
    <i:Details xsi:type="i:vanilla.details.stock">
       <i:RequestedBy>AA.MM</i:RequestedBy>
    The above XML is of type Document
    Document msgDoc;
    XPath xpath = XPathFactory.newInstance().newXPath();
    XPathExpression expr;
    Object result=null;
         try {
                  expr = xpath.compile("i:Interest/i:Details/i:RequestedBy/text()");
                  result = expr.evaluate(msgDoc, XPathConstants.NODESET);
               NodeList nodes = (NodeList) result;
                for (int i = 0; i < nodes.getLength(); i++) {
                 System.out.println(nodes.item(i).getNodeValue());
         } catch (XPathExpressionException e1) {
         e1.printStackTrace();
                             I am getting null/
    Is my XPATH correct?

    I don't know if your XPath is correct or not. Your XML is not well-formed because the namespace declarations are missing. And I don't see where you set the namespace context for your XPath object; that is quite likely why it doesn't do what you want.

  • Parsing attribute value using dbms_xslprocessor

    Hi,
    We have a xmltype column which has the following structure :
    <?xml version="1.0" encoding="utf-16"?>
    <myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
    <PayToTheOrderOf>TESTING</PayToTheOrderOf>
    <AllocationList>
    <Allocation d3p1:LineNum="0" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
    <d3p1:Name>ANNE PETER</d3p1:Name>
    <d3p1:StreetAddress2>600 N WEST ST</d3p1:StreetAddress2>
    <d3p1:City>BALTIMORE</d3p1:City>
    <d3p1:State>MD</d3p1:State>
    </Allocation>
    <Allocation d3p1:LineNum="1" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
    <d3p1:Name>DAVID GREY</d3p1:Name>
    <d3p1:StreetAddress2>EAST AVE</d3p1:StreetAddress2>
    <d3p1:City>4</d3p1:City>
    <d3p1:State>MD</d3p1:State>
    </Allocation>
    </myFields>"
    Can anyone tell me how to parse the attribute value from the tag, "Allocation". Example: I would like to get the value from "LineNum" attribute. I would like to use dbms_xslprocessor in pl/sql.
    Thanks in advance.

    DECLARE
    l_return xmltype;
    l_num VARCHAR2 (10);
    l_namespace1 VARCHAR2(200) := 'xmlns="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30"';
    l_namespace2 VARCHAR2(200) := 'xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30"';
    l_parser dbms_xmlparser.parser;
    l_doc dbms_xmldom.domdocument;
    l_nl dbms_xmldom.domnodelist;
    l_n dbms_xmldom.domnode;
    BEGIN
    SELECT xmltype('<?xml version="1.0" encoding="utf-16"?>
    <myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
         <PayToTheOrderOf>TESTING</PayToTheOrderOf>
         <AllocationList>
              <Allocation d3p1:LineNum="0" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
                   <d3p1:Name>ANNE PETER</d3p1:Name>
                   <d3p1:StreetAddress2>600 N WEST ST</d3p1:StreetAddress2>
                   <d3p1:City>BALTIMORE</d3p1:City>
                   <d3p1:State>MD</d3p1:State>
              </Allocation>
              <Allocation d3p1:LineNum="1" xmlns:d3p1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-05-06T14:08:30">
                   <d3p1:Name>DAVID GREY</d3p1:Name>
                   <d3p1:StreetAddress2>EAST AVE</d3p1:StreetAddress2>
                   <d3p1:City>4</d3p1:City>
                   <d3p1:State>MD</d3p1:State>
              </Allocation>
         </AllocationList>
    </myFields>')
    INTO l_return
    FROM dual;
    l_parser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseClob(l_parser, l_return.getclobval());
    l_doc := dbms_xmlparser.getDocument(l_parser);
    dbms_xmlparser.freeParser(l_parser);
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/myFields/AllocationList/Allocation', l_namespace1);
    FOR i IN 1 .. dbms_xmldom.getLength(l_nl) LOOP
    l_n := dbms_xmldom.item(l_nl, i-1);
    dbms_xslprocessor.valueOf(l_n,'@d3p1:LineNum',l_num, l_namespace2);
    dbms_output.put_line(l_num);
    END LOOP;
    dbms_xmldom.freeDocument(l_doc);
    END;

  • Updating Attribute value

    I have a simple XML document. file.
    <result success="TRUE">
    <plan>
    <step number="0" name="SelectTransportA"/>
    <step number="1" name="SelectFlight"/>
    <step number="2" name="GetMedicalFlightAccountB"/>
    <step number="3" name="SelectFlight"/>
    </plan>
    </result>What i want is to update any "name" attribute value at runtime. I receive "number" attribute value, so on the basis of the received number, i want my name attribute value to be updated.
    Just like updating a value in hashtable or vector given an index.
    Regards.

    It depends what you want to do, Do you just want to update the file? Then XSLT is probably the easiest. Do you want to update this in memory? Then DOM's Node.setAttribute is probably best.

  • Selecting attribute values with XPath?

    Dear all,
    Is it possible to retrieve the value of a certain attribute in an XML document using an XPath expression? For instance, if I have the following doc:
    <someTag>
       <anotherTag attr="123" />
    </someTag>Is there one XPath expression that will return the value of the attribute attr of the element anotherTag, i.e. "123"?
    Cheers,
    N.

    I think /anotherTag/@attr/text() does the job.

  • How to update condition value using e1edp05 segment during order creation

    Hi,
    I have a requirement where I need to update the item level condition value (komv-kbeter)  to the condition type (komv-kschl) from the incoming idocs (orders05).
    But  the same is configured  in such a way to populate automatically with the default condition value zero during the order creation level using VA01 at condition tab.
    I am able to populate condition values from incoming idoc using segment E1EDP05 which is good, but it was getting created as new entry with the same condition type  instead of updating the condition value to the existing condition type(which got populated from automatically from configuration) .
    So I want to restrict to one entry instead of two with same condition type. Is there any userexit/gap to restrict automatic population of condition type thru programming or to update with idoc (orders05) value rather than inserting as new row?
    My client doesn’t want to restrict the pricing automation from configuration. So I have to handle through programming level.
    Your  inputs are appreciated

    It doesn't really matter if it's a credit/debit memo, it's the same transaction anyway and pretty much the same functionality. What is your requirement exactly? Do you always have to override the price from Siebel or, let's say, some price is automatically proposed and you might or might not need to override it?
    We use a custom (Z..) condition for price override. When a material is entered in VA01, some price (condition PR00, for example) is assigned automatically. Then, let's say, a special price has been negotiated with this customer just for this purchase. So the user goes into Conditions, types in condition code Z... and types in the new price. This basically annuls the previous PR00 condition. I'm not a functional consultant and can't give you all the config details, but your SD person should be able to help.
    I'm still positive that conditions cannot be removed or changed by IDoc. One thing I would suggest for your situation: do not create ZCD2 condition initially and then just add ZCD2 condition when you receive the data from Siebel. Otherwise it seems that you would have to write a user exit or a requirement to deal with the duplicate conditions.

  • Error when replacing attribute value using LDAPConnection.modify()

    I am using Directory SDK 4.1 from netscape. I am trying to replace/modify the value of an attribute for a particular dn. Below is the code:
    LDAPConstraints constraints = new LDAPConstraints();
    constraints.setReferrals(true);
    LDAPAttribute attribute = new LDAPAttribute("passwordexpwarned","1");
    LDAPModification mod = new LDAPModification
    (LDAPModification.REPLACE , attribute);
    getLDAPConnection().modify(dn, mod,constraints);
    Automatic Referral Handling is enabled and I want to use to anonymous authentication. When I run the code, I get the following error:
    java.lang.ClassCastException: netscape.ldap.LDAPConstraints     at netscape.ldap.LDAPConnection.performReferrals(LDAPConnection.java:5057)
    at netscape.ldap.LDAPConnection.modify LDAPConnection.java:3121)
    at netscape.ldap.LDAPConnection.modify(LDAPConnection.java:2981)
    at PasswordExpiration.setPasswordWarnedAttribute(PasswordExpiration.java:305)
    Has anyone encountered the same error or could anyone provide me some input on what could be the reason for the error? I would greatly appreciate any help in this matter.
    Thanks for your time.

    you must use LDAPSearchConstraints instead of LDAPConstraints;
    the reason is a minor but awkward bug in LDAPJDK;

  • Fetching xml node nth value using Xpath

    HI Experts ,
    with reference to below question, i have one more doubt.
    https://social.msdn.microsoft.com/Forums/en-US/f894e5e2-8926-4604-9171-616da3f00cd7/xpath-to-fetch-value-in-flatfile-schema?forum=biztalkgeneral
    I used below xpath to fetch nth value of full repeating message nodes
    indexStr = System.Convert.ToString(index);DATE=xpath(In_FF, "string(//*[local-name() = 'Details']["+indexStr+"])/*[local-name()='DATE'])");index=index + 1;
    and i got below error, can any help me in this?
    Exception thrown from: segment 2, progress 43
    Inner exception: 'string(//*[local-name() = 'Details'][1])/*[local-name()='DATE'])' has an invalid token.
    Exception type: XPathException
    Source: System.Xml
    Target Site: MS.Internal.Xml.XPath.AstNode ParseXPathExpresion(System.String)
    The following is a stack trace that identifies the location where the exception occured

    your XPATH expression is WRONG.
    it should be
    DATE=xpath(In_FF,
    "string(//*[local-name() = 'Details']["+indexStr+"]/*[local-name()='DATE'])");
    There is NO ")" after ["+indexStr+"].
    The more reliable way is to use a string variable and use the System.String.Format() call as below
    xPathExpr = System.String.Format("string(//*[local-name() = 'Details'][{0}]/*[local-name()='DATE'])", index);
    DATE=xpath(In_FF, xPathExpr);
    The "invalid token" is because of the mismatched ")" in your XPATH Expression.
    Regards.

  • Set attribute value using plugins

    Hi Experts,
    I am facing error when setting the value of attribute in the event "OnInvestigationStartedEvent". Any suggestion to fix the issue
    code:
                Session ses = onInvestigationStartedEvent.getSessionContext().getInterviewSession().getRuleSession();
                Attribute start = ses.getGlobalEntityInstance().getEntity().getAttribute("test_start_time");
                Date start_date = new Date();
                start.setValue(ses.getGlobalEntityInstance(), start_date);
    Error:
    25750 [http-apr-8080-exec-9] INFO com.oracle.determinations.engine.Session  - User setting attribute test_start_time, entity global, instance name global, session 1 to value 7/21/13 2:17 PM
    25752 [http-apr-8080-exec-9] ERROR com.oracle.determinations.web.platform.templatingengine.ErrorRenderer  - A unauthorised change to the Rule Session has been detected.
    com.oracle.determinations.interview.engine.exceptions.CorruptSessionException: A unauthorised change to the Rule Session has been detected.
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.checkSessionIntegrity(RuleSessionManager.java:760)
      at com.oracle.determinations.interview.engine.data.local.RuleSessionManager.getRuleSession(RuleSessionManager.java:144)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getRuleSession(LocalInterviewSession.java:203)
      at com.oracle.determinations.interview.engine.data.model.InterviewEntityInstanceIdentifier.findEntityInstance(InterviewEntityInstanceIdentifier.java:73)
      at com.oracle.determinations.interview.engine.local.AttributeGoal.getNextScreen(AttributeGoal.java:112)
      at com.oracle.determinations.interview.engine.local.LocalInterviewSession.getNextScreen(LocalInterviewSession.java:222)
      at com.oracle.determinations.web.platform.controller.actions.InvestigateAction.getResource(InvestigateAction.java:65)
      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.doGet(WebDeterminationsServlet.java:112)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.oracle.determinations.web.platform.util.CharsetFilter.doFilter(CharsetFilter.java:46)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
    Thanks,
    Vinay

    Vinay,
    When working in an Interview Engine event handler, you need to use Interview Engine objects to set values. Have a look at the example "Use the OnInterviewSessionCreatedEvent to pre-seed data into a newly created session" in the "Oracle Policy Automation Developer's Guide"
    Your code should look something like:
    // get the globalInstance from a new InterviewUserData;
    InterviewUserData data = new InterviewUserData();
    InterviewEntityInstance globalInstance = data.getGlobalInstance();
    // set the test_start_time
    Date start_date = new Date();
    globalInstance.setValue("test_start_time", start_date );
    // submit the data to the Interview session.
    TransactionResult result = session.submit(data);
    Hope this helps.
    Cheers
    Frank

  • Reg:How to update VC values using BAPI_SALESORDER_CREATEFROMDAT2

    Hi,
    We are creating sales order using the BAPI_SALESORDER_CREATEFROMDAT2 FM but we also want to update variant configuration values in those sales orders. I'm passing these tables (ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_VALUE) to the FM.'
    The sales order is been created but the VC characteristics are not getting updated.
    After the FM I am calling the commit also..
    Am I missing anything..Please guide me how to update the VC values..

    hi,
    use swo1 for uploading BAPIs
    regards,
    uttam.

Maybe you are looking for