@EndUserText.label : 'Purchase Document'
@AbapCatalog.enhancementCategory : #EXTENSIBLE_ANY
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #ALLOWED
define table zpurchasedoc {
key client : abap.clnt not null;
key purchasedocument : zpurchasedocumentdtel not null;
@EndUserText.label : 'Description'
description : abap.sstring(128);
@EndUserText.label : 'Approval Status'
status : abap.char(1);
@EndUserText.label : 'Priority'
priority : abap.char(1);
@EndUserText.label : 'Purchasing Organization'
purchasingorganization : abap.char(4);
@EndUserText.label : 'Purchase Document Image URL'
purchasedocumentimageurl : abap.sstring(255);
crea_date_time : timestampl;
crea_uname : uname;
lchg_date_time : timestampl;
lchg_uname : uname;
}
@EndUserText.label : 'Purchase Document Item'
@AbapCatalog.enhancementCategory : #EXTENSIBLE_ANY
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #ALLOWED
define table zpurchdocitem {
key client : abap.clnt not null;
@EndUserText.label : 'Purchase Document Item'
key purchasedocumentitem : abap.char(10) not null;
key purchasedocument : zpurchasedocumentdtel not null;
@EndUserText.label : 'Description'
description : abap.sstring(128);
@EndUserText.label : 'Price'
@Semantics.amount.currencyCode : 'zpurchdocitem.currency'
price : abap.curr(13,2);
@EndUserText.label : 'Currency'
currency : abap.cuky;
@EndUserText.label : 'Quantity'
@Semantics.quantity.unitOfMeasure : 'zpurchdocitem.quantityunit'
quantity : abap.quan(13,2);
@EndUserText.label : 'Unit'
quantityunit : abap.unit(3);
@EndUserText.label : 'Vendor'
vendor : abap.sstring(32);
@EndUserText.label : 'Vendor Type'
vendortype : abap.sstring(32);
@EndUserText.label : 'Purchase Document Item Image URL'
purchasedocumentitemimageurl : abap.sstring(255);
crea_date_time : timestampl;
crea_uname : uname;
lchg_date_time : timestampl;
lchg_uname : uname;
}
@EndUserText.label : 'Purchase Document Material Item'
@AbapCatalog.enhancementCategory : #EXTENSIBLE_ANY
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #ALLOWED
define table zpurchdocmatitem {
key client : abap.clnt not null;
@EndUserText.label : 'Purchase Document Item'
key material : abap.char(10) not null;
key purchasedocument : zpurchasedocumentdtel not null;
@EndUserText.label : 'Description'
description : abap.sstring(128);
@EndUserText.label : 'Price'
@Semantics.amount.currencyCode : 'zpurchdocmatitem.currency'
price : abap.curr(13,2);
@EndUserText.label : 'Currency'
currency : abap.cuky;
@EndUserText.label : 'Quantity'
@Semantics.quantity.unitOfMeasure : 'zpurchdocmatitem.quantityunit'
quantity : abap.quan(13,2);
@EndUserText.label : 'Unit'
quantityunit : abap.unit(3);
@EndUserText.label : 'Vendor'
vendor : abap.sstring(32);
}
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Purschase Document Interface View'
define root view entity Z_I_PurchaseDocument as select from zpurchasedoc
composition [0..*] of Z_I_PurchItem as _poitem
composition [0..*] of Z_I_PURCHMATITEM as _pomatitem
{
key zpurchasedoc.purchasedocument as Purchasedocument,
zpurchasedoc.description as Description,
zpurchasedoc.status as Status,
zpurchasedoc.priority as Priority,
zpurchasedoc.purchasingorganization as Purchasingorganization,
zpurchasedoc.purchasedocumentimageurl as Purchasedocumentimageurl,
zpurchasedoc.crea_date_time as CreaDateTime,
zpurchasedoc.crea_uname as CreaUname,
zpurchasedoc.lchg_date_time as LchgDateTime,
zpurchasedoc.lchg_uname as LchgUname,
_poitem ,
_pomatitem
// Make association public
}
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Purschase Document Item Interface View'
define view entity Z_I_PurchItem as select from zpurchdocitem
association to parent Z_I_PurchaseDocument as _PoHeader on $projection.Purchasedocument = _PoHeader.Purchasedocument {
key zpurchdocitem.purchasedocumentitem as Purchasedocumentitem,
key zpurchdocitem.purchasedocument as Purchasedocument,
zpurchdocitem.description as Description,
zpurchdocitem.price as Price,
zpurchdocitem.currency as Currency,
zpurchdocitem.quantity as Quantity,
zpurchdocitem.quantityunit as Quantityunit,
zpurchdocitem.vendor as Vendor,
zpurchdocitem.vendortype as Vendortype,
zpurchdocitem.purchasedocumentitemimageurl as Purchasedocumentitemimageurl,
zpurchdocitem.crea_date_time as CreaDateTime,
zpurchdocitem.crea_uname as CreaUname,
zpurchdocitem.lchg_date_time as LchgDateTime,
zpurchdocitem.lchg_uname as LchgUname,
_PoHeader // Make association public
}
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Purschase Document Item Interface View'
define view entity Z_I_PURCHMATITEM as select from zpurchdocmatitem
association to parent Z_I_PurchaseDocument as _PoHeader on $projection.Purchasedocument = _PoHeader.Purchasedocument {
key zpurchdocmatitem.material as material,
key zpurchdocmatitem.purchasedocument as Purchasedocument,
zpurchdocmatitem.description as Description,
zpurchdocmatitem.price as Price,
zpurchdocmatitem.currency as Currency,
zpurchdocmatitem.quantity as Quantity,
zpurchdocmatitem.quantityunit as Quantityunit,
zpurchdocmatitem.vendor as Vendor,
_PoHeader // Make association public
}
@EndUserText.label: 'Purschase Order Consumption View'
@AccessControl.authorizationCheck: #CHECK
@Metadata.allowExtensions: true
define root view entity Z_C_PurchDocument as projection on Z_I_PurchaseDocument {
key Purchasedocument,
Description,
Status,
Priority,
Purchasingorganization,
Purchasedocumentimageurl,
CreaDateTime,
CreaUname,
LchgDateTime,
LchgUname,
/* Associations */
_poitem : redirected to composition child Z_C_PURCHITEM ,
_pomatitem : redirected to composition child Z_C_PURCHMATITEM
}
@EndUserText.label: 'Purschase Order item Consumption view'
@AccessControl.authorizationCheck: #CHECK
@Metadata.allowExtensions: true
define view entity Z_C_PURCHITEM as projection on Z_I_PurchItem {
key Purchasedocumentitem,
key Purchasedocument,
Description,
Price,
Currency,
Quantity,
Quantityunit,
Vendor,
Vendortype,
Purchasedocumentitemimageurl,
CreaDateTime,
CreaUname,
LchgDateTime,
LchgUname,
/* Associations */
_PoHeader : redirected to parent Z_C_PurchDocument
}
@EndUserText.label: 'Purschase Order Material item Consumption view'
@AccessControl.authorizationCheck: #CHECK
@Metadata.allowExtensions: true
define view entity Z_C_PURCHMATITEM as projection on Z_I_PURCHMATITEM {
key material,
key Purchasedocument,
Description,
Price,
Currency,
Quantity,
Quantityunit,
Vendor,
/* Associations */
_PoHeader : redirected to parent Z_C_PurchDocument
}
@Metadata.layer: #CORE
@UI: {
headerInfo: { typeName: 'Purchase Order Item',
typeNamePlural: 'Purchase Order Items',
title: { type: #STANDARD, label: 'Purchase Order Item'}
}
}
annotate view Z_C_PURCHITEM
with
{
@UI.facet: [ { id: 'Items',
purpose: #STANDARD,
type: #IDENTIFICATION_REFERENCE,
label: 'Item Data',
position: 10 }]
@UI:{ lineItem: [{ position: 10, label: 'PO Item' }],
identification: [{ position: 10, label: 'PO Item'}]
}
Purchasedocumentitem;
@UI:{ lineItem: [{ position: 20, label: 'PO Document' }],
identification: [{ position: 20, label: 'PO Document'}] }
Purchasedocument;
@UI:{ lineItem: [{ position: 30, label: 'PO Desc' }],
identification: [{ position: 30, label: 'PO Desc'}] }
Description;
@UI:{ lineItem: [{ position: 40, label: 'Price' }],
identification: [{ position: 40, label: 'Price'}] }
Price;
@UI:{ lineItem: [{ position: 50, label: 'Currency' }],
identification: [{ position: 50, label: 'Currency'}] }
Currency;
@UI:{ lineItem: [{ position: 60, label: 'Quantity' }],
identification: [{ position: 60, label: 'Quantity'}] }
Quantity;
}
@Metadata.layer: #CORE
@UI: {
headerInfo: { typeName: 'Purchase Order',
typeNamePlural: 'Purchase Orders',
title: { type: #STANDARD, label: 'Purchase Order', value: 'Purchasedocument' } },
presentationVariant: [{ sortOrder: [{ by: 'Purchasedocument', direction: #DESC }] }] }
annotate view Z_C_PurchDocument
with
{
@UI.facet: [ { id: 'Header',
purpose: #STANDARD,
type: #IDENTIFICATION_REFERENCE,
label: 'Header Data',
position: 10 },
{ id: 'Items',
purpose : #STANDARD,
type: #LINEITEM_REFERENCE,
label: 'Items',
position: 20,
targetElement: '_poitem'
},
{ id: 'MatItems',
purpose : #STANDARD,
type: #LINEITEM_REFERENCE,
label: 'MateriallItems',
position: 20,
targetElement: '_pomatitem'
}]
@UI: { lineItem: [ { position: 10 } ],
identification: [ { position: 10 } ],
selectionField: [ { position: 10 } ] }
Purchasedocument;
@UI:{ lineItem: [{ position: 20, label: 'Desccriton'}],
selectionField: [{ position: 20 }],
identification: [{ position: 20, label: 'Desccriton'}] }
Description;
@UI:{ lineItem: [{ position: 30, label: 'Purchasing organization'}],
selectionField: [{ position: 30 }],
identification: [{ position: 30, label: 'Purchasing organization'}] }
Purchasingorganization;
}
@Metadata.layer: #CORE
@UI: {
headerInfo: { typeName: 'Purchase Order Material',
typeNamePlural: 'Purchase Order Material',
title: { type: #STANDARD, label: 'Purchase Order Material'}
}
}
annotate view Z_C_PURCHMATITEM
with
{
@UI.facet: [ { id: 'MatItems',
purpose: #STANDARD,
type: #IDENTIFICATION_REFERENCE,
label: 'Item Data',
position: 10 }]
@UI:{ lineItem: [{ position: 10, label: 'Material' }],
identification: [{ position: 10, label: 'Material'}]
}
material;
@UI:{ lineItem: [{ position: 20, label: 'PO Document' }],
identification: [{ position: 20, label: 'PO Document'}] }
Purchasedocument;
@UI:{ lineItem: [{ position: 30, label: 'PO Desc' }],
identification: [{ position: 30, label: 'PO Desc'}] }
Description;
@UI:{ lineItem: [{ position: 40, label: 'Price' }],
identification: [{ position: 40, label: 'Price'}] }
Price;
@UI:{ lineItem: [{ position: 50, label: 'Currency' }],
identification: [{ position: 50, label: 'Currency'}] }
Currency;
@UI:{ lineItem: [{ position: 60, label: 'Quantity' }],
identification: [{ position: 60, label: 'Quantity'}] }
Quantity;
}
managed; // implementation in class zbp_i_purchasedocument unique;
define behavior for Z_I_PurchaseDocument alias Purchorder
persistent table ZPurchasedoc
lock master
//authorization master ( instance )
//etag master <field_name>
{
create;
update;
delete;
association _poitem { create; }
association _pomatitem { create; }
}
define behavior for Z_I_PurchItem alias PurchItem
persistent table ZPurchDOCitem
lock dependent by _PoHeader
//authorization dependent by <association>
//etag master <field_name>
{
update;
delete;
association _PoHeader { } field( mandatory) Purchasedocument;
}
define behavior for Z_I_PurchmatItem alias PurchmatItem
persistent table ZPurchDOCmatitem
lock dependent by _PoHeader
//authorization dependent by <association>
//etag master <field_name>
{
update;
delete;
association _PoHeader { } field( mandatory) Purchasedocument;
}
projection;
define behavior for Z_C_PurchDocument alias PurchDocumen
{
use create;
use update;
use delete;
use association _poitem { create; }
use association _pomatitem { create; }
}
define behavior for Z_C_PURCHITEM alias PURCHITEM
{
use update;
use delete;
use association _PoHeader;
}
define behavior for Z_C_PURCHMATITEM alias PurchmatItem
{
use update;
use delete;
use association _PoHeader;
}
@EndUserText.label: 'Purschase order server definition'
define service Z_PurschaseOrder_SD {
expose Z_C_PurchDocument;
expose Z_C_PURCHITEM;
expose Z_C_PURCHMATITEM;
expose Z_I_PurchaseDocument;
expose Z_I_PurchItem;
expose Z_I_PURCHMATITEM;
}
FIELD-SYMBOLS: <lv_data> TYPE any.
LOOP AT it_original_data ASSIGNING <lv_data>.
* Set index
DATA(lv_index) = sy-tabix.
ASSIGN COMPONENT to_upper( 'UICT_POITEM_IS' ) OF STRUCTURE ct_calculated_data[ lv_index ] TO FIELD-SYMBOL(<lv_purcitem>).
IF <lv_purcitem> IS ASSIGNED .
<lv_purcitem> = abap_false.
ENDIF.
ASSIGN COMPONENT to_upper( 'UICT_POITEMMAT_IS' ) OF STRUCTURE ct_calculated_data[ lv_index ] TO FIELD-SYMBOL(<lv_purcmatitem>).
IF <lv_purcitem> IS ASSIGNED .
if sy-uname = 'XXXXXX'.
<lv_purcmatitem> = abap_true.
endif.
ENDIF.
ENDLOOP.
IF iv_entity EQ 'Z_I_PURCHASEDOCUMENT'.
INSERT |UICT_POITEM_IS| INTO TABLE et_requested_orig_elements.
INSERT |UICT_POITEMMAT_IS| INTO TABLE et_requested_orig_elements.
ENDIF.
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 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |