1. Home
  2. /
  3. Abap
  4. /
  5. Counter and Theme Toggle

Counter and Theme Toggle - Abap Typing CST Test

Loading…

Counter and Theme Toggle — Abap Code

Demonstrates a simple counter with theme toggling using ABAP variables and WRITE statements.

DATA: count TYPE i VALUE 0.
DATA: isDark TYPE abap_bool VALUE abap_false.

FORM update_ui.
	WRITE: / 'Counter:', count.
	WRITE: / 'Theme:', (IF isDark = abap_true THEN 'Dark' ELSE 'Light').
ENDFORM.

FORM increment.
	count = count + 1.
	PERFORM update_ui.
ENDFORM.

FORM decrement.
	count = count - 1.
	PERFORM update_ui.
ENDFORM.

FORM reset.
	count = 0.
	PERFORM update_ui.
ENDFORM.

FORM toggle_theme.
	isDark = abap_not isDark.
	PERFORM update_ui.
ENDFORM.

" Simulate actions
PERFORM update_ui.
PERFORM increment.
PERFORM increment.
PERFORM toggle_theme.
PERFORM decrement.
PERFORM reset.

Abap Language Guide

ABAP (Advanced Business Application Programming) is a high-level, strongly typed, event-driven programming language created by SAP for developing business applications on the SAP platform. It is primarily used for enterprise resource planning (ERP), reporting, and workflow automation.

Primary Use Cases

  • ▸Custom SAP reports and ALV grids
  • ▸Enhancements to standard SAP functionality
  • ▸Batch jobs and background processing
  • ▸SAP interfaces (IDocs, BAPIs, RFCs)
  • ▸Workflow and business rule automation
  • ▸Forms (SmartForms, Adobe Forms) development

Notable Features

  • ▸Strong typing and structured syntax
  • ▸Integration with SAP database and modules
  • ▸Supports both procedural and OO paradigms
  • ▸Event-driven and modular design
  • ▸Rich standard function modules and APIs

Origin & Creator

ABAP was developed by SAP in the early 1980s to support its R/2 and later R/3 ERP systems, allowing customers to customize and extend SAP applications.

Industrial Note

ABAP is critical in enterprise ERP implementations, large-scale business workflow automation, SAP S/4HANA data models, and integration with SAP Fiori/UI5 frontends.

More Abap Typing Exercises

ABAP Fibonacci SequenceABAP Factorial CalculatorABAP Even/Odd CheckerABAP Sum of ArrayABAP Reverse StringABAP Prime CheckerABAP Multiplication TableABAP Temperature ConverterABAP Simple Alarm Simulation

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher