Application Development 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: 

Dialog programming - how to set text of a box at runtime?

Former Member
0 Kudos
796

Hi,

I'm in a middle of visual (dialog) programming in ABAP and have few related questions.

1. I have (few) boxes on my screen and I wish to set its text (that's the one which appear in the left upper corner of the box) dynamicaly at runtime depending on what details are shown within the box.

Is it possible, and if yes - could someone share his/her knowledge here?

2. Is it possible to dynamicaly change the position of the visual element (for example, box) on the screen? I successfuly manipulate the visibility of the box, but can't manage the position of the boxes rest ot the screen. Is it possible and how?

Many thanks in advance.

Regards,

Ivaylo Mutafchiev

1 ACCEPTED SOLUTION

abdul_hakim
Active Contributor
0 Kudos
233

Hi,

You cannot change the position of the screen elements dyanmically at runtime..

Abdul

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
233

For you first question,



* This program demonstrates how to dynamically add text to
* a box/frame at runtime.

report zrich_0005 .

**  Make sure that the box/frame is set as OUTPUT and the name
**  of the box/frame is BOX_NAME.

parameters: p1 radiobutton group grp1 default 'X',
            p2 radiobutton group grp1.

data: box_name(30) type c.
data: ok_code type sy-ucomm.

start-of-selection.

  call screen 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
  set pf-status '0100'.
*  SET TITLEBAR 'xxx'.

  if p1 = 'X'.
    box_name = 'P1 was pressed'.
  elseif p2 = 'X'.
    box_name = 'P2 was pressed'.
  endif.

endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_0100 input.

  case ok_code.

    when 'BACK'.
      set screen 0.
      leave screen.
  endcase.

endmodule.                 " USER_COMMAND_0100  INPUT


Regards,

Rich Heilman

0 Kudos
233

For your second question, I have never seen it done. I don't know if it is possible to move stuff around at runtime.

Regards,

Rich Heilman

abdul_hakim
Active Contributor
0 Kudos
234

Hi,

You cannot change the position of the screen elements dyanmically at runtime..

Abdul

Former Member
0 Kudos
233

Hi,

As we don't have option to change the text at run time using the screen for Buttons.

What can you do is create different push buttons with the corresponding texts and keep them in invisible mode.

Depending on the scenario you can make visible one button and others can be in invisible.

You can do this with less no. of options only.

Regards,

Anu.

0 Kudos
233

You can change the text of buttons inside the dynpro.




report zrich_0001.

type-pools: icon.

parameters: p_va02 radiobutton group grp1 default 'X'
                           user-command check,
            p_va03 radiobutton group grp1.
selection-screen pushbutton 40(20) gocfg user-command gocfg.




at selection-screen .

  case sy-ucomm.
    when 'GOCFG'.
      call transaction 'VA02'.
  endcase.

start-of-selection.



at selection-screen output.

* Write pushbutton text
  if p_va02 = 'X'.
    write icon_CHANGE as icon to gocfg.
    concatenate gocfg 'Go to VA02' into gocfg
                separated by space.

  elseif p_va03 = 'X'.
    write icon_DISPLAY as icon to gocfg.
    concatenate gocfg 'Go to VA03' into gocfg
                separated by space.

  endif.

REgards,

Rich Heilman

Former Member
0 Kudos
233

Guys,

Thanks to all of you for your replies.

Rich, your posts helps me a lot.

Abdul, I suppose I should choose another way but not dynamic move.

Thanks again.

Regards,

Ivaylo