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: 

SEL-SCREEN COMMENT only loading after first execution of report

nibiklavic
Explorer
0 Kudos

Hello,

I am trying to write a small report used for printing a smartform. I used the instruction "SELECTION-SCREEN COMMENT" to display a text next to the selection fields and the text is defined in the report. Strangely, the texts are blank when I initially start the report. But as soon as I enter the first value and hit enter the texts appears.

I'm sure that I made a very basic mistake, but I can't find it. I would be very happy if someone could take a quick look at my code:

REPORT z_k_we_label_print_test.

TABLES lqua.
DATA: ls_lqua              TYPE lqua.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (32) a1line1 FOR FIELD s_lenum.
SELECT-OPTIONS: s_lenum FOR lqua-lenum NO-EXTENSION NO INTERVALS.
a1line1 = 'Lagereinheit'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 1.
**Block 2 Auflösung Drucker
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (30) b1line1 FOR FIELD p_300.
PARAMETERS :     p_300  RADIOBUTTON GROUP rad1 default 'X'.
b1line1 = '300 DPI'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (30) b1line2 FOR FIELD p_200.
PARAMETERS :     p_200  RADIOBUTTON GROUP rad1.
b1line2 = '200 DPI'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 2.
**Block 3 Ausgabegerät
SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (32) a1line2 FOR FIELD p_padest.
PARAMETERS p_padest LIKE tsp03-padest MATCHCODE OBJECT h_tsp03 OBLIGATORY. " MEMORY ID pde.
a1line2 = 'Ausgabegerät'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 3.

CALL SELECTION-SCREEN 1000. 

START-OF-SELECTION.

PERFORM get_data.
PERFORM print_form.

INCLUDE zles_k_we_label_print_test_f01.

I tried to set the text variables beforehand but then I get the "has already been declared" error.

Best regards,

Niklas

1 ACCEPTED SOLUTION

Szczerbowski
Active Participant
0 Kudos

You need to put the text values in event AT SELECTION-SCREEN OUTPUT, it is described in the F1 help on the COMMENT keyword

AT SELECTION-SCREEN OUTPUT.

a1line1 = 'Lagereinheit'.

b1line1 = '300 DPI'.

And by the way, do you really have to format this screen yourself, or could you just use the Selection-Text part of the report:

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (32) a1line1 FOR FIELD s_lenum.
SELECT-OPTIONS: s_lenum FOR lqua-lenum NO-EXTENSION NO INTERVALS.
*SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 1.

7 REPLIES 7

BGarcia
Active Contributor
0 Kudos

Hi Niklas,

Can't you use text-elements instead? Example:

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (32) text-001 FOR FIELD s_lenum.
SELECT-OPTIONS: s_lenum FOR lqua-lenum NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 1.

Where text element 001 would be set to Lagereinheit.

Kind regards,
Garcia

Szczerbowski
Active Participant
0 Kudos

You need to put the text values in event AT SELECTION-SCREEN OUTPUT, it is described in the F1 help on the COMMENT keyword

AT SELECTION-SCREEN OUTPUT.

a1line1 = 'Lagereinheit'.

b1line1 = '300 DPI'.

And by the way, do you really have to format this screen yourself, or could you just use the Selection-Text part of the report:

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (32) a1line1 FOR FIELD s_lenum.
SELECT-OPTIONS: s_lenum FOR lqua-lenum NO-EXTENSION NO INTERVALS.
*SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 1.

0 Kudos

Thank you, it's working now! And you are right on the second point but I still wanted to know how the selcreen comments behave

0 Kudos

As those texts are constants, you could put their initialization code under event INITIALIZATION.

INITIALIZATION.
  a1line1 = 'Lagereinheit'(A11).
  b1line1 = '300 DPI'.
  b1line2 = '200 DPI'.
  a1line2 = 'Ausgabegerät'(A12).

As already written you could also remove those line/comment and define the texts in text element as selection texts related to parameters/select-options.

RAF
Active Contributor
0 Kudos

Hi,

you do not have to call screen 1000 - its default behavior

former_member614659
Participant
0 Kudos

Please check screen event sequence.
If your sel-screen comment falls under wrong event, it may not display correctly on output screens. Just giving you directions.
hope it helps

Sandra_Rossi
Active Contributor

This answer is to explain the reason why you have a bug. For a solution, see the one given by Michal.

In an Executable Program (type "1"), any executable ABAP line outside an event block is considered to be part of the START-OF-SELECTION event (whose lines are executed after the user presses F8 / button Execute / "ONLI" user command), consequently your code:

...
a1line1 = 'Lagereinheit'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 1.
**Block 2 Auflösung Drucker
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (30) b1line1 FOR FIELD p_300.
PARAMETERS :     p_300  RADIOBUTTON GROUP rad1 default 'X'.
b1line1 = '300 DPI'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (30) b1line2 FOR FIELD p_200.
PARAMETERS :     p_200  RADIOBUTTON GROUP rad1.
b1line2 = '200 DPI'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 2.
**Block 3 Ausgabegerät
SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (32) a1line2 FOR FIELD p_padest.
PARAMETERS p_padest LIKE tsp03-padest MATCHCODE OBJECT h_tsp03 OBLIGATORY. " MEMORY ID pde.
a1line2 = 'Ausgabegerät'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 3.

CALL SELECTION-SCREEN 1000. 

START-OF-SELECTION.
...

is interpreted like:

...
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 1.
**Block 2 Auflösung Drucker
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (30) b1line1 FOR FIELD p_300.
PARAMETERS :     p_300  RADIOBUTTON GROUP rad1 default 'X'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (30) b1line2 FOR FIELD p_200.
PARAMETERS :     p_200  RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 2.
**Block 3 Ausgabegerät
SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (32) a1line2 FOR FIELD p_padest.
PARAMETERS p_padest LIKE tsp03-padest MATCHCODE OBJECT h_tsp03 OBLIGATORY. " MEMORY ID pde.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK 3.

START-OF-SELECTION.
a1line1 = 'Lagereinheit'.
b1line1 = '300 DPI'.
b1line2 = '200 DPI'.
a1line2 = 'Ausgabegerät'.
CALL SELECTION-SCREEN 1000. 
...