Top 1,000 Features Creators Events Podcasts Extensions Blog Explorer CSV Download


< >

ABAP, aka Advanced Business Application Programming, is a programming language created in 1983.

#127on PLDB 41Years Old 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...

Example from hello-world:
Example from Linguist:
*/** * 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
Example from Wikipedia:
* 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 col_background col_group col_heading col_key col_negative col_normal col_positive col_total collect color column columns comment comments commit common communication comparing component components compression compute concat concat_with_space 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 currency_conversion current cursor cursor-selection customer customer-function dangerous data database datainfo dataset date dats_add_days dats_add_months dats_days_between dats_is_valid daylight dd/mm/yy dd/mm/yyyy ddmmyy deallocate decimal_shift 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 pos_high pos_low 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 rmc_communication_failure rmc_invalid_status rmc_system_failure role rollback rows rpad rtrim run sap sap-spool saving scale_preserving scale_preserving_scientific scan scientific scientific_with_leading_zero 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 sign_as_postfix 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 tims_is_valid 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 tstmp_add_seconds tstmp_current_utctimestamp tstmp_is_valid tstmp_seconds_between type type-pool type-pools types uline unassign under unicode union unique unit_conversion 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 abap_system_timezone abap_user_timezone access action adabas adjust_numbers allow_precision_loss allowed amdp applicationuser as_geo_json as400 associations balance behavior breakup bulk cds cds_client check_before_save child clients corr corr_spearman cross cycles datn_add_days datn_add_months datn_days_between dats_from_datn dats_tims_to_tstmp dats_to_datn db2 db6 ddl dense_rank depth deterministic discarding entities entity error failed finalize first_value fltp_to_dec following fractional full graph grouping hierarchy hierarchy_ancestors hierarchy_ancestors_aggregate hierarchy_descendants hierarchy_descendants_aggregate hierarchy_siblings incremental indicators lag last_value lead leaves like_regexpr link locale_sap lock locks many mapped matched measures median mssqlnt multiple nodetype ntile nulls occurrences_regexpr one operations oracle orphans over parent parents partition pcre period pfcg_mapping preceding privileged product projection rank redirected replace_regexpr reported response responses root row row_number sap_system_date save schema session sets shortdump siblings spantree start stddev string_agg subtotal sybase tims_from_timn tims_to_timn to_blob to_clob total trace-entry tstmp_to_dats tstmp_to_dst tstmp_to_tims tstmpl_from_utcl tstmpl_to_utcl unbounded utcl_add_seconds utcl_current utcl_seconds_between uuid var verbatim

Language features

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

View source

- Build the next great programming language Β· About Β· Resources Β· Acknowledgements Β· Part of the World Wide Scroll