Rahul
Rahul

Reputation: 903

Set Parameter ID not working for custom screen

I am trying to call a custom screen when a user clicks on a hotspot in an ALV grid (reuse_alv_grid_display). I want specific values from the row that has been selected by the user to be displayed in the fields of the custom screen.

form handle_user_command using r_ucomm     like sy-ucomm
                               rs_selfield type slis_selfield.

  CASE r_ucomm.
    when '&IC1'.

      if rs_selfield-fieldname = 'SEL'.

        READ TABLE it_zcnclog into wa_zcnclog INDEX rs_selfield-tabindex.
        SET PARAMETER ID 'MAT' FIELD wa_zcnclog-material.
        Call SCREEN '1001'.

If I replace the custom transaction with a standard SAP transaction then values are shown on the standard transaction's screen but otherwise it doesn't. I have checked the SET/GET parameter checkboxes and also checked the TPARA table for the entries but no luck.

Thanks for the help.

Upvotes: 0

Views: 9665

Answers (2)

Sandra Rossi
Sandra Rossi

Reputation: 13656

A screen field can take the value set by SET PARAMETER ID 'ZZZ' FIELD 'VALUE' only if:

  • Field is of type "input/output" (at design time and at run time)
  • Field attribute "parameter ID" is the same SAP memory ID (ZZZ)
  • Field attribute "GET parameter" is checked
  • In the program, the global variable corresponding to the screen field name is initial (at least at the end of the Process Before Output phase)

Excerpt from the ABAP documentation :

  • "When defining input fields, dynpro fields can be associated with SPA/GPA parameters by entering the name of an SPA/GPA parameter from the database table TPARA as an attribute PARAMETER ID. If the corresponding parameter GET PARAMETER is set and no other value is assigned to the input field, the input field is filled with the value of the SPA/GPA parameter when the screen is sent."

Demonstration, the value entered in the first screen appears in the second screen and vice versa :

REPORT z.

TABLES sscrfields.

" Selection screen 1000 (implicit first one)
SELECTION-SCREEN COMMENT /1(40) text1000.
PARAMETERS p_start TYPE c LENGTH 10 LOWER CASE MEMORY ID zzzz.

" Selection screen 1001
SELECTION-SCREEN BEGIN OF SCREEN 1001.
SELECTION-SCREEN COMMENT /1(40) text1001.
PARAMETERS p_b1ab1a TYPE c LENGTH 10.
PARAMETERS p_end TYPE c LENGTH 10 LOWER CASE MEMORY ID zzzz.
PARAMETERS p_b2ab2a TYPE c LENGTH 10.
SELECTION-SCREEN END OF SCREEN 1001.

INITIALIZATION.
  text1000 = 'Press Enter to go to next screen'(000).
  text1001 = 'Press Enter to go to previous screen'(001).

AT SELECTION-SCREEN.
  IF sscrfields-ucomm IS INITIAL.
    CASE sy-dynnr.
      WHEN 1000.
        CLEAR p_end. " <== very important !
        CALL SELECTION-SCREEN 1001.
      WHEN 1001.
        CLEAR p_start. " <== very important !
        LEAVE TO SCREEN 0. " go to previous screen (don't use CALL 
          " SELECTION-SCREEN to avoid a stack of more than 50 dynpros)
    ENDCASE.
  ENDIF.

Upvotes: 0

Bryan Cain
Bryan Cain

Reputation: 1776

The custom transaction that you're calling needs the MEMORY ID value set in the parameter declaration.

PARAMETER: matnr type mara-matnr MEMORY ID MAT.

If the transaction you are calling is a classic dynpro transaction, you need to edit the element attributes of the field and add the MEMORY ID and the SET & GET Parameter boxes.

screen element attributes

Upvotes: 2

Related Questions