Register Login

Loop at screen is not working

Updated May 18, 2018

Pls help me.I am using function key to change the fields dynamically but LOOP AT SCREEN is not working at all.PLS help here.I am writing the code.

REPORT  ztesttst_dynamic.
TABLES: sscrfields.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE  text-001.   "i am defining three blocks.
PARAMETERS: po_num        TYPE c LENGTH 20 DEFAULT 'mod' MODIF ID mod,
            op_num        TYPE c LENGTH 20 DEFAULT 'mod' MODIF ID mod.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE  text-002.
PARAMETERS:mat_num         TYPE c LENGTH 20 DEFAULT 'rad' MODIF ID rad,
           plant           TYPE c LENGTH 20 DEFAULT 'rad' MODIF ID rad.
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE  text-003.
PARAMETERS:so_num          TYPE c LENGTH 20 DEFAULT 'cad' MODIF ID cad,
           so_item         TYPE c LENGTH 20 DEFAULT 'cad' MODIF ID cad.
SELECTION-SCREEN END OF BLOCK b3.
"function keys for dynamic selection.
SELECTION-SCREEN : FUNCTION KEY 1,
                   FUNCTION KEY 2,
                   FUNCTION KEY 3,
                   FUNCTION KEY 4.

INITIALIZATION."name of the dynamic screen options which will appear on the selection screen
   

sscrfields-functxt_01 = 'Execute'. "function code will be fc01
  sscrfields-functxt_02 = 'Customer'."fc02
  sscrfields-functxt_03 = 'Sales order'."fc03
  sscrfields-functxt_04 = 'refresh'. "fc04

  AT SELECTION-SCREEN OUTPUT.
  CASE sscrfields-ucomm.

*now i want to make he make the first block invisible or inactive as i l click on the first button.

*but it is not happening at all. pls help.
    

WHEN  'FC01'.
      LOOP AT SCREEN.
        IF screen-group1 = 'MOD'.
          screen-active = '0'.
          screen-invisible =  '1'.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
  ENDCASE.

 


Comments

  • 27 Feb 2013 5:05 am arpit
    help pls help,, :( :(
  • 28 Feb 2013 10:23 am Abhishek Jonnalagadda
    Hi arpit,

    when you use AT SELECTION-SCREEN OUTPUT here sscrfields gets cleared.so using sscrfields-ucomm will be inappropriate here.

    I changed your code. PLease go thru it will work fine now.

    REPORT ztesttst_dynamic.

    TABLES: sscrfields.

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. "i am defining three blocks.
    PARAMETERS: po_num TYPE c LENGTH 20 DEFAULT 'mod' MODIF ID mod,
    op_num TYPE c LENGTH 20 DEFAULT 'mod' MODIF ID mod.
    SELECTION-SCREEN END OF BLOCK b1.

    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS:mat_num TYPE c LENGTH 20 DEFAULT 'rad' MODIF ID rad,
    plant TYPE c LENGTH 20 DEFAULT 'rad' MODIF ID rad.
    SELECTION-SCREEN END OF BLOCK b2.

    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS:so_num TYPE c LENGTH 20 DEFAULT 'cad' MODIF ID cad,
    so_item TYPE c LENGTH 20 DEFAULT 'cad' MODIF ID cad.
    SELECTION-SCREEN END OF BLOCK b3.

    "function keys for dynamic selection.
    SELECTION-SCREEN : FUNCTION KEY 1,
    FUNCTION KEY 2,
    FUNCTION KEY 3,
    FUNCTION KEY 4.

    data : str type string .

    INITIALIZATION.

    "name of the dynamic screen options which will appear on the selection screen
    sscrfields-functxt_01 = 'Execute'. "function code will be fc01
    sscrfields-functxt_02 = 'Customer'. "fc02
    sscrfields-functxt_03 = 'Sales order'."fc03
    sscrfields-functxt_04 = 'refresh'. "fc04


    AT SELECTION-SCREEN output.

    CASE str.
    *now i want to make he make the first block invisible or inactive as i click on the first button.
    *but it is not happening at all. pls help
    WHEN 'FC01'.
    LOOP AT SCREEN.
    IF screen-group1 = 'MOD'.
    screen-active = 0.
    screen-invisible = 1.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    ENDCASE.

    at selection-screen.
    str = sscrfields-ucomm.

×