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 at selection-screen with using Select statement

Former Member
0 Kudos

Hi All,

How to give search help which is selected on the base of another field of selection screen?

Regrads,

Denish Patel

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

Check the foll code ,

PARAMETERS : p_state TYPE char20,
             p_city  TYPE char18.

DATA       : BEGIN   OF   t_state OCCURS 0,
             state   TYPE char20,
             END     OF   t_state,
             BEGIN   OF   t_city  OCCURS 0,
             city    TYPE char18,
             END     OF   t_city.

DATA       : r_state TYPE TABLE OF ddshretval WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_state.
  REFRESH t_state.
  APPEND 'Tamil nadu' TO t_state.
  APPEND 'Kerala'     TO t_state.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'STATE'
      dynpprog        = sy-repid
      dynpnr          = '1000'
      dynprofield     = 'P_STATE'
      window_title    = 'State'
      value_org       = 'S'
    TABLES
      value_tab       = t_state[]
      RETURN_TAB      = r_state[]
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
  ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_city.
  REFRESH t_city.
  LOOP AT r_state.
    CASE    r_state-fieldval.
      WHEN  'TAMIL NADU'.
        APPEND 'Chennai'    TO t_city.
        APPEND 'Madurai'    TO t_city.
      WHEN  'KERALA'.
        APPEND 'Trivandrum' TO t_city.
        APPEND 'Kochi'      TO t_city.
    ENDCASE.
  ENDLOOP.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'CITY'
      dynpprog        = sy-repid
      dynpnr          = '1000'
      dynprofield     = 'P_CITY'
      window_title    = 'City'
      value_org       = 'S'
    TABLES
      value_tab       = t_city[]
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
  ENDIF.

Cheers,

jose.

6 REPLIES 6

Former Member
0 Kudos

HI,

Check the foll code ,

PARAMETERS : p_state TYPE char20,
             p_city  TYPE char18.

DATA       : BEGIN   OF   t_state OCCURS 0,
             state   TYPE char20,
             END     OF   t_state,
             BEGIN   OF   t_city  OCCURS 0,
             city    TYPE char18,
             END     OF   t_city.

DATA       : r_state TYPE TABLE OF ddshretval WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_state.
  REFRESH t_state.
  APPEND 'Tamil nadu' TO t_state.
  APPEND 'Kerala'     TO t_state.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'STATE'
      dynpprog        = sy-repid
      dynpnr          = '1000'
      dynprofield     = 'P_STATE'
      window_title    = 'State'
      value_org       = 'S'
    TABLES
      value_tab       = t_state[]
      RETURN_TAB      = r_state[]
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
  ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_city.
  REFRESH t_city.
  LOOP AT r_state.
    CASE    r_state-fieldval.
      WHEN  'TAMIL NADU'.
        APPEND 'Chennai'    TO t_city.
        APPEND 'Madurai'    TO t_city.
      WHEN  'KERALA'.
        APPEND 'Trivandrum' TO t_city.
        APPEND 'Kochi'      TO t_city.
    ENDCASE.
  ENDLOOP.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'CITY'
      dynpprog        = sy-repid
      dynpnr          = '1000'
      dynprofield     = 'P_CITY'
      window_title    = 'City'
      value_org       = 'S'
    TABLES
      value_tab       = t_city[]
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
  ENDIF.

Cheers,

jose.

0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

You can get the functionality using the function module

'DYNP_VALUES_READ'.

Use the below code.

tables: t001k.

  • For Identification Number

DATA: BEGIN OF it_bwkey OCCURS 0,

bwkey LIKE t001k-bwkey,

END OF it_bwkey.

data: v_bukrs(4).

  • For Run date

DATA: BEGIN OF it_bukrs OCCURS 0,

bukrs LIKE t001k-bukrs,

END OF it_bukrs.

DATA it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN: BEGIN OF BLOCK main WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP.

PARAMETERS: p_bukrs(4) TYPE c.

SELECT-OPTIONS s_bwkey FOR t001k-bwkey NO INTERVALS.

