Case Statement usage

Case statements in ABAP are great. Not only do they let you handle your logic flow like other control flow statements but also provide a clean/ better readable way to branch into multiple sublogics.

A typical use of a case statement is something like this as [CASE variable: WHEN value]:

However, they can also be used as [CASE values: WHEN variable] way.

Let's assume:

We have to validate and report if some variables have data or not.

One way to do it would be:  

Another way to use Case statement:

I prefer this way as it increases readability and in my opinion cleaner.


 

  

Popular posts from this blog

ABAP convert internal table to excel (.xlsx) format and Send email or download

ABAP read excel(.XLSX) file to internal table in ABAP using CL_FDT_XL_SPREADSHEET

Application Logging in ABAP