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

Help with SELECTIO SCREEN

Former Member
0 Likes
452

Dear Sirs:

I defined the following parameters in my program:

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS:

p_kokrs LIKE cobk-kokrs MEMORY ID ZKO OBLIGATORY,

  • More parameters.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_setcc-low.

IF p_kokrs = ''.

*Some Actions depending of p_kokrs value ..

When my user type a value in parameter p_kokrs but instead of pressing ENTER key, passes to another parameter with the tab key or using the mouse, p_kokrs remains INITIAL. How can I get current value if it hasn't passed to ABAP yet ?

Thanks for your help.

Best Regards,

Dairo Lozano.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
424

We use DYNP_VALUES_READ for this. Here is a sample program.



report zrich_0002 .

parameters: p_vbeln type vbak-vbeln,
            p_posnr type vbap-posnr.

at selection-screen on value-request for p_posnr.


  data: begin of help_item occurs 0,
          posnr type vbap-posnr,
          matnr type vbap-matnr,
          arktx type vbap-arktx,
        end of help_item.

  data: dynfields type table of dynpread with header line.


  dynfields-fieldname = 'P_VBELN'.
  append dynfields.

  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = sy-cprog
            dynumb               = sy-dynnr
            translate_to_upper   = 'X'
       tables
            dynpfields           = dynfields
       exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            others               = 11.


  read table dynfields with key fieldname = 'P_VBELN'.

  p_vbeln = dynfields-fieldvalue.


  call function 'CONVERSION_EXIT_ALPHA_INPUT'
       exporting
            input  = p_vbeln
       importing
            output = p_vbeln.

  select posnr matnr arktx into table help_item
                 from vbap
                      where vbeln = p_vbeln.



  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'POSNR'
            dynprofield = 'P_POSNR'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = help_item.


Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
425

We use DYNP_VALUES_READ for this. Here is a sample program.



report zrich_0002 .

parameters: p_vbeln type vbak-vbeln,
            p_posnr type vbap-posnr.

at selection-screen on value-request for p_posnr.


  data: begin of help_item occurs 0,
          posnr type vbap-posnr,
          matnr type vbap-matnr,
          arktx type vbap-arktx,
        end of help_item.

  data: dynfields type table of dynpread with header line.


  dynfields-fieldname = 'P_VBELN'.
  append dynfields.

  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = sy-cprog
            dynumb               = sy-dynnr
            translate_to_upper   = 'X'
       tables
            dynpfields           = dynfields
       exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            others               = 11.


  read table dynfields with key fieldname = 'P_VBELN'.

  p_vbeln = dynfields-fieldvalue.


  call function 'CONVERSION_EXIT_ALPHA_INPUT'
       exporting
            input  = p_vbeln
       importing
            output = p_vbeln.

  select posnr matnr arktx into table help_item
                 from vbap
                      where vbeln = p_vbeln.



  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'POSNR'
            dynprofield = 'P_POSNR'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = help_item.


Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
424

A more stripped down example.




report zrich_0002 .

parameters: <b>p_kokrs like cobk-kokrs,</b>
            p_setcc type t001-bukrs.

at selection-screen on value-request for p_setcc.

  data: dynfields type table of dynpread with header line.

  dynfields-fieldname = 'P_KOKRS'.
  append dynfields.

  call function 'DYNP_VALUES_READ'
       exporting
            dyname             = sy-cprog
            dynumb             = sy-dynnr
            translate_to_upper = 'X'
       tables
            dynpfields         = dynfields.

  read table dynfields with key fieldname = 'P_KOKRS'.

<b>  p_kokrs = dynfields-fieldvalue.</b>

  break-point.   " Check the value of P_KOKRS during debug

Regards,

Rich Heilman

Read only

dairolozano
Contributor
0 Likes
424

Try this function.

Sy-subrc eq 0 but the return table (tables     dynpfields  ) is initial.

CALL FUNCTION 'DYNP_VALUES_READ' 

EXPORTING   

dyname                              = sy-repid    

dynumb                              = sy-DYNNR 

tables    

dynpfields                          = t_prueba