Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

get screen resolution

Former Member
3,051

Hi all,

is there any way to get the current screen resolution from the system with ABAP? I would like to make some changes on the Dynpro depending on what resolution the users's GUI runs.

Thanks in advance!

1 ACCEPTED SOLUTION
Read only

Former Member
1,910

Tobias,

I had the same question today, and did a search on "screen resolution". This thread came up along with several others. There is another thread that has your answer. But I can't figure out to post a link to the thread. So I just copied the text from the answer and will post it here. I want to make this clear. THIS IS NOT MY ANSWER SO DON'T AWARD ME POINTS, I DON'T DESERVE THEM!!!

**********************************************************************

Hi Fabian,

The following code will give you the screen metrics,

DATA: ref_consumer TYPE REF TO cl_gui_props_consumer,

s_metric_factors TYPE CNTL_METRIC_FACTORS.

ref_consumer = cl_gui_props_consumer=>create_consumer( ).

s_metric_factors = ref_consumer->get_metric_factors( ).

Now s_metric_factors-screen-x

and s_metric_factors-screen-y has the GUI screen resolution values. You can code your logic based on this.

Hope this helps..

Sri

6 REPLIES 6
Read only

Former Member
0 Likes
1,910

Hi Tobias,

It is Purely Related to GUI.so i don't think you have control on it,But if your requirement is in BDC then you can have option to maintain the same resolution in all the systems.

this can be done using the CTU_PARMS-DEFSIZE parameter.

this DEFSIZE will maintian the default size in all the systems(with out consider GUI).

OPT is of type CTU_PARMS.

call transaction tcode option <b>OPT</b>....

Regards

vijay

Read only

Former Member
0 Likes
1,910

Thanks for your quick reply.

But I don't want to change the GUI size or resolution. I just want to get the current screen resolution in pixels.

Read only

Former Member
0 Likes
1,910

I believe, there's a quite complicated way to do it. You may try to write some Windows application, which is able to get screen resolution using Windows API. And then, you may connect to this application using RFC.

But is it worth doing?

Read only

Former Member
0 Likes
1,910

Hi,

I hoped there would be an "easy-to-use" function or object in ABAP. Using external code is no option.

Read only

Former Member
1,911

Tobias,

I had the same question today, and did a search on "screen resolution". This thread came up along with several others. There is another thread that has your answer. But I can't figure out to post a link to the thread. So I just copied the text from the answer and will post it here. I want to make this clear. THIS IS NOT MY ANSWER SO DON'T AWARD ME POINTS, I DON'T DESERVE THEM!!!

**********************************************************************

Hi Fabian,

The following code will give you the screen metrics,

DATA: ref_consumer TYPE REF TO cl_gui_props_consumer,

s_metric_factors TYPE CNTL_METRIC_FACTORS.

ref_consumer = cl_gui_props_consumer=>create_consumer( ).

s_metric_factors = ref_consumer->get_metric_factors( ).

Now s_metric_factors-screen-x

and s_metric_factors-screen-y has the GUI screen resolution values. You can code your logic based on this.

Hope this helps..

Sri

Read only

Former Member
0 Likes
1,910

Hi Tobias,

Well, there could be some way to get the screen resolution.

I understand what you are trying to do with the GUI resolution.

But it is definitely not advisable to code based on the GUI resolution.

Remember 2 reward points.

Rgds,

Prashanth,

SAP India.