Initial commit
This commit is contained in:
44
src/ezdemo_abap_lock.enqu.xml
Normal file
44
src/ezdemo_abap_lock.enqu.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_ENQU" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD25V>
|
||||
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<AGGTYPE>E</AGGTYPE>
|
||||
<ROOTTAB>ZDEMO_ABAP_RAPT1</ROOTTAB>
|
||||
<DDTEXT>Lock on demo table</DDTEXT>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD25V>
|
||||
<DD26E_TABLE>
|
||||
<DD26E>
|
||||
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||
<TABPOS>0001</TABPOS>
|
||||
<FORTABNAME>ZDEMO_ABAP_RAPT1</FORTABNAME>
|
||||
<ENQMODE>E</ENQMODE>
|
||||
</DD26E>
|
||||
</DD26E_TABLE>
|
||||
<DD27P_TABLE>
|
||||
<DD27P>
|
||||
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||
<OBJPOS>0001</OBJPOS>
|
||||
<VIEWFIELD>CLIENT</VIEWFIELD>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||
<FIELDNAME>CLIENT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ENQMODE>E</ENQMODE>
|
||||
</DD27P>
|
||||
<DD27P>
|
||||
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||
<OBJPOS>0002</OBJPOS>
|
||||
<VIEWFIELD>KEY_FIELD</VIEWFIELD>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ENQMODE>E</ENQMODE>
|
||||
</DD27P>
|
||||
</DD27P_TABLE>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
11
src/package.devc.xml
Normal file
11
src/package.devc.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DEVC>
|
||||
<CTEXT>ABAP Cheat Sheets</CTEXT>
|
||||
<TPCLASS>X</TPCLASS>
|
||||
</DEVC>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
20
src/zbp_demo_abap_rap_draft_m.clas.abap
Normal file
20
src/zbp_demo_abap_rap_draft_m.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* RAP BO provider (i. e. ABAP behavior pool/ABP)
|
||||
* for a RAP demo scenario
|
||||
*
|
||||
* See more information in the CCIMP include (local types tab in ADT).
|
||||
*
|
||||
**********************************************************************
|
||||
"! <p class="shorttext synchronized">Behavior implementation for RAP demo scenario (draft BO)</p>
|
||||
"! The class represents a RAP BO provider (i. e. an ABAP behavior pool/ABP) for a RAP demo scenario
|
||||
"! (managed, draft-enabled RAP BO with late numbering).
|
||||
CLASS zbp_demo_abap_rap_draft_m DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF zdemo_abap_rap_draft_m.
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS zbp_demo_abap_rap_draft_m IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
234
src/zbp_demo_abap_rap_draft_m.clas.locals_imp.abap
Normal file
234
src/zbp_demo_abap_rap_draft_m.clas.locals_imp.abap
Normal file
@@ -0,0 +1,234 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* RAP BO provider (i. e. ABAP behavior pool/ABP)
|
||||
* for a RAP demo scenario
|
||||
*
|
||||
* - RAP scenario: "RAP calculator" (managed, draft-enabled RAP BO with
|
||||
* late numbering)
|
||||
* - Data model: Consists of a root entity alone.
|
||||
* The BDEF defines the behavior for this entity. The definitions in the
|
||||
* BDEF determine which methods must be implemented in the ABAP behavior
|
||||
* pool (ABP). Note that the view contains many annotations for the
|
||||
* SAP Fiori UI.
|
||||
*
|
||||
* ----------------------------- NOTE -----------------------------------
|
||||
* This simplified example is not a real life scenario and rather
|
||||
* focuses on the technical side by giving an idea how the communication
|
||||
* and data exchange between a RAP BO consumer, which is a class
|
||||
* in this case, and RAP BO provider can work. Additionally, it shows
|
||||
* how the methods for non-standard RAP BO operations might be
|
||||
* self-implemented in an ABP. The example is is intentionally kept
|
||||
* short and simple and focuses on specific RAP aspects. For this reason,
|
||||
* the example might not fully meet the requirements of the RAP BO contract.
|
||||
*
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
***********************************************************************
|
||||
|
||||
CLASS lhc_calc DEFINITION INHERITING FROM cl_abap_behavior_handler.
|
||||
PRIVATE SECTION.
|
||||
|
||||
METHODS delete_all FOR MODIFY
|
||||
IMPORTING keys FOR ACTION calc~delete_all.
|
||||
|
||||
METHODS get_global_authorizations FOR GLOBAL AUTHORIZATION
|
||||
IMPORTING REQUEST requested_authorizations FOR calc RESULT result.
|
||||
|
||||
METHODS validate FOR VALIDATE ON SAVE
|
||||
IMPORTING keys FOR calc~validate.
|
||||
|
||||
METHODS det_modify FOR DETERMINE ON MODIFY
|
||||
IMPORTING keys FOR calc~det_modify.
|
||||
|
||||
METHODS calculation FOR MODIFY
|
||||
IMPORTING keys FOR ACTION calc~calculation.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lhc_calc IMPLEMENTATION.
|
||||
|
||||
METHOD delete_all.
|
||||
"Purpose: The method deletes all persisted database entries.
|
||||
|
||||
DATA all_keys TYPE TABLE FOR DELETE zdemo_abap_rap_draft_m.
|
||||
|
||||
SELECT id FROM zdemo_abap_tabca INTO CORRESPONDING FIELDS OF TABLE @all_keys.
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_draft_m IN LOCAL MODE
|
||||
ENTITY calc
|
||||
ALL FIELDS WITH CORRESPONDING #( all_keys )
|
||||
RESULT DATA(lt_del).
|
||||
|
||||
IF lt_del IS NOT INITIAL.
|
||||
|
||||
MODIFY ENTITY IN LOCAL MODE zdemo_abap_rap_draft_m
|
||||
DELETE FROM CORRESPONDING #( lt_del ).
|
||||
|
||||
APPEND VALUE #( %msg = new_message_with_text( text = 'All persisted calculations were deleted.'
|
||||
severity = if_abap_behv_message=>severity-information )
|
||||
) TO reported-calc.
|
||||
|
||||
ELSE.
|
||||
APPEND VALUE #( %msg = new_message_with_text( text = 'No persisted calculations available.'
|
||||
severity = if_abap_behv_message=>severity-information )
|
||||
) TO reported-calc.
|
||||
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_global_authorizations.
|
||||
"Purposely kept without implementation.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD validate.
|
||||
|
||||
"Retrieving instances based on requested keys
|
||||
READ ENTITIES OF zdemo_abap_rap_draft_m IN LOCAL MODE
|
||||
ENTITY calc
|
||||
ALL FIELDS
|
||||
WITH CORRESPONDING #( keys )
|
||||
RESULT DATA(result_validate)
|
||||
FAILED DATA(f).
|
||||
|
||||
CHECK result_validate IS NOT INITIAL.
|
||||
|
||||
"Various calculation errors are handled.
|
||||
LOOP AT result_validate ASSIGNING FIELD-SYMBOL(<fs>).
|
||||
|
||||
APPEND VALUE #( %tky = <fs>-%tky
|
||||
%state_area = 'VALIDATE_CALCULATION'
|
||||
) TO reported-calc.
|
||||
|
||||
IF <fs>-calc_result = `Wrong operator`.
|
||||
APPEND VALUE #( %tky = <fs>-%tky ) TO failed-calc.
|
||||
|
||||
APPEND VALUE #( %tky = <fs>-%tky
|
||||
%state_area = 'VALIDATE_CALCULATION'
|
||||
%msg = new_message_with_text( text = 'Only + - * / P allowed as operators.'
|
||||
severity = if_abap_behv_message=>severity-error )
|
||||
"%element highlights the input field
|
||||
%element-arithm_op = if_abap_behv=>mk-on
|
||||
) TO reported-calc.
|
||||
|
||||
ELSEIF <fs>-calc_result = `Division by 0`.
|
||||
|
||||
APPEND VALUE #( %tky = <fs>-%tky ) TO failed-calc.
|
||||
|
||||
APPEND VALUE #( %tky = <fs>-%tky
|
||||
%state_area = 'VALIDATE_CALCULATION'
|
||||
%msg = new_message_with_text( text = 'Zero division not possible.'
|
||||
severity = if_abap_behv_message=>severity-error )
|
||||
%element-arithm_op = if_abap_behv=>mk-on
|
||||
%element-num2 = if_abap_behv=>mk-on
|
||||
) TO reported-calc.
|
||||
|
||||
ELSEIF <fs>-calc_result = `Overflow error`.
|
||||
|
||||
APPEND VALUE #( %tky = <fs>-%tky ) TO failed-calc.
|
||||
|
||||
APPEND VALUE #( %tky = <fs>-%tky
|
||||
%state_area = 'VALIDATE_CALCULATION'
|
||||
%msg = new_message_with_text( text = 'Check the numbers. Try smaller ones.'
|
||||
severity = if_abap_behv_message=>severity-error )
|
||||
%element-num1 = if_abap_behv=>mk-on
|
||||
%element-num2 = if_abap_behv=>mk-on
|
||||
) TO reported-calc.
|
||||
ENDIF.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD det_modify.
|
||||
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_draft_m IN LOCAL MODE
|
||||
ENTITY calc
|
||||
EXECUTE calculation
|
||||
FROM CORRESPONDING #( keys ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD calculation.
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_draft_m IN LOCAL MODE
|
||||
ENTITY calc
|
||||
FIELDS ( num1 num2 arithm_op ) WITH CORRESPONDING #( keys )
|
||||
RESULT DATA(lt_calc)
|
||||
FAILED DATA(f).
|
||||
|
||||
LOOP AT lt_calc ASSIGNING FIELD-SYMBOL(<calc>).
|
||||
|
||||
TRY.
|
||||
<calc>-calc_result = SWITCH #( <calc>-arithm_op
|
||||
WHEN `+` THEN <calc>-num1 + <calc>-num2
|
||||
WHEN `-` THEN <calc>-num1 - <calc>-num2
|
||||
WHEN `*` THEN <calc>-num1 * <calc>-num2
|
||||
WHEN `/` THEN <calc>-num1 / <calc>-num2
|
||||
WHEN `P` THEN ipow( base = <calc>-num1 exp = <calc>-num2 )
|
||||
ELSE `Wrong operator` ).
|
||||
"Bringing "-" to the front in case of negative values in the string
|
||||
IF <calc>-calc_result CA `-`.
|
||||
<calc>-calc_result = shift_right( val = <calc>-calc_result circular = 1 ).
|
||||
ENDIF.
|
||||
|
||||
"Removing trailing .0 from the string
|
||||
REPLACE PCRE `\.0+\b` IN <calc>-calc_result WITH ``.
|
||||
|
||||
"Handling the fact that ABAP allows division by zero if the dividend itself is zero.
|
||||
IF <calc>-num1 = 0 AND <calc>-num2 = 0 AND <calc>-arithm_op = `/`.
|
||||
<calc>-calc_result = `Division by 0`.
|
||||
ENDIF.
|
||||
|
||||
CATCH cx_sy_zerodivide.
|
||||
<calc>-calc_result = `Division by 0`.
|
||||
|
||||
CATCH cx_sy_arithmetic_overflow.
|
||||
<calc>-calc_result = `Overflow error`.
|
||||
|
||||
ENDTRY.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
MODIFY ENTITY IN LOCAL MODE zdemo_abap_rap_draft_m
|
||||
UPDATE FIELDS ( calc_result )
|
||||
WITH CORRESPONDING #( lt_calc ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lsc_zdemo_abap_rap_draft_m DEFINITION INHERITING FROM cl_abap_behavior_saver.
|
||||
PROTECTED SECTION.
|
||||
|
||||
METHODS adjust_numbers REDEFINITION.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lsc_zdemo_abap_rap_draft_m IMPLEMENTATION.
|
||||
|
||||
METHOD adjust_numbers.
|
||||
|
||||
"The newly created entity instances are given their final key
|
||||
"only shortly before saving in the database in the adjust_numbers method.
|
||||
"Until then, the business logic uses a temporary key that has to be replaced.
|
||||
"In this very simplified example, the key 'id' is purposely typed with the
|
||||
"type sysuuid_x16 which can accept the value used in %pid to finally ensure
|
||||
"that there is a unique key and the instance can be stored in the database.
|
||||
"Hence, the final key 'id' is in this example just the value used for %pid.
|
||||
LOOP AT mapped-calc ASSIGNING FIELD-SYMBOL(<fs>).
|
||||
<fs>-%key-id = <fs>-%pid.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
18
src/zbp_demo_abap_rap_draft_m.clas.xml
Normal file
18
src/zbp_demo_abap_rap_draft_m.clas.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZBP_DEMO_ABAP_RAP_DRAFT_M</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Behavior implementation for RAP demo scenario (draft BO)</DESCRIPT>
|
||||
<CATEGORY>06</CATEGORY>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
<CLSDEFINT>ZDEMO_ABAP_RAP_DRAFT_M</CLSDEFINT>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
20
src/zbp_demo_abap_rap_ro_m.clas.abap
Normal file
20
src/zbp_demo_abap_rap_ro_m.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* RAP BO provider (i. e. ABAP behavior pool/ABP)
|
||||
* for a RAP demo scenario
|
||||
*
|
||||
* See more information in the CCIMP include (local types tab in ADT).
|
||||
*
|
||||
**********************************************************************
|
||||
"! <p class="shorttext synchronized">Behavior implementation for RAP demo scenario (managed BO)</p>
|
||||
"! The class represents a RAP BO provider (i. e. an ABAP behavior pool/ABP) for a RAP demo scenario
|
||||
"! (managed RAP BO with external numbering).
|
||||
CLASS zbp_demo_abap_rap_ro_m DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF zdemo_abap_rap_ro_m.
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS zbp_demo_abap_rap_ro_m IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
123
src/zbp_demo_abap_rap_ro_m.clas.locals_imp.abap
Normal file
123
src/zbp_demo_abap_rap_ro_m.clas.locals_imp.abap
Normal file
@@ -0,0 +1,123 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* RAP BO provider (i. e. ABAP behavior pool/ABP)
|
||||
* for a RAP demo scenario
|
||||
*
|
||||
* - RAP scenario: managed RAP BO, external numbering
|
||||
* - Data model: Consists of a root entity and one child entity. The BDEF
|
||||
* defines the behavior for these two entities which are connected via
|
||||
* a CDS composition relation. The definitions in the BDEF determine
|
||||
* which methods must be implemented in this ABAP behavior pool (ABP).
|
||||
*
|
||||
* ----------------------------- NOTE -----------------------------------
|
||||
* This simplified example is not a real life scenario and rather
|
||||
* focuses on the technical side by giving an idea how the communication
|
||||
* and data exchange between a RAP BO consumer, which is a class
|
||||
* in this case, and RAP BO provider can work. Additionally, it shows
|
||||
* how the methods for non-standard RAP BO operations might be
|
||||
* self-implemented in an ABP. The example is is intentionally kept
|
||||
* short and simple and focuses on specific RAP aspects. For this reason,
|
||||
* the example might not fully meet the requirements of the RAP BO contract.
|
||||
*
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
***********************************************************************
|
||||
|
||||
CLASS lhc_root DEFINITION INHERITING FROM cl_abap_behavior_handler.
|
||||
PRIVATE SECTION.
|
||||
|
||||
METHODS get_global_authorizations FOR GLOBAL AUTHORIZATION
|
||||
IMPORTING REQUEST requested_authorizations FOR root RESULT result.
|
||||
|
||||
METHODS multiply_by_2 FOR MODIFY
|
||||
IMPORTING keys FOR ACTION root~multiply_by_2.
|
||||
|
||||
METHODS det_add_text FOR DETERMINE ON SAVE
|
||||
IMPORTING keys FOR root~det_add_text.
|
||||
|
||||
METHODS val FOR VALIDATE ON SAVE
|
||||
IMPORTING keys FOR root~val.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lhc_root IMPLEMENTATION.
|
||||
|
||||
METHOD get_global_authorizations.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD multiply_by_2.
|
||||
|
||||
"Retrieving instances based on requested keys
|
||||
READ ENTITIES OF zdemo_abap_rap_ro_m IN LOCAL MODE
|
||||
ENTITY root
|
||||
FIELDS ( field3 field4 ) WITH CORRESPONDING #( keys )
|
||||
RESULT DATA(result)
|
||||
FAILED failed.
|
||||
|
||||
"If read result is initial, stop further method execution.
|
||||
CHECK result IS NOT INITIAL.
|
||||
|
||||
"Multiply integer values by 2
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m IN LOCAL MODE
|
||||
ENTITY root
|
||||
UPDATE FIELDS ( field3 field4 ) WITH VALUE #( FOR key IN result ( %tky = key-%tky
|
||||
field3 = key-field3 * 2
|
||||
field4 = key-field4 * 2 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD det_add_text.
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_ro_m IN LOCAL MODE
|
||||
ENTITY root
|
||||
FIELDS ( field2 ) WITH CORRESPONDING #( keys )
|
||||
RESULT DATA(lt_res).
|
||||
|
||||
"If read result is initial, stop further method execution.
|
||||
CHECK lt_res IS NOT INITIAL.
|
||||
|
||||
"field2 is changed
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m IN LOCAL MODE
|
||||
ENTITY root
|
||||
UPDATE FIELDS ( field2 )
|
||||
WITH VALUE #( FOR key IN lt_res ( %tky = key-%tky
|
||||
field2 = |{ key-field2 }_#| ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD val.
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_ro_m IN LOCAL MODE
|
||||
ENTITY root
|
||||
FIELDS ( field3 ) WITH CORRESPONDING #( keys )
|
||||
RESULT DATA(lt_res).
|
||||
|
||||
"If read result is initial, stop further method execution.
|
||||
CHECK lt_res IS NOT INITIAL.
|
||||
|
||||
LOOP AT lt_res ASSIGNING FIELD-SYMBOL(<fs_res>).
|
||||
IF <fs_res>-field3 > 1000.
|
||||
APPEND VALUE #( %tky = <fs_res>-%tky
|
||||
%fail-cause = if_abap_behv=>cause-disabled
|
||||
)
|
||||
TO failed-root.
|
||||
|
||||
APPEND VALUE #( %tky = <fs_res>-%tky
|
||||
%msg = new_message_with_text(
|
||||
severity = if_abap_behv_message=>severity-error
|
||||
text = 'Validation failed!' )
|
||||
) TO reported-root.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
18
src/zbp_demo_abap_rap_ro_m.clas.xml
Normal file
18
src/zbp_demo_abap_rap_ro_m.clas.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZBP_DEMO_ABAP_RAP_RO_M</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Behavior implementation for RAP demo scenario (managed BO)</DESCRIPT>
|
||||
<CATEGORY>06</CATEGORY>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
<CLSDEFINT>ZDEMO_ABAP_RAP_RO_M</CLSDEFINT>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
20
src/zbp_demo_abap_rap_ro_u.clas.abap
Normal file
20
src/zbp_demo_abap_rap_ro_u.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* RAP BO provider (i. e. ABAP behavior pool/ABP)
|
||||
* for a RAP demo scenario
|
||||
*
|
||||
* See more information in the CCIMP include (local types tab in ADT).
|
||||
*
|
||||
**********************************************************************
|
||||
"! <p class="shorttext synchronized">Behavior implementation for RAP demo scenario (unmanaged BO)</p>
|
||||
"! The class represents a RAP BO provider (i. e. an ABAP behavior pool/ABP) for a RAP demo scenario
|
||||
"! (unmanaged RAP BO with external numbering).
|
||||
CLASS zbp_demo_abap_rap_ro_u DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF zdemo_abap_rap_ro_u.
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS zbp_demo_abap_rap_ro_u IMPLEMENTATION.
|
||||
ENDCLASS.
|
||||
1023
src/zbp_demo_abap_rap_ro_u.clas.locals_imp.abap
Normal file
1023
src/zbp_demo_abap_rap_ro_u.clas.locals_imp.abap
Normal file
File diff suppressed because it is too large
Load Diff
18
src/zbp_demo_abap_rap_ro_u.clas.xml
Normal file
18
src/zbp_demo_abap_rap_ro_u.clas.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZBP_DEMO_ABAP_RAP_RO_U</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Behavior implementation for RAP demo scenario (unmanaged BO)</DESCRIPT>
|
||||
<CATEGORY>06</CATEGORY>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
<CLSDEFINT>ZDEMO_ABAP_RAP_RO_U</CLSDEFINT>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1277
src/zcl_demo_abap_constructor_expr.clas.abap
Normal file
1277
src/zcl_demo_abap_constructor_expr.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
27
src/zcl_demo_abap_constructor_expr.clas.locals_imp.abap
Normal file
27
src/zcl_demo_abap_constructor_expr.clas.locals_imp.abap
Normal file
@@ -0,0 +1,27 @@
|
||||
CLASS local_class DEFINITION.
|
||||
PUBLIC SECTION.
|
||||
METHODS: constructor IMPORTING txt TYPE string,
|
||||
double IMPORTING int TYPE
|
||||
REF TO i RETURNING VALUE(res) TYPE i.
|
||||
|
||||
DATA: timestamp TYPE string,
|
||||
text TYPE string.
|
||||
|
||||
CLASS-DATA: no_of_instances TYPE i READ-ONLY.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS local_class IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
"Number of instances of the class are counted.
|
||||
no_of_instances = no_of_instances + 1.
|
||||
"Set a time stamp.
|
||||
DATA: ts TYPE timestampl.
|
||||
GET TIME STAMP FIELD ts.
|
||||
timestamp = |{ ts TIMESTAMP = SPACE }|.
|
||||
|
||||
text = |{ txt }, { sy-uname }.|.
|
||||
ENDMETHOD.
|
||||
METHOD double.
|
||||
res = int->* * 2.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_constructor_expr.clas.xml
Normal file
16
src/zcl_demo_abap_constructor_expr.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_CONSTRUCTOR_EXPR</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: Constructor expressions</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
201
src/zcl_demo_abap_display.clas.abap
Normal file
201
src/zcl_demo_abap_display.clas.abap
Normal file
@@ -0,0 +1,201 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* Class for ABAP cheat sheet examples
|
||||
*
|
||||
* -------------------------- NOTE -------------------------------------
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
*
|
||||
***********************************************************************
|
||||
"! <p class="shorttext synchronized">Class for ABAP cheat sheet examples</p>
|
||||
"! The class supports the displaying of output of the ABAP cheat sheet examples.
|
||||
CLASS zcl_demo_abap_display DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS:
|
||||
constructor
|
||||
IMPORTING
|
||||
io_out TYPE REF TO if_oo_adt_classrun_out,
|
||||
display
|
||||
IMPORTING
|
||||
input TYPE data
|
||||
name TYPE string DEFAULT ``
|
||||
RETURNING
|
||||
VALUE(output) TYPE string,
|
||||
next_section
|
||||
IMPORTING
|
||||
heading TYPE string.
|
||||
|
||||
protected section.
|
||||
PRIVATE SECTION.
|
||||
DATA:
|
||||
mo_out TYPE REF TO if_oo_adt_classrun_out,
|
||||
offset TYPE i.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS ZCL_DEMO_ABAP_DISPLAY IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD constructor.
|
||||
mo_out = io_out.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD display.
|
||||
|
||||
"Checking data type
|
||||
DATA(type_descr) = cl_abap_typedescr=>describe_by_data( input ).
|
||||
|
||||
CASE type_descr->kind.
|
||||
|
||||
WHEN cl_abap_typedescr=>kind_struct.
|
||||
|
||||
DATA(struct_descr) = CAST cl_abap_structdescr( type_descr ).
|
||||
|
||||
"Checking for complex output
|
||||
IF struct_descr->struct_kind = cl_abap_structdescr=>structkind_nested
|
||||
OR line_exists( struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_table ] )
|
||||
OR line_exists( struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_dref ] )
|
||||
OR line_exists( struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_oref ] ).
|
||||
|
||||
DATA(to_be_serialized) = abap_true.
|
||||
|
||||
ELSE.
|
||||
|
||||
DATA(display) = mo_out->get( data = input name = name ).
|
||||
|
||||
ENDIF.
|
||||
|
||||
WHEN cl_abap_typedescr=>kind_table.
|
||||
|
||||
DATA(table_descr) = CAST cl_abap_tabledescr( type_descr ).
|
||||
|
||||
TRY.
|
||||
DATA(line_type_struct_descr) = CAST cl_abap_structdescr( table_descr->get_table_line_type( ) ).
|
||||
|
||||
"Checking for complex output
|
||||
IF line_type_struct_descr->struct_kind = cl_abap_structdescr=>structkind_nested
|
||||
OR line_exists( line_type_struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_table ] )
|
||||
OR line_exists( line_type_struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_dref ] )
|
||||
OR line_exists( line_type_struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_oref ] ).
|
||||
|
||||
to_be_serialized = abap_true.
|
||||
|
||||
ELSE.
|
||||
|
||||
display = mo_out->get( data = input name = name ).
|
||||
|
||||
ENDIF.
|
||||
|
||||
CATCH cx_sy_move_cast_error.
|
||||
|
||||
to_be_serialized = abap_true.
|
||||
|
||||
ENDTRY.
|
||||
|
||||
WHEN cl_abap_typedescr=>kind_class.
|
||||
|
||||
to_be_serialized = abap_true.
|
||||
|
||||
WHEN cl_abap_typedescr=>kind_intf.
|
||||
|
||||
to_be_serialized = abap_true.
|
||||
|
||||
WHEN cl_abap_typedescr=>kind_elem.
|
||||
|
||||
display = mo_out->get( data = COND string( WHEN name IS INITIAL THEN input ELSE `"` && name && `":` && cl_abap_char_utilities=>newline && input ) ).
|
||||
|
||||
WHEN cl_abap_typedescr=>kind_ref.
|
||||
|
||||
"Checking for data references
|
||||
IF type_descr->type_kind = cl_abap_typedescr=>typekind_dref.
|
||||
|
||||
"Checking type of dereferenced data object
|
||||
DATA(type_check_dref) = cl_abap_typedescr=>describe_by_data( input->* ).
|
||||
|
||||
"Processing (non-)elementary types
|
||||
IF type_check_dref->kind = type_descr->kind_elem.
|
||||
|
||||
display = mo_out->get( data = COND string( WHEN name IS INITIAL THEN input->* ELSE `"` && name && `":` && cl_abap_char_utilities=>newline && input->* ) ).
|
||||
|
||||
ELSE.
|
||||
|
||||
to_be_serialized = abap_true.
|
||||
|
||||
ENDIF.
|
||||
|
||||
ELSE.
|
||||
to_be_serialized = abap_true.
|
||||
ENDIF.
|
||||
|
||||
ENDCASE.
|
||||
|
||||
"Processing complex output by serializiation
|
||||
FIND SUBSTRING `Data type not yet supported ...` IN display MATCH OFFSET DATA(off) MATCH LENGTH DATA(len).
|
||||
|
||||
IF sy-subrc = 0 OR to_be_serialized = abap_true.
|
||||
|
||||
"ABAP JSON serializing
|
||||
DATA(json) = /ui2/cl_json=>serialize( data = input
|
||||
pretty_name = /ui2/cl_json=>pretty_mode-low_case
|
||||
compress = abap_false
|
||||
hex_as_base64 = abap_false
|
||||
format_output = abap_true
|
||||
assoc_arrays = abap_true
|
||||
assoc_arrays_opt = abap_true ).
|
||||
|
||||
IF to_be_serialized = abap_true.
|
||||
|
||||
IF name IS INITIAL.
|
||||
REPLACE PCRE `^` IN display WITH json && cl_abap_char_utilities=>newline.
|
||||
ELSE.
|
||||
REPLACE PCRE `^` IN display WITH `"` && name && `":` && cl_abap_char_utilities=>newline && json && cl_abap_char_utilities=>newline.
|
||||
|
||||
ENDIF.
|
||||
|
||||
"substring found
|
||||
ELSE.
|
||||
IF name IS INITIAL.
|
||||
REPLACE SECTION OFFSET off LENGTH len OF display WITH json && cl_abap_char_utilities=>newline.
|
||||
ELSE.
|
||||
REPLACE SECTION OFFSET off LENGTH len OF display WITH `"` && name && `":` && cl_abap_char_utilities=>newline && json && cl_abap_char_utilities=>newline.
|
||||
ENDIF.
|
||||
|
||||
ENDIF.
|
||||
|
||||
mo_out->write( display ).
|
||||
|
||||
ELSE.
|
||||
|
||||
mo_out->write( display ).
|
||||
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD next_section.
|
||||
|
||||
mo_out->write( `_________________________________________________________________________________`
|
||||
&& cl_abap_char_utilities=>newline
|
||||
&& cl_abap_char_utilities=>newline
|
||||
&& heading
|
||||
&& cl_abap_char_utilities=>newline ).
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_display.clas.xml
Normal file
16
src/zcl_demo_abap_display.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_DISPLAY</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Class for ABAP cheat sheet examples</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1211
src/zcl_demo_abap_dynamic_prog.clas.abap
Normal file
1211
src/zcl_demo_abap_dynamic_prog.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
228
src/zcl_demo_abap_dynamic_prog.clas.locals_imp.abap
Normal file
228
src/zcl_demo_abap_dynamic_prog.clas.locals_imp.abap
Normal file
@@ -0,0 +1,228 @@
|
||||
CLASS lcl_det_at_runtime DEFINITION.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS:
|
||||
get_dyn_table_name RETURNING VALUE(tab) TYPE string,
|
||||
get_dyn_dobj RETURNING VALUE(dobj) TYPE string,
|
||||
get_dyn_field RETURNING VALUE(field) TYPE string,
|
||||
get_dyn_select_list RETURNING VALUE(list) TYPE string,
|
||||
get_dyn_where_clause RETURNING VALUE(clause_tab) TYPE string_table,
|
||||
get_dyn_class RETURNING VALUE(cl) TYPE string,
|
||||
get_random_type RETURNING VALUE(random_type) TYPE string.
|
||||
|
||||
CLASS-DATA: string1 TYPE string,
|
||||
string2 TYPE string,
|
||||
string3 TYPE string.
|
||||
|
||||
TYPES: type1 TYPE p LENGTH 8 DECIMALS 2, "elementary type
|
||||
type2 TYPE zdemo_abap_carr, "structure type
|
||||
type3 TYPE TABLE OF zdemo_abap_flsch, "internal table type
|
||||
type4 TYPE REF TO lcl_det_at_runtime. "reference type
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_det_at_runtime IMPLEMENTATION.
|
||||
METHOD get_dyn_table_name.
|
||||
|
||||
"Providing DDIC table names in a string table to be selected from.
|
||||
DATA(flight_tables) = VALUE string_table(
|
||||
( `ZDEMO_ABAP_CARR` ) ( `ZDEMO_ABAP_FLSCH` ) ( `ZDEMO_ABAP_FLI` ) ).
|
||||
|
||||
"Getting random number to determine the table index at runtime.
|
||||
DATA(random) = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1
|
||||
max = lines( flight_tables ) ).
|
||||
DATA(idx) = random->get_next( ).
|
||||
|
||||
"Returning parameter to receive the random table name.
|
||||
TRY.
|
||||
tab = flight_tables[ idx ].
|
||||
CATCH cx_sy_itab_line_not_found INTO DATA(error).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_dyn_dobj.
|
||||
|
||||
"Providing strings with demo content.
|
||||
string1 = |Hallo, { sy-uname }. | &&
|
||||
|This is string1.|.
|
||||
string2 = |Hallo, { sy-uname }. | &&
|
||||
|This is string2.|.
|
||||
string3 = |Hallo, { sy-uname }. | &&
|
||||
|This is string3.|.
|
||||
|
||||
"Filling table with data object names.
|
||||
DATA(str_tab) = VALUE string_table(
|
||||
( `STRING1` ) ( `STRING2` ) ( `STRING3` ) ).
|
||||
|
||||
"Getting random number to determine the table index at runtime.
|
||||
DATA(random) = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1
|
||||
max = lines( str_tab ) ).
|
||||
DATA(idx) = random->get_next( ).
|
||||
|
||||
"Returning parameter to receive the random data object name.
|
||||
TRY.
|
||||
dobj = str_tab[ idx ].
|
||||
CATCH cx_sy_itab_line_not_found INTO DATA(error).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_dyn_field.
|
||||
|
||||
"Getting list of components of DDIC type zdemo_abap_carr
|
||||
DATA(comp) = CAST cl_abap_structdescr(
|
||||
cl_abap_typedescr=>describe_by_name(
|
||||
'ZDEMO_ABAP_CARR' )
|
||||
)->components.
|
||||
|
||||
"Getting random number to determine the table index at runtime.
|
||||
"Starting from 2 to exclude MANDT field
|
||||
DATA(random) = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 2
|
||||
max = lines( comp ) ).
|
||||
DATA(idx) = random->get_next( ).
|
||||
|
||||
"Returning parameter to receive the random component name.
|
||||
TRY.
|
||||
field = comp[ idx ]-name.
|
||||
CATCH cx_sy_itab_line_not_found INTO DATA(error).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_dyn_select_list.
|
||||
|
||||
"Providing SELECT lists in a string table to be selected from.
|
||||
DATA sel_list_tab TYPE string_table.
|
||||
sel_list_tab = VALUE #(
|
||||
( `CARRID, CONNID, COUNTRYFR, COUNTRYTO` )
|
||||
( `CARRID, CONNID, CITYFROM, CITYTO` )
|
||||
( `CARRID, CONNID, AIRPFROM, AIRPTO` )
|
||||
( `CARRID, CONNID, AIRPFROM, AIRPTO, ` &&
|
||||
`FLTIME, DEPTIME, ARRTIME, DISTANCE` )
|
||||
).
|
||||
|
||||
"Getting random number to determine the table index at runtime.
|
||||
DATA(random) = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1
|
||||
max = lines( sel_list_tab ) ).
|
||||
DATA(idx) = random->get_next( ).
|
||||
|
||||
"Returning parameter to receive the random SELECT list.
|
||||
TRY.
|
||||
list = sel_list_tab[ idx ].
|
||||
CATCH cx_sy_itab_line_not_found INTO DATA(error).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_dyn_where_clause.
|
||||
|
||||
"Providing WHERE clauses in a table to be selected from.
|
||||
DATA: BEGIN OF where_struc,
|
||||
where_clause_tab TYPE string_table,
|
||||
END OF where_struc.
|
||||
|
||||
DATA where_itab LIKE TABLE OF where_struc WITH EMPTY KEY.
|
||||
|
||||
where_itab = VALUE #(
|
||||
( where_clause_tab = VALUE #( ( `CARRID = 'LH'` )
|
||||
( `OR CARRID = 'AA'` ) ) )
|
||||
( where_clause_tab = VALUE #( ( `CONNID BETWEEN 0 AND 300` ) ) )
|
||||
( where_clause_tab = VALUE #( ( `CITYFROM LIKE '%FRA%'` ) ) )
|
||||
( where_clause_tab =
|
||||
VALUE #( ( `DISTANCE > 500 AND DISTID = 'KM'` ) ) ) ).
|
||||
|
||||
"Getting random number to determine the table index at runtime.
|
||||
DATA(random) = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1
|
||||
max = lines( where_itab ) ).
|
||||
DATA(idx) = random->get_next( ).
|
||||
|
||||
"Returning parameter to receive the random WHERE clause.
|
||||
TRY.
|
||||
clause_tab = where_itab[ idx ]-where_clause_tab.
|
||||
CATCH cx_sy_itab_line_not_found INTO DATA(error).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_dyn_class.
|
||||
|
||||
"Providing class names in a string table to be selected from.
|
||||
DATA(class_tab) = VALUE string_table(
|
||||
( `LCL_DET_AT_RUNTIME` )
|
||||
( `LCL_DUMMY` ) ).
|
||||
|
||||
"Getting random number to determine the table index at runtime.
|
||||
DATA(random) = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1
|
||||
max = lines( class_tab ) ).
|
||||
DATA(idx) = random->get_next( ).
|
||||
|
||||
"Returning parameter to receive the random class name.
|
||||
TRY.
|
||||
cl = class_tab[ idx ].
|
||||
CATCH cx_sy_itab_line_not_found INTO DATA(error).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_random_type.
|
||||
|
||||
"Providing names of classes in a string table to be selected from.
|
||||
"Note that in this example types are defined in the public section
|
||||
"of a class and the program logic is included in another class.
|
||||
"To be able to refer to the types, the class name is added.
|
||||
DATA(str_tab) = VALUE string_table(
|
||||
( `LCL_DET_AT_RUNTIME=>TYPE1` )
|
||||
( `LCL_DET_AT_RUNTIME=>TYPE2` )
|
||||
( `LCL_DET_AT_RUNTIME=>TYPE3` )
|
||||
( `LCL_DET_AT_RUNTIME=>TYPE4` )
|
||||
( `LCL_DET_AT_RUNTIME` )
|
||||
( `IF_OO_ADT_CLASSRUN` ) ).
|
||||
|
||||
"Getting random number to determine the table index at runtime.
|
||||
DATA(random) = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1
|
||||
max = lines( str_tab ) ).
|
||||
DATA(idx) = random->get_next( ).
|
||||
|
||||
"Returning parameter to receive the random type name.
|
||||
TRY.
|
||||
random_type = str_tab[ idx ].
|
||||
CATCH cx_sy_itab_line_not_found INTO DATA(error).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_dummy DEFINITION.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS:
|
||||
meth_a IMPORTING imp TYPE i
|
||||
EXPORTING exp TYPE i
|
||||
RETURNING VALUE(str) TYPE string,
|
||||
meth_b CHANGING ch TYPE string
|
||||
RETURNING VALUE(str) TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_dummy IMPLEMENTATION.
|
||||
METHOD meth_a.
|
||||
str = |Hallo from meth_a.|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD meth_b.
|
||||
str = |Hallo from meth_b.|.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_dynamic_prog.clas.xml
Normal file
16
src/zcl_demo_abap_dynamic_prog.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_DYNAMIC_PROG</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: Dynamic programming</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
711
src/zcl_demo_abap_flight_tables.clas.abap
Normal file
711
src/zcl_demo_abap_flight_tables.clas.abap
Normal file
@@ -0,0 +1,711 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* Class for clearing and filling demo database tables used in the
|
||||
* context of ABAP cheat sheets
|
||||
*
|
||||
* -------------------------- NOTE -------------------------------------
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
*
|
||||
***********************************************************************
|
||||
"! <p class="shorttext synchronized">Class for ABAP cheat sheet examples</p>
|
||||
"! The class is meant to clear and fill demo database tables used in the context of ABAP cheat sheet examples.
|
||||
"! The demo database tables contain airline and flight information.
|
||||
CLASS zcl_demo_abap_flight_tables DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS: clear_dbtabs,
|
||||
fill_dbtabs.
|
||||
|
||||
protected section.
|
||||
private section.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS ZCL_DEMO_ABAP_FLIGHT_TABLES IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD clear_dbtabs.
|
||||
DELETE FROM zdemo_abap_flsch.
|
||||
DELETE FROM zdemo_abap_carr.
|
||||
DELETE FROM zdemo_abap_fli.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD fill_dbtabs.
|
||||
|
||||
"Clearing db tables before filling
|
||||
clear_dbtabs( ).
|
||||
|
||||
"Filling db table
|
||||
MODIFY zdemo_abap_flsch FROM TABLE @( VALUE #(
|
||||
( carrid = 'AA'
|
||||
connid = 0017
|
||||
countryfr = 'US'
|
||||
cityfrom = 'NEW YORK'
|
||||
airpfrom = 'JFK'
|
||||
countryto = 'US'
|
||||
cityto = 'SAN FRANCISCO'
|
||||
airpto = 'SFO'
|
||||
fltime = 361
|
||||
deptime = '110000'
|
||||
arrtime = '140100'
|
||||
distance = 2572
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'AA'
|
||||
connid = 0064
|
||||
countryfr = 'US'
|
||||
cityfrom = 'SAN FRANCISCO'
|
||||
airpfrom = 'SFO'
|
||||
countryto = 'US'
|
||||
cityto = 'NEW YORK'
|
||||
airpto = 'JFK'
|
||||
fltime = 321
|
||||
deptime = '090000'
|
||||
arrtime = '172100'
|
||||
distance = 2572
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0555
|
||||
countryfr = 'IT'
|
||||
cityfrom = 'ROME'
|
||||
airpfrom = 'FCO'
|
||||
countryto = 'DE'
|
||||
cityto = 'FRANKFURT'
|
||||
airpto = 'FRA'
|
||||
fltime = 125
|
||||
deptime = '190000'
|
||||
arrtime = '210500'
|
||||
distance = 845
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0788
|
||||
countryfr = 'IT'
|
||||
cityfrom = 'ROME'
|
||||
airpfrom = 'FCO'
|
||||
countryto = 'JP'
|
||||
cityto = 'TOKYO'
|
||||
airpto = 'TYO'
|
||||
fltime = 775
|
||||
deptime = '120000'
|
||||
arrtime = '085500'
|
||||
distance = 6130
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 1 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0789
|
||||
countryfr = 'JP'
|
||||
cityfrom = 'TOKYO'
|
||||
airpfrom = 'TYO'
|
||||
countryto = 'IT'
|
||||
cityto = 'ROME'
|
||||
airpto = 'FCO'
|
||||
fltime = 940
|
||||
deptime = '114500'
|
||||
arrtime = '192500'
|
||||
distance = 6130
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0790
|
||||
countryfr = 'IT'
|
||||
cityfrom = 'ROME'
|
||||
airpfrom = 'FCO'
|
||||
countryto = 'JP'
|
||||
cityto = 'OSAKA'
|
||||
airpto = 'KIX'
|
||||
fltime = 815
|
||||
deptime = '103500'
|
||||
arrtime = '081000'
|
||||
distance = 6030
|
||||
distid = 'MI'
|
||||
fltype = 'X'
|
||||
period = 1 )
|
||||
( carrid = 'DL'
|
||||
connid = 0106
|
||||
countryfr = 'US'
|
||||
cityfrom = 'NEW YORK'
|
||||
airpfrom = 'JFK'
|
||||
countryto = 'DE'
|
||||
cityto = 'FRANKFURT'
|
||||
airpto = 'FRA'
|
||||
fltime = 475
|
||||
deptime = '193500'
|
||||
arrtime = '093000'
|
||||
distance = 3851
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 1 )
|
||||
( carrid = 'DL'
|
||||
connid = 1699
|
||||
countryfr = 'US'
|
||||
cityfrom = 'NEW YORK'
|
||||
airpfrom = 'JFK'
|
||||
countryto = 'US'
|
||||
cityto = 'SAN FRANCISCO'
|
||||
airpto = 'SFO'
|
||||
fltime = 382
|
||||
deptime = '171500'
|
||||
arrtime = '203700'
|
||||
distance = 2572
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'DL'
|
||||
connid = 1984
|
||||
countryfr = 'US'
|
||||
cityfrom = 'SAN FRANCISCO'
|
||||
airpfrom = 'SFO'
|
||||
countryto = 'US'
|
||||
cityto = 'NEW YORK'
|
||||
airpto = 'JFK'
|
||||
fltime = 325
|
||||
deptime = '100000'
|
||||
arrtime = '182500'
|
||||
distance = 2572
|
||||
distid = 'MI'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'JL'
|
||||
connid = 0407
|
||||
countryfr = 'JP'
|
||||
cityfrom = 'TOKYO'
|
||||
airpfrom = 'NRT'
|
||||
countryto = 'DE'
|
||||
cityto = 'FRANKFURT'
|
||||
airpto = 'FRA'
|
||||
fltime = 725
|
||||
deptime = '133000'
|
||||
arrtime = '173500'
|
||||
distance = 9100
|
||||
distid = 'KM'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'JL'
|
||||
connid = 0408
|
||||
countryfr = 'DE'
|
||||
cityfrom = 'FRANKFURT'
|
||||
airpfrom = 'FRA'
|
||||
countryto = 'JP'
|
||||
cityto = 'TOKYO'
|
||||
airpto = 'NRT'
|
||||
fltime = 675
|
||||
deptime = '202500'
|
||||
arrtime = '154000'
|
||||
distance = 9100
|
||||
distid = 'KM'
|
||||
fltype = 'X'
|
||||
period = 1 )
|
||||
( carrid = 'LH'
|
||||
connid = 0400
|
||||
countryfr = 'DE'
|
||||
cityfrom = 'FRANKFURT'
|
||||
airpfrom = 'FRA'
|
||||
countryto = 'US'
|
||||
cityto = 'NEW YORK'
|
||||
airpto = 'JFK'
|
||||
fltime = 444
|
||||
deptime = '101000'
|
||||
arrtime = '113400'
|
||||
distance = 6162
|
||||
distid = 'KM'
|
||||
fltype = ''
|
||||
period = 0 )
|
||||
( carrid = 'LH'
|
||||
connid = 0401
|
||||
countryfr = 'US'
|
||||
cityfrom = 'NEW YORK'
|
||||
airpfrom = 'JFK'
|
||||
countryto = 'DE'
|
||||
cityto = 'FRANKFURT'
|
||||
airpto = 'FRA'
|
||||
fltime = 435
|
||||
deptime = '183000'
|
||||
arrtime = '074500'
|
||||
distance = 6162
|
||||
distid = 'KM'
|
||||
fltype = ''
|
||||
period = 1 )
|
||||
( carrid = 'LH'
|
||||
connid = 0402
|
||||
countryfr = 'DE'
|
||||
cityfrom = 'FRANKFURT'
|
||||
airpfrom = 'FRA'
|
||||
countryto = 'US'
|
||||
cityto = 'NEW YORK'
|
||||
airpto = 'JFK'
|
||||
fltime = 455
|
||||
deptime = '133000'
|
||||
arrtime = '150500'
|
||||
distance = 6162
|
||||
distid = 'KM'
|
||||
fltype = 'X'
|
||||
period = 0 )
|
||||
( carrid = 'LH'
|
||||
connid = 2402
|
||||
countryfr = 'DE'
|
||||
cityfrom = 'FRANKFURT'
|
||||
airpfrom = 'FRA'
|
||||
countryto = 'DE'
|
||||
cityto = 'BERLIN'
|
||||
airpto = 'SXF'
|
||||
fltime = 65
|
||||
deptime = '103000'
|
||||
arrtime = '113500'
|
||||
distance = 555
|
||||
distid = 'KM'
|
||||
fltype = ''
|
||||
period = 0 ) ) ).
|
||||
|
||||
"Filling db table
|
||||
MODIFY zdemo_abap_carr FROM TABLE @( VALUE #(
|
||||
( carrid = 'AA'
|
||||
carrname = 'American Airlines'
|
||||
currcode = 'USD'
|
||||
url = 'http://www.aa.com' )
|
||||
( carrid = 'LH'
|
||||
carrname = 'Lufthansa'
|
||||
currcode = 'EUR'
|
||||
url = 'http://www.lufthansa.com' )
|
||||
( carrid = 'JL'
|
||||
carrname = 'Japan Airlines'
|
||||
currcode = 'JPY'
|
||||
url = 'http://www.jal.co.jp' )
|
||||
( carrid = 'DL'
|
||||
carrname = 'Delta Airlines'
|
||||
currcode = 'USD'
|
||||
url = 'http://www.delta-air.com' )
|
||||
( carrid = 'AZ'
|
||||
carrname = 'ITA Airways'
|
||||
currcode = 'EUR'
|
||||
url = 'http://www.ita-airways.com' ) ) ).
|
||||
|
||||
"Filling db table
|
||||
MODIFY zdemo_abap_fli FROM TABLE @( VALUE #(
|
||||
( carrid = 'AA'
|
||||
connid = 0017
|
||||
fldate = '20230923'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = '747-400'
|
||||
seatsmax = 385
|
||||
seatsocc = 369
|
||||
paymentsum = '191993.87'
|
||||
seatsmax_b = 31
|
||||
seatsocc_b = 31
|
||||
seatsmax_f = 21
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'AA'
|
||||
connid = 0017
|
||||
fldate = '20230929'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = '747-400'
|
||||
seatsmax = 385
|
||||
seatsocc = 372
|
||||
paymentsum = '193537.52'
|
||||
seatsmax_b = 31
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 21
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'AA'
|
||||
connid = 0017
|
||||
fldate = '20231111'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = '747-400'
|
||||
seatsmax = 385
|
||||
seatsocc = 374
|
||||
paymentsum = '193651.77'
|
||||
seatsmax_b = 31
|
||||
seatsocc_b = 29
|
||||
seatsmax_f = 21
|
||||
seatsocc_f = 21 )
|
||||
( carrid = 'AA'
|
||||
connid = 0064
|
||||
fldate = '20220131'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = 'A340-600'
|
||||
seatsmax = 330
|
||||
seatsocc = 313
|
||||
paymentsum = '168469.88'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'AA'
|
||||
connid = 0064
|
||||
fldate = '20220215'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = 'A340-600'
|
||||
seatsmax = 330
|
||||
seatsocc = 157
|
||||
paymentsum = '84846.15'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 15
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 10 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0555
|
||||
fldate = '20230721'
|
||||
price = '226.41'
|
||||
currency = 'EUR'
|
||||
planetype = 'A319-100'
|
||||
seatsmax = 120
|
||||
seatsocc = 114
|
||||
paymentsum = '26519.75'
|
||||
seatsmax_b = 8
|
||||
seatsocc_b = 8
|
||||
seatsmax_f = 8
|
||||
seatsocc_f = 8 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0555
|
||||
fldate = '20230728'
|
||||
price = '226.41'
|
||||
currency = 'EUR'
|
||||
planetype = 'A319-100'
|
||||
seatsmax = 120
|
||||
seatsocc = 115
|
||||
paymentsum = '16695.50'
|
||||
seatsmax_b = 8
|
||||
seatsocc_b = 8
|
||||
seatsmax_f = 8
|
||||
seatsocc_f = 8 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0788
|
||||
fldate = '20230922'
|
||||
price = '1071.41'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 456
|
||||
paymentsum = '548722.20'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0788
|
||||
fldate = '20230722'
|
||||
price = '1071.41'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 455
|
||||
paymentsum = '544674.30'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 28
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0789
|
||||
fldate = '20231025'
|
||||
price = '1071.41'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 455
|
||||
paymentsum = '545704.30'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0789
|
||||
fldate = '20230221'
|
||||
price = '1071.41'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 459
|
||||
paymentsum = '549226.90'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0790
|
||||
fldate = '20231228'
|
||||
price = '1055.41'
|
||||
currency = 'EUR'
|
||||
planetype = '747-400'
|
||||
seatsmax = 385
|
||||
seatsocc = 370
|
||||
paymentsum = '462373.86'
|
||||
seatsmax_b = 31
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 21
|
||||
seatsocc_f = 21 )
|
||||
( carrid = 'AZ'
|
||||
connid = 0790
|
||||
fldate = '20231201'
|
||||
price = '1055.41'
|
||||
currency = 'EUR'
|
||||
planetype = '747-400'
|
||||
seatsmax = 385
|
||||
seatsocc = 367
|
||||
paymentsum = '463661.64'
|
||||
seatsmax_b = 31
|
||||
seatsocc_b = 31
|
||||
seatsmax_f = 21
|
||||
seatsocc_f = 21 )
|
||||
( carrid = 'DL'
|
||||
connid = 0106
|
||||
fldate = '20230209'
|
||||
price = '652.42'
|
||||
currency = 'USD'
|
||||
planetype = 'A340-600'
|
||||
seatsmax = 330
|
||||
seatsocc = 178
|
||||
paymentsum = '136750.33'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 17
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 10 )
|
||||
( carrid = 'DL'
|
||||
connid = 0106
|
||||
fldate = '20240102'
|
||||
price = '652.42'
|
||||
currency = 'USD'
|
||||
planetype = 'A340-600'
|
||||
seatsmax = 330
|
||||
seatsocc = 16
|
||||
paymentsum = '12892.33'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 2
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 10 )
|
||||
( carrid = 'DL'
|
||||
connid = 1699
|
||||
fldate = '20230921'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = '767-200'
|
||||
seatsmax = 260
|
||||
seatsocc = 250
|
||||
paymentsum = '126636.91'
|
||||
seatsmax_b = 21
|
||||
seatsocc_b = 20
|
||||
seatsmax_f = 11
|
||||
seatsocc_f = 11 )
|
||||
( carrid = 'DL'
|
||||
connid = 1699
|
||||
fldate = '20230511'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = '767-200'
|
||||
seatsmax = 260
|
||||
seatsocc = 251
|
||||
paymentsum = '126493.06'
|
||||
seatsmax_b = 21
|
||||
seatsocc_b = 20
|
||||
seatsmax_f = 11
|
||||
seatsocc_f = 11 )
|
||||
( carrid = 'DL'
|
||||
connid = 1984
|
||||
fldate = '20230719'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 460
|
||||
paymentsum = '225427.35'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 29
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'DL'
|
||||
connid = 1984
|
||||
fldate = '20230213'
|
||||
price = '464.35'
|
||||
currency = 'USD'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 458
|
||||
paymentsum = '225088.83'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'JL'
|
||||
connid = 0407
|
||||
fldate = '20231128'
|
||||
price = '1102.77'
|
||||
currency = 'JPY'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 458
|
||||
paymentsum = '563231.65'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 27
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'JL'
|
||||
connid = 0407
|
||||
fldate = '20231019'
|
||||
price = '1102.77'
|
||||
currency = 'JPY'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 452
|
||||
paymentsum = '553552.12'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 28
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'JL'
|
||||
connid = 0408
|
||||
fldate = '20231128'
|
||||
price = '1102.77'
|
||||
currency = 'JPY'
|
||||
planetype = '747-400'
|
||||
seatsmax = 385
|
||||
seatsocc = 365
|
||||
paymentsum = '470129.20'
|
||||
seatsmax_b = 31
|
||||
seatsocc_b = 28
|
||||
seatsmax_f = 21
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'JL'
|
||||
connid = 0408
|
||||
fldate = '20230123'
|
||||
price = '1102.77'
|
||||
currency = 'JPY'
|
||||
planetype = '747-400'
|
||||
seatsmax = 385
|
||||
seatsocc = 372
|
||||
paymentsum = '487715.90'
|
||||
seatsmax_b = 31
|
||||
seatsocc_b = 31
|
||||
seatsmax_f = 21
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'LH'
|
||||
connid = 0400
|
||||
fldate = '20230628'
|
||||
price = '1184.54'
|
||||
currency = 'EUR'
|
||||
planetype = 'A340-600'
|
||||
seatsmax = 330
|
||||
seatsocc = 319
|
||||
paymentsum = '270822.24'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 20 )
|
||||
( carrid = 'LH'
|
||||
connid = 0400
|
||||
fldate = '20230323'
|
||||
price = '1184.54'
|
||||
currency = 'EUR'
|
||||
planetype = 'A340-600'
|
||||
seatsmax = 330
|
||||
seatsocc = 312
|
||||
paymentsum = '262597.14'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 28
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'LH'
|
||||
connid = 0401
|
||||
fldate = '20231128'
|
||||
price = '669.20'
|
||||
currency = 'EUR'
|
||||
planetype = '767-200'
|
||||
seatsmax = 260
|
||||
seatsocc = 246
|
||||
paymentsum = '195417.72'
|
||||
seatsmax_b = 21
|
||||
seatsocc_b = 19
|
||||
seatsmax_f = 11
|
||||
seatsocc_f = 10 )
|
||||
( carrid = 'LH'
|
||||
connid = 0401
|
||||
fldate = '20231229'
|
||||
price = '669.20'
|
||||
currency = 'EUR'
|
||||
planetype = '767-200'
|
||||
seatsmax = 260
|
||||
seatsocc = 252
|
||||
paymentsum = '199300.50'
|
||||
seatsmax_b = 21
|
||||
seatsocc_b = 19
|
||||
seatsmax_f = 11
|
||||
seatsocc_f = 11 )
|
||||
( carrid = 'LH'
|
||||
connid = 0402
|
||||
fldate = '20230617'
|
||||
price = '669.20'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 461
|
||||
paymentsum = '353526.12'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 29
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 18 )
|
||||
( carrid = 'LH'
|
||||
connid = 0402
|
||||
fldate = '20230313'
|
||||
price = '669.20'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 450
|
||||
paymentsum = '349223.76'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 29
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'LH'
|
||||
connid = 2402
|
||||
fldate = '20231028'
|
||||
price = '245.20'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 451
|
||||
paymentsum = '127197.62'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 29
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 19 )
|
||||
( carrid = 'LH'
|
||||
connid = 2402
|
||||
fldate = '20231223'
|
||||
price = '245.20'
|
||||
currency = 'EUR'
|
||||
planetype = 'A380-800'
|
||||
seatsmax = 475
|
||||
seatsocc = 458
|
||||
paymentsum = '18944.86'
|
||||
seatsmax_b = 30
|
||||
seatsocc_b = 30
|
||||
seatsmax_f = 20
|
||||
seatsocc_f = 20 ) ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_flight_tables.clas.xml
Normal file
16
src/zcl_demo_abap_flight_tables.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_FLIGHT_TABLES</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Class for ABAP cheat sheet examples</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1497
src/zcl_demo_abap_internal_tables.clas.abap
Normal file
1497
src/zcl_demo_abap_internal_tables.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_internal_tables.clas.xml
Normal file
16
src/zcl_demo_abap_internal_tables.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_INTERNAL_TABLES</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: Internal tables</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1001
src/zcl_demo_abap_objects.clas.abap
Normal file
1001
src/zcl_demo_abap_objects.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
556
src/zcl_demo_abap_objects.clas.locals_imp.abap
Normal file
556
src/zcl_demo_abap_objects.clas.locals_imp.abap
Normal file
@@ -0,0 +1,556 @@
|
||||
*&--------------------------------------------------------------------*
|
||||
*& Custom exception classes
|
||||
*&--------------------------------------------------------------------*
|
||||
|
||||
CLASS cx_afternoon DEFINITION INHERITING FROM cx_static_check.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS cx_night DEFINITION INHERITING FROM cx_static_check.
|
||||
ENDCLASS.
|
||||
|
||||
*&--------------------------------------------------------------------*
|
||||
*& Class to demonstrate various method parameters
|
||||
*& All formal parameters are passed by reference except the
|
||||
*& returning parameter.
|
||||
*&--------------------------------------------------------------------*
|
||||
CLASS lcl_demo DEFINITION.
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS:
|
||||
"No parameters
|
||||
hallo_static_ext,
|
||||
|
||||
"One importing parameter
|
||||
powers_of_two IMPORTING i_pow TYPE i,
|
||||
|
||||
"Two importing parameters
|
||||
"Specifying REFERENCE(p) is optional; a formal parameter
|
||||
"without VALUE(p) or REFERENCE(p) is REFERENCE(p) by default
|
||||
addition IMPORTING i_add1 TYPE i
|
||||
REFERENCE(i_add2) TYPE i,
|
||||
|
||||
"Two importing parameters, one of them is optional.
|
||||
addition_optional IMPORTING i_add_mand TYPE i
|
||||
i_add_opt TYPE i OPTIONAL,
|
||||
|
||||
"Importing and exporting parameters
|
||||
subtraction IMPORTING i_sub1 TYPE i
|
||||
i_sub2 TYPE i
|
||||
EXPORTING e_sub_result TYPE i,
|
||||
|
||||
"One exporting parameter
|
||||
exporting_hallo EXPORTING text TYPE string,
|
||||
|
||||
"Changing parameter
|
||||
square_root CHANGING i_sqr TYPE decfloat34,
|
||||
|
||||
"Importing and returning parameters
|
||||
multiplication IMPORTING i_mult1 TYPE i
|
||||
i_mult2 TYPE i
|
||||
RETURNING VALUE(r_mult_result) TYPE i,
|
||||
|
||||
"Importing and exporting parameters
|
||||
"for comparing the signature with method 'multiplication'
|
||||
multiplication_exp_param IMPORTING i_multa TYPE i
|
||||
i_multb TYPE i
|
||||
EXPORTING e_mult_result TYPE i,
|
||||
|
||||
"Includes RAISING
|
||||
division IMPORTING i_div1 TYPE i
|
||||
i_div2 TYPE i
|
||||
RETURNING VALUE(r_div_result) TYPE decfloat34
|
||||
RAISING cx_sy_arithmetic_error,
|
||||
|
||||
check_daytime IMPORTING time TYPE t
|
||||
EXPORTING greetings TYPE string
|
||||
RAISING cx_afternoon cx_night,
|
||||
|
||||
"Include parameters with generic types
|
||||
generic_data IMPORTING i_data TYPE data,
|
||||
generic_tab IMPORTING i_anytab TYPE ANY TABLE.
|
||||
|
||||
CLASS-DATA: calc_result TYPE i,
|
||||
string TYPE string,
|
||||
some_data TYPE REF TO data.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_demo IMPLEMENTATION.
|
||||
|
||||
METHOD hallo_static_ext.
|
||||
string = |Hallo { sy-uname }. | &&
|
||||
|I'm a static method of class lcl_demo.|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD square_root.
|
||||
i_sqr = sqrt( i_sqr ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD powers_of_two.
|
||||
calc_result = i_pow * i_pow.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD addition.
|
||||
calc_result = i_add1 + i_add2.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD addition_optional.
|
||||
calc_result = i_add_mand + i_add_opt.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD subtraction.
|
||||
e_sub_result = i_sub1 - i_sub2.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exporting_hallo.
|
||||
text = |Hallo { sy-uname }. | && |I'm a static method of class lcl_demo with one exporting parameter.|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD multiplication.
|
||||
r_mult_result = i_mult1 * i_mult2.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD multiplication_exp_param.
|
||||
e_mult_result = i_multa * i_multb.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD division.
|
||||
CLEAR string.
|
||||
|
||||
TRY.
|
||||
r_div_result = i_div1 / i_div2.
|
||||
CATCH cx_sy_arithmetic_error INTO DATA(exc).
|
||||
string = exc->get_text( ).
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_daytime.
|
||||
CLEAR string.
|
||||
|
||||
"Morning: 5 am to 12 pm
|
||||
IF time BETWEEN '050001' AND '120000'.
|
||||
DATA(subrc) = 0.
|
||||
ENDIF.
|
||||
|
||||
"Afternoon: 12 pm to 5 pm.
|
||||
IF time BETWEEN '120001' AND '170000'.
|
||||
subrc = 11.
|
||||
ENDIF.
|
||||
|
||||
"Evening 5 pm to 9 pm.
|
||||
"Commented out on purpose to have a time range for OTHERS :)
|
||||
"IF time BETWEEN '170001' AND '210000'.
|
||||
" subrc = 22.
|
||||
"ENDIF.
|
||||
|
||||
"Night: 9 pm to 4 am.
|
||||
IF time BETWEEN '210001' AND '050000'.
|
||||
subrc = 33.
|
||||
ENDIF.
|
||||
|
||||
IF subrc <> 0.
|
||||
CASE subrc.
|
||||
WHEN 11.
|
||||
greetings = |Good afternoon.|.
|
||||
WHEN 33.
|
||||
greetings = |Good night.|.
|
||||
WHEN OTHERS.
|
||||
greetings = |It's neither morning, afternoon or night. | &&
|
||||
|Hence, wishing you a good evening.|.
|
||||
ENDCASE.
|
||||
ELSE.
|
||||
greetings = |Good morning.|.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD generic_data.
|
||||
"A data reference variable is created that has the type of the
|
||||
"imported variable. Its content is store in the variable
|
||||
"some_data in the public section to be able to access the content.
|
||||
CREATE DATA some_data LIKE i_data.
|
||||
some_data->* = i_data.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD generic_tab.
|
||||
"See implementation of generic_data.
|
||||
"Here, an internal table is handled.
|
||||
CREATE DATA some_data LIKE i_anytab.
|
||||
some_data->* = i_anytab.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
*&--------------------------------------------------------------------*
|
||||
*& Class to demonstrate basics in the global class
|
||||
*&--------------------------------------------------------------------*
|
||||
|
||||
CLASS local_class DEFINITION.
|
||||
PUBLIC SECTION.
|
||||
|
||||
METHODS: constructor.
|
||||
|
||||
DATA: num_inst TYPE i,
|
||||
uuid TYPE sysuuid_x16,
|
||||
timestamp TYPE timestampl.
|
||||
|
||||
CLASS-DATA: no_of_instances TYPE i READ-ONLY,
|
||||
num_stat TYPE i VALUE 33.
|
||||
|
||||
CONSTANTS: const_number TYPE i VALUE 11.
|
||||
|
||||
TYPES type_i TYPE i.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS local_class IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
"Number of instances of the class are counted.
|
||||
no_of_instances = no_of_instances + 1.
|
||||
"Set a time stamp.
|
||||
GET TIME STAMP FIELD timestamp.
|
||||
"Increase the number.
|
||||
num_inst = num_inst + 1.
|
||||
"Get a random UUID.
|
||||
TRY.
|
||||
uuid = cl_system_uuid=>create_uuid_x16_static( ) .
|
||||
CATCH cx_uuid_error.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
*&--------------------------------------------------------------------*
|
||||
*& Class to demonstrate events
|
||||
*&--------------------------------------------------------------------*
|
||||
|
||||
CLASS lcl_events DEFINITION.
|
||||
PUBLIC SECTION.
|
||||
DATA: greets TYPE string.
|
||||
|
||||
"Events declaration.
|
||||
EVENTS: morning, afternoon, evening, night.
|
||||
|
||||
"Event handler methods
|
||||
METHODS: morning_greets FOR EVENT morning OF lcl_events,
|
||||
afternoon_greets FOR EVENT afternoon OF lcl_events,
|
||||
evening_greets FOR EVENT evening OF lcl_events,
|
||||
night_greets FOR EVENT night OF lcl_events.
|
||||
|
||||
"Method to raise events
|
||||
METHODS: greetings.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_events IMPLEMENTATION.
|
||||
|
||||
METHOD greetings.
|
||||
|
||||
DATA(syst_time) = cl_abap_context_info=>get_system_time( ).
|
||||
|
||||
"Morning: 5 am to 12 pm
|
||||
IF syst_time BETWEEN '050001' AND '120000'.
|
||||
RAISE EVENT morning.
|
||||
|
||||
"Afternoon: 12 pm to 5 pm.
|
||||
ELSEIF syst_time BETWEEN '120001' AND '170000'.
|
||||
RAISE EVENT afternoon.
|
||||
|
||||
"Evening 5 pm to 9 pm.
|
||||
ELSEIF syst_time BETWEEN '170001' AND '210000'.
|
||||
RAISE EVENT evening.
|
||||
|
||||
"Night: 9 pm to 5 am.
|
||||
ELSEIF syst_time BETWEEN '210001' AND '050000'.
|
||||
RAISE EVENT night.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD morning_greets.
|
||||
greets = |Good morning, { sy-uname }.|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD afternoon_greets.
|
||||
greets = |Good afternoon, { sy-uname }.|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD evening_greets.
|
||||
greets = |Good evening, { sy-uname }.|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD night_greets.
|
||||
greets = |Good night, { sy-uname }.|.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
*&--------------------------------------------------------------------*
|
||||
*& Class to demonstrate constructors
|
||||
*&--------------------------------------------------------------------*
|
||||
|
||||
CLASS lcl_constructors DEFINITION.
|
||||
PUBLIC SECTION.
|
||||
|
||||
METHODS: constructor IMPORTING num1 TYPE i
|
||||
num2 TYPE i RAISING cx_sy_zerodivide.
|
||||
|
||||
DATA: uuid TYPE sysuuid_x16,
|
||||
in_div_result TYPE i,
|
||||
in_text TYPE string.
|
||||
|
||||
|
||||
CLASS-METHODS: class_constructor,
|
||||
add_1.
|
||||
|
||||
CLASS-DATA: no_of_instances TYPE i READ-ONLY,
|
||||
stat_number TYPE i,
|
||||
stat_text TYPE string.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_constructors IMPLEMENTATION.
|
||||
|
||||
METHOD constructor.
|
||||
"Get time stamp.
|
||||
DATA(ts1) = utclong_current( ).
|
||||
"Provide message.
|
||||
in_text = |The instance constructor of the class | &&
|
||||
|lcl_constructors was called on { ts1 }.|.
|
||||
|
||||
"Count number of instances.
|
||||
no_of_instances = no_of_instances + 1.
|
||||
"Get random UUID.
|
||||
TRY.
|
||||
uuid = cl_system_uuid=>create_uuid_x16_static( ) .
|
||||
CATCH cx_uuid_error.
|
||||
ENDTRY.
|
||||
|
||||
CLEAR in_div_result.
|
||||
"Do calculation.
|
||||
in_div_result = num1 / num2.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_constructor.
|
||||
"Set a number.
|
||||
stat_number = 999.
|
||||
"Get time stamp.
|
||||
DATA(ts2) = utclong_current( ).
|
||||
"Provide message.
|
||||
stat_text = |The static constructor of the class | &&
|
||||
|lcl_constructors was called on { ts2 } and the | &&
|
||||
|value for the variable 'stat_number' was set to | &&
|
||||
|{ stat_number }.|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_1.
|
||||
stat_number += 1.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
*&--------------------------------------------------------------------*
|
||||
*& Classes to demonstrate inheritance, polymorphism and casting
|
||||
*&--------------------------------------------------------------------*
|
||||
|
||||
"Class 1
|
||||
CLASS lcl_class1 DEFINITION.
|
||||
|
||||
PUBLIC SECTION.
|
||||
"Note: All methods are purposely included in the public section.
|
||||
"Otherwise, it cannot be called in the demo's main class.
|
||||
METHODS: constructor IMPORTING i_obj TYPE string OPTIONAL,
|
||||
get_string RETURNING VALUE(str) TYPE string,
|
||||
get_obj_name RETURNING VALUE(obj) TYPE string.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA: obj_name TYPE string.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_class1 IMPLEMENTATION.
|
||||
|
||||
METHOD constructor.
|
||||
obj_name = i_obj.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_obj_name.
|
||||
obj = obj_name.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_string.
|
||||
str = `Hallo`.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
"Class 2a
|
||||
CLASS lcl_class2a DEFINITION INHERITING FROM lcl_class1.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
METHODS: get_string REDEFINITION,
|
||||
get_number_2a RETURNING VALUE(num) TYPE i..
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_class2a IMPLEMENTATION.
|
||||
|
||||
METHOD get_string.
|
||||
str = |{ super->get_string( ) }, { sy-uname }!|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_number_2a.
|
||||
num = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1 max = 100 )->get_next( ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
"Class 2b
|
||||
CLASS lcl_class2b DEFINITION INHERITING FROM lcl_class1 FINAL.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
METHODS: get_string REDEFINITION,
|
||||
get_number_2b RETURNING VALUE(num) TYPE i.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_class2b IMPLEMENTATION.
|
||||
|
||||
METHOD get_string.
|
||||
str = |{ super->get_string( ) } from lcl_class2b, { sy-uname }!|.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_number_2b.
|
||||
num = cl_abap_random_int=>create(
|
||||
seed = cl_abap_random=>seed( ) min = 1 max = 100 )->get_next( ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
"Class 3a
|
||||
CLASS lcl_class3a DEFINITION INHERITING FROM lcl_class2a FINAL.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
METHODS: get_string REDEFINITION.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_class3a IMPLEMENTATION.
|
||||
|
||||
METHOD get_string.
|
||||
str = |{ super->get_string( ) } How are you doing?|.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
*&--------------------------------------------------------------------*
|
||||
*& Classes to demonstrate a factory method in a singleton
|
||||
*& and an abstract class.
|
||||
*&--------------------------------------------------------------------*
|
||||
|
||||
CLASS lcl_singleton DEFINITION CREATE PRIVATE.
|
||||
PUBLIC SECTION.
|
||||
|
||||
METHODS: constructor,
|
||||
"Methods for setting and getting a time stamp.
|
||||
get_timestamp RETURNING VALUE(res_timestamp)
|
||||
TYPE timestampl,
|
||||
set_timestamp.
|
||||
|
||||
CLASS-METHODS:
|
||||
"Factory method that returns an instance of the class.
|
||||
factory_method RETURNING VALUE(res_instance)
|
||||
TYPE REF TO lcl_singleton.
|
||||
|
||||
CLASS-DATA: "Holds the number of overall instances.
|
||||
no_of_instances TYPE i READ-ONLY.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA: obj TYPE REF TO lcl_singleton.
|
||||
|
||||
DATA: timestamp TYPE timestampl.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_singleton IMPLEMENTATION.
|
||||
|
||||
METHOD factory_method.
|
||||
"Checking if an instance of the class already exists.
|
||||
"An instance should only be created if no instance exists
|
||||
"to make sure that there is only a single instance overall.
|
||||
IF obj IS INITIAL.
|
||||
CREATE OBJECT obj.
|
||||
ENDIF.
|
||||
"In case an instance already exists, the existing one is
|
||||
"always returned.
|
||||
res_instance = obj.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD constructor.
|
||||
"Counts the number of instances of the class.
|
||||
no_of_instances = no_of_instances + 1.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_timestamp.
|
||||
res_timestamp = timestamp.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_timestamp.
|
||||
GET TIME STAMP FIELD timestamp.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_sub DEFINITION DEFERRED.
|
||||
|
||||
CLASS lcl_abstract DEFINITION ABSTRACT.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
CLASS-METHODS: factory_method IMPORTING check_num TYPE i
|
||||
RETURNING VALUE(obj) TYPE REF TO lcl_abstract.
|
||||
|
||||
CLASS-DATA: message TYPE string.
|
||||
|
||||
"Abstract method: There's no implementation in this class.
|
||||
METHODS: return_string ABSTRACT
|
||||
IMPORTING i_str TYPE string
|
||||
RETURNING VALUE(res_string) TYPE string.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_sub DEFINITION INHERITING FROM lcl_abstract.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
METHODS: return_string REDEFINITION.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS lcl_abstract IMPLEMENTATION.
|
||||
|
||||
METHOD factory_method.
|
||||
"Purpose of factory method: An instance can only be created
|
||||
"if a certain condition is met.
|
||||
CASE check_num.
|
||||
WHEN 1.
|
||||
obj = NEW lcl_sub( ).
|
||||
message = `Great! I was able to create an instance.`.
|
||||
WHEN OTHERS.
|
||||
message = `What a pity. I'm not allowed to create an instance.`.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_sub IMPLEMENTATION.
|
||||
|
||||
METHOD return_string.
|
||||
res_string = |I'm a returned string. | &&
|
||||
|The object reference variable is { i_str }.|.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_objects.clas.xml
Normal file
16
src/zcl_demo_abap_objects.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_OBJECTS</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: ABAP Object Orientation</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
40
src/zcl_demo_abap_objects_friend.clas.abap
Normal file
40
src/zcl_demo_abap_objects_friend.clas.abap
Normal file
@@ -0,0 +1,40 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* Class for ABAP cheat sheet example
|
||||
*
|
||||
* ----------------------------- NOTE -----------------------------------
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets in this repository. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
*
|
||||
***********************************************************************
|
||||
"! <p class="shorttext synchronized">Class for ABAP cheat sheet example</p>
|
||||
"! The class supports the ABAP cheat sheet on object orientation and demonstrates the concept of friendship.
|
||||
CLASS zcl_demo_abap_objects_friend DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
CLASS-METHODS get_strings RETURNING VALUE(res_string) TYPE string_table.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ZCL_DEMO_ABAP_OBJECTS_FRIEND IMPLEMENTATION.
|
||||
|
||||
METHOD get_strings.
|
||||
"Getting the strings and put them in the string table
|
||||
APPEND zcl_demo_abap_objects=>public_string TO res_string.
|
||||
APPEND zcl_demo_abap_objects=>protected_string TO res_string.
|
||||
APPEND zcl_demo_abap_objects=>private_string TO res_string.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_objects_friend.clas.xml
Normal file
16
src/zcl_demo_abap_objects_friend.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_OBJECTS_FRIEND</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Class for ABAP cheat sheet example</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
506
src/zcl_demo_abap_rap_draft_ln_m.clas.abap
Normal file
506
src/zcl_demo_abap_rap_draft_ln_m.clas.abap
Normal file
@@ -0,0 +1,506 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* RAP BO consumer for a RAP demo scenario
|
||||
* ABAP EML in use: RAP calculator (managed, draft-enabled RAP BO with
|
||||
* late numbering
|
||||
*
|
||||
* -------------------------- PURPOSE ----------------------------------
|
||||
* - This class is the RAP BO consumer for a RAP demo scenario that
|
||||
* represents a calculator using RAP concepts, i. e. using ABAP EML in
|
||||
* the context of a managed and draft-enabled RAP business object with
|
||||
* RAP late numbering to carry out simple calculations. Here, a RAP BO
|
||||
* instance consists of a calculation ID (which is the key that is finally
|
||||
* set not until the RAP save sequence), two operands (having integer
|
||||
* values), the arithmetic operator and the result plus other
|
||||
* draft-related fields.
|
||||
* - Underlying data model: Consists of a root entity alone.
|
||||
* The BDEF defines the behavior for this entity. The definitions in the
|
||||
* BDEF determine which methods must be implemented in the ABAP behavior
|
||||
* pool (ABP). Note that the view consists many annotations for the SAP
|
||||
* Fiori UI.
|
||||
* - ABP for this scenario: zbp_demo_abap_rap_draft_m
|
||||
*
|
||||
* ----------------------- GETTING STARTED (1) -------------------------
|
||||
* ----------------- Using this class as RAP BO consumer ---------------
|
||||
*
|
||||
* - Open the class with the ABAP Development Tools (ADT).
|
||||
* - Choose F9 to run the class.
|
||||
* - Check the console output.
|
||||
* - To understand the context and the ABAP syntax used, check the notes
|
||||
* included in the class as comments or refer to the respective topic
|
||||
* in the ABAP Keyword Documentation.
|
||||
* - Due to the amount of output in the console, the examples include
|
||||
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
|
||||
* sections. Plus, the variable name is displayed in most cases. Hence,
|
||||
* to easier and faster find the relevant output in the console, just
|
||||
* search in the console for the number/variable name (STRG+F in the
|
||||
* console) or use the debugger.
|
||||
*
|
||||
* ----------------------- GETTING STARTED (2) -------------------------
|
||||
* Using the preview version of an SAP Fiori Elements as RAP BO consumer
|
||||
*
|
||||
* Create a service binding:
|
||||
* 1. Find the service definition ZDEMO_ABAP_RAP_CALC_SD in the imported
|
||||
* package in Business Services -> Service Definitions.
|
||||
* 2. Right-click the service definition and choose New Service Binding.
|
||||
* 3. In the New Service Binding pop-up, make the following entries:
|
||||
* - Name: ZDEMO_ABAP_RAP_CALC_SB
|
||||
* - Description: Service binding for demo
|
||||
* - Binding type: OData V2 - UI
|
||||
* - Service Definition: ZDEMO_ABAP_RAP_CALC_SD (should be already filled)
|
||||
* 4. Choose Next.
|
||||
* 5. Assign a transport request and choose Finish.
|
||||
* 6. The service binding ZDEMO_ABAP_RAP_CALC_SB is opened. Activate the
|
||||
* service binding.
|
||||
* 7. In the Service Version Details section, choose the Publish button
|
||||
* for the Local Service Endpoint. Once the service has been published,
|
||||
* you should see ZDEMO_ABAP_RAP_DRAFT_M in the Entity Set and Association
|
||||
* section.
|
||||
* 8. Activate the service binding once the service has been published.
|
||||
* 9. Select ZDEMO_ABAP_RAP_DRAFT_M and choose the Preview button.
|
||||
* 10. The preview version of an SAP Fiori Elements app is displayed. If
|
||||
* prompted, provide your credentials.
|
||||
* 11. The app and the managed, draft-enabled RAP BO can be explored. If no
|
||||
* columns are displayed, choose the 'Settings' button and select the
|
||||
* desired columns.
|
||||
* Choosing the 'Go' button refreshes the list. At first use, there
|
||||
* might not any entry. You can create an entry choosing the 'Create'
|
||||
* button.
|
||||
* The late numbering aspects comes into the picture when you, for
|
||||
* example, create a new instance, i. e. create a new calculation, and
|
||||
* you keep a draft version of it instead of saving it to the database.
|
||||
* The calculation ID which represents the key of the instance has an
|
||||
* initial value. Only when you save the instance to the database, the
|
||||
* final key is set.
|
||||
*
|
||||
* ----------------------------- NOTE -----------------------------------
|
||||
* This simplified example is not a real life scenario and rather
|
||||
* focuses on the technical side by giving an idea how the communication
|
||||
* and data exchange between a RAP BO consumer, which is a class
|
||||
* in this case, and RAP BO provider can work. Additionally, it shows
|
||||
* how the methods for non-standard RAP BO operations might be
|
||||
* self-implemented in an ABP. The example is intentionally kept
|
||||
* short and simple and focuses on specific RAP aspects. For this reason,
|
||||
* the example might not fully meet the requirements of the RAP BO contract.
|
||||
*
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
***********************************************************************
|
||||
"! <p class="shorttext synchronized">ABAP cheat sheet: ABAP EML in a RAP scenario (draft BO)</p>
|
||||
"! Example to demonstrate ABAP EML in the context of a RAP demo scenario (managed and draft-enabled RAP business object with RAP late numbering).
|
||||
"! The class represents a RAP BO consumer.<br>Choose F9 in ADT to run the class.
|
||||
CLASS zcl_demo_abap_rap_draft_ln_m DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES: if_oo_adt_classrun.
|
||||
|
||||
CLASS-METHODS:
|
||||
class_constructor.
|
||||
|
||||
protected section.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA:
|
||||
activate_tab TYPE TABLE FOR ACTION IMPORT
|
||||
zdemo_abap_rap_draft_m~activate,
|
||||
activate_tab2 TYPE TABLE FOR ACTION IMPORT
|
||||
zdemo_abap_rap_draft_m~activate,
|
||||
activate_tab3 TYPE TABLE FOR ACTION IMPORT
|
||||
zdemo_abap_rap_draft_m~activate,
|
||||
edit_tab TYPE TABLE FOR ACTION IMPORT
|
||||
zdemo_abap_rap_draft_m~edit,
|
||||
read_tab TYPE TABLE FOR READ IMPORT zdemo_abap_rap_draft_m,
|
||||
f TYPE RESPONSE FOR FAILED zdemo_abap_rap_draft_m,
|
||||
r TYPE RESPONSE FOR REPORTED zdemo_abap_rap_draft_m,
|
||||
m TYPE RESPONSE FOR MAPPED zdemo_abap_rap_draft_m.
|
||||
|
||||
CLASS-METHODS:
|
||||
initialize_dbtabs.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS ZCL_DEMO_ABAP_RAP_DRAFT_LN_M IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD class_constructor.
|
||||
initialize_dbtabs( ).
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
|
||||
DATA(output) = NEW zcl_demo_abap_display( out ).
|
||||
|
||||
output->display( `RAP Demo: RAP Calculator Using Managed, ` &&
|
||||
`Draft-Enabled RAP BO (Late Numbering)` ).
|
||||
output->display( `1) Creating Instances and ` &&
|
||||
`Saving to the database` ).
|
||||
|
||||
"Creating instances; draft indicator %is_draft is enabled
|
||||
MODIFY ENTITY zdemo_abap_rap_draft_m
|
||||
CREATE AUTO FILL CID
|
||||
FIELDS ( num1 arithm_op num2 )
|
||||
WITH VALUE #(
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 1 arithm_op = '+' num2 = 2 )
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 2 arithm_op = '*' num2 = 4 )
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 3 arithm_op = '-' num2 = 5 )
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 1 arithm_op = '/' num2 = 4 )
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 2 arithm_op = 'P' num2 = 5 ) )
|
||||
FAILED f
|
||||
REPORTED r
|
||||
MAPPED m.
|
||||
|
||||
"Displaying responses only if FAILED and REPORTED
|
||||
"response parameters are not initial
|
||||
IF f IS NOT INITIAL OR r IS NOT INITIAL.
|
||||
output->display( `Responses after MODIFY operation` ).
|
||||
|
||||
IF m IS NOT INITIAL.
|
||||
output->display( input = m name = `m` ).
|
||||
ENDIF.
|
||||
|
||||
IF f IS NOT INITIAL.
|
||||
output->display( input = f name = `f` )..
|
||||
ENDIF.
|
||||
|
||||
IF r IS NOT INITIAL.
|
||||
output->display( input = r name = `r` ).
|
||||
ENDIF.
|
||||
|
||||
ENDIF.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving draft table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time, draftentitycreationdatetime,
|
||||
draftentitylastchangedatetime
|
||||
FROM zdemo_abap_draft
|
||||
ORDER BY id
|
||||
INTO TABLE @DATA(draft_parent_before_act).
|
||||
|
||||
"Retrieving database table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time
|
||||
FROM zdemo_abap_tabca
|
||||
ORDER BY id
|
||||
INTO TABLE @DATA(db_tab_root_before_act).
|
||||
|
||||
"Filling the derived type for the ACTIVATE method by
|
||||
"getting %pid values
|
||||
LOOP AT m-calc
|
||||
ASSIGNING FIELD-SYMBOL(<fs>).
|
||||
APPEND VALUE #( %pid = <fs>-%pid )
|
||||
TO activate_tab.
|
||||
ENDLOOP.
|
||||
|
||||
MODIFY ENTITY zdemo_abap_rap_draft_m
|
||||
EXECUTE activate AUTO FILL CID WITH activate_tab
|
||||
MAPPED m
|
||||
FAILED f
|
||||
REPORTED r.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving draft table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time, draftentitycreationdatetime,
|
||||
draftentitylastchangedatetime
|
||||
FROM zdemo_abap_draft
|
||||
ORDER BY id
|
||||
INTO TABLE @DATA(draft_parent_afer_act).
|
||||
|
||||
"Retrieving database table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time
|
||||
FROM zdemo_abap_tabca
|
||||
ORDER BY id
|
||||
INTO TABLE @DATA(db_tab_root_after_act).
|
||||
|
||||
"Displaying entries
|
||||
output->display( `1a) Draft and database tables before ` &&
|
||||
`ACTIVATE action` ).
|
||||
output->display( `Draft table before activation` ).
|
||||
output->display( input = draft_parent_before_act name = `draft_parent_before_act` ).
|
||||
|
||||
|
||||
output->display( `Database table before activation` ).
|
||||
output->display( input = db_tab_root_before_act name = `db_tab_root_before_act` ).
|
||||
|
||||
|
||||
output->next_section( `1b) Draft and database tables after ` &&
|
||||
`ACTIVATE action` ).
|
||||
output->display( `Draft table after activation` ).
|
||||
output->display( input = draft_parent_afer_act name = `draft_parent_afer_act` ).
|
||||
|
||||
|
||||
output->display( `Database table after activation` ).
|
||||
output->display( input = db_tab_root_after_act name = `db_tab_root_after_act` ).
|
||||
|
||||
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `2) Creating Invalid Instances` ).
|
||||
|
||||
"Purposely creating invalid instances;
|
||||
"draft indicator %is_draft is enabled
|
||||
MODIFY ENTITY zdemo_abap_rap_draft_m
|
||||
CREATE AUTO FILL CID
|
||||
FIELDS ( num1 arithm_op num2 )
|
||||
WITH VALUE #(
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 1 arithm_op = 'a' num2 = 1 ) "wrong operator
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 1 arithm_op = '/' num2 = 0 ) "0 division
|
||||
( %is_draft = if_abap_behv=>mk-on
|
||||
num1 = 2 arithm_op = 'P' num2 = 12345 ) ) "arithmetic overflow
|
||||
FAILED f
|
||||
REPORTED r
|
||||
MAPPED m.
|
||||
|
||||
"Displaying responses only if FAILED and REPORTED
|
||||
"response parameters are not initial.
|
||||
IF f IS NOT INITIAL OR r IS NOT INITIAL.
|
||||
output->display( input = `Responses after MODIFY operation` ).
|
||||
|
||||
IF m IS NOT INITIAL.
|
||||
output->display( input = m name = `m` ).
|
||||
ENDIF.
|
||||
|
||||
IF f IS NOT INITIAL.
|
||||
output->display( input = f name = `f` )..
|
||||
ENDIF.
|
||||
|
||||
IF r IS NOT INITIAL.
|
||||
output->display( input = r name = `r` ).
|
||||
ENDIF.
|
||||
|
||||
ENDIF.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving draft table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time, draftentitycreationdatetime,
|
||||
draftentitylastchangedatetime
|
||||
FROM zdemo_abap_draft
|
||||
ORDER BY id
|
||||
INTO TABLE @draft_parent_before_act.
|
||||
|
||||
"Retrieving database table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time
|
||||
FROM zdemo_abap_tabca
|
||||
ORDER BY id
|
||||
INTO TABLE @db_tab_root_before_act.
|
||||
|
||||
|
||||
"Filling the derived type for the ACTIVATE method by
|
||||
"getting %pid values; here, another table is filled for later use
|
||||
LOOP AT m-calc
|
||||
ASSIGNING FIELD-SYMBOL(<fs2>).
|
||||
|
||||
APPEND VALUE #( %pid = <fs2>-%pid )
|
||||
TO activate_tab2.
|
||||
|
||||
APPEND VALUE #( %pid = <fs2>-%pid )
|
||||
TO activate_tab3.
|
||||
ENDLOOP.
|
||||
|
||||
MODIFY ENTITY zdemo_abap_rap_draft_m
|
||||
EXECUTE activate AUTO FILL CID WITH activate_tab2
|
||||
MAPPED m
|
||||
FAILED f
|
||||
REPORTED r.
|
||||
|
||||
"Displaying responses only if FAILED and REPORTED
|
||||
"response parameters are not initial.
|
||||
IF f IS NOT INITIAL OR r IS NOT INITIAL.
|
||||
output->display( input = `Responses after MODIFY operation` ).
|
||||
|
||||
IF m IS NOT INITIAL.
|
||||
output->display( input = m name = `m` ).
|
||||
ENDIF.
|
||||
|
||||
IF f IS NOT INITIAL.
|
||||
output->display( input = f name = `f` )..
|
||||
ENDIF.
|
||||
|
||||
IF r IS NOT INITIAL.
|
||||
output->display( input = r name = `r` ).
|
||||
ENDIF.
|
||||
|
||||
ENDIF.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving draft table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time, draftentitycreationdatetime,
|
||||
draftentitylastchangedatetime
|
||||
FROM zdemo_abap_draft
|
||||
ORDER BY id
|
||||
INTO TABLE @draft_parent_afer_act.
|
||||
|
||||
"Retrieving database table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time
|
||||
FROM zdemo_abap_tabca
|
||||
ORDER BY id
|
||||
INTO TABLE @db_tab_root_after_act.
|
||||
|
||||
"Displaying entries
|
||||
output->next_section( `2a) Draft and database tables before ` &&
|
||||
`ACTIVATE action` ).
|
||||
output->display( `Draft table before activation` ).
|
||||
output->display( input = draft_parent_before_act name = `draft_parent_before_act` ).
|
||||
|
||||
|
||||
output->display( `Database table before activation` ).
|
||||
output->display( input = db_tab_root_before_act name = `db_tab_root_before_act` ).
|
||||
|
||||
|
||||
output->next_section( `2b) Draft and database tables after ` &&
|
||||
`ACTIVATE action` ).
|
||||
output->display( `Draft table after activation` ).
|
||||
output->display( input = draft_parent_afer_act name = `draft_parent_afer_act` ).
|
||||
|
||||
|
||||
output->display( `Database table after activation` ).
|
||||
output->display( input = db_tab_root_after_act name = `db_tab_root_after_act` ).
|
||||
|
||||
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `3) Correcting and Updating Invalid Instances` ).
|
||||
|
||||
"Preparing the derived type for the read operation to
|
||||
"retrieve the field values; the draft indicator is enabled
|
||||
LOOP AT activate_tab3 ASSIGNING FIELD-SYMBOL(<fs3>).
|
||||
|
||||
APPEND VALUE #( %pky = <fs3>-%pky
|
||||
%is_draft = if_abap_behv=>mk-on
|
||||
%control-id = if_abap_behv=>mk-on
|
||||
%control-num1 = if_abap_behv=>mk-on
|
||||
%control-arithm_op = if_abap_behv=>mk-on
|
||||
%control-num2 = if_abap_behv=>mk-on
|
||||
%control-calc_result = if_abap_behv=>mk-on
|
||||
%control-crea_date_time = if_abap_behv=>mk-on
|
||||
%control-lchg_date_time = if_abap_behv=>mk-on
|
||||
) TO read_tab.
|
||||
ENDLOOP.
|
||||
|
||||
"Retrieving the entries of the invalid instances
|
||||
READ ENTITY zdemo_abap_rap_draft_m
|
||||
ALL FIELDS WITH read_tab
|
||||
RESULT DATA(result).
|
||||
|
||||
"Correcting and updating the invalid instances
|
||||
MODIFY ENTITY zdemo_abap_rap_draft_m
|
||||
UPDATE FROM VALUE #(
|
||||
FOR wa IN result (
|
||||
%pid = wa-%pid
|
||||
%is_draft = if_abap_behv=>mk-on
|
||||
num2 = SWITCH #( wa-calc_result
|
||||
WHEN `Division by 0` THEN 2
|
||||
WHEN `Overflow error` THEN 3 )
|
||||
arithm_op = SWITCH #( wa-calc_result
|
||||
WHEN `Wrong operator` THEN '+' )
|
||||
%control-num2 = SWITCH #( wa-calc_result
|
||||
WHEN `Division by 0` THEN if_abap_behv=>mk-on
|
||||
WHEN `Overflow error` THEN if_abap_behv=>mk-on
|
||||
ELSE if_abap_behv=>mk-off )
|
||||
%control-arithm_op = SWITCH #( wa-calc_result
|
||||
WHEN `Wrong operator` THEN if_abap_behv=>mk-on
|
||||
ELSE if_abap_behv=>mk-off ) ) )
|
||||
FAILED f
|
||||
REPORTED r
|
||||
MAPPED m.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
MODIFY ENTITY zdemo_abap_rap_draft_m
|
||||
EXECUTE activate AUTO FILL CID WITH activate_tab3
|
||||
MAPPED m
|
||||
FAILED f
|
||||
REPORTED r.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving draft table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time, draftentitycreationdatetime,
|
||||
draftentitylastchangedatetime
|
||||
FROM zdemo_abap_draft
|
||||
ORDER BY id
|
||||
INTO TABLE @draft_parent_afer_act.
|
||||
|
||||
"Retrieving database table entries
|
||||
SELECT id, num1, arithm_op, num2, calc_result, crea_date_time,
|
||||
lchg_date_time
|
||||
FROM zdemo_abap_tabca
|
||||
ORDER BY id
|
||||
INTO TABLE @db_tab_root_after_act.
|
||||
|
||||
"Displaying entries
|
||||
output->display( input = `Draft and database tables after ` &&
|
||||
`ACTIVATE action` ).
|
||||
|
||||
output->display( `Draft table after activation` ).
|
||||
output->display( input = draft_parent_afer_act name = `draft_parent_afer_act` ).
|
||||
|
||||
|
||||
output->display( `Database table after activation` ).
|
||||
output->display( input = db_tab_root_after_act name = `db_tab_root_after_act` ).
|
||||
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD initialize_dbtabs.
|
||||
DELETE FROM zdemo_abap_tabca.
|
||||
DELETE FROM zdemo_abap_draft.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_rap_draft_ln_m.clas.xml
Normal file
16
src/zcl_demo_abap_rap_draft_ln_m.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_RAP_DRAFT_LN_M</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: ABAP EML in a RAP scenario (draft BO)</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
975
src/zcl_demo_abap_rap_ext_num_m.clas.abap
Normal file
975
src/zcl_demo_abap_rap_ext_num_m.clas.abap
Normal file
@@ -0,0 +1,975 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* RAP BO consumer for a RAP demo scenario:
|
||||
* ABAP EML in use: Managed RAP BO with external numbering
|
||||
*
|
||||
* -------------------------- PURPOSE ----------------------------------
|
||||
* - This class is the RAP BO consumer for a RAP demo scenario that
|
||||
* demonstrates various RAP BO standard operations and non-standard
|
||||
* operations using ABAP EML in the context of a managed RAP business
|
||||
* object with RAP external numbering.
|
||||
* See also the ABAP for RAP (EML) ABAP cheat sheet.
|
||||
* - Topics covered: RAP BO operations like create (including a
|
||||
* determination on save), update, delete, executing an action, validation,
|
||||
* create-by-association (parent to child), read (root entity),
|
||||
* read-by-association (parent to child), read (child entity),
|
||||
* read-by-association (child to parent)
|
||||
* - Underlying data model: Consists of a root entity and one child entity.
|
||||
* The BDEF defines the behavior for these two entities which are connected
|
||||
* via a CDS composition relation. The definitions in the BDEF determine
|
||||
* which methods must be implemented in the ABAP behavior pool (ABP).
|
||||
* - ABP for this scenario: zbp_demo_abap_rap_ro_m
|
||||
*
|
||||
* ----------------------- GETTING STARTED -----------------------------
|
||||
* - Open the class with the ABAP Development Tools (ADT).
|
||||
* - Choose F9 to run the class.
|
||||
* - Check the console output.
|
||||
* - To understand the context and the ABAP syntax used, check the notes
|
||||
* included in the class as comments or refer to the respective topic
|
||||
* in the ABAP Keyword Documentation.
|
||||
* - Due to the amount of output in the console, the examples include
|
||||
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
|
||||
* sections. Plus, the variable name is displayed in most cases. Hence,
|
||||
* to easier and faster find the relevant output in the console, just
|
||||
* search in the console for the number/variable name (STRG+F in the
|
||||
* console) or use the debugger.
|
||||
*
|
||||
* ----------------------------- NOTE -----------------------------------
|
||||
* This simplified example is not a real life scenario and rather
|
||||
* focuses on the technical side by giving an idea how the communication
|
||||
* and data exchange between a RAP BO consumer, which is a class
|
||||
* in this case, and RAP BO provider can work. Additionally, it shows
|
||||
* how the methods for non-standard RAP BO operations might be
|
||||
* self-implemented in an ABP. The example is intentionally kept
|
||||
* short and simple and focuses on specific RAP aspects. For this reason,
|
||||
* the example might not fully meet the requirements of the RAP BO contract.
|
||||
*
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
***********************************************************************
|
||||
"! <p class="shorttext synchronized">ABAP cheat sheet: ABAP EML in a RAP scenario (managed BO)</p>
|
||||
"! Example to demonstrate ABAP EML in the context of a RAP demo scenario (managed RAP BO with external numbering).
|
||||
"! The class represents a RAP BO consumer.<br>Choose F9 in ADT to run the class.
|
||||
CLASS zcl_demo_abap_rap_ext_num_m DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES: if_oo_adt_classrun.
|
||||
|
||||
CLASS-METHODS:
|
||||
class_constructor.
|
||||
|
||||
protected section.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA:
|
||||
failed TYPE RESPONSE FOR FAILED zdemo_abap_rap_ro_m,
|
||||
reported TYPE RESPONSE FOR REPORTED zdemo_abap_rap_ro_m,
|
||||
mapped TYPE RESPONSE FOR MAPPED zdemo_abap_rap_ro_m.
|
||||
CLASS-METHODS:
|
||||
initialize_dbtabs,
|
||||
"If there are entries in the response parameters following EML
|
||||
"requests, they should be processed for displaying purposes.
|
||||
extract_from_reported RETURNING VALUE(messages) TYPE string_table,
|
||||
extract_from_failed RETURNING VALUE(errors) TYPE string_table,
|
||||
fill_db_tab.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS ZCL_DEMO_ABAP_RAP_EXT_NUM_M IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD class_constructor.
|
||||
initialize_dbtabs( ).
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD extract_from_failed.
|
||||
CLEAR errors.
|
||||
|
||||
LOOP AT failed-root ASSIGNING FIELD-SYMBOL(<err>).
|
||||
|
||||
DATA op TYPE string.
|
||||
|
||||
CASE if_abap_behv=>mk-on.
|
||||
WHEN <err>-%op-%create.
|
||||
op = `create operation`.
|
||||
WHEN <err>-%op-%update.
|
||||
op = `update operation`.
|
||||
WHEN <err>-%op-%delete.
|
||||
op = `delete operation`.
|
||||
WHEN <err>-%op-%assoc-_child.
|
||||
op = `operation involving the child entity`.
|
||||
WHEN <err>-%op-%action-multiply_by_2.
|
||||
op = `executing action multiply_by_2`.
|
||||
WHEN OTHERS. op = `operation`.
|
||||
ENDCASE.
|
||||
|
||||
APPEND `Error for instance with ` &&
|
||||
COND #( WHEN <err>-%cid IS NOT INITIAL THEN `%cid = `
|
||||
&& <err>-%cid
|
||||
ELSE `key = ` && <err>-key_field ) &&
|
||||
`: Fail cause ` && <err>-%fail-cause && ` for ` && op
|
||||
&& `.` TO errors.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
IF failed-child IS NOT INITIAL.
|
||||
LOOP AT failed-child ASSIGNING FIELD-SYMBOL(<err_ch>).
|
||||
APPEND `Error for child instance with key_field = ` &&
|
||||
<err_ch>-key_field && ` and key_ch = ` &&
|
||||
<err_ch>-key_ch && `: Fail cause `
|
||||
&& <err_ch>-%fail-cause && `.` TO errors.
|
||||
ENDLOOP.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD extract_from_reported.
|
||||
CLEAR messages.
|
||||
|
||||
LOOP AT reported-root ASSIGNING FIELD-SYMBOL(<rep>).
|
||||
IF <rep>-%global = if_abap_behv=>mk-on.
|
||||
APPEND <rep>-%msg->m_severity &&
|
||||
<rep>-%msg->if_t100_dyn_msg~msgv1 TO messages.
|
||||
ELSE.
|
||||
APPEND `Message for instance with ` &&
|
||||
COND #( WHEN <rep>-%cid IS NOT INITIAL
|
||||
THEN `%cid = ` && <rep>-%cid
|
||||
ELSE `key = ` && <rep>-key_field ) &&
|
||||
`: ` && <rep>-%msg->m_severity && ` ` &&
|
||||
<rep>-%msg->if_t100_dyn_msg~msgv1 TO messages.
|
||||
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
IF reported-child IS NOT INITIAL.
|
||||
LOOP AT reported-child ASSIGNING FIELD-SYMBOL(<rep_ch>).
|
||||
APPEND `Message for child instance with key_field = ` &&
|
||||
<rep_ch>-key_field && ` and key_ch = `
|
||||
&& <rep_ch>-key_ch && `: ` && <rep_ch>-%msg->m_severity &&
|
||||
` ` && <rep_ch>-%msg->if_t100_dyn_msg~msgv1 TO messages.
|
||||
ENDLOOP.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD fill_db_tab.
|
||||
|
||||
MODIFY zdemo_abap_rapt1 FROM TABLE @( VALUE #(
|
||||
( key_field = 4
|
||||
field1 = 'ggg'
|
||||
field2 = 'hhh'
|
||||
field3 = 40
|
||||
field4 = 41 ) ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
|
||||
DATA(output) = NEW zcl_demo_abap_display( out ).
|
||||
|
||||
output->display( `RAP Demo: RAP BO Operations Using a Managed ` &&
|
||||
`RAP BO` ).
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Create operation
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->display( `1) Create operation` ).
|
||||
|
||||
"Adding an entry to the database table to provoke an error for the
|
||||
"EML create request.
|
||||
fill_db_tab( ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - field4 is purposely not included in the FIELDS list
|
||||
* - Effect:
|
||||
* - %control value for field4 is set to if_abap_behv=>mk-off
|
||||
* - Although the derived type (created inline here) includes a
|
||||
* value assignment for field4 in an instance, the field value is
|
||||
* not saved. The initial value is used.
|
||||
* - The instance with key_field = 4 will not be saved since an entry
|
||||
* already exists in the database table with the same key.
|
||||
* - Response parameters are specified to receive information.
|
||||
* - A COMMIT ENTITIES statement triggers the saving of the instances.
|
||||
* - The example BDEF includes the definition of a determination on
|
||||
* save for create operations. In this case, the determination
|
||||
* adds some text to the value in field2.
|
||||
**********************************************************************
|
||||
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
CREATE FIELDS ( key_field field1 field2 field3 )
|
||||
WITH VALUE #( ( %cid = 'cid1'
|
||||
key_field = 1
|
||||
field1 = 'aaa'
|
||||
field2 = 'bbb'
|
||||
field3 = 10
|
||||
field4 = 11 ) "Value not considered
|
||||
( %cid = 'cid2'
|
||||
key_field = 2
|
||||
field1 = 'ccc'
|
||||
field2 = 'ddd'
|
||||
field3 = 20 )
|
||||
( %cid = 'cid3'
|
||||
key_field = 3
|
||||
field1 = 'eee'
|
||||
field2 = 'fff'
|
||||
field3 = 30 )
|
||||
( %cid = 'cid4' "Instance to fail
|
||||
key_field = 4
|
||||
field1 = 'error'
|
||||
field2 = 'error'
|
||||
field3 = 99 ) )
|
||||
MAPPED mapped
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving and displaying database content
|
||||
SELECT FROM zdemo_abap_rapt1
|
||||
FIELDS key_field, field1, field2, field3, field4
|
||||
ORDER BY key_field
|
||||
INTO TABLE @DATA(tab_root).
|
||||
|
||||
output->display( input = tab_root name = `tab_root` ).
|
||||
|
||||
"Displaying response information
|
||||
IF mapped-root IS NOT INITIAL.
|
||||
output->display( `Entries in MAPPED response parameter ` &&
|
||||
`(root entity)` ).
|
||||
|
||||
output->display( input = mapped-root name = `mapped-root` ).
|
||||
ENDIF.
|
||||
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Update operations
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `2) Update operation` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a create and an update request. The
|
||||
* create request is included to have a %cid to refer to for demo
|
||||
* purposes. This instance has not yet been persisted.
|
||||
* - The EML statement for the create operation includes the ABAP
|
||||
* FROM ... (instead of FIELDS ( ... ) WITH ...) for demo purposes.
|
||||
* Here, the %control values must be set explicitly.
|
||||
* - The update request purposely excludes field2 so as not to update
|
||||
* the value of this particular field.
|
||||
**********************************************************************
|
||||
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
CREATE FROM VALUE #(
|
||||
%control-key_field = if_abap_behv=>mk-on
|
||||
%control-field1 = if_abap_behv=>mk-on
|
||||
%control-field2 = if_abap_behv=>mk-on
|
||||
%control-field3 = if_abap_behv=>mk-on
|
||||
%control-field4 = if_abap_behv=>mk-on
|
||||
( %cid = 'cid5'
|
||||
key_field = 5
|
||||
field1 = 'iii'
|
||||
field2 = 'jjj'
|
||||
field3 = 50
|
||||
field4 = 51 ) )
|
||||
UPDATE FIELDS ( field1 field3 field4 )
|
||||
WITH VALUE #(
|
||||
"Update via cid_ref
|
||||
( %cid_ref = 'cid5'
|
||||
field1 = 'up_kkk'
|
||||
field2 = 'up_lll' "Value not considered
|
||||
field3 = 500
|
||||
field4 = 501 )
|
||||
"Updates via key
|
||||
( key_field = 1
|
||||
field1 = 'up_mmm'
|
||||
field3 = 100
|
||||
field4 = 101 )
|
||||
( key_field = 2
|
||||
field1 = 'up_ooo'
|
||||
field3 = 200
|
||||
field4 = 201 )
|
||||
( key_field = 99 "Instance to fail
|
||||
field1 = 'error'
|
||||
field3 = 99
|
||||
field4 = 99 ) )
|
||||
MAPPED mapped
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving and displaying database content
|
||||
SELECT FROM zdemo_abap_rapt1
|
||||
FIELDS key_field, field1, field2, field3, field4
|
||||
ORDER BY key_field
|
||||
INTO TABLE @tab_root.
|
||||
|
||||
output->display( input = tab_root name = `tab_root` ).
|
||||
|
||||
"Displaying response information
|
||||
IF mapped-root IS NOT INITIAL.
|
||||
output->display( `Entries in MAPPED response parameter ` &&
|
||||
`(root entity)` ).
|
||||
|
||||
output->display( input = mapped-root name = `mapped-root` ).
|
||||
ENDIF.
|
||||
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Delete operation
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `3) Delete operation` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a create and an delete request. The
|
||||
* create request is included to have a %cid to refer to for demo
|
||||
* purposes. This instance has not yet been persisted.
|
||||
* - EML statements for delete operations can only be used with the
|
||||
* ABAP word FROM ....
|
||||
**********************************************************************
|
||||
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
CREATE FIELDS ( key_field field1 field2 field3 field4 )
|
||||
WITH VALUE #(
|
||||
( %cid = 'cid_del'
|
||||
key_field = 6
|
||||
field1 = 'mmm'
|
||||
field2 = 'nnn'
|
||||
field3 = 60
|
||||
field4 = 61 ) )
|
||||
DELETE FROM VALUE #(
|
||||
"Deletion via %cid_ref
|
||||
( %cid_ref = 'cid_del' )
|
||||
"Deletions via key
|
||||
( key_field = 4 )
|
||||
( key_field = 5 )
|
||||
"Instance to fail
|
||||
( key_field = 100 ) ) "Key not available
|
||||
MAPPED mapped
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving and displaying database content
|
||||
SELECT FROM zdemo_abap_rapt1
|
||||
FIELDS key_field, field1, field2, field3, field4
|
||||
ORDER BY key_field
|
||||
INTO TABLE @tab_root.
|
||||
|
||||
output->display( input = tab_root name = `tab_root` ).
|
||||
|
||||
"Displaying response information
|
||||
IF mapped-root IS NOT INITIAL.
|
||||
output->display( `Entries in MAPPED response parameter ` &&
|
||||
`(root entity)` ).
|
||||
|
||||
output->display( input = mapped-root name = `mapped-root` ).
|
||||
ENDIF.
|
||||
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Action multiply_by_2
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `4) Action execution: mutliply_by_2` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a create request and a request to execute
|
||||
* an action. The create request is included to have a %cid to refer
|
||||
* to for demo purposes. This instance has not yet been persisted.
|
||||
* - EML statements for executing actions can only be used with the
|
||||
* ABAP word FROM ....
|
||||
* - As the name implies, the action multiplies field
|
||||
* values (field3 and field4) by 2 for requested instances.
|
||||
**********************************************************************
|
||||
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
CREATE FIELDS ( key_field field1 field2 field3 field4 )
|
||||
WITH VALUE #(
|
||||
( %cid = 'cid_x2'
|
||||
key_field = 7
|
||||
field1 = 'ooo'
|
||||
field2 = 'ppp'
|
||||
field3 = 70
|
||||
field4 = 71 ) )
|
||||
EXECUTE multiply_by_2 FROM VALUE #(
|
||||
"Executing action via %cid_ref
|
||||
( %cid_ref = 'cid_x2' )
|
||||
"Executing action via key
|
||||
( key_field = 1 )
|
||||
( key_field = 2 )
|
||||
( key_field = 1234 ) ) "Instance to fail
|
||||
MAPPED mapped
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving and displaying database content
|
||||
SELECT FROM zdemo_abap_rapt1
|
||||
FIELDS key_field, field1, field2, field3, field4
|
||||
ORDER BY key_field
|
||||
INTO TABLE @tab_root.
|
||||
|
||||
output->display( input = tab_root name = `tab_root` ).
|
||||
|
||||
"Displaying response information
|
||||
IF mapped-root IS NOT INITIAL.
|
||||
output->display( `Entries in MAPPED response parameter ` &&
|
||||
`(root entity)` ).
|
||||
|
||||
output->display( input = mapped-root name = `mapped-root` ).
|
||||
ENDIF.
|
||||
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Create-by-association operation (from root to child entity)
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `5) Create-by-association operation (from parent to child)` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a create and create-by-association
|
||||
* request, i. e. a "deep create". An instance is created for the
|
||||
* parent entity and, in the same request and based on this
|
||||
* instance, instances are created for the child entity, too.
|
||||
**********************************************************************
|
||||
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
CREATE FIELDS ( key_field field1 field2 field3 field4 )
|
||||
WITH VALUE #(
|
||||
( %cid = 'cid_cba'
|
||||
key_field = 9
|
||||
field1 = 'qqq'
|
||||
field2 = 'rrr'
|
||||
field3 = 90
|
||||
field4 = 91 ) )
|
||||
CREATE BY \_child
|
||||
FIELDS ( key_ch field_ch1 field_ch2 ) WITH VALUE #(
|
||||
"CBA operation via %cid_ref
|
||||
( %cid_ref = 'cid_cba'
|
||||
%target = VALUE #( ( %cid = 'cid_ch1'
|
||||
key_ch = 9
|
||||
field_ch1 = 'aaa_ch'
|
||||
field_ch2 = 99 )
|
||||
( %cid = 'cid_ch2'
|
||||
key_ch = 10
|
||||
field_ch1 = 'bbb_ch'
|
||||
field_ch2 = 100 ) ) )
|
||||
"CBA operation via root key
|
||||
( key_field = 1
|
||||
%target = VALUE #( ( %cid = 'cid_ch3'
|
||||
key_ch = 1
|
||||
field_ch1 = 'ccc_ch'
|
||||
field_ch2 = 11 )
|
||||
( %cid = 'cid_ch4'
|
||||
key_ch = 2
|
||||
field_ch1 = 'ddd_ch'
|
||||
field_ch2 = 22 ) ) )
|
||||
( key_field = 2
|
||||
%target = VALUE #( ( %cid = 'cid_ch5'
|
||||
key_ch = 3
|
||||
field_ch1 = 'ccc_ch'
|
||||
field_ch2 = 33 )
|
||||
( %cid = 'cid_ch6'
|
||||
key_ch = 4
|
||||
field_ch1 = 'ddd_ch'
|
||||
field_ch2 = 44 ) ) )
|
||||
"Instance to fail
|
||||
( key_field = 123
|
||||
%target = VALUE #( ( %cid = 'cid_ch7'
|
||||
key_ch = 1
|
||||
field_ch1 = 'error'
|
||||
field_ch2 = 2 )
|
||||
( %cid = 'cid_ch8'
|
||||
key_ch = 2
|
||||
field_ch1 = 'error'
|
||||
field_ch2 = 3 ) ) )
|
||||
)
|
||||
MAPPED mapped
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
COMMIT ENTITIES.
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving and displaying database content
|
||||
SELECT FROM zdemo_abap_rapt1
|
||||
FIELDS key_field, field1, field2, field3, field4
|
||||
ORDER BY key_field
|
||||
INTO TABLE @tab_root.
|
||||
|
||||
SELECT FROM zdemo_abap_rapt2
|
||||
FIELDS key_field, key_ch, field_ch1, field_ch2
|
||||
ORDER BY key_field, key_ch
|
||||
INTO TABLE @DATA(tab_child).
|
||||
|
||||
output->display( input = tab_root name = `tab_root` ).
|
||||
output->display( input = tab_child name = `tab_child` ).
|
||||
|
||||
"Displaying response information
|
||||
IF mapped IS NOT INITIAL.
|
||||
output->display( `Entries in MAPPED response parameter ` &&
|
||||
`(root and child entity)` ).
|
||||
|
||||
output->display( input = mapped name = `mapped` ).
|
||||
ENDIF.
|
||||
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Validation val
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `6) Validation val` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a create request. The validation's
|
||||
* handler method is implementation in a way that the saving of
|
||||
* instances is disabled if a field value is not allowed. In this
|
||||
* example, the value of the integer in field3 shall not exceed 1000.
|
||||
* Here, the third instance will fail for the validation.
|
||||
* Consequently, all instances of this request are not saved to the
|
||||
* database. Either all is ok and will be saved or nothing.
|
||||
* - Note that the response information for the validation is only
|
||||
* available in the response parameters of the COMMIT ENTITIES
|
||||
* statement. Here, the BDEF derived type is
|
||||
* ... TYPE RESPONSE FOR ... LATE ....
|
||||
**********************************************************************
|
||||
|
||||
MODIFY ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
CREATE FIELDS ( key_field field1 field2 field3 field4 )
|
||||
WITH VALUE #(
|
||||
( %cid = 'cid_val1'
|
||||
key_field = 123
|
||||
field1 = 'sss'
|
||||
field2 = 'ttt'
|
||||
field3 = 1
|
||||
field4 = 2 )
|
||||
( %cid = 'cid_val2'
|
||||
key_field = 456
|
||||
field1 = 'uuu'
|
||||
field2 = 'vvv'
|
||||
field3 = 3
|
||||
field4 = 4 )
|
||||
( %cid = 'cid_val3'
|
||||
key_field = 789
|
||||
field1 = 'www'
|
||||
field2 = 'xxx'
|
||||
field3 = 1001
|
||||
field4 = 5 ) )
|
||||
MAPPED mapped
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
COMMIT ENTITIES RESPONSES
|
||||
FAILED DATA(failed_late)
|
||||
REPORTED DATA(reported_late).
|
||||
|
||||
IF sy-subrc <> 0.
|
||||
output->display( `An issue occurred in the RAP save sequence.` ).
|
||||
ENDIF.
|
||||
|
||||
"Retrieving and displaying database content
|
||||
SELECT FROM zdemo_abap_rapt1
|
||||
FIELDS key_field, field1, field2, field3, field4
|
||||
ORDER BY key_field
|
||||
INTO TABLE @tab_root.
|
||||
|
||||
output->display( input = tab_root name = `tab_root` ).
|
||||
|
||||
"Displaying response information
|
||||
IF mapped IS NOT INITIAL.
|
||||
output->display( `Entries in MAPPED response parameter ` &&
|
||||
`(root and child entity)` ).
|
||||
|
||||
output->display( input = mapped name = `mapped` ).
|
||||
ENDIF.
|
||||
|
||||
IF failed_late IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED LATE response parameter` ).
|
||||
|
||||
output->display( input = failed_late name = `failed_late` ).
|
||||
ENDIF.
|
||||
|
||||
IF reported_late IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED LATE response parameter` ).
|
||||
|
||||
output->display( input = reported_late name = `reported_late` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Read operation (root entity)
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `7) Read operation (root entity)` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a read request. The EML statement uses
|
||||
* the ABAP words ALL FIELDS WITH. In this case, as the name implies,
|
||||
* all field values are retrieved. The %control values for all fields
|
||||
* are set to if_abap_behv=>mk-on.
|
||||
* - When using the ABAP words FIELDS ( ... ) WITH and specifying the
|
||||
* concrete fields to be read, only for those fields %control is
|
||||
* set accordingly.
|
||||
* - Filling the parameter for RESULT is mandatory.
|
||||
**********************************************************************
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
ALL FIELDS WITH VALUE #(
|
||||
( key_field = 1 )
|
||||
( key_field = 2 )
|
||||
( key_field = 7 )
|
||||
( key_field = 5 ) ) "Instance to fail
|
||||
RESULT DATA(result)
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
"Displaying the read result
|
||||
output->display( input = result name = `result` ).
|
||||
|
||||
"Displaying response information
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
*********************************************************************
|
||||
*
|
||||
* Read operation (child entity)
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `8) Read operation (child entity)` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a read request. The read operation is
|
||||
* executed on the child entity directly by specifying the alias, as
|
||||
* it is defined in the BDEF, following the ABAP word ENTITY.
|
||||
* - All field values are read using the addition ALL FIELDS WITH.
|
||||
**********************************************************************
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY child
|
||||
ALL FIELDS WITH VALUE #(
|
||||
( key_field = 1 key_ch = 1 )
|
||||
( key_field = 2 key_ch = 4 )
|
||||
"Instances to fail
|
||||
( key_field = 9 )
|
||||
( key_field = 9 key_ch = 11 ) )
|
||||
RESULT DATA(read_ch)
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
"Displaying read result
|
||||
output->display( input = read_ch name = `read_ch` ).
|
||||
|
||||
|
||||
"Displaying response information
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Read-by-association operation (from parent to child)
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `9) Read-by-association operation (from parent to child)` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a read-by-association request from the
|
||||
* parent to the child.
|
||||
* - All field values are read using the addition ALL FIELDS WITH.
|
||||
* - Specifying the parameter for RESULT is mandatory.
|
||||
* - Additionally, the optional association links are retrieved.
|
||||
**********************************************************************
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY root
|
||||
BY \_child
|
||||
ALL FIELDS WITH VALUE #(
|
||||
( key_field = 2 )
|
||||
( key_field = 9 )
|
||||
( key_field = 999 ) ) "Instance to fail
|
||||
RESULT DATA(rba_result)
|
||||
LINK DATA(association_links)
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
"Displaying read result and association links
|
||||
output->display( input = rba_result name = `rba_result` ).
|
||||
output->display( input = association_links name = `association_links` ).
|
||||
|
||||
"Displaying response information
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Read-by-association operation (from child to parent)
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
output->next_section( `10) Read-by-association operation (from child to parent)` ).
|
||||
|
||||
**********************************************************************
|
||||
* Notes:
|
||||
* - The EML request includes a read-by-association request from the
|
||||
* child to the parent.
|
||||
* - All field values are read using the addition ALL FIELDS WITH.
|
||||
* - Specifying the parameter for RESULT is mandatory.
|
||||
* - Additionally, the optional association links are retrieved.
|
||||
**********************************************************************
|
||||
|
||||
READ ENTITIES OF zdemo_abap_rap_ro_m
|
||||
ENTITY child
|
||||
BY \_parent ALL FIELDS WITH VALUE #(
|
||||
( key_field = 1 key_ch = 1 )
|
||||
( key_field = 2 key_ch = 4 )
|
||||
"Instances to fail
|
||||
( key_field = 1 key_ch = 3 )
|
||||
( key_field = 543 key_ch = 1 ) )
|
||||
RESULT DATA(rba_parent)
|
||||
LINK DATA(association_links_parent)
|
||||
FAILED failed
|
||||
REPORTED reported.
|
||||
|
||||
"Displaying read result and association links
|
||||
output->display( input = rba_parent name = `rba_parent` ).
|
||||
output->display( input = association_links_parent name = `association_links_parent` ).
|
||||
|
||||
"Displaying response information
|
||||
IF failed IS NOT INITIAL.
|
||||
output->display( `Entries in FAILED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_failed( ) name = `extract_from_failed( )` ).
|
||||
ENDIF.
|
||||
IF reported IS NOT INITIAL.
|
||||
output->display( `Entries in REPORTED response parameter` ).
|
||||
|
||||
output->display( input = extract_from_reported( ) name = `extract_from_reported( )` ).
|
||||
ENDIF.
|
||||
|
||||
**********************************************************************
|
||||
*
|
||||
* Excursion: Read and read-by-association operation using dynamic
|
||||
* EML statements
|
||||
*
|
||||
**********************************************************************
|
||||
|
||||
* output->next_section( `11) Excursion: Read and read-by-association ` &&
|
||||
* `operations using dynamic EML` ).
|
||||
* DATA:
|
||||
* op_tab TYPE abp_behv_retrievals_tab,
|
||||
* read_dyn TYPE TABLE FOR READ IMPORT zdemo_abap_rap_ro_m,
|
||||
* read_dyn_result TYPE TABLE FOR READ RESULT zdemo_abap_rap_ro_m,
|
||||
* rba_dyn TYPE TABLE FOR READ IMPORT
|
||||
* zdemo_abap_rap_ro_m\_child,
|
||||
* rba_dyn_result TYPE TABLE FOR READ RESULT
|
||||
* zdemo_abap_rap_ro_m\_child,
|
||||
* rba_dyn_link TYPE TABLE FOR READ LINK zdemo_abap_rap_ro_m\_child.
|
||||
*
|
||||
* read_dyn = VALUE #(
|
||||
* ( %key-key_field = 1
|
||||
* %control = VALUE #(
|
||||
* field1 = if_abap_behv=>mk-on
|
||||
* field2 = if_abap_behv=>mk-on
|
||||
* field3 = if_abap_behv=>mk-on
|
||||
* field4 = if_abap_behv=>mk-on ) )
|
||||
* ( %key-key_field = 2
|
||||
* %control = VALUE #(
|
||||
* field1 = if_abap_behv=>mk-on
|
||||
* field2 = if_abap_behv=>mk-on
|
||||
* field3 = if_abap_behv=>mk-on
|
||||
* field4 = if_abap_behv=>mk-on ) ) ).
|
||||
*
|
||||
* rba_dyn = VALUE #(
|
||||
* ( %key-key_field = 1
|
||||
* %control = VALUE #(
|
||||
* key_field = if_abap_behv=>mk-on
|
||||
* key_ch = if_abap_behv=>mk-on
|
||||
* field_ch1 = if_abap_behv=>mk-on
|
||||
* field_ch2 = if_abap_behv=>mk-on ) )
|
||||
* ( %key-key_field = 2
|
||||
* %control = VALUE #(
|
||||
* key_field = if_abap_behv=>mk-on
|
||||
* key_ch = if_abap_behv=>mk-on
|
||||
* field_ch1 = if_abap_behv=>mk-on
|
||||
* field_ch2 = if_abap_behv=>mk-on ) ) ).
|
||||
*
|
||||
* op_tab = VALUE #(
|
||||
* ( op = if_abap_behv=>op-r-read
|
||||
* entity_name = 'ZDEMO_ABAP_RAP_RO_M'
|
||||
* instances = REF #( read_dyn )
|
||||
* results = REF #( read_dyn_result ) )
|
||||
* ( op = if_abap_behv=>op-r-read_ba
|
||||
* entity_name = 'ZDEMO_ABAP_RAP_RO_M'
|
||||
* sub_name = '_CHILD'
|
||||
* full = abap_true
|
||||
* instances = REF #( rba_dyn )
|
||||
* results = REF #( rba_dyn_result )
|
||||
* links = REF #( rba_dyn_link ) ) ).
|
||||
*
|
||||
* READ ENTITIES OPERATIONS op_tab.
|
||||
*
|
||||
* output->display( `Read result (root)` ).
|
||||
* output->display( input = read_dyn_result name = `read_dyn_result` ).
|
||||
* output->display( `Read result (read-by-association)` ).
|
||||
* output->display( input = rba_dyn_result name = `rba_dyn_result` ).
|
||||
* output->display( `Links` ).
|
||||
* output->display( input = rba_dyn_link name = `rba_dyn_link` ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD initialize_dbtabs.
|
||||
DELETE FROM zdemo_abap_rapt1.
|
||||
DELETE FROM zdemo_abap_rapt2.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_rap_ext_num_m.clas.xml
Normal file
16
src/zcl_demo_abap_rap_ext_num_m.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_RAP_EXT_NUM_M</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: ABAP EML in a RAP scenario (managed BO)</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1089
src/zcl_demo_abap_rap_ext_num_u.clas.abap
Normal file
1089
src/zcl_demo_abap_rap_ext_num_u.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_rap_ext_num_u.clas.xml
Normal file
16
src/zcl_demo_abap_rap_ext_num_u.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_RAP_EXT_NUM_U</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: ABAP EML in a RAP scenario (unmanaged BO)</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1477
src/zcl_demo_abap_sql.clas.abap
Normal file
1477
src/zcl_demo_abap_sql.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_sql.clas.xml
Normal file
16
src/zcl_demo_abap_sql.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_SQL</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: ABAP SQL</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
175
src/zcl_demo_abap_sql_group_by.clas.abap
Normal file
175
src/zcl_demo_abap_sql_group_by.clas.abap
Normal file
@@ -0,0 +1,175 @@
|
||||
***********************************************************************
|
||||
*
|
||||
* ABAP cheat sheet: ABAP SQL - Grouping Internal Tables
|
||||
*
|
||||
* -------------------------- PURPOSE ----------------------------------
|
||||
* - Example to demonstrate syntactical options when grouping internal
|
||||
* tables.
|
||||
*
|
||||
* ----------------------- GETTING STARTED -----------------------------
|
||||
* - Open the class with the ABAP Development Tools (ADT).
|
||||
* - Choose F9 to run the class.
|
||||
* - Check the console output.
|
||||
* - To understand the context and the ABAP syntax used, check the notes
|
||||
* included in the class as comments or refer to the respective topic
|
||||
* in the ABAP Keyword Documentation.
|
||||
* - Due to the amount of output in the console, the examples include
|
||||
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
|
||||
* sections. Plus, the variable name is displayed in most cases. Hence,
|
||||
* to easier and faster find the relevant output in the console, just
|
||||
* search in the console for the number/variable name (STRG+F in the
|
||||
* console) or use the debugger.
|
||||
* ----------------------------- NOTE -----------------------------------
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
*
|
||||
***********************************************************************
|
||||
"! <p class="shorttext synchronized">ABAP cheat sheet: ABAP SQL - Grouping Internal Tables</p>
|
||||
"! Example to demonstrate working with structures.<br>Choose F9 in ADT to run the class.
|
||||
CLASS zcl_demo_abap_sql_group_by DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES: if_oo_adt_classrun.
|
||||
|
||||
CLASS-METHODS: class_constructor.
|
||||
|
||||
protected section.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA:
|
||||
wa TYPE zdemo_abap_flsch,
|
||||
member TYPE zdemo_abap_flsch,
|
||||
members TYPE STANDARD TABLE OF zdemo_abap_flsch WITH EMPTY KEY.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS ZCL_DEMO_ABAP_SQL_GROUP_BY IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD class_constructor.
|
||||
"Fill demo database tables.
|
||||
zcl_demo_abap_flight_tables=>fill_dbtabs( ).
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
|
||||
DATA(output) = NEW zcl_demo_abap_display( out ).
|
||||
|
||||
output->display( `Demo: Grouping Internal Tables` ).
|
||||
|
||||
SELECT *
|
||||
FROM zdemo_abap_flsch
|
||||
INTO TABLE @DATA(fli_tab).
|
||||
|
||||
output->next_section( `1) Representative Binding` ).
|
||||
output->display( `1a) Grouping by one column` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY wa-carrid.
|
||||
output->display( wa-carrid ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `1b) Members of one column groups` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY wa-carrid.
|
||||
CLEAR members.
|
||||
LOOP AT GROUP wa INTO member.
|
||||
members = VALUE #( BASE members ( member ) ).
|
||||
ENDLOOP.
|
||||
|
||||
output->display( members ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `1c) Grouping by two columns` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom ).
|
||||
|
||||
output->display( |{ wa-carrid } { wa-airpfrom }| ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `1d) Members of two column groups` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom ).
|
||||
CLEAR members.
|
||||
LOOP AT GROUP wa INTO member.
|
||||
members = VALUE #( BASE members ( member ) ).
|
||||
ENDLOOP.
|
||||
|
||||
output->display( members ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `2) Group Key Binding` ).
|
||||
output->display( `2a) Grouping by one column` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY wa-carrid
|
||||
INTO DATA(key).
|
||||
|
||||
output->display( key ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `2b) Members of one column groups` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY wa-carrid
|
||||
INTO key.
|
||||
CLEAR members.
|
||||
LOOP AT GROUP key INTO member.
|
||||
members = VALUE #( BASE members ( member ) ).
|
||||
ENDLOOP.
|
||||
|
||||
output->display( members ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `2c) Grouping by two columns` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom )
|
||||
INTO DATA(keys).
|
||||
|
||||
output->display( keys ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `2d) Members of two column groups` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom )
|
||||
INTO keys.
|
||||
CLEAR members.
|
||||
LOOP AT GROUP keys INTO member.
|
||||
members = VALUE #( BASE members ( member ) ).
|
||||
ENDLOOP.
|
||||
|
||||
output->display( members ).
|
||||
ENDLOOP.
|
||||
|
||||
output->next_section( `2e) Two column groups without members` ).
|
||||
|
||||
LOOP AT fli_tab INTO wa
|
||||
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom
|
||||
index = GROUP INDEX size = GROUP SIZE )
|
||||
WITHOUT MEMBERS
|
||||
INTO DATA(keysplus).
|
||||
|
||||
output->display( keysplus ).
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
src/zcl_demo_abap_sql_group_by.clas.xml
Normal file
16
src/zcl_demo_abap_sql_group_by.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_SQL_GROUP_BY</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: ABAP SQL - Grouping Internal Tables</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1270
src/zcl_demo_abap_string_proc.clas.abap
Normal file
1270
src/zcl_demo_abap_string_proc.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_string_proc.clas.xml
Normal file
16
src/zcl_demo_abap_string_proc.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_STRING_PROC</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: String processing</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
1086
src/zcl_demo_abap_structures.clas.abap
Normal file
1086
src/zcl_demo_abap_structures.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_structures.clas.xml
Normal file
16
src/zcl_demo_abap_structures.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOCLASS>
|
||||
<CLSNAME>ZCL_DEMO_ABAP_STRUCTURES</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: Structures</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
94
src/zdemo_abap_carr.tabl.xml
Normal file
94
src/zdemo_abap_carr.tabl.xml
Normal file
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_CARR</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table: Airline</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_CARR</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>MANDT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CARRID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CARRNAME</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000040</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000020</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CURRCODE</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000010</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CUKY</DATATYPE>
|
||||
<LENG>000005</LENG>
|
||||
<MASK> CUKY</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>URL</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000510</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000255</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_CARR</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_CARR</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
127
src/zdemo_abap_draft.tabl.xml
Normal file
127
src/zdemo_abap_draft.tabl.xml
Normal file
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_DRAFT</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<LANGDEP>X</LANGDEP>
|
||||
<DDTEXT>Draft table for RAP calculator</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<MAINFLAG>X</MAINFLAG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_DRAFT</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>CLIENT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>ID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ROLLNAME>SYSUUID_X16</ROLLNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<COMPTYPE>E</COMPTYPE>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>DRAFTUUID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ROLLNAME>SYSUUID_X16</ROLLNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<COMPTYPE>E</COMPTYPE>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUM1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>ARITHM_OP</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000002</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000001</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUM2</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CALC_RESULT</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>g</INTTYPE>
|
||||
<INTLEN>000008</INTLEN>
|
||||
<DATATYPE>STRG</DATATYPE>
|
||||
<MASK> STRG</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CREA_DATE_TIME</FIELDNAME>
|
||||
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<COMPTYPE>E</COMPTYPE>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>LCHG_DATE_TIME</FIELDNAME>
|
||||
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<COMPTYPE>E</COMPTYPE>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>.INCLUDE</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<PRECFIELD>SYCH_BDL_DRAFT_ADMIN_INC</PRECFIELD>
|
||||
<MASK> S</MASK>
|
||||
<DDTEXT>Standard Include for Draft Administration (BDL Syntax Check)</DDTEXT>
|
||||
<COMPTYPE>S</COMPTYPE>
|
||||
<GROUPNAME>%ADMIN</GROUPNAME>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_DRAFT</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_DRAFT</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
192
src/zdemo_abap_fli.tabl.xml
Normal file
192
src/zdemo_abap_fli.tabl.xml
Normal file
@@ -0,0 +1,192 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_FLI</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table: Flight</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_FLI</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>MANDT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CARRID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CONNID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>N</INTTYPE>
|
||||
<INTLEN>000008</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>NUMC</DATATYPE>
|
||||
<LENG>000004</LENG>
|
||||
<MASK> NUMC</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FLDATE</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>D</INTTYPE>
|
||||
<INTLEN>000016</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>DATS</DATATYPE>
|
||||
<LENG>000008</LENG>
|
||||
<MASK> DATS</MASK>
|
||||
<SHLPORIGIN>T</SHLPORIGIN>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>PRICE</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>P</INTTYPE>
|
||||
<INTLEN>000008</INTLEN>
|
||||
<REFTABLE>ZDEMO_ABAP_FLI</REFTABLE>
|
||||
<REFFIELD>CURRENCY</REFFIELD>
|
||||
<DATATYPE>CURR</DATATYPE>
|
||||
<LENG>000015</LENG>
|
||||
<DECIMALS>000002</DECIMALS>
|
||||
<MASK> CURR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CURRENCY</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000010</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CUKY</DATATYPE>
|
||||
<LENG>000005</LENG>
|
||||
<MASK> CUKY</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>PLANETYPE</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000020</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>SEATSMAX</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>SEATSOCC</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>PAYMENTSUM</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>P</INTTYPE>
|
||||
<INTLEN>000009</INTLEN>
|
||||
<REFTABLE>ZDEMO_ABAP_FLI</REFTABLE>
|
||||
<REFFIELD>CURRENCY</REFFIELD>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CURR</DATATYPE>
|
||||
<LENG>000017</LENG>
|
||||
<DECIMALS>000002</DECIMALS>
|
||||
<MASK> CURR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>SEATSMAX_B</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>SEATSOCC_B</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>SEATSMAX_F</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>SEATSOCC_F</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_FLI</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_FLI</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
209
src/zdemo_abap_flsch.tabl.xml
Normal file
209
src/zdemo_abap_flsch.tabl.xml
Normal file
@@ -0,0 +1,209 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_FLSCH</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table: Flight schedule</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<MAINFLAG>X</MAINFLAG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_FLSCH</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>MANDT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CARRID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CONNID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>N</INTTYPE>
|
||||
<INTLEN>000008</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>NUMC</DATATYPE>
|
||||
<LENG>000004</LENG>
|
||||
<MASK> NUMC</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>COUNTRYFR</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CITYFROM</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000040</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000020</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>AIRPFROM</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>COUNTRYTO</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CITYTO</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000040</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000020</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>AIRPTO</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FLTIME</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>DEPTIME</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>T</INTTYPE>
|
||||
<INTLEN>000012</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>TIMS</DATATYPE>
|
||||
<LENG>000006</LENG>
|
||||
<MASK> TIMS</MASK>
|
||||
<SHLPORIGIN>T</SHLPORIGIN>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>ARRTIME</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>T</INTTYPE>
|
||||
<INTLEN>000012</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>TIMS</DATATYPE>
|
||||
<LENG>000006</LENG>
|
||||
<MASK> TIMS</MASK>
|
||||
<SHLPORIGIN>T</SHLPORIGIN>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>DISTANCE</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>P</INTTYPE>
|
||||
<INTLEN>000005</INTLEN>
|
||||
<REFTABLE>ZDEMO_ABAP_FLSCH</REFTABLE>
|
||||
<REFFIELD>DISTID</REFFIELD>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>QUAN</DATATYPE>
|
||||
<LENG>000009</LENG>
|
||||
<DECIMALS>000004</DECIMALS>
|
||||
<MASK> QUAN</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>DISTID</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>UNIT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> UNIT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FLTYPE</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000002</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000001</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>PERIOD</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000001</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT1</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> INT1</MASK>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_FLSCH</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_FLSCH</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
37
src/zdemo_abap_objects_interface.intf.abap
Normal file
37
src/zdemo_abap_objects_interface.intf.abap
Normal file
@@ -0,0 +1,37 @@
|
||||
***********************************************************************
|
||||
* ---------------------------- PURPOSE --------------------------------
|
||||
* Interface to support the ABAP cheat sheet ABAP object orientation.
|
||||
*
|
||||
* ----------------------------- NOTE ----------------------------------
|
||||
* The code presented in this class is only meant for supporting the ABAP
|
||||
* cheat sheets. It is not intended for direct use in a
|
||||
* production system environment. The code examples in the ABAP cheat
|
||||
* sheets are primarily intended to provide a better explanation and
|
||||
* visualization of the syntax and semantics of ABAP statements and not to
|
||||
* solve concrete programming tasks. For production application programs,
|
||||
* a dedicated solution should therefore always be worked out for each
|
||||
* individual case. There is no guarantee for either the correctness or
|
||||
* the completeness of the code. In addition, there is no legal
|
||||
* responsibility or liability for possible errors or their consequences
|
||||
* which occur through the use of the example code.
|
||||
*
|
||||
***********************************************************************
|
||||
"! <p class="shorttext synchronized">Interface for ABAP cheat sheet example</p>
|
||||
"! The interface supporta the ABAP cheat sheet on object orientation and demonstrates the use of interfaces.
|
||||
INTERFACE zdemo_abap_objects_interface
|
||||
PUBLIC .
|
||||
|
||||
METHODS: double IMPORTING i_op TYPE i
|
||||
RETURNING VALUE(r_double) TYPE i,
|
||||
|
||||
triple DEFAULT IGNORE IMPORTING i_op TYPE i
|
||||
RETURNING VALUE(r_triple) TYPE i .
|
||||
|
||||
DATA: in_str TYPE string.
|
||||
|
||||
CLASS-METHODS: halve IMPORTING i_op TYPE i
|
||||
RETURNING VALUE(r_halve) TYPE i.
|
||||
|
||||
CLASS-DATA: stat_str TYPE string.
|
||||
|
||||
ENDINTERFACE.
|
||||
15
src/zdemo_abap_objects_interface.intf.xml
Normal file
15
src/zdemo_abap_objects_interface.intf.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_INTF" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOINTERF>
|
||||
<CLSNAME>ZDEMO_ABAP_OBJECTS_INTERFACE</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Interface for ABAP cheat sheet example</DESCRIPT>
|
||||
<EXPOSURE>2</EXPOSURE>
|
||||
<STATE>1</STATE>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOINTERF>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
4
src/zdemo_abap_rap_calc_sd.srvd.srvdsrv
Normal file
4
src/zdemo_abap_rap_calc_sd.srvd.srvdsrv
Normal file
@@ -0,0 +1,4 @@
|
||||
@EndUserText.label: 'Service definition for RAP Calculator'
|
||||
define service ZDEMO_ABAP_RAP_CALC_SD {
|
||||
expose ZDEMO_ABAP_RAP_DRAFT_M;
|
||||
}
|
||||
19
src/zdemo_abap_rap_calc_sd.srvd.xml
Normal file
19
src/zdemo_abap_rap_calc_sd.srvd.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_SRVD" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<SRVD>
|
||||
<NAME>ZDEMO_ABAP_RAP_CALC_SD</NAME>
|
||||
<TYPE>SRVD/SRV</TYPE>
|
||||
<DESCRIPTION>Service definition for RAP Calculator</DESCRIPTION>
|
||||
<LANGUAGE>EN</LANGUAGE>
|
||||
<MASTER_LANGUAGE>EN</MASTER_LANGUAGE>
|
||||
<SOURCE_URI>./zdemo_abap_rap_calc_sd/source/main</SOURCE_URI>
|
||||
<SOURCE_TYPE>ABAP_SOURCE</SOURCE_TYPE>
|
||||
<SOURCE_ORIGIN_DESCRIPTION>ABAP Development Tools</SOURCE_ORIGIN_DESCRIPTION>
|
||||
<SRVD_SOURCE_TYPE>S</SRVD_SOURCE_TYPE>
|
||||
<SRVD_SOURCE_TYPE_DESC>Definition</SRVD_SOURCE_TYPE_DESC>
|
||||
</SRVD>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
12
src/zdemo_abap_rap_ch_m.ddls.asddls
Normal file
12
src/zdemo_abap_rap_ch_m.ddls.asddls
Normal file
@@ -0,0 +1,12 @@
|
||||
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||
define view entity ZDEMO_ABAP_RAP_CH_M
|
||||
as select from zdemo_abap_rapt2
|
||||
association to parent ZDEMO_ABAP_RAP_RO_M
|
||||
as _parent on $projection.key_field = _parent.key_field
|
||||
{
|
||||
_parent,
|
||||
key key_field,
|
||||
key key_ch,
|
||||
field_ch1,
|
||||
field_ch2
|
||||
}
|
||||
21
src/zdemo_abap_rap_ch_m.ddls.baseinfo
Normal file
21
src/zdemo_abap_rap_ch_m.ddls.baseinfo
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"BASEINFO":
|
||||
{
|
||||
"FROM":
|
||||
[
|
||||
"ZDEMO_ABAP_RAPT2"
|
||||
],
|
||||
"ASSOCIATED":
|
||||
[
|
||||
"ZDEMO_ABAP_RAP_RO_M"
|
||||
],
|
||||
"BASE":
|
||||
[],
|
||||
"ANNO_REF":
|
||||
[],
|
||||
"SCALAR_FUNCTION":
|
||||
[],
|
||||
"VERSION":0,
|
||||
"ANNOREF_EVALUATION_ERROR":""
|
||||
}
|
||||
}
|
||||
13
src/zdemo_abap_rap_ch_m.ddls.xml
Normal file
13
src/zdemo_abap_rap_ch_m.ddls.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DDLS>
|
||||
<DDLNAME>ZDEMO_ABAP_RAP_CH_M</DDLNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<DDTEXT>CDS view entity (child)</DDTEXT>
|
||||
<SOURCE_TYPE>W</SOURCE_TYPE>
|
||||
</DDLS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
12
src/zdemo_abap_rap_ch_u.ddls.asddls
Normal file
12
src/zdemo_abap_rap_ch_u.ddls.asddls
Normal file
@@ -0,0 +1,12 @@
|
||||
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||
define view entity ZDEMO_ABAP_RAP_CH_U
|
||||
as select from zdemo_abap_rapt2
|
||||
association to parent ZDEMO_ABAP_RAP_RO_U
|
||||
as _parent on $projection.key_field = _parent.key_field
|
||||
{
|
||||
_parent,
|
||||
key key_field,
|
||||
key key_ch,
|
||||
field_ch1,
|
||||
field_ch2
|
||||
}
|
||||
21
src/zdemo_abap_rap_ch_u.ddls.baseinfo
Normal file
21
src/zdemo_abap_rap_ch_u.ddls.baseinfo
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"BASEINFO":
|
||||
{
|
||||
"FROM":
|
||||
[
|
||||
"ZDEMO_ABAP_RAPT2"
|
||||
],
|
||||
"ASSOCIATED":
|
||||
[
|
||||
"ZDEMO_ABAP_RAP_RO_U"
|
||||
],
|
||||
"BASE":
|
||||
[],
|
||||
"ANNO_REF":
|
||||
[],
|
||||
"SCALAR_FUNCTION":
|
||||
[],
|
||||
"VERSION":0,
|
||||
"ANNOREF_EVALUATION_ERROR":""
|
||||
}
|
||||
}
|
||||
13
src/zdemo_abap_rap_ch_u.ddls.xml
Normal file
13
src/zdemo_abap_rap_ch_u.ddls.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DDLS>
|
||||
<DDLNAME>ZDEMO_ABAP_RAP_CH_U</DDLNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<DDTEXT>CDS view entity (child)</DDTEXT>
|
||||
<SOURCE_TYPE>W</SOURCE_TYPE>
|
||||
</DDLS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
31
src/zdemo_abap_rap_draft_m.bdef.asbdef
Normal file
31
src/zdemo_abap_rap_draft_m.bdef.asbdef
Normal file
@@ -0,0 +1,31 @@
|
||||
managed implementation in class zbp_demo_abap_rap_draft_m unique;
|
||||
strict;
|
||||
with draft;
|
||||
|
||||
define behavior for ZDEMO_ABAP_RAP_DRAFT_M alias calc
|
||||
persistent table zdemo_abap_tabca
|
||||
draft table zdemo_abap_draft
|
||||
lock master
|
||||
total etag crea_date_time
|
||||
etag master lchg_date_time
|
||||
authorization master ( global )
|
||||
late numbering
|
||||
{
|
||||
create;
|
||||
update;
|
||||
delete;
|
||||
field ( readonly ) id, calc_result, crea_date_time, lchg_date_time;
|
||||
field ( mandatory ) num1, num2, arithm_op;
|
||||
static action delete_all;
|
||||
internal action calculation;
|
||||
validation validate on save { create; field num1, arithm_op, num2; }
|
||||
determination det_modify on modify { field num1, num2, arithm_op; }
|
||||
draft action Resume;
|
||||
draft action Edit;
|
||||
draft action Activate;
|
||||
draft action Discard;
|
||||
draft determine action Prepare
|
||||
{
|
||||
validation validate;
|
||||
}
|
||||
}
|
||||
50
src/zdemo_abap_rap_draft_m.bdef.xml
Normal file
50
src/zdemo_abap_rap_draft_m.bdef.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_BDEF" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<BDEF>
|
||||
<NAME>ZDEMO_ABAP_RAP_DRAFT_M</NAME>
|
||||
<TYPE>BDEF/BDO</TYPE>
|
||||
<DESCRIPTION>BDEF, managed, draft, late numbering</DESCRIPTION>
|
||||
<DESCRIPTION_TEXT_LIMIT>60</DESCRIPTION_TEXT_LIMIT>
|
||||
<LANGUAGE>EN</LANGUAGE>
|
||||
<LINKS>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_draft_m/source/main/versions</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/versions</REL>
|
||||
<TITLE>Historic versions</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_draft_m/source/main</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/source</REL>
|
||||
<TYPE>text/plain</TYPE>
|
||||
<TITLE>Source Content</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_draft_m/source/main</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/source</REL>
|
||||
<TYPE>text/html</TYPE>
|
||||
<TITLE>Source Content (HTML)</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_draft_m/objectstructure</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/objectstructure</REL>
|
||||
<TITLE>Object Structure</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>/sap/bc/adt/vit/wb/object_type/bdefbdo/object_name/ZDEMO_ABAP_RAP_DRAFT_M</HREF>
|
||||
<REL>self</REL>
|
||||
<TYPE>application/vnd.sap.sapgui</TYPE>
|
||||
<TITLE>Representation in SAP GUI</TITLE>
|
||||
</item>
|
||||
</LINKS>
|
||||
<MASTER_LANGUAGE>EN</MASTER_LANGUAGE>
|
||||
<ABAP_LANGU_VERSION>5</ABAP_LANGU_VERSION>
|
||||
<SOURCE_URI>./zdemo_abap_rap_draft_m/source/main</SOURCE_URI>
|
||||
<SOURCE_TYPE>ABAP_SOURCE</SOURCE_TYPE>
|
||||
<SOURCE_FIXED_POINT_ARITHMETIC>true</SOURCE_FIXED_POINT_ARITHMETIC>
|
||||
<SOURCE_UNICODE_CHECKS_ACTIVE>true</SOURCE_UNICODE_CHECKS_ACTIVE>
|
||||
</BDEF>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
73
src/zdemo_abap_rap_draft_m.ddls.asddls
Normal file
73
src/zdemo_abap_rap_draft_m.ddls.asddls
Normal file
@@ -0,0 +1,73 @@
|
||||
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||
|
||||
@ObjectModel.semanticKey: ['id']
|
||||
@UI: { headerInfo: { title: { value: 'id' },
|
||||
typeName: 'Calculation', typeNamePlural: 'Calculations' } }
|
||||
define root view entity ZDEMO_ABAP_RAP_DRAFT_M
|
||||
as select from zdemo_abap_tabca
|
||||
{
|
||||
//FACET SECTION
|
||||
@UI.facet: [
|
||||
|
||||
// Header Facet (Object Page):
|
||||
|
||||
{ id: 'HeaderFacet',
|
||||
purpose: #HEADER,
|
||||
type: #FIELDGROUP_REFERENCE,
|
||||
//label: 'Calculation ID',
|
||||
targetQualifier: 'Fieldgroup:HeaderItems',
|
||||
position: 10 },
|
||||
|
||||
// Body Facets (Object Page)
|
||||
|
||||
{ id: 'Calculation',
|
||||
type: #IDENTIFICATION_REFERENCE,
|
||||
label: 'Calculation',
|
||||
position: 10 }
|
||||
|
||||
]
|
||||
|
||||
// Element List
|
||||
@EndUserText.label: 'Calculation ID'
|
||||
@UI: { lineItem: [ { importance: #HIGH, position: 10,
|
||||
label: 'Calculation ID' },
|
||||
{ type: #FOR_ACTION, dataAction: 'delete_all',
|
||||
label: 'Delete All Persisted Calculations' } ],
|
||||
fieldGroup: [ { qualifier: 'Fieldgroup:HeaderItems',
|
||||
position: 10 } ] }
|
||||
key id,
|
||||
@UI: { lineItem: [ { importance: #HIGH, position: 20,
|
||||
label: '1st Operand' } ],
|
||||
identification: [ { position: 20,
|
||||
label: '1st Operand' } ],
|
||||
fieldGroup: [ { qualifier: 'CaluclationItems',
|
||||
position: 10 } ] }
|
||||
num1,
|
||||
@UI: { lineItem: [ { importance: #HIGH, position: 30,
|
||||
label: 'Operator' } ],
|
||||
identification: [ { position: 30, label: 'Operator' } ],
|
||||
fieldGroup: [ { qualifier: 'CaluclationItems',
|
||||
position: 20 } ] }
|
||||
arithm_op,
|
||||
@UI: { lineItem: [ { importance: #HIGH, position: 40,
|
||||
label: '2nd Operand' } ],
|
||||
identification: [ { position: 40,
|
||||
label: '2nd Operand' } ],
|
||||
fieldGroup: [ { qualifier: 'CaluclationItems',
|
||||
position: 30 } ] }
|
||||
num2,
|
||||
@UI: { lineItem: [ { importance: #HIGH, position: 50,
|
||||
label: 'Result' } ],
|
||||
identification: [ { position: 50, label: 'Result' } ],
|
||||
fieldGroup: [ { qualifier: 'CaluclationItems',
|
||||
position: 40 } ] }
|
||||
calc_result,
|
||||
@UI: { hidden: true }
|
||||
@Semantics.systemDateTime.lastChangedAt: true
|
||||
crea_date_time,
|
||||
@EndUserText.label: 'Last Changed At'
|
||||
@UI: { fieldGroup: [ { qualifier: 'Fieldgroup:HeaderItems',
|
||||
position: 20 } ] }
|
||||
@Semantics.systemDateTime.localInstanceLastChangedAt: true
|
||||
lchg_date_time
|
||||
}
|
||||
19
src/zdemo_abap_rap_draft_m.ddls.baseinfo
Normal file
19
src/zdemo_abap_rap_draft_m.ddls.baseinfo
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"BASEINFO":
|
||||
{
|
||||
"FROM":
|
||||
[
|
||||
"ZDEMO_ABAP_TABCA"
|
||||
],
|
||||
"ASSOCIATED":
|
||||
[],
|
||||
"BASE":
|
||||
[],
|
||||
"ANNO_REF":
|
||||
[],
|
||||
"SCALAR_FUNCTION":
|
||||
[],
|
||||
"VERSION":0,
|
||||
"ANNOREF_EVALUATION_ERROR":""
|
||||
}
|
||||
}
|
||||
13
src/zdemo_abap_rap_draft_m.ddls.xml
Normal file
13
src/zdemo_abap_rap_draft_m.ddls.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DDLS>
|
||||
<DDLNAME>ZDEMO_ABAP_RAP_DRAFT_M</DDLNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<DDTEXT>CDS root view entity</DDTEXT>
|
||||
<SOURCE_TYPE>W</SOURCE_TYPE>
|
||||
</DDLS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
30
src/zdemo_abap_rap_ro_m.bdef.asbdef
Normal file
30
src/zdemo_abap_rap_ro_m.bdef.asbdef
Normal file
@@ -0,0 +1,30 @@
|
||||
managed implementation in class zbp_demo_abap_rap_ro_m unique;
|
||||
strict;
|
||||
|
||||
define behavior for ZDEMO_ABAP_RAP_RO_M alias root
|
||||
persistent table zdemo_abap_rapt1
|
||||
lock master
|
||||
authorization master ( global )
|
||||
|
||||
{
|
||||
create;
|
||||
update;
|
||||
delete;
|
||||
association _child { create; }
|
||||
action multiply_by_2;
|
||||
validation val on save { field field3; }
|
||||
determination det_add_text on save { create; }
|
||||
field ( readonly:update ) key_field;
|
||||
}
|
||||
|
||||
define behavior for ZDEMO_ABAP_RAP_CH_M alias child
|
||||
persistent table zdemo_abap_rapt2
|
||||
lock dependent by _parent
|
||||
authorization dependent by _parent
|
||||
{
|
||||
update;
|
||||
delete;
|
||||
field ( readonly ) key_field;
|
||||
field ( readonly:update ) key_ch;
|
||||
association _parent;
|
||||
}
|
||||
50
src/zdemo_abap_rap_ro_m.bdef.xml
Normal file
50
src/zdemo_abap_rap_ro_m.bdef.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_BDEF" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<BDEF>
|
||||
<NAME>ZDEMO_ABAP_RAP_RO_M</NAME>
|
||||
<TYPE>BDEF/BDO</TYPE>
|
||||
<DESCRIPTION>BDEF, managed, external numbering</DESCRIPTION>
|
||||
<DESCRIPTION_TEXT_LIMIT>60</DESCRIPTION_TEXT_LIMIT>
|
||||
<LANGUAGE>EN</LANGUAGE>
|
||||
<LINKS>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_m/source/main/versions</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/versions</REL>
|
||||
<TITLE>Historic versions</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_m/source/main</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/source</REL>
|
||||
<TYPE>text/plain</TYPE>
|
||||
<TITLE>Source Content</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_m/source/main</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/source</REL>
|
||||
<TYPE>text/html</TYPE>
|
||||
<TITLE>Source Content (HTML)</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_m/objectstructure</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/objectstructure</REL>
|
||||
<TITLE>Object Structure</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>/sap/bc/adt/vit/wb/object_type/bdefbdo/object_name/ZDEMO_ABAP_RAP_RO_M</HREF>
|
||||
<REL>self</REL>
|
||||
<TYPE>application/vnd.sap.sapgui</TYPE>
|
||||
<TITLE>Representation in SAP GUI</TITLE>
|
||||
</item>
|
||||
</LINKS>
|
||||
<MASTER_LANGUAGE>EN</MASTER_LANGUAGE>
|
||||
<ABAP_LANGU_VERSION>5</ABAP_LANGU_VERSION>
|
||||
<SOURCE_URI>./zdemo_abap_rap_ro_m/source/main</SOURCE_URI>
|
||||
<SOURCE_TYPE>ABAP_SOURCE</SOURCE_TYPE>
|
||||
<SOURCE_FIXED_POINT_ARITHMETIC>true</SOURCE_FIXED_POINT_ARITHMETIC>
|
||||
<SOURCE_UNICODE_CHECKS_ACTIVE>true</SOURCE_UNICODE_CHECKS_ACTIVE>
|
||||
</BDEF>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
12
src/zdemo_abap_rap_ro_m.ddls.asddls
Normal file
12
src/zdemo_abap_rap_ro_m.ddls.asddls
Normal file
@@ -0,0 +1,12 @@
|
||||
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||
define root view entity ZDEMO_ABAP_RAP_RO_M
|
||||
as select from zdemo_abap_rapt1
|
||||
composition [0..*] of ZDEMO_ABAP_RAP_CH_M as _child
|
||||
{
|
||||
key key_field,
|
||||
field1,
|
||||
field2,
|
||||
field3,
|
||||
field4,
|
||||
_child
|
||||
}
|
||||
21
src/zdemo_abap_rap_ro_m.ddls.baseinfo
Normal file
21
src/zdemo_abap_rap_ro_m.ddls.baseinfo
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"BASEINFO":
|
||||
{
|
||||
"FROM":
|
||||
[
|
||||
"ZDEMO_ABAP_RAPT1"
|
||||
],
|
||||
"ASSOCIATED":
|
||||
[
|
||||
"ZDEMO_ABAP_RAP_CH_M"
|
||||
],
|
||||
"BASE":
|
||||
[],
|
||||
"ANNO_REF":
|
||||
[],
|
||||
"SCALAR_FUNCTION":
|
||||
[],
|
||||
"VERSION":0,
|
||||
"ANNOREF_EVALUATION_ERROR":""
|
||||
}
|
||||
}
|
||||
13
src/zdemo_abap_rap_ro_m.ddls.xml
Normal file
13
src/zdemo_abap_rap_ro_m.ddls.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DDLS>
|
||||
<DDLNAME>ZDEMO_ABAP_RAP_RO_M</DDLNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<DDTEXT>CDS root view entity</DDTEXT>
|
||||
<SOURCE_TYPE>W</SOURCE_TYPE>
|
||||
</DDLS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
26
src/zdemo_abap_rap_ro_u.bdef.asbdef
Normal file
26
src/zdemo_abap_rap_ro_u.bdef.asbdef
Normal file
@@ -0,0 +1,26 @@
|
||||
unmanaged implementation in class zbp_demo_abap_rap_ro_u unique;
|
||||
strict;
|
||||
|
||||
define behavior for ZDEMO_ABAP_RAP_RO_U alias root
|
||||
lock master
|
||||
authorization master ( global, instance )
|
||||
|
||||
{
|
||||
create;
|
||||
update;
|
||||
delete;
|
||||
association _child { create; }
|
||||
action multiply_by_2;
|
||||
action ( features : instance ) multiply_by_3;
|
||||
action ( features : global ) set_z;
|
||||
field ( readonly:update ) key_field;
|
||||
}
|
||||
|
||||
define behavior for ZDEMO_ABAP_RAP_CH_U alias child
|
||||
lock dependent by _parent
|
||||
authorization dependent by _parent
|
||||
{
|
||||
field ( readonly ) key_field;
|
||||
field ( readonly : update ) key_ch;
|
||||
association _parent;
|
||||
}
|
||||
50
src/zdemo_abap_rap_ro_u.bdef.xml
Normal file
50
src/zdemo_abap_rap_ro_u.bdef.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_BDEF" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<BDEF>
|
||||
<NAME>ZDEMO_ABAP_RAP_RO_U</NAME>
|
||||
<TYPE>BDEF/BDO</TYPE>
|
||||
<DESCRIPTION>BDEF, unmanaged, external numbering</DESCRIPTION>
|
||||
<DESCRIPTION_TEXT_LIMIT>60</DESCRIPTION_TEXT_LIMIT>
|
||||
<LANGUAGE>EN</LANGUAGE>
|
||||
<LINKS>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_u/source/main/versions</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/versions</REL>
|
||||
<TITLE>Historic versions</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_u/source/main</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/source</REL>
|
||||
<TYPE>text/plain</TYPE>
|
||||
<TITLE>Source Content</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_u/source/main</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/source</REL>
|
||||
<TYPE>text/html</TYPE>
|
||||
<TITLE>Source Content (HTML)</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>./zdemo_abap_rap_ro_u/objectstructure</HREF>
|
||||
<REL>http://www.sap.com/adt/relations/objectstructure</REL>
|
||||
<TITLE>Object Structure</TITLE>
|
||||
</item>
|
||||
<item>
|
||||
<HREF>/sap/bc/adt/vit/wb/object_type/bdefbdo/object_name/ZDEMO_ABAP_RAP_RO_U</HREF>
|
||||
<REL>self</REL>
|
||||
<TYPE>application/vnd.sap.sapgui</TYPE>
|
||||
<TITLE>Representation in SAP GUI</TITLE>
|
||||
</item>
|
||||
</LINKS>
|
||||
<MASTER_LANGUAGE>EN</MASTER_LANGUAGE>
|
||||
<ABAP_LANGU_VERSION>5</ABAP_LANGU_VERSION>
|
||||
<SOURCE_URI>./zdemo_abap_rap_ro_u/source/main</SOURCE_URI>
|
||||
<SOURCE_TYPE>ABAP_SOURCE</SOURCE_TYPE>
|
||||
<SOURCE_FIXED_POINT_ARITHMETIC>true</SOURCE_FIXED_POINT_ARITHMETIC>
|
||||
<SOURCE_UNICODE_CHECKS_ACTIVE>true</SOURCE_UNICODE_CHECKS_ACTIVE>
|
||||
</BDEF>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
12
src/zdemo_abap_rap_ro_u.ddls.asddls
Normal file
12
src/zdemo_abap_rap_ro_u.ddls.asddls
Normal file
@@ -0,0 +1,12 @@
|
||||
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||
define root view entity ZDEMO_ABAP_RAP_RO_U
|
||||
as select from zdemo_abap_rapt1
|
||||
composition [0..*] of ZDEMO_ABAP_RAP_CH_U as _child
|
||||
{
|
||||
key key_field,
|
||||
field1,
|
||||
field2,
|
||||
field3,
|
||||
field4,
|
||||
_child
|
||||
}
|
||||
21
src/zdemo_abap_rap_ro_u.ddls.baseinfo
Normal file
21
src/zdemo_abap_rap_ro_u.ddls.baseinfo
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"BASEINFO":
|
||||
{
|
||||
"FROM":
|
||||
[
|
||||
"ZDEMO_ABAP_RAPT1"
|
||||
],
|
||||
"ASSOCIATED":
|
||||
[
|
||||
"ZDEMO_ABAP_RAP_CH_U"
|
||||
],
|
||||
"BASE":
|
||||
[],
|
||||
"ANNO_REF":
|
||||
[],
|
||||
"SCALAR_FUNCTION":
|
||||
[],
|
||||
"VERSION":0,
|
||||
"ANNOREF_EVALUATION_ERROR":""
|
||||
}
|
||||
}
|
||||
13
src/zdemo_abap_rap_ro_u.ddls.xml
Normal file
13
src/zdemo_abap_rap_ro_u.ddls.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DDLS>
|
||||
<DDLNAME>ZDEMO_ABAP_RAP_RO_U</DDLNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<DDTEXT>CDS root view entity</DDTEXT>
|
||||
<SOURCE_TYPE>W</SOURCE_TYPE>
|
||||
</DDLS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
101
src/zdemo_abap_rapt1.tabl.xml
Normal file
101
src/zdemo_abap_rapt1.tabl.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table for RAP</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<MAINFLAG>X</MAINFLAG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>CLIENT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FIELD1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000020</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FIELD2</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000020</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FIELD3</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FIELD4</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_RAPT1</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
94
src/zdemo_abap_rapt2.tabl.xml
Normal file
94
src/zdemo_abap_rapt2.tabl.xml
Normal file
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT2</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table for RAP</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<MAINFLAG>X</MAINFLAG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT2</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>CLIENT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>KEY_CH</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FIELD_CH1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000020</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>FIELD_CH2</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_RAPT2</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_RAPT2</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
101
src/zdemo_abap_tab1.tabl.xml
Normal file
101
src/zdemo_abap_tab1.tabl.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_TAB1</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<MAINFLAG>X</MAINFLAG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_TAB1</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>CLIENT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CHAR1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000020</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CHAR2</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000020</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUM1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUM2</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_TAB1</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_TAB1</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
92
src/zdemo_abap_tab2.tabl.xml
Normal file
92
src/zdemo_abap_tab2.tabl.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_TAB2</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<MAINFLAG>X</MAINFLAG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_TAB2</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>CLIENT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CHAR1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000020</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUM1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUMLONG</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>8</INTTYPE>
|
||||
<INTLEN>000008</INTLEN>
|
||||
<DATATYPE>INT8</DATATYPE>
|
||||
<LENG>000019</LENG>
|
||||
<MASK> INT8</MASK>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_TAB2</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_TAB2</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
109
src/zdemo_abap_tabca.tabl.xml
Normal file
109
src/zdemo_abap_tabca.tabl.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DD02V>
|
||||
<TABNAME>ZDEMO_ABAP_TABCA</TABNAME>
|
||||
<DDLANGUAGE>E</DDLANGUAGE>
|
||||
<TABCLASS>TRANSP</TABCLASS>
|
||||
<CLIDEP>X</CLIDEP>
|
||||
<DDTEXT>Demo table for RAP calculator</DDTEXT>
|
||||
<MASTERLANG>E</MASTERLANG>
|
||||
<MAINFLAG>X</MAINFLAG>
|
||||
<CONTFLAG>A</CONTFLAG>
|
||||
<EXCLASS>1</EXCLASS>
|
||||
<ABAP_LANGUAGE_VERSION>5</ABAP_LANGUAGE_VERSION>
|
||||
</DD02V>
|
||||
<DD09L>
|
||||
<TABNAME>ZDEMO_ABAP_TABCA</TABNAME>
|
||||
<AS4LOCAL>A</AS4LOCAL>
|
||||
<TABKAT>0</TABKAT>
|
||||
<TABART>APPL0</TABART>
|
||||
<BUFALLOW>N</BUFALLOW>
|
||||
</DD09L>
|
||||
<DD03P_TABLE>
|
||||
<DD03P>
|
||||
<FIELDNAME>CLIENT</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000006</INTLEN>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<DATATYPE>CLNT</DATATYPE>
|
||||
<LENG>000003</LENG>
|
||||
<MASK> CLNT</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>ID</FIELDNAME>
|
||||
<KEYFLAG>X</KEYFLAG>
|
||||
<ROLLNAME>SYSUUID_X16</ROLLNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<NOTNULL>X</NOTNULL>
|
||||
<COMPTYPE>E</COMPTYPE>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUM1</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>ARITHM_OP</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>C</INTTYPE>
|
||||
<INTLEN>000002</INTLEN>
|
||||
<DATATYPE>CHAR</DATATYPE>
|
||||
<LENG>000001</LENG>
|
||||
<MASK> CHAR</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>NUM2</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>X</INTTYPE>
|
||||
<INTLEN>000004</INTLEN>
|
||||
<DATATYPE>INT4</DATATYPE>
|
||||
<LENG>000010</LENG>
|
||||
<MASK> INT4</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CALC_RESULT</FIELDNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<INTTYPE>g</INTTYPE>
|
||||
<INTLEN>000008</INTLEN>
|
||||
<DATATYPE>STRG</DATATYPE>
|
||||
<MASK> STRG</MASK>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>CREA_DATE_TIME</FIELDNAME>
|
||||
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<COMPTYPE>E</COMPTYPE>
|
||||
</DD03P>
|
||||
<DD03P>
|
||||
<FIELDNAME>LCHG_DATE_TIME</FIELDNAME>
|
||||
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||
<ADMINFIELD>0</ADMINFIELD>
|
||||
<COMPTYPE>E</COMPTYPE>
|
||||
</DD03P>
|
||||
</DD03P_TABLE>
|
||||
<I18N_LANGS>
|
||||
<LANGU>늑</LANGU>
|
||||
</I18N_LANGS>
|
||||
<DD02_TEXTS>
|
||||
<item>
|
||||
<DDLANGUAGE>늑</DDLANGUAGE>
|
||||
<DDTEXT>TABT ZDEMO_ABAP_TABCA</DDTEXT>
|
||||
</item>
|
||||
</DD02_TEXTS>
|
||||
<TABL_EXTRAS>
|
||||
<TDDAT>
|
||||
<TABNAME>ZDEMO_ABAP_TABCA</TABNAME>
|
||||
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||
</TDDAT>
|
||||
</TABL_EXTRAS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
Reference in New Issue
Block a user