Quantcast
Viewing all articles
Browse latest Browse all 66

Is data element BOOLE_D and CHAR1 same in SAP Selection Screen?

In one of our post in Web Dynpro we showed that WDY_BOOLEAN and FLAG data elements, which are both of type CHAR 1 behave differently. Similarly, very recently, I came to know that all CHAR1 data elements are not same.

Let us look this example.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_init TYPE char1.
SELECTION-SCREEN END OF BLOCK b1.

You expect a selection screen parameter with one character length. You are right.

Image may be NSFW.
Clik here to view.
check box in sap

Now, instead of TYPE CHAR1, let us take BOOLE_D which is also of TYPE CHAR1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_delt TYPE boole_d.
SELECTION-SCREEN END OF BLOCK b1.

What do you expect the output to be?
Honestly, I expected the same as above. One character placeholder. But to my surprise, when I execute this piece of code, it gave me a CHECKBOX.

Image may be NSFW.
Clik here to view.
AS CHECK BOX

[adToAppearHere]

All these years, I have been using the explicit CHECKBOX statement to generate a checkbox in the selection screen. And every time, I needed to declare a checkbox in my selection screen, I needed to refer to previous code snippet, google or do an F1 to get the syntax. Even after 10 years of ABAP programming, I do not remember the syntax (actually, I do not want to).

But not anymore. Now, I can declare a CHECKBOX in my selection screen without referring anything.. Image may be NSFW.
Clik here to view.
🙂

This is the explicit CHECKBOX syntax.

* Explicit CHECKBOX syntax
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_init AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b1.

This is WITHOUT AS CHECKBOX keyword

* CHECKBOX through data element
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_delt TYPE boole_d.
SELECTION-SCREEN END OF BLOCK b1.

The output of both these PARAMETERS is the same.

Image may be NSFW.
Clik here to view.
check box declaration

So next time you need a CHECKBOX for your program, you have another alternative. Image may be NSFW.
Clik here to view.
🙂

Also Read: Six Selection Screen Development in every other Project

Please note: All one character data elements of TYPE CHAR1 which has a domain with Value Range X and blank can be used for CHECKBOX declaration.

Image may be NSFW.
Clik here to view.
check box in sap 4

Data elements like WDY_BOOLEAN, BOOLE_D, FLAG, LVOMA etc can be used for CHECKBOX.

I am sure, all of us knew about the Value Range domains. But did you really use them in such practical cases?

Food for thought:
Data element FLAG can be used for CHECK BOX declaration. Can we NOT use data element FLAG1 for CHECK BOX declaration? FLAG1 is also CHAR1 type. Image may be NSFW.
Clik here to view.
🙂

If you want to get such practical issues and resolutions straight to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

If you liked this post, please hit the share buttons.

Thank you very much for your time!!


Viewing all articles
Browse latest Browse all 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>