Groovy web console

subscribe to the feed Subscribe
to this
site

PruebaCPI

Published 2 months ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.xml.*;

def xml = '''<AccountingEntryReadByIDResponse_sync xmlns:n0="http://sap.com/xi/SAPGlobal20/Global" xmlns:prx="urn:sap.com:proxy:LUW:/1SAI/TASC81E50EF9D8D273466CA:804" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><AccountingEntry><UUID>00163e70-a58d-1edb-9dd6-e039270dde4c</UUID><ID>143</ID><CompanyUUID>00163e33-ce23-1ed7-a0f1-f9a0f20b9e7f</CompanyUUID><CompanyID>GR056-00-00</CompanyID><Note languageCode="EN">FACTURA EJEMPLO UUID SAP</Note><AccountingDocumentTypeCode>00047</AccountingDocumentTypeCode><AccountingDocumentTypeName>Manual Posting - Journal Entry Voucher</AccountingDocumentTypeName><EntryDate>2021-02-23</EntryDate><PostingDate>2021-02-23</PostingDate><AccountingClosingStepCode>010</AccountingClosingStepCode><AccountingClosingStepName>Operational postings</AccountingClosingStepName><BusinessTransactionTypeCode>601</BusinessTransactionTypeCode><BusinessTransactionTypeName>Journal Entry Voucher</BusinessTransactionTypeName><TransactionCurrencyCode>GTQ</TransactionCurrencyCode><TransactionCurrencyName>Quetzal</TransactionCurrencyName><Status><LifeCycleStatusCode>1</LifeCycleStatusCode><LifeCycleStatusName>In Preparation</LifeCycleStatusName><ApprovalStatusCode>1</ApprovalStatusCode><ApprovalStatusName>Not Started</ApprovalStatusName><PostingStatusCode>1</PostingStatusCode><PostingStatusName>Not Posted</PostingStatusName></Status><SystemAdministrativeData><CreationDateTime>2021-02-24T15:43:14.981285Z</CreationDateTime><CreationIdentityUUID>00163e0d-bbbe-1ed6-a199-dec6d5bfa9ac</CreationIdentityUUID><LastChangeDateTime>2021-02-24T15:43:14.981285Z</LastChangeDateTime><LastChangeIdentityUUID>00163e0d-bbbe-1ed6-a199-dec6d5bfa9ac</LastChangeIdentityUUID></SystemAdministrativeData><SetOfBooks><SetOfBooksID>GTSC</SetOfBooksID></SetOfBooks><Item><UUID>00163e70-a58d-1edb-9dd6-e039270dfe4c</UUID><ID>1</ID><DebitCreditCode>1</DebitCreditCode><DebitCreditName>Debit</DebitCreditName><ChartOfAccountsCode>PDC1</ChartOfAccountsCode><ChartOfAccountsName><PDC1></ChartOfAccountsName><ChartOfAccountsItemCode listID="PDC1">1110101</ChartOfAccountsItemCode><ChartOfAccountsItemName><1110101></ChartOfAccountsItemName><Note languageCode="EN">Cuenta por Cobrar</Note><TransactionCurrencyAmount currencyCode="GTQ">25000.0</TransactionCurrencyAmount><AccountingCodingBlockTypeCode>ACC</AccountingCodingBlockTypeCode><AccountingCodingBlockTypeName>General Ledger Account only</AccountingCodingBlockTypeName></Item><Item><UUID>00163e70-a58d-1edb-9dd6-e039270e1e4c</UUID><ID>2</ID><DebitCreditCode>2</DebitCreditCode><DebitCreditName>Credit</DebitCreditName><ChartOfAccountsCode>PDC1</ChartOfAccountsCode><ChartOfAccountsName><PDC1></ChartOfAccountsName><ChartOfAccountsItemCode listID="PDC1">2130401</ChartOfAccountsItemCode><ChartOfAccountsItemName><2130401></ChartOfAccountsItemName><Note languageCode="EN">Impuesto</Note><TransactionCurrencyAmount currencyCode="GTQ">-5000.0</TransactionCurrencyAmount><AccountingCodingBlockTypeCode>ACC</AccountingCodingBlockTypeCode><AccountingCodingBlockTypeName>General Ledger Account only</AccountingCodingBlockTypeName></Item><Item><UUID>00163e70-a58d-1edb-9dd6-e039270e3e4c</UUID><ID>3</ID><DebitCreditCode>2</DebitCreditCode><DebitCreditName>Credit</DebitCreditName><ChartOfAccountsCode>PDC1</ChartOfAccountsCode><ChartOfAccountsName><PDC1></ChartOfAccountsName><ChartOfAccountsItemCode listID="PDC1">5110201</ChartOfAccountsItemCode><ChartOfAccountsItemName><5110201></ChartOfAccountsItemName><Note languageCode="EN">Arrendamiento</Note><TransactionCurrencyAmount currencyCode="GTQ">-12000.0</TransactionCurrencyAmount><AccountingCodingBlockTypeCode>ACC</AccountingCodingBlockTypeCode><AccountingCodingBlockTypeName>General Ledger Account only</AccountingCodingBlockTypeName></Item><Item><UUID>00163e70-a58d-1edb-9dd6-e039270e5e4c</UUID><ID>4</ID><DebitCreditCode>2</DebitCreditCode><DebitCreditName>Credit</DebitCreditName><ChartOfAccountsCode>PDC1</ChartOfAccountsCode><ChartOfAccountsName><PDC1></ChartOfAccountsName><ChartOfAccountsItemCode listID="PDC1">5210101</ChartOfAccountsItemCode><ChartOfAccountsItemName><5210101></ChartOfAccountsItemName><Note languageCode="EN">Seguridad</Note><TransactionCurrencyAmount currencyCode="GTQ">-8000.0</TransactionCurrencyAmount><AccountingCodingBlockTypeCode>ACC</AccountingCodingBlockTypeCode><AccountingCodingBlockTypeName>General Ledger Account only</AccountingCodingBlockTypeName></Item><Company><UUID>00163e33-ce23-1ed7-a0f1-f9a0f20b9e7f</UUID><ID>GR056-00-00</ID></Company></AccountingEntry><Log/></AccountingEntryReadByIDResponse_sync>'''

def root = new XmlParser().parseText(xml)

print root.AccountingEntry.value