‎2022 Mar 06 6:39 PM
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,
‎2022 Mar 06 7:53 PM
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!
‎2022 Mar 06 7:54 PM
‎2022 Mar 07 1:58 AM
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!