Beruflich Dokumente
Kultur Dokumente
4
/ SAP ABAP General / New ABAP Language in ABAP 7.4
ABAP Language 7.4 bring a lot of brand new functionality, this article will focus on the large number of
new features that have been introduced into ABAP 7.4. These features are divided into the following
categories database access, creating data, string processing, calling function, conditional logic, internal
table, OOP, etc.
One of the new features of ABAP 7.4 is the ability to insert CASE statements into SQL Queries. Please
check ABAP Code below.
1 START-OF-SELECTION.
2
3 SELECT CASE WHEN auart = 'Z1IN' THEN
4 WHEN auart = 'Z2KP' THEN
5 ELSE 'OTHERS'
6 END AS group,
7 vbeln FROM vbak INTO TABLE @D
@ symbols is to let SAP System know you are not talking about field in the database, @DATA(li_Vbeln) is
means SAP System will create internal table LI_VBELN directly so you dont need declare before.
If you ever used Inner Join in ABAP you must to list field one by one from the main table , this
improvement you can list all of the fields. Please check out this ABAP Code.
ABAP 7.4
The symbol * ( asterisk ) it acts just like the wildcard SELECT * , and for this sample you will get all fields
in VBAK table.
If you double click column A ( Flat Structure ) in Debugger, you will see all field in VBAK table.
In ABAP 7.4 has made it less important to declare variables at the start of your routine or method, the
ABAP Compiler knows what data type it should be, instead of declaring it yourself and can save you
several lines of code.
ABAP 7.4
Normally in Java you need to use NEW to create instances of objects, but in the ABAP 7.4 , you can use
NEW to instances object instead of use CREATE OBJECT.
ABAP 7.4
1 DATA : lo_myclass TYPE REF TO ZCL_MYCLA
2
3 lo_myclass = NEW zcl_Myclass( myname =
Normally you can use the CONCATENATE statement to concatenate two or more string. but start from
ABAP 7.02 you can use pipes and curly bracket to concatenate two or more string.
You can simpler ABAP Code for two lines before like this
Normally to call function module you need to pass some variable to function module parameter, the dump
error occured when we declare different type our variable than parameter of function module.
In ABAP 7.40 you can declaring the variable from method /function module at the start of the routine but
the rather at the instant they have their values filled by the method.
This approach has several advantages, fewer code lines, and avoid type mismatch error.
Using CASE you need to keep mentioning what variable you’re filling in every branch in CASE Statement.
1 ...
2 CASE LV_INDICATOR.
3 WHEN 1.
4 LV_DAY = 'January'.
5 WHEN 2.
6 LV_DAY = 'February'.
7
8 ...
9 ENDCASE.