You are on page 1of 3

New ABAP Language in ABAP 7.

4
/ SAP ABAP General / New ABAP Language in ABAP 7.4

Oct 10, 2016 Admin SAP ABAP General

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.

1.ABAP Language 7.4 Database Access.

a.CASE statement in SQL Queries

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.

b. INNER JOIN Improvement

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.

Before ABAP 7.4

1 SELECT a~vbeln b~posnr b~matnr FROM vb


2
3
4

ABAP 7.4

1 SELECT a~*, b~posnr, b~matnr FROM vbak


2
3
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.

c.Ommiting Data Type Declarations

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.

Before ABAP 7.4

1 DATA : lv_string type string.


2
3 lv_string = 'ABAPGurus SAP ABAP Tutoria

ABAP 7.4

1 DATA(lv_string) = 'ABAPGurus SAP ABAP T

d.NEW keyword for Creating Objects

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.

Before ABAP 7.4

1 DATA : lo_myclass TYPE REF TO ZCL_MYCLA


2
3 CREATE OBJECT lo_myclass EXPORTING myna

ABAP 7.4
1 DATA : lo_myclass TYPE REF TO ZCL_MYCLA
2
3 lo_myclass = NEW zcl_Myclass( myname =

e.New String Features in ABAP 7.4

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.

Before ABAP 7.02 and ABAP 7.04

1 CONCATENATE 'MY First String' LV_NUMBER


2 CONCATENATE LV_TEMP LV_STATUS INTO LV_R

ABAP 7.03 and ABAP 7.04

You can simpler ABAP Code for two lines before like this

1 lv_string = | My First String { lv_nu

In ABAP 7.40 You don’t need use CONVERSION_EXIT_ALPHA_INPUT and


CONVERSION_EXIT_ALPHA_OUTPUT , you just need ALPHA keyword formatting option with OUT or
IN.

1 DATA : lv_kunnr TYPE kunnr VALUE '11000


2
3 START-OF-SELECTION.
4
5 DATA(lv_real) = |{ lv_kunnr ALPHA = I
6
7 WRITE lv_real.

f.Avoiding Type Mismatch Dump when Calling Function Module

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.

1 CALL FUNCTION 'ZMY_FM'


2 EXPORTING ID = LV_MYID
3 IMPORTING NAMEZ = DATA( LV_NAMEZ ).

This approach has several advantages, fewer code lines, and avoid type mismatch error.

g. Using SWITCH statement as replacement for CASE

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.

You might also like