Skip to Content
0
Oct 27, 2022 at 06:53 AM

Convert internal table data to Json

220 Views

Hi ,

I have to convert internal table data to JSON, but i have option only either low case or upper case but i have to send json in mix case somewhere it is in small case somewhere in capital ,'

used below code for conversion

 /ui2/cl_json=>serialize(
exporting
data = lwa "li_supplier "lt_scarr1 "Data to serialize
pretty_name = /ui2/cl_json=>pretty_mode-camel_case "low_case "Pretty print property names
receiving
r_json = lv_json ).

sample as below

{ "Supplier": "SPP", "SupplierSite": "Riyadh", "InvoiceAmount": 5000, "InvoiceCurrency": "SAR", "InvoiceNumber": "20220909", "BusinessUnit": "SAMPLE", "InvoiceDate": "2022-03-09", "InvoiceType": "Standard", "PaymentTerms": "Immediate", "PaymentMethodCode": "CHECK", "Description": "TEST", "PayAloneFlag": "Y","invoiceDff":[{ "apInvRefNo": "20220725", "__FLEX_Context": "", "__FLEX_Context_DisplayValue": "", "party": "TEST", "claimtype": "TEST", "startdate": null, "enddate": null, "citizenname1": "TEST", "citizenname2": "/ TEST", "instrumentno": "314004004010", "buildingspace": "109.2", "price": "3500", "year": "1439"}],"attachments":[{"Type":"File","FileName":"Ω‡TEST.pdf "}],"invoiceLines":[{"LineNumber": 1,"LineType":"Item","Description":"Lease","LineAmount":"6000","AccountingDate":"2022-03-09","DistributionSet":"TEST"}],"invoiceInstallments":[{"InstallmentNumber": 1,"DueDate":"2022-03-09","GrossAmount": 4000,"PaymentMethodCode":"Check","RemitToSupplier":"TEST","RemittanceMessageOne":"Test"}]}