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

AT SELECTION-SCREEN

Former Member
0 Likes
828

Dear All,

I designed a selection screen which consists of two blocks. One block with parameters scarrid and sconnid. Second block with paramter sfldate. I also declared a checkbox [showdate]. If we select the check box only the second block will be displayed.

Now my problem is retrieving the data and wrting output.

I have written the code and i am not getting the output. I dont know where i went wrong. Please have a look at the following code and kindly get back to me.

Thanks for your time.

REPORT zselectscreen1.

TABLES: sflight.

DATA: iflight TYPE TABLE OF sflight WITH HEADER LINE.

PARAMETERS: showdate AS CHECKBOX USER-COMMAND flag.

SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME.

PARAMETERS: scarrid LIKE sflight-carrid,

sconnid LIKE sflight-connid.

SELECTION-SCREEN END OF BLOCK b.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS: sfldate LIKE sflight-fldate MODIF ID sg1.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF showdate <> 'X' AND screen-group1 = 'SG1'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

AT SELECTION-SCREEN.

IF showdate <> 'X'.

SELECT * FROM sflight INTO TABLE iflight WHERE carrid = scarrid

AND connid = sconnid

AND fldate = sfldate.

LOOP AT iflight.

WRITE: / iflight-carrid , iflight-connid , iflight-fldate , iflight-price, iflight-currency, iflight-planetype.

ENDLOOP.

ELSE.

SELECT * FROM sflight INTO TABLE iflight WHERE carrid = scarrid

AND connid = sconnid.

LOOP AT iflight.

WRITE: / iflight-carrid , iflight-connid , iflight-fldate , iflight-price, iflight-currency, iflight-planetype.

ENDLOOP.

Edited by: Alvaro Tejada Galindo on Apr 7, 2008 4:05 PM

8 REPLIES 8
Read only

Former Member
0 Likes
784

I changed it this way


TABLES: sflight.

DATA: iflight TYPE TABLE OF sflight WITH HEADER LINE.

PARAMETERS: showdate AS CHECKBOX USER-COMMAND flag.

SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME.
PARAMETERS: scarrid LIKE sflight-carrid,
sconnid LIKE sflight-connid.
SELECTION-SCREEN END OF BLOCK b.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: sfldate LIKE sflight-fldate MODIF ID sg1.
SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF showdate <> 'X' AND screen-group1 = 'SG1'.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

START-OF-SELECTION.
IF showdate <> 'X'.
SELECT * FROM sflight INTO TABLE iflight WHERE carrid = scarrid
AND connid = sconnid
AND fldate = sfldate.

LOOP AT iflight.
WRITE: / iflight-carrid , iflight-connid , iflight-fldate ,
iflight-price, iflight-currency, iflight-planetype.
ENDLOOP.

ELSE.
SELECT * FROM sflight INTO TABLE iflight WHERE carrid = scarrid
AND connid = sconnid.
LOOP AT iflight.
WRITE: / iflight-carrid , iflight-connid , iflight-fldate ,
iflight-price, iflight-currency, iflight-planetype.
ENDLOOP.
endif.

Read only

0 Likes
784

I guess u have changed AT SELECTION-SCREEN to START-OF-SELECTION.

The code still not working buddy. I teste it.

I don't know why.

Read only

Former Member
0 Likes
784

Hi,

Change the AT SELECTION-SCREEN OUTPUT code as below.

AT SELECTION-SCREEN OUTPUT.

IF showdate = 'X'.

LOOP AT SCREEN.

IF screen-name = 'SFLDATE'.

screen-input = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-name = 'SFLDATE'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Hope it is helpful..

Regards,

Chithra

Read only

0 Likes
784

Thanks for taking ur precious time to answer my question.

The problem is retrieving the data. I dont have any problem with 1st AT SELECTION-SCREEN part. The problem is with second one. I dont know whether my approcah is correct or not.

Let me tell you.

If the showdate check box = 'X'.

Then sfldate parameter field will be displayed and user is permitted to enter all the three fields. scarrid , sconnid and sfldate.

If the showdate checkbox is not checked only the first block with two parameter fields will be displayed.

scarrid and sconnid.

Till this part screen elements are working fine.

Now the problem begins.

How to retrieve the data in both cases?????

I hope you got my problem.

Read only

Former Member
0 Likes
784

TABLES: sflight.

DATA: iflight TYPE TABLE OF sflight WITH HEADER LINE.

PARAMETERS: showdate AS CHECKBOX USER-COMMAND flag.

SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME.
PARAMETERS: scarrid LIKE sflight-carrid,
sconnid LIKE sflight-connid.
SELECTION-SCREEN END OF BLOCK b.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: sfldate LIKE sflight-fldate MODIF ID sg1.
SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF showdate NE 'X' AND screen-group1 = 'SG1'.
      screen-active = '0'.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

START-OF-SELECTION.
  IF showdate EQ 'X'.
    SELECT * FROM sflight INTO TABLE iflight WHERE carrid = scarrid
    AND connid = sconnid
    AND fldate = sfldate.

    LOOP AT iflight.
      WRITE: / iflight-carrid , iflight-connid , iflight-fldate ,
      iflight-price, iflight-currency, iflight-planetype.
    ENDLOOP.

  ELSE.
    SELECT * FROM sflight INTO TABLE iflight WHERE carrid = scarrid
    AND connid = sconnid.
    LOOP AT iflight.
      WRITE: / iflight-carrid , iflight-connid , iflight-fldate ,
      iflight-price, iflight-currency, iflight-planetype.
    ENDLOOP.
  ENDIF.

It should be like this...And it works -:) However, you must fill the parameters...If you want to always show data you might use SELECT-OPTIONS...

Greetings,

Blag.

Read only

Former Member
0 Likes
784

Use Start-of-Selection Event instead of At Selection Screen. Also, Check whether ur select query is successful or not. If you select query fails then nothing will be displayed on to the report.

Hope this will help you..

Regards,

Swaroop Patri

Read only

0 Likes
784

Thanks for your reply.

I found there is something wrong with my select Query.

Could please provide appropriate select query for both the cases.

Thanks once again.

Read only

Former Member
0 Likes
784

Thanks, my problem has been resolved.

Thanks for all who took time to answer my query.