Abap On Hana
Abap On Hana
define root
view entity
define
behavior for
CL_ABAP_BEHAVIOR_HANDLER
ABSTRACT FINAL
CLASS lhc_root DEFINITION INHERITING FROM cl_abap_behavior_handler.
...
ENDCLASS.
RESULT
FOR MODIFY
METHODS, FOR
"Create
METHODS create FOR MODIFY
IMPORTING entities FOR CREATE bdef.
"Action: action name is preceded by the BDEF name and a tilde after FOR ACTION
METHODS some_action FOR MODIFY
IMPORTING keys FOR ACTION bdef~some_action.
IMPORTING
CHANGING
mapped failed reported
mapped
mapped
%cid
failed
reported
reported
ABSTRACT FINAL
adjust_numbers
CL_ABAP_BEHAVIOR_SAVER
COMMIT
ENTITIES
COMMIT ENTITIES
CLASS lsc_bdef DEFINITION INHERITING FROM cl_abap_behavior_saver.
PROTECTED SECTION.
"Preliminary IDs are mapped to final keys. Only for late numbering.
METHODS adjust_numbers REDEFINITION.
ENDCLASS.
FOR
"Data objects with input derived types (entity = name of a root entity)
"Response parameters
DATA map TYPE RESPONSE FOR MAPPED entity.
DATA fail TYPE RESPONSE FOR FAILED entity.
DATA rep TYPE RESPONSE FOR REPORTED entity.
%
%
%data
%key
%
%pid
%is_draft
%cid
%cid_ref %cid
%cid
AUTO FILL
CID %cid
%cid
%key %tky
%tky
%key %tky %key %is_draft
%tky
%control
%control
ABP_BEHV_FLAG mk
IF_ABAP_BEHV x length 1
%control if_abap_behv=>mk-off
...
create;
update;
delete;
action some_act;
...
DATA: cr_tab TYPE TABLE FOR CREATE root_ent, "input derived type
mapped_resp TYPE RESPONSE FOR MAPPED root_ent, "response parameters
failed_resp TYPE RESPONSE FOR FAILED root_ent,
reported_resp TYPE RESPONSE FOR REPORTED root_ent.
"Input derived type for the EML statement is filled using the VALUE operator
"Assumption: key_field is the key field having type i,
"field1 and field2 are data fields with character-like data type.
"Specify %cid even if not used or of interest; it must be unique within a reque
cr_tab = VALUE #(
( %cid = 'cid1' key_field = 1
field1 = 'A' field2 = 'B' )
( %cid = 'cid2'
"Just to demo %data/%key. You can specify fields with or without
"the derived type components
%data = VALUE #( %key-key_field = 2
field1 = 'C'
field2 = 'D' ) ) ).
WITH
FIELDS %control
if_abap_behv=>mk-on
%control if_abap_behv=>mk-off field2
field2
key_field
failed_resp
reported_resp
%cid
MODIFY
ENTITY
DATA FINAL
%cid_ref %cid_ref
DELETE
FROM TYPE
TABLE FOR DELETE %cid_ref
DELETE FROM
VALUE #( ( %cid_ref = 'cid5' ) "Instance referenced via %cid_ref
( key_field = 9 ) ) "Instance referenced via the key
...
RESULT
READ
READ FIELDS ( ... )
WITH FROM
ALL FIELDS WITH
LINK
READ ENTITIES
OPERATIONS
"The statement is taken from the executable example. The example has a
"root entity and a child entity. For both entities, RAP BO instances
"are to be read (read and read-by-association operation).
DATA:
"The following data object is the operand of the dynamic EML statement
"It is an internal table and has a special, RAP-specific type.
op_tab TYPE abp_behv_retrievals_tab,
"Child entity
"Instances to be read for a read-by-association operation
"The shared key is 'key_field'.
rba_dyn = VALUE #(
( %key-key_field = 1
%control = VALUE #(
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_ch = if_abap_behv=>mk-on
field_ch1 = if_abap_behv=>mk-on
field_ch2 = if_abap_behv=>mk-on ) ) ).
COMMIT ENTITIES
COMMIT ENTITIES
COMMIT ENTITIES COMMIT WORK
COMMIT ENTITIES
COMMIT ENTITIES sy-subrc COMMIT
ENTITIES COMMIT WORK
sy-subrc COMMIT ENTITIES
COMMIT ENTITIES
COMMIT ENTITIES.
IF sy-subrc <> 0.
...
ENDIF.
IN LOCAL
MODE
IN LOCAL MODE
num = 2 * 3 * 5 * 53 * 2267.
cl_demo_output=>display( num ).
num
cl_demo_output=>display
32003700 838874880
3604530
cl_demo_output=>display( text ).
cl_demo_output=>display 27
27
32003700 32003700
27
DATA hex TYPE x LENGTH 4 VALUE 'CDFFC8FF'.
cl_demo_output=>display( hex ).
cl_demo_output=>display
32003700
cl_demo_output=>new(
)->write_data( hex
)->write_data( <num>
)->write_data( <text> )->display( ).
hex <num>
<text>
32003700 3604530 27
num = text.
cl_demo_output=>new(
)->write_data( text
)->write_data( <hex_text>
)->write_data( num
)->write_data( <hex_num> )->display( ).
text num
27 27
num
num
32003700 text 1B000000 num
<hex_text> <hex_num>
text num
text
'27'
FROM
FROM
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view entity DEMO_CDS_SIMPLE_TREE_VIEW
as select from demo_simple_tree
association [1..1] to DEMO_CDS_SIMPLE_TREE_VIEW as _tree
on $projection.parent = _tree.id
{
_tree,
key id,
parent_id as parent,
name
}
DEMO_SIMPLE_TREE
_tree ON
id parent
parent id
name
ON
DEFINE HIERARCHY
SOURCE DEMO_CDS_SIMPLE_TREE_VIEW
CHILD TO PARENT ASSOCIATION _tree
START WHERE
p_id
SIBLINGS ORDER BY
{ ... }
DEFINE HIERARCHY
DEMO_SIMPLE_TREE START WHERE
ON
DEFINE HIERARCHY
FROM
...
SELECT
CL_DEMO_SQL_HIERARCHIES
SELECT
NAME
HIERARCHY
...
HIERARCHY( ... )
ASSERT
DEMO_CDS_SIMPLE_TREE_VIEW
_tree
...
WITH
+cte_simple_tree_source AS
( SELECT FROM demo_simple_tree
FIELDS id,
parent_id AS parent,
name )
WITH ASSOCIATIONS (
JOIN TO MANY +cte_simple_tree_source AS _tree
ON +cte_simple_tree_source~parent = _tree~id )
SELECT FROM HIERARCHY( SOURCE +cte_simple_tree_source
CHILD TO PARENT ASSOCIATION _tree
START WHERE id = @root_id
SIBLINGS ORDER BY id
MULTIPLE PARENTS NOT ALLOWED ) "hierarchy
FIELDS id,
parent,
name,
hierarchy_rank,
hierarchy_tree_size,
hierarchy_parent_rank,
hierarchy_level,
hierarchy_is_cycle,
hierarchy_is_orphan,
node_id,
parent_id
INTO TABLE @FINAL(asql_cte_result).
WITH
cte_simple_tree_source
DEMO_CDS_SIMPLE_TREE_VIEW
DEMO_SIMPLE_TREE
_tree WITH ASSOCIATIONS
WITH
SELECT
SELECT, FROM
HIERARCHY
WITH HIERARCHY
WITH
DATA root_id TYPE demo_cds_simple_tree_view-id.
...
WITH
+tree AS
( SELECT FROM demo_cds_simple_tree( p_id = @root_id )
FIELDS * )
WITH HIERARCHY demo_cds_simple_tree
SELECT FROM +tree "hierarchy
FIELDS id,
parent,
name,
hierarchy_rank,
hierarchy_tree_size,
hierarchy_parent_rank,
hierarchy_level,
hierarchy_is_cycle,
hierarchy_is_orphan,
node_id,
parent_id
INTO TABLE @FINAL(cte_cds_result).
...
WITH
+tree AS
( SELECT FROM HIERARCHY(
SOURCE demo_cds_simple_tree_view
CHILD TO PARENT ASSOCIATION _tree
START WHERE id = @root_id
SIBLINGS ORDER BY id
MULTIPLE PARENTS NOT ALLOWED ) AS asql_hierarchy
FIELDS id,
parent,
name )
WITH HIERARCHY asql_hierarchy
SELECT FROM +tree "hierarchy
FIELDS id,
parent,
name,
hierarchy_rank,
hierarchy_tree_size,
hierarchy_parent_rank,
hierarchy_level,
hierarchy_is_cycle,
hierarchy_is_orphan,
node_id,
parent_id
INTO TABLE @FINAL(cte_asql_result).
...
WITH
+cte_simple_tree_source AS
( SELECT FROM demo_simple_tree
FIELDS id,
parent_id AS parent,
name )
WITH ASSOCIATIONS (
JOIN TO MANY +cte_simple_tree_source AS _tree
ON +cte_simple_tree_source~parent = _tree~id ),
+tree AS
( SELECT FROM HIERARCHY(
SOURCE +cte_simple_tree_source
CHILD TO PARENT ASSOCIATION _tree
START WHERE id = @root_id
SIBLINGS ORDER BY id
MULTIPLE PARENTS NOT ALLOWED ) AS cte_hierarchy
FIELDS id,
parent,
name )
WITH HIERARCHY cte_hierarchy
SELECT FROM +tree "hierarchy
FIELDS id,
parent,
name,
hierarchy_rank,
hierarchy_tree_size,
hierarchy_parent_rank,
hierarchy_level,
hierarchy_is_cycle,
hierarchy_is_orphan,
node_id,
parent_id
INTO TABLE @FINAL(cte_cte_result).
CL_DEMO_SQL_HIERARCHIES
HIERARCHY_DESCENDANTS
HIERARCHY_DISTANCE
CL_DEMO_SQL_HIERARCHIES
...
DEMO_CDS_SIMPLE_TREE_VIEW
p_id sub_id
HIERARCHY_DISTANCE
DISTANCE
HIERARCHY_ANCESTORS
DATA root_id TYPE demo_cds_simple_tree_view-id.
...
CL_DEMO_SQL_HIERARCHIES
HIERARCHY_DISTANCE
HIERARCHY_PARENT_RANK HIERARCHY_SIBLINGS
...
HIERARCHY_SIBLING_DISTANCE
CL_DEMO_SQL_HIERARCHIES
HIERARCHY_DESCENDANTS_AGGREGATE
HIERARCHY_ANCESTORS_AGGREGATE
HIERARCHY_DESCENDANTS_AGGREGATE
TYPES:
BEGIN OF value,
id TYPE i,
amount TYPE p LENGTH 16 DECIMALS 2,
END OF value.
DATA value_tab TYPE SORTED TABLE OF value WITH UNIQUE KEY id.
...
value_tab
HIERARCHY_DESCENDANTS_AGGREGATE
FROM
DEMO_CDS_SIMPLE_TREE_VIEW value_tab
SUM MEASURES
WHERE
WITH
HIERARCHY_AGGREGATE_TYPE
WITH SUBTOTAL
HIERARCHY_AGGREGATE_TYPE AMOUNT_SUM
WHERE
WITH BALANCE
HIERARCHY_AGGREGATE_TYPE
AMOUNT_SUM
WHERE
WITH
CL_DEMO_SQL_HIERARCHIES
SELECT, FROM
hierarchy_data
GROUP BY GROUP BY
LOOP AT itab IN GROUP FOR
AT NEW ...
spfli_tab SPFLI
LOOP AT GROUP BY
wa wa-
carrid wa
wa
INTO GROUP BY
wa key
GROUP SIZE GROUP INDEX WITHOUT MEMBERS
key wa
NO MEMBERS
PUBLIC SECTION.
"Specifying the interface is mandatory
INTERFACES if_amdp_marker_hdb.
...
ENDCLASS.
METHODS CLASS-
METHODS
AMDP OPTIONS
...
PUBLIC SECTION.
METHODS some_amdp_meth
... "Here go the parameters
PRIVATE SECTION.
CLASS-METHODS another_amdp_meth
... "Here go the parameters
...
VALUE(...)
RETURNING
...
PUBLIC SECTION.
METHODS amdp_meth
IMPORTING VALUE(num) TYPE i,
EXPORTING VALUE(tab) TYPE tab_type.
...
METHOD
...
METHOD amdp_meth
BY DATABASE PROCEDURE
FOR HDB
LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
USING db_object. "see comments further down
"Beginning of the SQLScript code (note that it is not ABAP code although it loo
ENDMETHOD.
...
"Comments:
" BY DATABASE PROCEDURE -> Flags the AMDP method as AMDP procedure
" FOR HDB -> Definess the database system where the method is
" currently, only HDB (SAP HANA database) is possib
" LANGUAGE SQLSCRIPT -> Defines the programming language of the database
" OPTIONS READ-ONLY -> Specifies database-specific options
" USING db_object. -> Optional addition; specifies database objects;
" can also be AMDP procedures and functions
OPTIONS READ-ONLY
USING
RETURNING
RAISING
...
PUBLIC SECTION.
METHODS amdp_func
IMPORTING VALUE(num) TYPE i,
VALUE(some_elem) TYPE c LENGTH 3,
RETURNING VALUE(tab) TYPE tab_type.
...
...
METHOD amdp_func
BY DATABASE FUNCTION
FOR HDB
LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
USING db_object.
"Beginning of the SQLScript code (note that it is not ABAP code although it loo
ENDMETHOD.
"Comment:
" BY DATABASE FUNCTION -> Flags the AMDP method as AMDP function
...
CLASS-METHODS
FOR TABLE FUNCTION
...
PUBLIC SECTION.
CLASS-METHODS:
table_func FOR TABLE FUNCTION some_ddl_source.
...
IMPLEMENTED BY METHOD
amdp_class=>amdp_method
//Here go annotations.
define table function some_ddl_source
returns
{
client : abap.clnt;
field1 : abap.char(5);
field2 : abap.char(5);
}
implemented by method amdp_class=>amdp_method;
SELECT
SELECT * FROM some_ddl_source INTO ...
OPTIONS READ-ONLY
CALL_AMDP_METHOD CL_ABAP_DBFEATURES
IF NOT cl_abap_dbfeatures=>use_features(
EXPORTING requested_features =
VALUE #( ( cl_abap_dbfeatures=>call_amdp_method ) ) ).
DO
WHILE
IF
DATA(num) = 1 + 1.
NOT AND OR
"Multiple expressions
IF num = 1 AND flag = 'X'.
...
ENDIF.
IF
"Comparisons
IF 2 = num "equal, alternative EQ
AND 1 <> num "not equal, alternative NE
AND 1 < num "less than, alternative LT
AND 3 > num "greater than, alternative GT
AND 2 >= num "greater equal, alternative GE
AND 2 <= num "less equal, alternative LE
"Comparison operators CO, CN ,CA, NA, CS, NS, CP, NP for character-like data ty
"see the cheat sheet on string processing
"Predicate Expressions
AND empty_string IS INITIAL "Checks whether the operand is initial. The expres
"is true, if the operand contains its type-depende
AND num IS NOT INITIAL "NOT negates
AND dref IS BOUND "Checks whether a data reference variable contains a valid r
"can be dereferenced;
"Negation (IS NOT BOUND) is possible which is also valid for
AND oref IS BOUND "Checks whether an object reference variable contains a vali
AND <fs> IS ASSIGNED "Checks whether a memory area is assigned to a field symb
"Boolean Functions
"Determine the truth value of a logical expression specified as an argument;
"the return value has a data type dependent on the function and expresses
"the truth value of the logical expression with a value of this type.
"Built-in functions
AND to_upper( flag ) = 'X'
AND NOT to_lower( flag ) = 'X'
"Numeric functions
AND ipow( base = num exp = 2 ) = 4
"Functional methods
"Method with exactly one return value
AND addition( num1 = 1 num2 = 1 ) = 2
"Calculation expressions
AND 4 - 3 + 1 = num
"String expressions
AND `ha` && `llo` = <fs>
"Constructor expression
AND CONV i( '2.03' ) = num
AND VALUE string_table( ( `a` ) ( `b` ) ( `c` ) ) = str_table
"Table expression
AND str_table[ 2 ] = `b`.
ELSE.
ENDIF.
IF
IF
ELSE
ELSE ELSEIF
ELSE
ENDIF.
ELSEIF log_exp2.
... "statement_block2
ELSEIF log_exp3.
... "statement_block3
ELSE.
... "statement_blockn
ENDIF.
DATA(num) = 1.
DATA(flag) = 'X'.
IF num = 1.
IF flag = 'X'.
...
ELSE.
...
ENDIF.
ELSE.
ENDIF.
ASSERT 1 = 0
ELSE ELSE
COND
COND
COND
#
THEN
CASE
CASE
CASE
WHEN CASE
ENDCASE.
CASE operand.
WHEN op1.
... "statement_block
WHEN op2.
... "statement_block
WHEN op3 OR op4.
... "statement_block
WHEN OTHERS.
... "statement_block
ENDCASE.
CASE TYPE OF
"oref must be an object reference variable with the static type of a class or a
CASE TYPE OF oref.
WHEN TYPE some_class.
... "statement_block
WHEN TYPE some_intf.
... "statement_block
WHEN OTHERS.
... "statement_block
ENDCASE.
SWITCH
SWITCH
COND
SWITCH COND
DO
DO ENDDO
EXIT
DO.
... "statement_block
"To be terminated with an EXIT statement.
ENDDO.
TIMES
DO 5 TIMES.
... "statement_block
ENDDO.
sy-index
CONTINUE CONTINUE.
log_exp
CHECK
CHECK
log_exp.
EXIT EXIT.
RETURN
RETURN
EXIT CHECK
WHILE
WHILE ENDWHILE
DO sy-index
WHILE log_exp.
... "statement_block
ENDWHILE.
LOOP ... ENDLOOP
sy-index
sy-tabix
VALUE REDUCE
RETURN
CX_...
TRY
TRY
TRY.
"statement block
ENDTRY.
TRY CATCH
CATCH CATCH
CX_SY_ZERODIVIDE
TRY.
"TRY block
DATA(div1) = 1 / 0.
"A CATCH block is in this example not only valid for cx_sy_zerodivide as
"but also for all derived exceptions classes.
"In the following CATCH block, the predefined exception class cx_sy_arith
"is specified. cx_sy_zerodivide is derived from cx_sy_arithmetic_error.
"Hence, cx_sy_arithmetic_error can be specified and handle the exception,
"Basically, using the exception root class cx_root would be also possible
"choosing an appropriate exception class is recommended. See further down
CATCH cx_sy_arithmetic_error.
... "CATCH block
ENDTRY.
INTO CATCH
CX_SY_ZERODIVIDE
CX_SY_ARITHMETIC_OVERFLOW
CX_SY_ARITHMETIC_ERROR
CX_SY_ARITHMETIC_ERROR
CX_SY_ARITHMETIC_OVERFLOW CX_SY_ZERODIVIDE
INTO
TRY.
... "TRY block
"The object reference variable can be created inline, for example, using
CATCH cx_sy_arithmetic_error INTO DATA(error_oref).
... "catch block
"To get exception texts, you can call, for example, the method get_text
DATA(error_text) = error_oref->get_text( ).
ENDTRY.
TRY.
TRY
CATCH
CATCH
TRY
TRY
TRY
TRY
ENDTRY
CX_SY_ZERODIVIDE COMPUTE_INT_ZERODIVIDE
UNCAUGHT_EXCEPTION
TRY
CX
CL
CX_ROOT CX_ROOT
CX_SY_ZERODIVIDE
CX_STATIC_CHECK
CX_STATIC_CHECK
TRY
RAISING
CX_SOME_ERROR CX_STATIC_CHECK
...
"Method call: Somewhere in the code of a user that calls the method
"Exception handled locally in a TRY control structure.
TRY.
DATA(val) = some_meth( str = `hallo` ).
CATCH cx_some_error.
...
ENDTRY.
"If it was just like this without the TRY control structure, a warning
DATA(val2) = some_meth( str = `hi` ).
CX_DYNAMIC_CHECK
CX_STATIC_CHECK CX_DYNAMIC_CHECK
CX_SY_NO_HANDLER PREVIOUS
CX_SY_ZERODIVIDE
CX_DYNAMIC_CHECK
CX_NO_CHECK
CX_NO_CHECK
RAISE EXCEPTION
COND THROW
...
"RAISE EXCEPTION statement
"The TYPE addition specifies the type of the exception, i. e. the exception cla
"The statement is also possible without TYPE. In that case, you can use an exis
"Note that there are plenty of additions. Check the ABAP Keyword Documentation.
RAISE EXCEPTION TYPE cx_sy_zerodivide.
...
ASSERT ASSERT
ASSERTION_FAILED
DATA(flag) = abap_false.
...
ENDCLASS.
FOR TESTING
FOR TESTING
RISK LEVEL ...
CRITICAL
DANGEROUS
HARMLESS
DURATION ...
SHORT
MEDIUM
LONG
CTRL SPACE
"The code in this snippet refers to the test class in the test include.
"Test class, declaration part
CLASS ltc_test_class DEFINITION
FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
...
ENDCLASS.
"Declaring friendship
CLASS cl_class_under_test DEFINITION LOCAL FRIENDS ltc_test_class.
DEFERRED
"Test include
PARTIALLY IMPLEMENTED
ABSTRACT
CL_ABAP_UNIT_ASSERT
PRIVATE SECTION.
"Note: As a further component in test classes, usually, a reference varia
"is created for an instance of the class under test.
DATA ref_cut TYPE REF TO cl_class_under_test.
ENDCLASS.
METHOD some_test_method.
... "Here goes the implementation of the test.
ENDMETHOD.
ENDCLASS.
CL_ABAP_UNIT_ASSERT
CL_ABAP_UNIT_ASSERT
ASSERT_EQUALS
ASSERT_BOUND
ASSERT_NOT_BOUND
ASSERT_INITIAL
ASSERT_NOT_INITIAL
ASSERT_SUBRC sy-subrc
FAIL
ACT ANY
EXP ANY
ASSERT_EQUALS
MSG CSEQUENCE
QUIT INT1
if_abap_unit_constant=>quit-no
"The code in this snippet refers to the production code in the global class.
"It shows a method declaration for a simple calculation in the class under test
PRIVATE SECTION.
METHODS:
multiply_by_two IMPORTING num TYPE i
RETURNING VALUE(result) TYPE i.
...
"Class implementation part
CLASS cl_class_under_test IMPLEMENTATION.
METHOD multiply_by_two.
result = num * 2.
ENDMETHOD.
...
"The code in this snippet refers to the test class in the test include.
...
"when
"Calling method that is to be tested
"As an example, 5 is inserted. The result should be 10, which is then check
DATA(result) = ref_cut->multiply_by_two( 5 ).
"then
"Assertion
cl_abap_unit_assert=>assert_equals(
act = result
exp = 10 ).
ENDMETHOD.
ENDCLASS.
FOR TESTING
setup
teardown
class_setup
class_teardown
PRIVATE SECTION.
DATA: ref_cut TYPE REF TO cl_class_under_test.
METHODS:
"special methods
setup,
teardown,
"test methods
some_test_method FOR TESTING,
another_test_method FOR TESTING.
ENDCLASS.
METHOD setup.
"Creating an object of the class under test
ref_cut = NEW #( ).
"Here goes, for example, code for preparing the test data,
"e.g. filling a database table used for test methods.
...
ENDMETHOD.
METHOD some_test_method.
"Method call
DATA(result) = ref_cut->multiply_by_two( 5 ).
"Assertion
cl_abap_unit_assert=>...
ENDMETHOD.
METHOD another_test_method.
"Another method to be tested, it can also use the centrally created instanc
"Calling method
DATA(result) = ref_cut->multiply_by_three( 6 ).
"Assertion
cl_abap_unit_assert=>...
ENDMETHOD.
METHOD teardown.
"Here goes, for example, code to undo the test data preparation
"during the setup method (e.g. deleting the inserted database table entr
...
ENDMETHOD.
ENDCLASS.
PARTIALLY IMPLEMENTED
FINAL
constructor
...
DATA some_table TYPE TABLE OF dbtab WITH EMPTY KEY.
TEST-SEAM select_from_db.
SELECT * FROM dbtab
INTO TABLE @some_table.
END-TEST-SEAM.
...
"The code in this snippet refers to the code in the test class.
...
TEST-INJECTION select_from_db.
some_table = VALUE #(
( ... )
( ... ) ).
END-TEST-INJECTION.
...
zdemo_abap_cds_ve...
WAIT
COMMIT CONNECTION
DB_COMMIT
COMMIT WORK
ROLLBACK CONNECTION
DB_ROLLBACK
ROLLBACK WORK
CALL FUNCTION ... IN UPDATE TASK
COMMIT WORK
FUNCTION zsome_update_fu_mod
IMPORTING
VALUE(values) TYPE some_dbtab.
ENDFUNCTION.
COMMIT WORK
COMMIT WORK AND WAIT
"Synchronous update
...
...
*************************************************************
"Asynchronous update
...
...
*************************************************************
"Local update
...
PERFORM ... ON
ROLLBACK ROLLBACK WORK
ON COMMIT
COMMIT WORK [AND
WAIT] ROLLBACK WORK
ROLLBACK WORK
COMMIT WORK
AUTHORITY-CHECK
ENQUEUE_... DEQUEUE_...
CL_ABAP_LOCK_OBJECT_FACTORY
ROLLBACK ENTITIES
ROLLBACK WORK
CTRL + SHIFT + A
zdemo_abap_sap_luw
F8
COMMIT WORK COMMIT WORK AND WAIT SET UPDATE TASK
LOCAL
ON
ROLLBACK
ON COMMIT ON ROLLBACK
EXPORT IMPORT
sy-dynnr
CALL SCREEN
PROCESS BEFORE OUTPUT
PROCESS ON HELP-REQUEST
PROCESS ON VALUE-REQUEST
PROCESS BEFORE OUTPUT.
... "Here, for example, modules can be called.
"When you implement field or value helps, use the following processin
PROCESS ON HELP-REQUEST.
...
PROCESS ON VALUE-REQUEST.
...
MODULE
FIELD
CHAIN ENDCHAIN
LOOP ENDLOOP
LOOP
CALL SUBSCREEN
MODULE ENDMODULE
MODULE
some_module_9000.
some_module_9000
PROCESS BEFORE OUTPUT MODULE
OUTPUT
DATA
CLASS-DATA
TABLES
DATA CLASS-DATA
TABLES
PROGRAM some_program.
"Variable declarations
DATA some_dobj TYPE abap_bool.
TABLES some_struct.
ENDCLASS.
ok_code
CASE
sy-ucomm
sy-ucomm
CASE
PROGRAM zdemo_program.
...
"PBO
MODULE pbo_9000 OUTPUT.
...
"Prefill the value for a screen element, e.g. input field
some_input_field = 'Hallo'.
...
ENDMODULE.
"PAI
MODULE pai_9000 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
"For example, a button is linked with a function code named PUSH
WHEN 'PUSH'.
...
WHEN 'ENTER'.
...
WHEN 'CANCEL'.
...
WHEN OTHERS.
...
ENDCASE.
ENDMODULE.
...
FIELD
FIELD
FIELD
FIELD
FIELD
"Note: More syntax options are possible with the FIELD statement.
"See some of them below and more details in the ABAP Keyword Document
mod
dynp_field
mod dynp_field
CHAIN ENDCHAIN
CHAIN.
FIELD dynp_field1.
FIELD dynp_field2.
...
MODULE mod ON CHAIN-INPUT.
"Note: ON REQUEST is also possible
ENDCHAIN.
required
E
LEAVE
W E MESSAGE
FIELD CHAIN
FIELD
mod
CHAIN
CHAIN.
FIELD dynp_field1.
FIELD dynp_field2.
...
MODULE mod.
ENDCHAIN.
mod
PROCESS ON HELP-REQUEST
FIELD dynp_field MODULE mod.
FIELD
mod
HELP_OBJECT_SHOW
PROCESS ON VALUE-REQUEST
FIELD dynp_field MODULE mod.
FIELD
DYNP_VALUES_READ DYNP_VALUES_UPDATE
F4IF_INT_TABLE_VALUE_REQUEST
CALL
SCREEN
***************************
STARTING AT ENDING AT
STARTING AT ENDING AT
col_up_left line_up
col_up_right line_low
col_up_left line_up
col_up_right line_low
LEAVE SCREEN.
SET SCREEN
LEAVE TO SCREEN
SET SCREEN
dynnr. LEAVE SCREEN.
LEAVE
CALL
TRANSACTION LEAVE TO TRANSACTION
LEAVE PROGRAM
****************************************
****************************************
****************************************
LOOP AT SCREEN
SCREEN
LOOP AT SCREEN
MODIFY SCREEN
LOOP AT SCREEN
SCREEN FROM
SET PF-STATUS
****************************************
sy-
pfkey GET PF-STATUS
****************************************
SET TITLEBAR
****************************************
"WITH addition
"The placeholders of a GUI title can be replaced by the forma
"content of data objects text1, and so on.
SET TITLEBAR title WITH text1 ... text9.
CONTROLS
REFRESH CONTROL
activetab
CALL
SUBSCREEN
activetab
CALL SUBSCREEN
CALL
SUBSCREEN
CALL SUBSCREEN sub_area.
******************************************************
CL_GUI_TOOLBAR
ADD_BUTTON
FUNCTION_SELECTED
CL_GUI_PICTURE
LOAD_PICTURE_FROM_URL
PICTURE_DBLCLICK
CL_GUI_HTML_VIEWER
SAPEVENT
CL_GUI_TEXTEDIT
FIND_AND_REPLACE
CL_GUI_SIMPLE_TREE
CL_GUI_ALV_GRID
CL_SALV_TABLE
CTRL + SHIFT + A
zdemo_abap_dynpro
F8
MODULE FIELD CHAIN ENDCHAIN LOOP ENDLOOP CALL SUBSCREEN