
@AbapCatalog.sqlViewName: 'YSITHH_SO'
define view ysitHHSalesOrder as select from snwd_so as so
inner join snwd_bpa as bpa on so.buyer_guid = bpa.node_key {
key so.so_id as id,
bpa.bp_id as business_partner_id,
bpa.company_name,
substring( bpa.company_name, 1, 10 ) as company_short,
case bpa.bp_role
when '01' then 'Customer'
when '02' then 'Supplier'
else 'undefined'
end as business_partner_role,
case so.billing_status
when ' ' then 'unpaid'
else 'paid'
end as billing_status,
@Semantics.currencyCode so.currency_code,
@Semantics.amount.currencyCode: 'currency_code' so.gross_amount
}
DATA salesorders TYPE STANDARD TABLE OF ysithhsalesorder.
SELECT * FROM ysithhsalesorder
INTO TABLE @salesorders.
cl_demo_output=>display( salesorders ).
DATA salesorders TYPE STANDARD TABLE OF ysithhsalesorder.
SELECT * FROM ysithhsalesorder
INTO TABLE @salesorders.
cl_demo_output=>display_json( zcl_json_document=>create_with_data( salesorders )->get_json( ) ).
CLASS ysithh_dispatcher_test DEFINITION
PUBLIC
INHERITING FROM y_adl_disp_base
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS if_http_extension~handle_request REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS YSITHH_DISPATCHER_TEST IMPLEMENTATION.
METHOD if_http_extension~handle_request.
handler( p = '^/SalesOrder' h = 'YSITHH_SALESORDER_TEST' ).
dispatch( server ).
ENDMETHOD.
ENDCLASS.
CLASS ysithh_salesorder_test DEFINITION
PUBLIC
INHERITING FROM y_adl_res_base
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS get
IMPORTING matches TYPE stringtab.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ysithh_salesorder_test IMPLEMENTATION.
METHOD get.
DATA salesorder TYPE STANDARD TABLE OF ysithhsalesorder.
SELECT * FROM ysithhsalesorder
INTO TABLE @salesorder.
response->set_cdata( zcl_json_document=>create_with_data( salesorder )->get_json( ) ).
response->set_header_field(
EXPORTING
name = 'Access-Control-Allow-Origin' " Name of the header field
value = '*' " HTTP header field value
).
ENDMETHOD.
ENDCLASS.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
<script>
sap.ui.localResources("sithh_test");
var view = sap.ui.view({id:"idmain1", viewName:"sithh_test.main", type:sap.ui.core.mvc.ViewType.XML});
view.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
<core:View xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns:commons="sap.ui.commons"
xmlns:m="sap.m"
xmlns="sap.ui.table"
controllerName="sithh_test.main" xmlns:html="http://www.w3.org/1999/xhtml">
<Table
id="tt"
rows="{/itab}"
title="Table Example">
<columns>
<Column>
<label>
<commons:Label text="ID" />
</label>
<template>
<commons:TextField value="{id}" />
</template>
</Column>
<Column>
<label>
<commons:Label text="Company" />
</label>
<template>
<commons:TextField value="{company_short}" />
</template>
</Column>
<Column>
<label>
<commons:Label text="Role" />
</label>
<template>
<commons:TextField value="{business_partner_role}" />
</template>
</Column>
<Column>
<label>
<commons:Label text="Status" />
</label>
<template>
<commons:TextField value="{billing_status}" />
</template>
</Column>
<Column>
<label>
<commons:Label text="Currency" />
</label>
<template>
<commons:TextField value="{currency_code}" />
</template>
</Column>
<Column>
<label>
<commons:Label text="Value" />
</label>
<template>
<commons:TextField value="{gross_amount}" />
</template>
</Column>
</columns>
</Table>
</core:View>
sap.ui.controller("sithh_test.main", {
onInit: function() {
var oModel = new sap.ui.model.json.JSONModel(
'http://se38-d7x-1.se38.local:8000/sap/bc/ysithh_test/SalesOrder'
);
sap.ui.getCore().setModel(oModel);
},
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
7 | |
7 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |