The Development of ABAP Nigel James SAUG2013

33
© Square Cloud Pty Ltd SAUG National Summit | Hilton Hotel, Sydney September 2013 The Development of ABAP Nigel James – SAP Mentor Director – Square Cloud @squarecloud
  • date post

    18-Oct-2014
  • Category

    Technology

  • view

    406
  • download

    2

description

In this talk I look at some of the new features of ABAP added to the language over the last couple of releases.

Transcript of The Development of ABAP Nigel James SAUG2013

Page 1: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty LtdSAUG National Summit | Hilton Hotel, Sydney

September 2013

The Development of ABAPNigel James – SAP Mentor Director – Square Cloud@squarecloud

Page 2: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

Why?

ABAP is just another software product

Page 3: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

New language features are shipped in every

release

Page 4: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

Language features are less visible than

tooling features

Page 5: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

UpgradingUp-skilling

Back-porting

Page 6: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

4.6CSAP BASIS 6.10

Page 7: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

SAP R/3 Enterprise (4.7x)SAP BASIS 6.20

Page 8: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

4.7 – Packages

Better way to organise code and objects

Page 9: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

4.7 – Packages

“In my opinion the ABAP package concept was – besides object orientation and ICF – the most important innovation of the ABAP application server” – Tobias Trapp, SAP Mentor

Page 10: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

4.7 – UnicodeSHIFT dobj [ {[places] [direction]} | deleting ]            [IN {CHARACTER|BYTE} MODE]. 

FIND [{FIRST OCCURRENCE}|{ALL OCCURRENCES} OF] pattern   IN [section_of] dobj   [IN {CHARACTER|BYTE} MODE] 

DESCRIBE FIELD f LENGTH len IN BYTE MODE.

TYPE X and XSTRING

and much much more...

Page 11: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

SAP Netweaver 7.0 EhP 2AS ABAP 7.02

Page 12: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 DECFLOAT TYPE

DATA float TYPE f.  float = 805 / 1000.

Combines the advantages of F and P

Decfloat16: 8 bytes, 16 digits

exponent -383 to +384 (range 1E-383 through 9.999999999999999E+384 )

Page 13: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 DECFLOAT TYPE

Also Decfloat34:

16 bytes, 34 digits, exponent -6143 to +6144 (range 1E-6143 through 9.999999999999999999999999999999999E+6144)

If P is not enough use a decfloat

Page 14: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 – Embedded expressions

You used to ...

v1 = a + b.v2 = c - d.v3 = meth( v2 ).IF v1 > v3.

Now you can...

IF a + b > meth( v2 ).

Page 15: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 – Embedded expressions

You used to ...

len = strlen( txt ) – 1.DO len TIMES.

Now you can...

DO strlen( txt ) – 1 TIMES.

Page 16: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 – Embedded expressions

You used to ...

CONCATENATE txt1 txt2 INTO txt.CONDENSE txt.

CONCATENATE txt1 txt2 txt3 INTO alltext

Now you can...

CONDENSE ( txt1 && txt2 ).

alltext = txt1 && txt2 && txt3.

Page 17: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 – String Expressions

New string delimiter.We have ‘ ’ and ` ` .Introducing ||And && for concatenation with various formatting options

txt1 = |{ txt1 } value { sy-index * 10 } , |.

BYE BYE CONCATENATE

Page 18: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 – Method Chaining

You used to ...

DATA obj1 type ref to Class1.Obj1 = class2=>method2( ).Obj1->method1( ).

Now you can

class2=>method2( )->method1( ).

Page 19: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.02 – Resumable TRY CATCHTRY....

cl_office_func=>convert_to_pdf(input_stream, filename).

“2 ...CATCH BEFORE UNWIND cx_wrong_filename INTO

ex.IF cl_helper=>get_filename_from_user(

user_filename,...)...ex->new_filename =

user_filename.

“3 RESUME.ENDIF.

ENDTRY

* method callMETHOD convert_to_pdf(...) RAISING

cx_wrong_filename RESUMABLE...WHILE NOT cl_file func=>checkFilename(filename) = ... .”1

RAISE cx_exc RESUMABLE. filename =

cx_exc->new_filename.ENDWHILE.“4...

ENDMETHOD.

Page 20: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

AS ABAP 7.4

Page 21: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.4 – Expressions – Inline Declarations

