There are several ways to load data into your tables in SAP HANA. you will use an artifact similar to the former .hdbti
development object, that allows you to upload a file into your directory in SPA Web IDE and load the data into a table or tables according to the configuration. This is handy for initial loads or small configuration tables.
In your data
folder, create a file named load.hdbtabledata
and enter this text into it. Don’t forget to save the file afterwards.
{
"format_version": 1,
"imports": [{
"target_table": "PurchaseOrder.Header",
"source_data": {
"data_type": "CSV",
"file_name": "header.csv",
"has_header": false,
"dialect": "HANA",
"type_config": {
"delimiter": ","
}
},
"import_settings": {
"import_columns": ["PURCHASEORDERID",
"NOTEID",
"PARTNER",
"CURRENCY",
"GROSSAMOUNT",
"NETAMOUNT",
"TAXAMOUNT",
"LIFECYCLESTATUS",
"APPROVALSTATUS",
"CONFIRMSTATUS",
"ORDERINGSTATUS",
"INVOICINGSTATUS"]
},
"column_mappings": {
"PURCHASEORDERID": 1,
"NOTEID": 6,
"PARTNER": 7,
"CURRENCY": 8,
"GROSSAMOUNT": 9,
"NETAMOUNT": 10,
"TAXAMOUNT": 11,
"LIFECYCLESTATUS": 12,
"APPROVALSTATUS": 13,
"CONFIRMSTATUS": 14,
"ORDERINGSTATUS": 15,
"INVOICINGSTATUS": 16
}
},
{
"target_table": "PurchaseOrder.Item",
"source_data": {
"data_type": "CSV",
"file_name": "item.csv",
"has_header": false,
"dialect": "HANA",
"type_config": {
"delimiter": ","
}
},
"import_settings": {
"import_columns": ["POHeader.PURCHASEORDERID",
"PRODUCT",
"NOTEID",
"CURRENCY",
"GROSSAMOUNT",
"NETAMOUNT",
"TAXAMOUNT",
"QUANTITY",
"QUANTITYUNIT" ]
},
"column_mappings": {
"POHeader.PURCHASEORDERID": 1,
"PRODUCT": 3,
"NOTEID": 4,
"CURRENCY": 5,
"GROSSAMOUNT": 6,
"NETAMOUNT": 7,
"TAXAMOUNT": 8,
"QUANTITY": 9,
"QUANTITYUNIT": 10
}
}]
}
Note: You can find a reference of the .hdbtabledata
artifact in the official SAP Help
Skim through the contents of the file you have just created and you will see the file_name
fields.
Create a file called header.csv
with the following content:
0500000000,0000000033,20120101,0000000033,20120101,9000000001,0100000000,EUR,13224.47,11113,2111.47,N,I,I,I,I
0500000001,0000000033,20120102,0000000033,20120102,9000000001,0100000002,EUR,12493.73,10498.94,1994.79,N,I,I,I,I
Create a file called item.csv
and use the following data. Don’t forget to save all of the files.
0500000000,0000000010,HT-1000,,EUR,1137.64,956,181.64,1,EA,20121204
0500000000,0000000020,HT-1091,,EUR,61.88,52,9.88,2,EA,20121204
0500000000,0000000030,HT-6100,,EUR,1116.22,938,178.22,2,EA,20121204
0500000000,0000000040,HT-1001,,EUR,2275.28,1912,363.28,2,EA,20121204
0500000000,0000000050,HT-1092,,EUR,92.82,78,14.82,3,EA,20121204
0500000000,0000000060,HT-6101,,EUR,1116.22,938,178.22,2,EA,20121204
0500000000,0000000070,HT-1002,,EUR,2275.28,1912,363.28,2,EA,20121204
0500000000,0000000080,HT-1090,,EUR,61.88,52,9.88,2,EA,20121204
0500000000,0000000090,HT-6102,,EUR,1674.33,1407,267.33,3,EA,20121204
0500000000,0000000100,HT-1007,,EUR,3412.92,2868,544.92,3,EA,20121204
0500000001,0000000010,HT-1100,,USD,213.96,179.8,34.16,2,EA,20121204
0500000001,0000000020,HT-2026,,USD,35.69,29.99,5.7,1,EA,20121204
0500000001,0000000030,HT-1002,,USD,3736.6,3140,596.6,2,EA,20121204
0500000001,0000000040,HT-1101,,USD,213.96,179.8,34.16,2,EA,20121204
0500000001,0000000050,HT-2027,,USD,71.38,59.98,11.4,2,EA,20121204
0500000001,0000000060,HT-1003,,USD,3736.6,3140,596.6,2,EA,20121204
0500000001,0000000070,HT-1102,,USD,320.94,269.7,51.24,3,EA,20121204
0500000001,0000000080,HT-2028,,USD,107.06,89.97,17.09,3,EA,20121204
0500000001,0000000090,HT-1004,,USD,3736.6,3140,596.6,2,EA,20121204
0500000001,0000000100,HT-1103,,USD,320.94,269.7,51.24,3,EA,20121204
Build the db
module.