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

parameters checkbox at selection screen

0 Likes
1,406

hello all,

I have a problem that I don't know how to solve:

I will put my program here:

the problems are with selection-screen block 2.

so, I have 4 checkboxes: 3 for class and one for invoice.

when I hit the business class checkbox I need to bring all the flights for business class. And so on for the other 2.

for the invoice, when I hit the check box for invoice, I need to bring all the flights that have invoice flag.

TABLES: spfli.
*==================================================================*
* data declaration *
*==================================================================*
DATA: BEGIN OF gs_flights,
carrid TYPE spfli-carrid, "Airline"
connid TYPE spfli-connid, "Flight number"
fldate TYPE sflight-fldate, "Date"
countryfr TYPE spfli-countryfr, "Country"
carrname TYPE scarr-carrname, "Airline Name"
cityfrom TYPE spfli-cityfrom, "Departure city"
cityto TYPE spfli-cityto, "Arrival city"
deptime TYPE spfli-deptime, "Departure"
arrtime TYPE spfli-arrtime, "Arrival"
price TYPE sflight-price, "Airfare"
bookid TYPE sbook-bookid, "Booking number"
luggweight TYPE sbook-luggweight, "Luggage weight"
order_date TYPE sbook-order_date, "Booking date"
cancelled TYPE sbook-cancelled, "Cancelation flag"
reserved TYPE sbook-reserved, "Reserved"
passname TYPE sbook-passname, "Passanger name"
customid TYPE sbook-customid, "Customer number"
counter TYPE sbook-counter, "Sales office"
currency TYPE sflight-currency, "Airline currency"
agencynum TYPE sbook-agencynum, "Agency number"
class TYPE sbook-class, "Class"
invoice TYPE sbook-invoice, "invoice flagg"
END OF gs_flights.
DATA: gt_flights LIKE TABLE OF gs_flights.
DATA: gd_ucomm TYPE sy-ucomm.
DATA: go_salv TYPE REF TO cl_salv_table.
DATA: go_function TYPE REF TO cl_salv_functions_list.
DATA: go_display TYPE REF TO cl_salv_display_settings.
DATA: go_cols_tab TYPE REF TO cl_salv_columns_table.
*==================================================================*
* SELECTION SCREEN *
*==================================================================*
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_carrid FOR spfli-carrid, "Airline"
s_connid FOR spfli-connid, "Flight number"
s_countr FOR spfli-countryfr, "Country"
s_cityto FOR spfli-cityto, "Departure city"
s_cityfr FOR spfli-cityfrom. "Arrival city"
SELECTION-SCREEN: END OF BLOCK b1.


SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_cb_b AS CHECKBOX USER-COMMAND cb_b, " checkbox for business clas C"
p_cb_f AS CHECKBOX USER-COMMAND cb_f, " checkbox for economy class Y"
p_cb_e AS CHECKBOX USER-COMMAND cb_e, " checkbox for first class F"
p_cb_inv AS CHECKBOX, " check box for invoice flag"
p_var TYPE disvariant-variant.
SELECTION-SCREEN: END OF BLOCK b2.

*=====================================================================*
* AT SELECTION-SCREEN *
*=====================================================================*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
PERFORM value_request_p_var CHANGING p_var.

AT SELECTION-SCREEN OUTPUT.

 CASE gd_ucomm.
WHEN 'cb_b' .
CLEAR: p_cb_f , p_cb_e.
WHEN 'cb_f'.
CLEAR: p_cb_b , p_cb_e.
WHEN 'cb_e'.
CLEAR: p_cb_b , p_cb_f.
ENDCASE.

and the invoice parameter I used it here:

after all the data from select data and joins ..

 LOOP AT lt_schedule INTO ls_schedule.
READ TABLE lt_scarr INTO ls_scarr WITH KEY carrid = ls_schedule-carrid
BINARY SEARCH.
IF sy-subrc = 0.

 gs_flights-carrname = ls_scarr-carrname.
 ENDIF.
READ TABLE lt_sbook INTO ls_sbook WITH KEY carrid = ls_schedule-carrid
connid = ls_schedule-connid
BINARY SEARCH.
IF sy-subrc = 0.


gs_flights-invoice = ls_sbook-invoice.

 IF p_cb_inv IS NOT INITIAL.
gs_flights-invoice = ls_sbook-invoice.

 IF ls_sbook-invoice <> 'X'.
CONTINUE.
ENDIF.
ENDIF.
ENDIF.

 IF sy-subrc = 0.
READ TABLE lt_stravelag INTO ls_stravelag WITH KEY agencynum = ls_sbook-agencynum
BINARY SEARCH.
ENDIF.

can anyone tell me what have I missed, because no checkbox work as it should.

thank you all,

3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,202

Please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!

Read only

Sandra_Rossi
Active Contributor
1,202

Please debug your code, and you'll see the problem.

Read only

former_member793180
Discoverer
0 Likes
1,202

Hi,

Try using At selection screen event which triggers at PAI. Make sure all the checkboxes are having correct values before START-OF-SELECTION. Please check if you can directly use these flags in database tables while fetching the entries. Also, for the class checkbox if only one is possible at a time, replace them with radio button.

Thanks!