
Centralised Transport Naming Standards |
Centralised Transport Naming Standards - Branch By Abstraction |
Centralised Transport Naming Standards – Service Now Integration |
Very few domains and data elements exist within the Steampunk (93 data elements, 22 domains at the time of writng this) and the advice from SAP is to create your own anyway. For even this small piece of development, I had to create 17 data elements and 17 domains. Not difficult of course, just time consuming. Naturally, as you build up your own environment, it would be wise to have a strategy as to how/when you create DDIC objects vs use your existing namespace ones.
Of course now the required data elements and domains are in place, the table definitions now needed to be adjusted accordingly, reflactoring the typing of fields to the newly created data elements. Also, system fields that we would orinarily take as granted are not in the standard guise, sy-mandt for example is not available - use abap.clnt instead. However, sy-subrc is thankfully there though!
An example of 1 table is below:
@EndUserText.label : 'Transport Naming Standards Statistics'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #ALLOWED
define table zcau_tr_nm_stats {
key mandt : abap.clnt not null;
key system_id : zcau_dev_sysid not null;
key transport_number : zcau_trkorr not null;
key id : zcau_id not null;
transport_type : zcau_transport_type;
transport_title : zcau_transport_title;
transport_user : zcau_transport_user;
transport_date : zcau_transport_date;
transport_time : zcau_transport_time;
error_code : zcau_tr_err_cde;
}
No ABAP generator as per on premise, so this involves a CDS views (should be two I believe now - interface and consumption?), plus the Business Definition and Implementation, then the Service Definition and Binding. The Fiori Elements UI is then accessed from the Service Binding. (No FLP currently I understand although on the roadmap).
I've aligned the objects alongside the RAP model in the diagram below as best as I understand them.
CLASS lcl_buffer DEFINITION.
* 1) define the data buffer
PUBLIC SECTION.
TYPES: BEGIN OF ty_buffer.
INCLUDE TYPE zcau_lndscpe_cfg AS data.
TYPES: flag TYPE c LENGTH 1,
END OF ty_buffer.
TYPES tt_config TYPE SORTED TABLE OF ty_buffer WITH UNIQUE KEY dev_system.
CLASS-DATA mt_buffer TYPE tt_config.
ENDCLASS.
CLASS lcl_handler DEFINITION final INHERITING FROM cl_abap_behavior_handler.
PRIVATE SECTION.
METHODS modify FOR BEHAVIOR IMPORTING
roots_to_create FOR CREATE landscape_config
roots_to_update FOR UPDATE landscape_config
roots_to_delete FOR DELETE landscape_config.
METHODS read FOR BEHAVIOR
IMPORTING it_config_key FOR READ landscape_config RESULT et_config.
METHODS lock FOR BEHAVIOR
IMPORTING it_config_key FOR LOCK landscape_config.
ENDCLASS.
This was an imported object that at least on the surface was successful
REPORT ZSTEAMPUNKTEST.
constants: lc_use_rfc type abap_bool value abap_false.
data: lo_http_client type ref to if_http_client,
lo_rest_client type ref to cl_rest_http_client,
lo_response type ref to if_rest_entity,
lo_request type ref to if_rest_entity,
lv_rfc_dest(20) type c,
lv_http_status type string,
lv_body type string,
lv_resp_data type string,
lv_resp_reason type string,
lv_resp_status type string,
lv_resp_code type i,
lv_resp_length type i,
lv_resp_type type string,
lt_resp_headers type tihttpnvp,
lv_msg type string,
lv_url type string.
"PLEASE REPLACE THE DOMAIN WITH YOUR INSTANCE DOMAIN
lv_url = `https://<enter your RL here>/sap/bc/http/sap/z_cau_check_transport_title/?sap-client=100`.
cl_http_client=>create_by_url(
exporting url = lv_url
ssl_id = 'ANONYM'
sap_client = '100'
importing client = lo_http_client
exceptions argument_not_found = 1
plugin_not_active = 2
internal_error = 3
pse_not_found = 4
pse_not_distrib = 5
pse_errors = 6
others = 7 ).
if sy-subrc ne 0.
lv_msg = 'Failed to create HTTP client: RC=' && sy-subrc.
write: / lv_msg color col_negative.
return.
endif.
lo_http_client->propertytype_accept_cookie = if_http_client=>co_enabled.
lo_http_client->propertytype_accept_compress = if_http_client=>co_enabled.
lo_http_client->authenticate( username = '<the username you setup>'
password = '<the password you setup>'
client = '100' ).
"?SET_OAUTH2C_INFO
lo_http_client->request->set_version( if_http_request=>co_protocol_version_1_1 ).
lo_http_client->request->set_header_field( name = 'connection' value = 'keep-alive' ).
"set other header values (optional)
lo_http_client->request->set_header_field( name = 'Content-Type'
value = 'text/xml; charset=utf-8' ).
"send GET/POST request (with default timeout)
"lo_http_client->request->set_method( if_http_request=>co_request_method_get ).
lo_http_client->request->set_method( if_http_request=>co_request_method_POST ).
lo_http_client->request->set_content_type( 'application/json;odata=verbose' ).
lo_http_client->request->set_cdata( `{ "tr_number":"PF2K000815", "tr_description":"My invalid test object"}` ).
lo_http_client->request->set_form_field( name = 'REQUEST' value = 'SYSK123456' ).
lo_http_client->request->set_form_field( name = 'TYPE' value = 'K' ).
lo_http_client->request->set_form_field( name = 'SYSID' value = 'NKP' ).
lo_http_client->request->set_form_field( name = 'TEXT' value = 'CAU:R1:INC0001234:Steampunk:1' ).
lo_http_client->request->set_form_field( name = 'OWNER' value = '<your userid>' ).
lo_http_client->send( timeout = if_http_client=>co_timeout_default ).
"read response
lo_http_client->receive( ).
lo_http_client->response->get_status(
importing code = lv_resp_code
reason = lv_resp_reason ).
lv_resp_status = lv_resp_code.
"dump response header
skip 1.
write: / 'HTTP Response Header' color col_heading.
lo_http_client->response->get_header_fields( changing fields = lt_resp_headers ).
loop at lt_resp_headers assigning field-symbol(<f>).
write: / `[`, <f>-name, `]`, at 40 <f>-value.
endloop.
"read response data
lv_resp_data = lo_http_client->response->get_cdata( ).
skip 1.
write: / 'Raw Response' color col_heading.
write: / lv_resp_data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 |