ABAP, aka Advanced Business Application Programming, is a programming language created in 1983.
#135on PLDB | 40Years Old | 2.4kUsers |
55Books | 2Papers | 4kRepos |
ABAP (Advanced Business Application Programming, originally Allgemeiner Berichts-Aufbereitungs-Prozessor, German for "general report creation processor") is a high-level programming language created by the German software company SAP SE. It is currently positioned, alongside Java, as the language for programming the SAP Application Server, which is part of the NetWeaver platform for building business applications.. Read more on Wikipedia...
REPORT ZHELLO_WORLD.
START-OF-SELECTION.
WRITE: 'Hello World'.
*/**
* The MIT License (MIT)
* Copyright (c) 2012 René van Mil
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
*----------------------------------------------------------------------*
* CLASS CL_CSV_PARSER DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class cl_csv_parser definition
public
inheriting from cl_object
final
create public .
public section.
*"* public components of class CL_CSV_PARSER
*"* do not include other source files here!!!
type-pools abap .
methods constructor
importing
!delegate type ref to if_csv_parser_delegate
!csvstring type string
!separator type c
!skip_first_line type abap_bool .
methods parse
raising
cx_csv_parse_error .
protected section.
*"* protected components of class CL_CSV_PARSER
*"* do not include other source files here!!!
private section.
*"* private components of class CL_CSV_PARSER
*"* do not include other source files here!!!
constants _textindicator type c value '"'. "#EC NOTEXT
data _delegate type ref to if_csv_parser_delegate .
data _csvstring type string .
data _separator type c .
type-pools abap .
data _skip_first_line type abap_bool .
methods _lines
returning
value(returning) type stringtab .
methods _parse_line
importing
!line type string
returning
value(returning) type stringtab
raising
cx_csv_parse_error .
endclass. "CL_CSV_PARSER DEFINITION
*----------------------------------------------------------------------*
* CLASS CL_CSV_PARSER IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class cl_csv_parser implementation.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method CL_CSV_PARSER->CONSTRUCTOR
* +-------------------------------------------------------------------------------------------------+
* | [--->] DELEGATE TYPE REF TO IF_CSV_PARSER_DELEGATE
* | [--->] CSVSTRING TYPE STRING
* | [--->] SEPARATOR TYPE C
* | [--->] SKIP_FIRST_LINE TYPE ABAP_BOOL
* +--------------------------------------------------------------------------------------</SIGNATURE>
method constructor.
super->constructor( ).
_delegate = delegate.
_csvstring = csvstring.
_separator = separator.
_skip_first_line = skip_first_line.
endmethod. "constructor
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method CL_CSV_PARSER->PARSE
* +-------------------------------------------------------------------------------------------------+
* | [!CX!] CX_CSV_PARSE_ERROR
* +--------------------------------------------------------------------------------------</SIGNATURE>
method parse.
data msg type string.
if _csvstring is initial.
message e002(csv) into msg.
raise exception type cx_csv_parse_error
exporting
message = msg.
endif.
" Get the lines
data is_first_line type abap_bool value abap_true.
data lines type standard table of string.
lines = _lines( ).
field-symbols <line> type string.
loop at lines assigning <line>.
" Should we skip the first line?
if _skip_first_line = abap_true and is_first_line = abap_true.
is_first_line = abap_false.
continue.
endif.
" Parse the line
data values type standard table of string.
values = _parse_line( <line> ).
" Send values to delegate
_delegate->values_found( values ).
endloop.
endmethod. "parse
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method CL_CSV_PARSER->_LINES
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RETURNING TYPE STRINGTAB
* +--------------------------------------------------------------------------------------</SIGNATURE>
method _lines.
split _csvstring at cl_abap_char_utilities=>cr_lf into table returning.
endmethod. "_lines
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method CL_CSV_PARSER->_PARSE_LINE
* +-------------------------------------------------------------------------------------------------+
* | [--->] LINE TYPE STRING
* | [<-()] RETURNING TYPE STRINGTAB
* | [!CX!] CX_CSV_PARSE_ERROR
* +--------------------------------------------------------------------------------------</SIGNATURE>
method _parse_line.
data msg type string.
data csvvalue type string.
data csvvalues type standard table of string.
data char type c.
data pos type i value 0.
data len type i.
len = strlen( line ).
while pos < len.
char = line+pos(1).
if char <> _separator.
if char = _textindicator.
data text_ended type abap_bool.
text_ended = abap_false.
while text_ended = abap_false.
pos = pos + 1.
if pos < len.
char = line+pos(1).
if char = _textindicator.
text_ended = abap_true.
else.
if char is initial. " Space
concatenate csvvalue ` ` into csvvalue.
else.
concatenate csvvalue char into csvvalue.
endif.
endif.
else.
" Reached the end of the line while inside a text value
" This indicates an error in the CSV formatting
text_ended = abap_true.
message e003(csv) into msg.
raise exception type cx_csv_parse_error
exporting
message = msg.
endif.
endwhile.
" Check if next character is a separator, otherwise the CSV formatting is incorrect
data nextpos type i.
nextpos = pos + 1.
if nextpos < len and line+nextpos(1) <> _separator.
message e003(csv) into msg.
raise exception type cx_csv_parse_error
exporting
message = msg.
endif.
else.
if char is initial. " Space
concatenate csvvalue ` ` into csvvalue.
else.
concatenate csvvalue char into csvvalue.
endif.
endif.
else.
append csvvalue to csvvalues.
clear csvvalue.
endif.
pos = pos + 1.
endwhile.
append csvvalue to csvvalues. " Don't forget the last value
returning = csvvalues.
endmethod. "_parse_line
endclass. "CL_CSV_PARSER IMPLEMENTATION
* First define structured type
TYPES: BEGIN OF t_vbrk,
VBELN TYPE VBRK-VBELN,
ZUONR TYPE VBRK-ZUONR,
END OF t_vbrk.
* Now define internal table of our defined type t_vbrk
DATA : gt_vbrk TYPE STANDARD TABLE OF t_vbrk,
gt_vbrk_2 TYPE STANDARD TABLE OF t_vbrk. "easy to define more tables
* If needed, define structure (line of internal table)
* Definition with type or with reference to internal table:
DATA : gs_vbrk TYPE t_vbrk,
gs_vbrk2 LIKE LINE OF gt_vbrk2.
* You can also define table type if needed
TYPES tt_vbrk TYPE STANDARD TABLE OF t_vbrk.
abap-source abbreviated abstract accept accepting according activation actual add add-corresponding adjacent after alias aliases align all allocate alpha analysis analyzer and append appendage appending application archive area arithmetic as ascending aspect assert assign assigned assigning association asynchronous at attributes authority authority-check avg back background backup backward badi base before begin between big binary bintohex bit black blank blanks blob block blocks blue bound boundaries bounds boxed break-point buffer by bypassing byte byte-order call calling case cast casting catch center centered chain chain-input chain-request change changing channels character char-to-hex check checkbox ci circular class class-coding class-data class-events class-methods class-pool cleanup clear client clob clock close coalesce code coding colbackground colgroup colheading colkey colnegative colnormal colpositive coltotal collect color column columns comment comments commit common communication comparing component components compression compute concat concatwithspace concatenate cond condense condition connect connection constants context contexts continue control controls conv conversion convert copies copy corresponding country cover cpi create creating critical currency currencyconversion current cursor cursor-selection customer customer-function dangerous data database datainfo dataset date datsadddays datsaddmonths datsdaysbetween datsisvalid daylight dd/mm/yy dd/mm/yyyy ddmmyy deallocate decimalshift decimals declarations deep default deferred define defining definition delete deleting demand department descending describe destination detail dialog directory disconnect display display-mode distinct divide divide-corresponding division do dummy duplicate duplicates duration during dynamic dynpro edit editor-call else elseif empty enabled enabling encoding end endat endcase endcatch endchain endclass enddo endenhancement end-enhancement-section endexec endform endfunction endian endif ending endinterface end-lines endloop endmethod endmodule end-of-definition end-of-editing end-of-file end-of-page end-of-selection endon endprovide endselect end-test-injection end-test-seam endtry endwhile endwith engineering enhancement enhancement-point enhancements enhancement-section entries entry enum environment equiv errormessage errors escaping event events exact except exception exceptions exception-table exclude excluding exec execute exists exit exit-command expand expanding expiration explicit exponent export exporting extend extended extension extract fail fetch field field-groups fields field-symbol field-symbols file filter filters filter-table final find first first-line fixed-point fkeq fkge flush font for form format forward found frame frames free friends from function functionality function-pool further gaps generate get giving gkeq gkge global grant green group groups handle handler harmless hashed having hdb header headers heading head-lines help-id help-request hextobin hide high hint hold hotspot icon id identification identifier ids if ignore ignoring immediately implementation implementations implemented implicit import importing in inactive incl include includes including increment index index-line infotypes inheriting init initial initialization inner inout input insert instance instances instr intensified interface interface-pool interfaces internal intervals into inverse inverted-date is iso job join keep keeping kernel key keys keywords kind language last late layout leading leave left left-justified leftplus leftspace legacy length let level levels like line lines line-count linefeed line-selection line-size list listbox list-processing little llang load load-of-program lob local locale locator logfile logical log-point long loop low lower lpad lpi ltrim mail main major-id mapping margin mark mask match matchcode max maximum medium members memory mesh message message-id messages messaging method methods min minimum minor-id mm/dd/yy mm/dd/yyyy mmddyy mode modif modifier modify module move move-corresponding multiply multiply-corresponding name nametab native nested nesting new new-line new-page new-section next no no-display no-extension no-gap no-gaps no-grouping no-heading no-scrolling no-sign no-title no-topofpage no-zero node nodes non-unicode non-unique not null number object objects obligatory occurrence occurrences occurs of off offset ole on only open option optional options or order other others out outer output output-length overflow overlay pack package pad padding page pages parameter parameters parameter-table part partially pattern percentage perform performing person pf1 pf10 pf11 pf12 pf13 pf14 pf15 pf2 pf3 pf4 pf5 pf6 pf7 pf8 pf9 pf-status pink places pool poshigh poslow position pragmas precompiled preferred preserving primary print print-control priority private procedure process program property protected provide public push pushbutton put queue-only quickinfo radiobutton raise raising range ranges read reader read-only receive received receiver receiving red redefinition reduce reduced ref reference refresh regex reject remote renaming replace replacement replacing report request requested reserve reset resolution respecting responsible result results resumable resume retry return returncode returning returns right right-justified rightplus rightspace risk rmccommunicationfailure rmcinvalidstatus rmcsystemfailure role rollback rows rpad rtrim run sap sap-spool saving scalepreserving scalepreservingscientific scan scientific scientificwithleadingzero scroll scroll-boundary scrolling search secondary seconds section select selection selections selection-screen selection-set selection-sets selection-table select-options send separate separated set shared shift short shortdump-id signaspostfix single size skip skipping smart some sort sortable sorted source specified split spool spots sql sqlscript stable stamp standard starting start-of-editing start-of-selection state statement statements static statics statusinfo step-loop stop structure structures style subkey submatches submit subroutine subscreen subtract subtract-corresponding suffix sum summary summing supplied supply suppress switch switchstates symbol syncpoints syntax syntax-check syntax-trace system-call system-exceptions system-exit tab tabbed table tables tableview tabstrip target task tasks test testing test-injection test-seam text textpool then throw time times timestamp timezone timsisvalid title titlebar title-lines to tokenization tokens top-lines top-of-page trace-file trace-table trailing transaction transfer transformation translate transporting trmac truncate truncation try tstmpaddseconds tstmpcurrentutctimestamp tstmpisvalid tstmpsecondsbetween type type-pool type-pools types uline unassign under unicode union unique unitconversion unix unpack until unwind up update upper user user-command using utf-8 valid value value-request values vary varying verification-message version via view visible wait warning when whenever where while width window windows with with-heading without with-title word work write writer xml xsd yellow yes yymmdd zero zone abapsystemtimezone abapusertimezone access action adabas adjustnumbers allowprecisionloss allowed amdp applicationuser asgeojson as400 associations balance behavior breakup bulk cds cdsclient checkbeforesave child clients corr corrspearman cross cycles datnadddays datnaddmonths datndaysbetween datsfromdatn datstimstotstmp datstodatn db2 db6 ddl denserank depth deterministic discarding entities entity error failed finalize firstvalue fltptodec following fractional full graph grouping hierarchy hierarchyancestors hierarchyancestorsaggregate hierarchydescendants hierarchydescendantsaggregate hierarchysiblings incremental indicators lag lastvalue lead leaves likeregexpr link localesap lock locks many mapped matched measures median mssqlnt multiple nodetype ntile nulls occurrencesregexpr one operations oracle orphans over parent parents partition pcre period pfcgmapping preceding privileged product projection rank redirected replaceregexpr reported response responses root row rownumber sapsystemdate save schema session sets shortdump siblings spantree start stddev stringagg subtotal sybase timsfromtimn timstotimn toblob toclob total trace-entry tstmptodats tstmptodst tstmptotims tstmplfromutcl tstmpltoutcl unbounded utcladdseconds utclcurrent utclsecondsbetween uuid var verbatim
Feature | Supported | Token | Example |
---|---|---|---|
Integers | ✓ | * [0-9]+ |
|
Conditionals | ✓ | ||
Access Modifiers | ✓ | ||
Switch Statements | ✓ | ||
Functions | ✓ | ||
Exceptions | ✓ | ||
Classes | ✓ | ||
While Loops | ✓ | ||
Booleans | ✓ | true false | |
Strings | ✓ | ' | 'Hello world' |
Line Comments | ✓ | * | * A comment |
Comments | ✓ | ||
Case Sensitivity | X | ||
Semantic Indentation | X |
title | author | year | reviews | ratings | rating |
---|---|---|---|---|---|
ABAP Objects: ABAP Programming in SAP NetWeaver Book/DVD Package | H. Keller | 2007 | 1 | 8 | 4.25 |
Introduction to ABAP/4 Programming for SAP | Robert Lyfareff | 1996 | 1 | 6 | 3.67 |
ABAP Objects: Introduction to Programming SAP Applications | Horst Keller | 2002 | 1 | 20 | 4.10 |
Advanced ABAP Programming for SAP | Gareth M. De Bruyn | 1999 | 0 | 4 | 3.00 |
title | authors | year | publisher |
---|---|---|---|
SAP.Keller: ABAP Objects_c | Keller, Horst and Keller, Horst and Kruger, Sascha | 2002 | Addison-Wesley Professional |
ABAP Programming Model for SAP Fiori: ABAP Development for SAP S/4HANA (SAP PRESS) | Stefan Haas and Bince Mathew | 2018 | SAP Press |
Advanced Abap Programming For Sap (sap R/3) | Gareth M De Bruyn and Ken Kroes | 1999 | Premier Pr |
Web Dynpro ABAP for Practitioners | Gellert, Ulrich and Cristea, Ana Daniela | 2010 | Springer |
ABAP: The Comprehensive Guide to SAP ABAP 7.52 and 1909 (Second Edition) (SAP PRESS) | Kiran Bandari | 2019 | SAP Press |
ABAP: An Introduction and Beginner's Guide to Programming with SAP ABAP (2nd Edition) (SAP PRESS) | Brian O'Neil and Jelena Perfiljeva | 2019 | SAP Press |
ABAP Objects: ABAP Object-Oriented Programming (OOP) (2nd Edition) (SAP PRESS) | James Wood and Joseph Rupert | 2015-11-30T00:00:01Z | SAP Press |
ABAP to the Future: Advanced, Modern ABAP (Third Edition) (SAP PRESS) | Paul Hardy | 2019 | SAP Press |
Mastering SAP ABAP: A complete guide to developing fast, durable, and maintainable ABAP programs in SAP | Grześkowiak, Paweł and Ciesielski, Wojciech and Ćwik, Wojciech | 2019 | Packt Publishing |
Discover ABAP: Your Introduction to ABAP Objects | Kühnhauser, Karl-Heinz and Franz, Thorsten | 2011 | SAP PRESS |
ABAP Objects: ABAP Programming in SAP NetWeaver | Keller, Horst and Krüger, Sascha | 2007 | SAP PRESS |
Learn ABAP in 1 Day: Definitive Guide to Learn SAP ABAP Programming for Beginners | Rungta, Krishna | 2017 | Independently published |
Introduction to ABAP Programming for SAP, 3rd Edition | Gareth M. De Bruyn and Robert Lyfareff and Mark Balleza and Dhruv Kashyap | 2014-07-17T00:00:01Z | Cengage Learning PTR |
ABAP RESTful Programming Model: ABAP Development for SAP S/4HANA (SAP PRESS) | Stefan Haas and Bince Mathew | 2019 | SAP Press |
Official ABAP Programming Guidelines | Keller, Horst and Thümmel, Wolf Hagen | 2009-09-28T00:00:01Z | SAP PRESS |
SAP ABAP Advanced cookbook (Quick Answers to Common Problems) | Zaidi, Rehan | 2012 | Packt Publishing |
Mastering SAP ABAP: A complete guide to developing fast, durable, and maintainable ABAP programs in SAP | Grzeskowiak, Pawel and Ciesielski, Wojciech and Cwik, Wojciech | 2019 | Packt Publishing |
ABAP Cookbook: Programming Recipes for Everyday Solutions | Wood, James | 2010-05-28T00:00:01Z | SAP PRESS |
Improving the Quality of ABAP Code: Striving for Perfection | Hardy, Paul David | 2021 | Apress |
Web Dynpro ABAP for Practitioners | Gellert, Ulrich and Cristea, Ana Daniela | 2013 | Springer |
Object-Oriented Programming with ABAP Objects | Wood, James | 2009-01-28T00:00:01Z | SAP PRESS |
ABAP Development for Materials Management in SAP: User Exits and BAdIs | Schwaninger, Jürgen | 2010 | SAP PRESS |
Pro SAP Scripts, Smartforms, and Data Migration: ABAP Programming Simplified | Markandeya, Sushil | 2017 | Apress |
Foundations of Java for ABAP Programmers | Rooney, Alistair | 2006 | Apress |
SAP ABAP Advanced cookbook (Quick Answers to Common Problems) | Zaidi Rehan | 2012 | Packt Publishing |
SAP ABAP Certification Review: SAP ABAP Interview Questions, Answers, And Explanations | Fewer, Barry | 2006 | Equity Press |
Enhancing the Quality of ABAP Development | Heuvelmans, Wouter and Krouwels, Albert and Meijs, Ben and Sommen, Ron | 2004 | SAP PRESS |
JavaScript Essentials for SAP ABAP Developers | Rehan Zaidi | 20170620 | Springer Nature |
Complete Abap | Bandari, Kiran | 2017 | Rheinwerk Publishing, |
ABAP Cookbook | James Wood | 2010-05-28 | Rheinwerk Publishing, Inc. |
Web Dynpro ABAP | James Wood and Shaan Parvaze | 2012-10-28 | Rheinwerk Publishing, Inc. |
SAP ABAP Objects | Rehan Zaidi | 20190927 | Springer Nature |
ABAP in Eclipse | Łukasz Pęgiel | 20210529 | Springer Nature |
ABAP Performance Tuning | Hermann Gahm | 2009-06-28 | Rheinwerk Publishing, Inc. |
ABAP RESTful Programming Model | Stefan Haas and Bince Mathew | 2019-11-21 | Rheinwerk Publishing, Inc. |
Function Modules in ABAP | Tanmaya Gupta | 2013-10-28 | Rheinwerk Publishing, Inc. |
ABAP to the Future | Paul Hardy | 2019-02-26 | Rheinwerk Publishing, Inc. |
ABAP Programming Model for SAP Fiori | Stefan Haas and Bince Mathew | 2018-11-27 | Rheinwerk Publishing, Inc. |
Interface Programming In Sap Abap | Dr Boris Rubarth | 2018-08-01 | Createspace Independent Publishing Platform |
Automated Unit Testing with ABAP | James E. McDonough | 20210401 | Springer Nature |
Introduction To Abap 4 Programming | Gareth Debruyn | 1996 | Prima Pub |
Object-oriented Programming With Abap Objects | Wood, James and Rupert, Joe | 2016 | Rheinwerk Publishing, |
Object-Oriented Programming with ABAP Objects | James Wood and Joseph Rupert | 2015-10-22 | Rheinwerk Publishing, Inc. |
BRFplus—Business Rule Management for ABAP Applications | Thomas Albrecht and Carsten Ziegler | 2010-11-28 | Rheinwerk Publishing, Inc. |
Instant Access: Sap Developer's Reference For Abap | The Consultants Network Inc. | 1999 | Consultants Network Inc |
ABAP Development for Financial Accounting: Custom Enhancements | Sergey Korolev | 2011-01-28 | Rheinwerk Publishing, Inc. |
ABAP Development for Sales and Distribution in SAP | Michael Koch | 2012-09-28 | Rheinwerk Publishing, Inc. |
Abap Programming: A Guide To The Certification Course | Kathleen Sikora | 2000 | Youguys Pub |
Pro Sap Scripts, Smartforms, And Data Migration: Abap Programming Simplified | Sushil Markandeya | 2017 | Apress |
ABAP Development for Materials Management in SAP: User Exits and BAdIs | Jürgen Schwaninger | 2010-11-28 | Rheinwerk Publishing, Inc. |
Web Programming With The Sap Web Application Server: The Complete Guide For Abap And Web Developers | Frédéric Heinemann and Christian Rau | 2003 | Sap Press |
title | authors | year | citations | influentialCitations |
---|---|---|---|---|
Teaching SAP's ABAP Programming Language to IS Students: Adopting and Adapting Web-based Technologies | Brendan McCarthy and Paul Hawking | 2002 | 6 | 0 |
ABAP OBJECTS: DESIGNING A PROGRAMMING COURSE FOR INFORMATION SYSTEMS STUDENTS USING SAP SOFTWARE | C. Rogers | 2008 | 1 | 0 |