mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 22:03:59 +08:00
small adjustments - steampuncification (#1121)
* small adjustments * update * update
This commit is contained in:
parent
520a7f83b7
commit
5dc45966a2
97
src/01/00/02/z2ui5_cl_stmpncfctn_api.clas.locals_imp.abap
Normal file
97
src/01/00/02/z2ui5_cl_stmpncfctn_api.clas.locals_imp.abap
Normal file
|
@ -0,0 +1,97 @@
|
|||
*"* use this source file for the definition and implementation of
|
||||
*"* local helper classes, interface definitions and type
|
||||
*"* declarations
|
||||
|
||||
CLASS lcl_rfc_bapi DEFINITION CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS factory_rfc_destination
|
||||
IMPORTING
|
||||
destination TYPE clike
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE REF TO lcl_rfc_bapi.
|
||||
|
||||
METHODS bapi_message_getdetail
|
||||
IMPORTING
|
||||
id TYPE clike
|
||||
number TYPE clike
|
||||
textformat TYPE clike DEFAULT ``
|
||||
EXPORTING
|
||||
message TYPE string
|
||||
error TYPE string.
|
||||
|
||||
PROTECTED SECTION.
|
||||
|
||||
DATA mv_destination TYPE string.
|
||||
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS lcl_rfc_bapi IMPLEMENTATION.
|
||||
|
||||
METHOD factory_rfc_destination.
|
||||
|
||||
CREATE OBJECT r_result.
|
||||
r_result->mv_destination = destination.
|
||||
|
||||
TRY.
|
||||
|
||||
* DATA(lo_rfc_dest) = cl_rfc_destination_provider=>create_by_cloud_destination(
|
||||
* i_name = |FSD_RFC|
|
||||
** i_service_instance_name = |CA_EXTERNAL_API_SIN|
|
||||
* ).
|
||||
*
|
||||
* DATA(lv_rfc_dest) = lo_rfc_dest->get_destination_name( ).
|
||||
|
||||
CATCH cx_root.
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bapi_message_getdetail.
|
||||
|
||||
DATA lv_id TYPE c LENGTH 20.
|
||||
DATA lv_number TYPE n LENGTH 3.
|
||||
DATA lv_textformat TYPE c LENGTH 3.
|
||||
DATA lv_message TYPE c LENGTH 220.
|
||||
|
||||
lv_id = id.
|
||||
lv_number = number.
|
||||
lv_textformat = textformat.
|
||||
|
||||
* DATA(lo_rfc_dest) = cl_rfc_destination_provider=>create_by_cloud_destination(
|
||||
* i_name = |FSD_RFC|
|
||||
* i_service_instance_name = |CA_EXTERNAL_API_SIN| ).
|
||||
*
|
||||
* DATA(lv_rfc_dest) = lo_rfc_dest->get_destination_name( ).
|
||||
|
||||
TRY.
|
||||
|
||||
DATA(lv_fm_name) = `BAPI_MESSAGE_GETDETAIL`.
|
||||
CALL FUNCTION lv_fm_name
|
||||
DESTINATION mv_destination
|
||||
EXPORTING
|
||||
id = lv_id " Message class
|
||||
number = lv_number " Message number
|
||||
textformat = lv_textformat " Format of text to be displayed
|
||||
IMPORTING
|
||||
message = lv_message
|
||||
EXCEPTIONS
|
||||
error_message = 2
|
||||
OTHERS = 1. " Message Short Text
|
||||
IF sy-subrc <> 0.
|
||||
error = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
CATCH cx_root INTO DATA(x).
|
||||
error = abap_true.
|
||||
RETURN.
|
||||
ENDTRY.
|
||||
|
||||
message = lv_message.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
|
@ -71,3 +71,32 @@ CLASS ltcl_test IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltcl_rfc_bapi_test DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT
|
||||
RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS:
|
||||
first_test FOR TESTING RAISING cx_static_check.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltcl_rfc_bapi_test IMPLEMENTATION.
|
||||
|
||||
METHOD first_test.
|
||||
|
||||
DATA(lo_rfc) = lcl_rfc_bapi=>factory_rfc_destination( `NONE` ).
|
||||
|
||||
* lo_rfc->bapi_message_getdetail(
|
||||
* EXPORTING
|
||||
* id = 'LTVF_EXEC'
|
||||
* number = '014'
|
||||
** textformat = ''
|
||||
* IMPORTING
|
||||
* message = DATA(lv_message)
|
||||
* ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -222,7 +222,7 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
|
|||
simple_form2->label( `Feedback` ).
|
||||
simple_form2->link( text = `Contact`
|
||||
target = `_blank`
|
||||
href = `https://taplink.cc/oblomov` ).
|
||||
href = `https://github.com/oblomov-dev` ).
|
||||
|
||||
client->view_display( page2->stringify( ) ).
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user