Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Input parameter is not save after selection. Please help!

Former Member
0 Likes
1,768

Hi all,

I am writing a report that read two inputs parameters. These are obligatory.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-005.

PARAMETERS:   name(40) type c OBLIGATORY.

PARAMETERS:   nr type i OBLIGATORY.

SELECTION-SCREEN END OF BLOCK 1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR name.

............

Perfom XXXX.

Perform YYY.

What am I doing wrong?

I can select the first parameter from the help list without problem. When I enter the second one, I can see that the variable is empty after setting a break point and going in the debug mode.

What should I do to make this work? Please help.

1 ACCEPTED SOLUTION
Read only

former_member209120
Active Contributor
0 Likes
1,518

Hi Maria Margy,

I tried like this,  I am getting values can you share your code to check what's the problem.

DATA       : r_name TYPE TABLE OF ddshretval WITH HEADER LINE.
DATA       : BEGIN   OF   t_name OCCURS 0,
              name   TYPE char40,
              END     OF   t_name.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-005.
PARAMETERS:   name(40) type c OBLIGATORY.
PARAMETERS:   nr type i OBLIGATORY.
SELECTION-SCREEN END OF BLOCK 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR name.
  REFRESH t_name.
   APPEND 'Ramesh' TO t_name.
   APPEND 'Ganesh' TO t_name.

   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
     EXPORTING
       retfield        = 'NAME'
       dynpprog        = sy-repid
       dynpnr          = '1000'
       dynprofield     = 'name'
       window_title    = 'Name'
       value_org       = 'S'
     TABLES
       value_tab       = t_name[]
       RETURN_TAB      = r_name[]
     EXCEPTIONS
       parameter_error = 1
       no_values_found = 2
       OTHERS          = 3.
   IF sy-subrc <> 0.
   ENDIF.

start-of-SELECTION.

Write :/ name, nr.



7 REPLIES 7
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
1,518

Hello Maria Margy.

Refer this thread http://scn.sap.com/thread/840861.

Regards.

Read only

former_member209120
Active Contributor
0 Likes
1,519

Hi Maria Margy,

I tried like this,  I am getting values can you share your code to check what's the problem.

DATA       : r_name TYPE TABLE OF ddshretval WITH HEADER LINE.
DATA       : BEGIN   OF   t_name OCCURS 0,
              name   TYPE char40,
              END     OF   t_name.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-005.
PARAMETERS:   name(40) type c OBLIGATORY.
PARAMETERS:   nr type i OBLIGATORY.
SELECTION-SCREEN END OF BLOCK 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR name.
  REFRESH t_name.
   APPEND 'Ramesh' TO t_name.
   APPEND 'Ganesh' TO t_name.

   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
     EXPORTING
       retfield        = 'NAME'
       dynpprog        = sy-repid
       dynpnr          = '1000'
       dynprofield     = 'name'
       window_title    = 'Name'
       value_org       = 'S'
     TABLES
       value_tab       = t_name[]
       RETURN_TAB      = r_name[]
     EXCEPTIONS
       parameter_error = 1
       no_values_found = 2
       OTHERS          = 3.
   IF sy-subrc <> 0.
   ENDIF.

start-of-SELECTION.

Write :/ name, nr.



Read only

0 Likes
1,518

Thanks for your answer. Is it possible to define an intervall for the parameter

PARAMETERS:   nr type i OBLIGATORY.

I would like that only number for example between 0 and 1000 can be enter by the user.

Thanks

Read only

0 Likes
1,518

Hi Maria Margy,

Use select options and   put validation

DATA : var TYPE i.

SELECT-OPTIONS s_var FOR var OBLIGATORY.

AT SELECTION-SCREEN ON s_var.
   IF  ( s_var-low NOT BETWEEN '0' AND '1000' ) AND ( s_var-high NOT BETWEEN '0' AND '1000' ).
     MESSAGE : 'Please enter vale between 0 to 100' TYPE 'E'.
   ENDIF.


Read only

SujeetMishra
Active Contributor
0 Likes
1,518

Hi Maria,

ELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-005.

PARAMETERS:   name(40) type c OBLIGATORY.

PARAMETERS:   nr type i OBLIGATORY.

SELECTION-SCREEN END OF BLOCK 1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR name.

............

If below perform is not used for screen level validation then please use it in start of selection event.

START-OF-SELECTION.

Perfom XXXX.

Perform YYY.

Regards,

Sujeet

Read only

Former Member
0 Likes
1,518

Hi Maria,

To get the values input at the selection screen,

you can try the FM,

  CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

      dyname     = sy-repid    "Program name

      dynumb     = sy-dynnr   "screen number

    TABLES

      dynpfields = gt_dynfields  "fields on selection screen

    EXCEPTIONS

      OTHERS     = 01.

  IF sy-subrc = 0.

    READ TABLE gt_dynfields INTO gs_dynfields  WITH KEY fieldname = 'NAME'.

    IF sy-subrc = 0.

     gv_name = gs_dynfields-fieldvalue.

    ENDIF.

  ENDIF.

Regards,

Shruti D

Read only

Former Member
0 Likes
1,518

Hi Maria,

Please check if after the FM is executed you are assigning a value to the selection screen parameter. Also

use a data type for deifining a parameter .

Thanks

Asha