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

Amending a screen after execution

Former Member
0 Likes
1,320

I currently have the following code, which creates a selection screen of 2 text parameters and a check box. When the check box is selected a portion of text appears under the check box and when it is de-selected the text disappears. This is all working fine, but when I execute I want the check box to default to empty and the text to disappear automatically when the user goes back to the selection screen. The code I have got makes the text disappear on execution but the check box is still selected.

Can anyone point out where I am going wrong?

Kind Regards

Carly

SELECTION-SCREEN BEGIN OF BLOCK s1 WITH FRAME TITLE title1.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(14) text-001 MODIF ID std.
    PARAMETERS: pa_week TYPE scal-week OBLIGATORY MODIF ID std.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(14) text-002 MODIF ID std.
    PARAMETERS: pa_date TYPE sy-datum MODIF ID std.
  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK s1.

SELECTION-SCREEN BEGIN OF BLOCK s2 WITH FRAME TITLE title2.
  SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: cb_info AS CHECKBOX USER-COMMAND * MODIF ID std.
    SELECTION-SCREEN COMMENT (50) text-003 MODIF ID std.
  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK s2.

SELECTION-SCREEN BEGIN OF BLOCK s3 WITH FRAME TITLE title3.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-004 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN SKIP.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-005 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN SKIP.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-006 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-007 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN SKIP.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-008 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-009 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK s3.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF screen-group1 = 'INF' AND
     ( flag = 'X').
      screen-invisible = 0.
    ELSEIF screen-group1 = 'INF' AND
     ( flag <> 'X').
      screen-invisible = 1.
    ELSEIF screen-group1 = 'STD'.
      screen-active = 1.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN.
  
  IF cb_info = 'X'.
    flag = 'X'.
  ELSE.
    CLEAR flag.
  ENDIF.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,294

You can achieve this with one statement at the end of your program execution. I assume that you have a START-OF-SELECTION event, at the end of this event, put the statement FREE MEMORY. That's it.

Regards,

RIch Heilman

I currently have the following code, which creates a selection screen of 2 text parameters and a check box. When the check box is selected a portion of text appears under the check box and when it is de-selected the text disappears. This is all working fine, but when I execute I want the check box to default to empty and the text to disappear automatically when the user goes back to the selection screen. The code I have got makes the text disappear on execution but the check box is still selected.

Can anyone point out where I am going wrong?

Kind Regards

Carly

SELECTION-SCREEN BEGIN OF BLOCK s1 WITH FRAME TITLE title1.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(14) text-001 MODIF ID std.
    PARAMETERS: pa_week TYPE scal-week OBLIGATORY MODIF ID std.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(14) text-002 MODIF ID std.
    PARAMETERS: pa_date TYPE sy-datum MODIF ID std.
  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK s1.

SELECTION-SCREEN BEGIN OF BLOCK s2 WITH FRAME TITLE title2.
  SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: cb_info AS CHECKBOX USER-COMMAND * MODIF ID std.
    SELECTION-SCREEN COMMENT (50) text-003 MODIF ID std.
  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK s2.

SELECTION-SCREEN BEGIN OF BLOCK s3 WITH FRAME TITLE title3.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-004 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN SKIP.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-005 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN SKIP.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-006 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-007 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN SKIP.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-008 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
  SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-009 MODIF ID inf.
  SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK s3.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF screen-group1 = 'INF' AND
     ( flag = 'X').
      screen-invisible = 0.
    ELSEIF screen-group1 = 'INF' AND
     ( flag <> 'X').
      screen-invisible = 1.
    ELSEIF screen-group1 = 'STD'.
      screen-active = 1.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

AT SELECTION-SCREEN.
  
  IF cb_info = 'X'.
    flag = 'X'.
  ELSE.
    CLEAR flag.
  ENDIF.

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,295

You can achieve this with one statement at the end of your program execution. I assume that you have a START-OF-SELECTION event, at the end of this event, put the statement FREE MEMORY. That's it.

Regards,

RIch Heilman

Read only

0 Likes
1,294

That's great - Thank you...

Another problem though...Within my Start-Of-Selection I have got a piece of code that checks for errors and when there are errors is doesn't go right to the end of the Start-Of-Selection.

How can I get over this?

Regards

Carly

START-OF-SELECTION.

  PERFORM get_selection.
  PERFORM get_trading_branches.
  PERFORM get_stock_data.

  CHECK wa_error IS INITIAL.

  SKIP 1.

  WRITE: / ' Shop Core Report - ',
             pa_week+4(2) NO-GAP, '/' NO-GAP, pa_week(4).
  WRITE: / ' ---------------------------'.
  PERFORM summarise_data USING 'trading'.
  PERFORM produce_report USING 'trading'.

  SKIP 1.

  WRITE: / ' NDC 6000 - ',
            pa_week+4(2) NO-GAP, '/' NO-GAP, pa_week(4).
  WRITE: / ' -------------------'.
  PERFORM summarise_data USING 'ndc'.
  PERFORM produce_report USING 'ndc'.

  FREE MEMORY.

Read only

0 Likes
1,294

Wrap it an IF statement.




START-OF-SELECTION.
 
  PERFORM get_selection.
  PERFORM get_trading_branches.
  PERFORM get_stock_data.
 
  IF  wa_error IS INITIAL.
 
  SKIP 1.
 
  WRITE: / ' Shop Core Report - ',
             pa_week+4(2) NO-GAP, '/' NO-GAP, pa_week(4).
  WRITE: / ' ---------------------------'.
  PERFORM summarise_data USING 'trading'.
  PERFORM produce_report USING 'trading'.
 
  SKIP 1.
 
  WRITE: / ' NDC 6000 - ',
            pa_week+4(2) NO-GAP, '/' NO-GAP, pa_week(4).
  WRITE: / ' -------------------'.
  PERFORM summarise_data USING 'ndc'.
  PERFORM produce_report USING 'ndc'.
 
  ENDIF.

  FREE MEMORY.



Regards,

Rich Heilman

Read only

0 Likes
1,294

Hi

U shouldn't use FREE MEMORY here, but in the INITIALIZATION event, u can also move all code to write the list in the END-OF-SELECTION event or insert an IF/ENDIF statament instead of CHECK.

Anyway if you'll use FREE MEMROY you'll loose all paramenters of selection-screen.

Max

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,294

Just clear cb_info field after the AT SELECTION-SCREEN block.

Regards

Read only

Former Member
0 Likes
1,294

Hi

All values inserted in the SELECTION-SCREEN are stored in the memory, in this way the system can get back them after excuting the report.

U should export a flag in the start-of-selection to the memory and import it in the AT SELECTION-SCREEN event in order to deselect the check box.

Max

Read only

0 Likes
1,294

How would I export a flag to the memory in Start-Of-Selection as when I just put executionflag = 'X' it loses its value once it leave Start-Of-Selection so I import it elsewhere?

Regards

Carly

Read only

Former Member
0 Likes
1,294

I have searched on the forums and have now got this code:

START-OF-SELECTION.

  execflag = 'X'.
  EXPORT execflag TO MEMORY ID 'INF'.

AT SELECTION-SCREEN.

  IMPORT execflag FROM MEMORY ID 'INF'.
  FREE MEMORY ID 'INF'.

but the FREE MEMORY part does not seem to be emptying the memory.

Any ideas?

Kind Regards

Carly