SELECTION-SCREEN END OF BLOCK main.

*----


  • Validation Section

*----


INITIALIZATION.

SELECT DISTINCT bukrs FROM t001k INTO TABLE it_bukrs.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P_BUKRS'

value_org = 'S'

TABLES

value_tab = it_bukrs

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

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

TABLES: t130r.

DATA: BEGIN OF dynpfields OCCURS 0. "Hilfsstruktur zum auslesen des

INCLUDE STRUCTURE dynpread. "Feldwertes vom Dynpro bei >F4<

DATA: END OF dynpfields.

DATA : sy_repid LIKE sy-repid,

sy_dynnr LIKE sy-dynnr.

CLEAR dynpfields.

REFRESH dynpfields.

dynpfields-fieldname = 'P_BUKRS'.

APPEND dynpfields.

    • Lesen des akt. Wertes von Dynpro

sy_repid = sy-repid.

sy_dynnr = sy-dynnr.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy_repid

dynumb = sy_dynnr

TABLES

dynpfields = dynpfields

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

READ TABLE dynpfields WITH KEY fieldname = 'P_BUKRS'.

IF sy-subrc = 0.

v_bukrs = dynpfields-fieldvalue.

ENDIF.

ENDIF.

SELECT bwkey FROM t001k

INTO TABLE it_bwkey

WHERE bukrs = v_bukrs.

DELETE ADJACENT DUPLICATES FROM it_bwkey.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BWKEY'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_BWKEY'

value_org = 'S'

TABLES

value_tab = it_bwkey

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Edited by: Velangini Showry Maria Kumar Bandanadham on Apr 28, 2008 2:31 PM

Former Member
0 Kudos

Hi,

Use the below code.

tables: t001k.

  • For Identification Number

DATA: BEGIN OF it_bwkey OCCURS 0,

bwkey LIKE t001k-bwkey,

END OF it_bwkey.

data: v_bukrs(4).

  • For Run date

DATA: BEGIN OF it_bukrs OCCURS 0,

bukrs LIKE t001k-bukrs,

END OF it_bukrs.

DATA it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN: BEGIN OF BLOCK main WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP.

PARAMETERS: p_bukrs(4) TYPE c.

SELECT-OPTIONS s_bwkey FOR t001k-bwkey NO INTERVALS.

SELECTION-SCREEN END OF BLOCK main.

*----


  • Validation Section

*----


INITIALIZATION.

SELECT DISTINCT bukrs FROM t001k INTO TABLE it_bukrs.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BUKRS'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P_BUKRS'

value_org = 'S'

TABLES

value_tab = it_bukrs

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

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

TABLES: t130r.

DATA: BEGIN OF dynpfields OCCURS 0. "Hilfsstruktur zum auslesen des

INCLUDE STRUCTURE dynpread. "Feldwertes vom Dynpro bei >F4<

DATA: END OF dynpfields.

DATA : sy_repid LIKE sy-repid,

sy_dynnr LIKE sy-dynnr.

CLEAR dynpfields.

REFRESH dynpfields.

dynpfields-fieldname = 'P_BUKRS'.

APPEND dynpfields.

    • Lesen des akt. Wertes von Dynpro

sy_repid = sy-repid.

sy_dynnr = sy-dynnr.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy_repid

dynumb = sy_dynnr

TABLES

dynpfields = dynpfields

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

READ TABLE dynpfields WITH KEY fieldname = 'P_BUKRS'.

IF sy-subrc = 0.

v_bukrs = dynpfields-fieldvalue.

ENDIF.

ENDIF.

SELECT bwkey FROM t001k

INTO TABLE it_bwkey

WHERE bukrs = v_bukrs.

DELETE ADJACENT DUPLICATES FROM it_bwkey.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'BWKEY'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_BWKEY'

value_org = 'S'

TABLES

value_tab = it_bwkey

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

0 Kudos

Hi,

i worte that code but it show blank in search help but it count how many entries in it. what's problem now?

Regards,

Denish Patel

Former Member
0 Kudos

solved