You used to ...DATA: wa TYPE sometype....LOOP AT itab INTO wa. ... ENDLOOP.READ TABLE itab INTO wa.

Now you can...LOOP AT itab INTO DATA(wa). ... ENDLOOP.READ TABLE itab INTO DATA(wa).

Page 22: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.4 – Expressions – Inline Declarations

You used to ...FIELD-SYMBOLS <line> LIKE

LINE OF itab.

LOOP AT itab ASSIGNING <line>.

...ENDLOOP.

Now you can...LOOP AT itab ASSIGNING FIELD-

SYMBOL(<line>)....ENDLOOP.

Page 23: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.4 – NEW Keyword

You used to ...

FIELD-SYMBOLS <fS> TYPE data.DATA dref TYPE REF TO data.CREATE DATA dref TYPE i.ASSIGN dref->* TO <fs>.<fs> = 555.

Now you can...

DATA dref TYPE REF TO data.dref = NEW i( 555 ).

Page 24: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.4 – VALUE Keyword

You used to ...

DATA itab TYPE t_itab.DATA wa LIKE LINE OF itab.wa-col1 = 1. wa-col2 = 2.APPEND wa TO itab.wa-col1 = 3. wa-col2 = 4.APPEND wa TO itab.meth( itab ).

Now you can...

DATA(itab) = VALUE t_itab(( col1 = 1 col2 = 2 )( col1 = 3 col2 = 4 ) ). - or - meth( VALUE t_itab(( col1 = 1 col2 = 2 )( col1 = 3 col2 = 4 ) ) ).

Page 25: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.4 – COND KeywordYou used to ...

DATA time TYPE string.IF sy-timlo < '120000'.time = |{ sy-timlo TIME = ISO } AM|.ELSEIF sy-timlo > '120000'.time = |{ CONV t( sy-timlo - 12 * 3600 )TIME = ISO } PM|.ELSEIF sy-timlo = '120000'.time = |High Noon|.ELSE.

RAISE EXCEPTION TYPE cx_cant_be.ENDIF.

Now you can...

DATA(time) =COND string(WHEN sy-timlo < '120000' THEN|{ sy-timlo TIME = ISO } AM|WHEN sy-timlo > '120000' THEN|{ CONV t( sy-timlo - 12 * 3600 )

TIME = ISO } PM|WHEN sy-timlo = '120000' THEN|High Noon|ELSE

THROW cx_cant_be( ) ).

Page 26: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.4 – Expressions – Switch

You used to ...DATA number TYPE string.CASE sy-index.WHEN 1.number = 'one'.WHEN 2.number = 'two'.WHEN 3.number = 'three'.WHEN OTHERS.RAISE EXCEPTION TYPE cx_overflow.ENDCASE

Now you can...DATA(number) =

SWITCH string( sy-indexWHEN 1 THEN 'one'WHEN 2 THEN 'two'WHEN 3 THEN 'three'ELSE THROW

cx_overflow( ) ).

Page 27: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

7.4

Much much more

Page 28: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

Things that have been around forever

OO – Object Orientation ICF – Internet Communication

Framework

Page 29: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

Lastly...

Are you waiting for a a native BOOLEAN type?

If TRUE. WRITE `Make some noise about it`. ENDIF. #that is all

Page 30: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

Questions and Discussion?

Page 31: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

Thanks and Credits Michael Kovacevic SAP Mentors Graham Robbo Tobias Trapp Arial Monospaced for SAP

Page 32: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

Sources and ReferencesHorst Kellers Blog’s http://scn.sap.com/people/horst.keller/contentMain 7.4 Features http://scn.sap.com/community/abap/blog/2013/07/22/abap-news-for-release-740Presentation Deck http://www.gib-dispo-cockpit.de/mediathek/events/success-days-2013/DE/SDS_2013_ABAP_News_Dr_Keller_SAP.pdfUnicode Summary http://goo.gl/09WqPIWolfgang Weiss http://events.asug.com/2012AC/0711_Whats_New_in_ABAP_7_02_and_7_03.pdfThomas Weiss

http://scn.sap.com/people/thomas.weiss/blog/2010/04/14/what-is-new-in-abap-language-abap-workbench-and-enhancement-framework-with-sap-netweaver-70-ehp2

Page 33: The Development of ABAP Nigel James SAUG2013

© Square Cloud Pty Ltd

No ... That really was the last slide