0

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.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Rahul
  • 903
  • 1
  • 10
  • 27
  • It can work without the TPARA table. As said by @Bryan Cain, you must set the 3 elements "Parameter ID" (not "MEMORY ID"), "SET parameter", "GET parameter" of the field in your dynpro screen so that it is automatically filled with the value set by `SET PARAMETER ID FIELD ...` where is the ID you have entered in "Parameter ID". – Sandra Rossi Dec 14 '18 at 17:06
  • @SandraRossi I have set the parameter id and checked the checkboxes. Do i still have to declare the PARAMETER: line? If yes, where will i have to do this? – Rahul Dec 14 '18 at 18:07
  • Again, it can work without the TPARA table (it's just a best practice to declare a custom parameter as a workbench object and transport it). In your example, you use `MAT`, it's not a custom parameter, it's a standard one, so don't declare it in TPARA. – Sandra Rossi Dec 14 '18 at 18:28
  • @SandraRossi Okay. MAT is working but another field won't work. Just to confirm. I simply check both the checkboxes and declare a parameter id correct? – Rahul Dec 14 '18 at 18:29
  • Maybe your issue is that you didn't activate the dynpro screen, or that you didn't restart your application after each change of the dynpro screen (?) Try to investigate any possible "silly" error (make sure by debug that you enter the SET PARAMETER statement before calling the transaction, etc.) You may also check the value of the memory with the backend debugger (add a breakpoint before the CALL SCREEN and display the memory). – Sandra Rossi Dec 14 '18 at 18:33
  • @ Rahul That's correct. – Sandra Rossi Dec 14 '18 at 18:34
  • @SandraRossi Do you think conv. exit has to do anything with the issue? Ran the debugger, i am not able to set the parameter ids for the rest of the fields. – Rahul Dec 14 '18 at 18:43
  • @ Rahul No, only the three parameters. The debugger is only about looking at the values of those parameters in the memory (I'm not talking about the display of screen field attributes). Again, look at silly possibilities. Also you may re-create a simple case from scratch, because that will work undoubtedly, then you know that something from there try to recreate the same dynpro. It may help if you explain more precisely what you did (screen properties, properties of screen field, use of set hold data, etc.), and screen shots are helpful too... – Sandra Rossi Dec 14 '18 at 19:55
  • By the way, displaying the values selected from the ALV screen into a screen belonging to the same program, is usually done by setting the global variables assigned to the screen fields (same name), not by using `SET PARAMETER`. This is reserved to facilitating the inputs between transactions. – Sandra Rossi Dec 14 '18 at 19:58
  • @ Rahul Again, did you activate the dynpro screen after each dynpro change, and did you restart your application after each activation of the dynpro screen ? – Sandra Rossi Dec 14 '18 at 20:09
  • @SandraRossi Yes, Sandra. I am lost at this point as to why this wont work.I am trying the global variables approach. – Rahul Dec 14 '18 at 20:10
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/185269/discussion-between-rahul-and-sandra-rossi). – Rahul Dec 14 '18 at 20:42

2 Answers2

2

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

Community
  • 1
  • 1
Bryan Cain
  • 1,736
  • 9
  • 17
  • what if it is a custom screen? – Rahul Dec 14 '18 at 16:23
  • The parameter declaration, where would you do it? My program has a custom screen in it, I am just calling that screen. – Rahul Dec 14 '18 at 17:00
  • hey bryan thanks for the answer. One last question, there are multiple fields and upon doing the same with other fields none of the new fields produced the desired output. Only, material gives me the selected row's value. Any idea why this could be happening? – Rahul Dec 14 '18 at 19:03
0

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.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • @Rahul Is your issue solved? What was the issue and solution? Thanks. – Sandra Rossi Dec 17 '18 at 19:25
  • 1
    Sandra, I took your advice and created global variables for the fields on the new screen. I do not know why Set and Get parameter ID was not working(also checked TPARA table). I have just posted a new question, if you would like to take a look. – Rahul Dec 17 '18 at 19:26