Application Development 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: 

search help

Former Member
0 Kudos

Hi all,

I have 2 select options.i want to get the f4 help for the second select option based on the entry of first select option.

ex: first select option is <b>customer number</b>

and second is <b>purchase order no</b>.

if enter some value in customer select option .

based on this i need to get f4 search for the purchase orders.

thanks in advance

kiran

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

This sample uses parameters instead of select-options, but you get the idea here.....



report zrich_0002 .

parameters: p_kunnr type vbak-kunnr,
            p_bstkd type vbkd-bstkd.

at selection-screen on value-request for p_bstkd.
  data: begin of help_bstkd occurs 0,
         bstkd type vbkd-bstkd,
        end of help_bstkd.

  data: dynfields type table of dynpread with header line.

  dynfields-fieldname = 'P_KUNNR'.
  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_KUNNR'.


  select bstkd into corresponding fields of table help_bstkd
               from vbak
                    inner join vbkd
                       on vbak~vbeln = vbkd~vbeln
                          where vbak~kunnr = p_kunnr.

    delete adjacent duplicates from help_bstkd comparing bstkd.

    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
         exporting
              retfield    = 'BSTKD'
              dynprofield = 'P_BSTKD'
              dynpprog    = sy-cprog
              dynpnr      = sy-dynnr
              value_org   = 'S'
         tables
              value_tab   = help_bstkd.

In this case, user must hit enter after entering the customer number and before hitting F4 on PO number.

Regards,

Rich Heilman

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

This sample uses parameters instead of select-options, but you get the idea here.....



report zrich_0002 .

parameters: p_kunnr type vbak-kunnr,
            p_bstkd type vbkd-bstkd.

at selection-screen on value-request for p_bstkd.
  data: begin of help_bstkd occurs 0,
         bstkd type vbkd-bstkd,
        end of help_bstkd.

  data: dynfields type table of dynpread with header line.

  dynfields-fieldname = 'P_KUNNR'.
  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_KUNNR'.


  select bstkd into corresponding fields of table help_bstkd
               from vbak
                    inner join vbkd
                       on vbak~vbeln = vbkd~vbeln
                          where vbak~kunnr = p_kunnr.

    delete adjacent duplicates from help_bstkd comparing bstkd.

    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
         exporting
              retfield    = 'BSTKD'
              dynprofield = 'P_BSTKD'
              dynpprog    = sy-cprog
              dynpnr      = sy-dynnr
              value_org   = 'S'
         tables
              value_tab   = help_bstkd.

In this case, user must hit enter after entering the customer number and before hitting F4 on PO number.

Regards,

Rich Heilman

0 Kudos

Hai Rich,

I need for select-options but not for parameters.in parameters we have only one value,but in select-options we have more values .

regards

kiran

0 Kudos

I thought maybe you would go by my example and make the parameters as select-options. Turns out, its even easier for select-options.




report zrich_0002 .

tables: vbak, vbkd.

select-options: s_kunnr for vbak-kunnr,
                s_bstkd for vbkd-bstkd.

at selection-screen on value-request for s_bstkd-low.
  perform help_bstkd.

at selection-screen on value-request for s_bstkd-high.
  perform help_bstkd.


*---------------------------------------------------------------------*
*       FORM help_bstkd                                               *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form help_bstkd.
  data: begin of help_bstkd occurs 0,
         bstkd type vbkd-bstkd,
        end of help_bstkd.

  select bstkd into corresponding fields of table help_bstkd
               from vbak
                    inner join vbkd
                       on vbak~vbeln = vbkd~vbeln
                          where vbak~kunnr in s_kunnr.

  delete adjacent duplicates from help_bstkd comparing bstkd.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'BSTKD'
            dynprofield = 'S_BSTKD'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = help_bstkd.

endform.

Please remember to award points for helpful answers. Thanks.

Regards,

Rich Heilman

0 Kudos

Hi rich,

its working fine .but how to read the dynpro values.please send me code for DYNP_VALUES_READ function module.becoz i was struck up there.iam unable to read the values that i enter in the select option customer as i said earlier.

with regard

kiran

0 Kudos

Hmmm.... You are saying that there is no value in the S_KUNNR when trying to retrieve POs from VBKD? In my system, it can see the values in S_KUNNR. Post your program code.

Regards,

Rich Heilman

0 Kudos

If you hit enter after entering your customer numbers and then hit F4 on the purchase order field. Then it works. I am looking for a way to read dynpro values for select-options.

Regards,

Rich Heilman

0 Kudos

I've been playing with it for a while, I don't think that it is going to work they you want it to by using the DYNPRO_VALUES_READ. I think that you going to have to force the user to hit enter after they enter the customer number and before the F4 dropdown for po number.

Regards,

Rich Heilman

0 Kudos

Thanks rich,

kiran