Skip to Content
avatar image
-2
Former Member

Dynamic change based on 3 radio buttons not working ? (Working only first 2)

When i click on p_r_ord radio button its not showing contents of this radio buttons as p_r_sto and p_r_car showing need help for only highlighted part "IF....Else LOGIC"

*-----------------------------------*

* DECLARATIONS
TABLES:
zsa_ddic_store.

CONSTANTS:
gc_show_store TYPE i VALUE 1,
gc_hide_store TYPE i VALUE 0,
gc_show_car TYPE i VALUE 1,
gc_hide_car TYPE i VALUE 0,
gc_show_ord TYPE i VALUE 1,
gc_hide_ord TYPE i VALUE 0.

*-----------------------------------*
* SELECTION-SCREEN

" Dynamic Change based on Radio Button Selection
SELECTION-SCREEN BEGIN OF BLOCK b06 WITH FRAME TITLE text-b06.

" Store Information
SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
PARAMETERS:
p_sto_f1 TYPE zsa_ddic_store_id MODIF ID sto, " Show Only When p_r_sto selected
p_sto_f2 TYPE zsa_ddic_address MODIF ID sto,
p_sto_f3 TYPE zsa_ddic_city MODIF ID sto,
p_sto_f4 TYPE zsa_ddic_country MODIF ID sto,
p_sto_f5 TYPE zsa_ddic_opened_at MODIF ID sto,
p_sto_f6 TYPE zsa_ddic_closed_at MODIF ID sto.
SELECTION-SCREEN END OF BLOCK b02.

" Car Information
SELECTION-SCREEN BEGIN OF BLOCK b03 WITH FRAME TITLE text-b03.
PARAMETERS:
p_car_f1 TYPE zsa_ddic_icpn MODIF ID car, " Show Only When p_r_car selected
p_car_f2 TYPE zsa_ddic_model_id MODIF ID car, " p -parameter sto - store f1 for field 1
p_car_f3 TYPE zsa_ddic_store_id MODIF ID car,
p_car_f4 TYPE zsa_ddic_price MODIF ID car,
p_car_f5 TYPE zsa_ddic_currency MODIF ID car.
SELECTION-SCREEN END OF BLOCK b03.

" Order Information
SELECTION-SCREEN BEGIN OF BLOCK b04 WITH FRAME TITLE text-b04.
PARAMETERS:
p_ord_f1 TYPE zsa_ddic_order_id MODIF ID ord, " Show Only When p_r_ord selected
p_ord_f2 TYPE zsa_ddic_customer_id MODIF ID ord.
* p_ord_f3 TYPE zsa_ddic_price,
* p_ord_f4 TYPE zsa_ddic_currency,
* p_ord_f5 TYPE zsa_ddic_ordered_at.
SELECTION-SCREEN END OF BLOCK b04.

SELECTION-SCREEN END OF BLOCK b06.

*-----------------------------------*
* AT SELECTION-SCREEN OUTPUT

" Use this event to change properties on sel.screen elements

AT SELECTION-SCREEN OUTPUT.

 IF p_r_sto = abap_true.
 " Display only store related selection screen elements
 " Hide all car related selection screen elements
 PERFORM toggle_selscreen
 USING gc_show_store.
 ELSE.
 " Display only car related selection screen elements
 " Hide all store related selection screen elements
 PERFORM toggle_selscreen
 USING gc_hide_store.
 ENDIF.


*&---------------------------------------------------------------------*
*& Form toggle_selscreen
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IB_SHOW_STO text
*----------------------------------------------------------------------*
FORM toggle_selscreen
USING ib_show_sto TYPE i.

DATA:
lb_disp_sto TYPE i,
lb_disp_car TYPE i,
lb_disp_ord TYPE i.

 IF ib_show_sto = gc_show_store.
 lb_disp_sto = gc_show_store.
 lb_disp_car = gc_hide_car.
 ELSE.
 lb_disp_sto = gc_hide_store.
 lb_disp_car = gc_show_car.
 ENDIF.
 

" Update Screen Elements
LOOP AT SCREEN.

 CASE screen-group1.
 WHEN 'STO'.
 screen-active = lb_disp_sto.
 MODIFY SCREEN.
 WHEN 'CAR'.
 screen-active = lb_disp_car.
 MODIFY SCREEN.
 WHEN 'ORD'.
 screen-active = lb_disp_ord.
 MODIFY SCREEN.
 ENDCASE.
 ENDLOOP.
 


ENDFORM. " TOGGLE_SELSCREEN

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 06, 2017 at 09:22 PM

    Sorry, but these are programming basics!

    You need to something like this:

    ...
    ...
    
    CONSTANTS:
      gc_show_store TYPE i VALUE 1,
      gc_show_car   TYPE i VALUE 2,
      gc_show_ord   TYPE i VALUE 3.
    CONSTANTS:
      gc_show TYPE i VALUE 1,
      gc_hide TYPE i VALUE 0.
    
    ...
    ...
    
    AT SELECTION-SCREEN OUTPUT.
    
      IF p_r_sto = abap_true.
        PERFORM toggle_selscreen USING gc_show_store.
      ELSEIF p_r_car = abap_true.
        PERFORM toggle_selscreen USING gc_show_car.
      ELSE.
        PERFORM toggle_selscreen USING gc_show_order.
      ENDIF.
    
      ...
      ...
    
    *  CASE abap_true.
      CASE ib_show_sto.
        WHEN gc_show_store.
          lb_disp_sto = gc_show.
          lb_disp_car = gc_hide.
          lb_disp_ord = gc_hide.
    
        WHEN gc_show_car.
          lb_disp_sto = gc_hide.
          lb_disp_car = gc_show.
          lb_disp_ord = gc_hide.
    
        WHEN gc_show_order.
          lb_disp_sto = gc_hide.
          lb_disp_car = gc_hide.
          lb_disp_ord = gc_show.
    
      ENDCASE.
     
      ...
      ...
    

    BTW: don`t use FORMs, use a local class instead

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 09, 2017 at 07:55 AM

    Use the code tags!

    Add comment
    10|10000 characters needed characters exceeded