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: 

One parameter value based on another parameter

0 Kudos

Once Company Code is entered, for House bank input parameter search filter should come for that particular Company code only.

And same for Account ID. Search should filter Account ID for that particular House bank only.

Suppose Company code is A008

Then in house bank in the search help values of only that company code should reflect and in account Id only for that house bank values should reflect in the search help

1 ACCEPTED SOLUTION

former_member1716
Active Contributor

Hello nidhi1994,

You can use the event AT SELECTION ON VALUE REQUEST FIELD_NAME. Below Link should help you achieving the requirement. The logic is to get the input from the first field then construct your internal table which will be fed into the next field based on the value entered above.

F4 Link

Regards!

9 REPLIES 9

former_member1716
Active Contributor

Hello nidhi1994,

You can use the event AT SELECTION ON VALUE REQUEST FIELD_NAME. Below Link should help you achieving the requirement. The logic is to get the input from the first field then construct your internal table which will be fed into the next field based on the value entered above.

F4 Link

Regards!

0 Kudos

I called the FM

F4IF_INT_TABLE_VALUE_REQUEST

But in the fields

retfield and tables value_tab what data should be provided

Here is the code for reference

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield =
* PVALKEY = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
* VALUE_ORG = 'C'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
tables
value_tab =

* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3


* Implement suitable error handling here
ENDIF.

nidhi1994,RETFIELD is the field name on which F4 is applied and Value_tab is the table which will hold the values that are displayed while using the help option.Regards!

The exact event names are:

  • If the screen is of type "selection screen", in ABAP code:
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR fieldname.
    " ... your code
  • If the screen is of another type:
    1) in screen flow logic:
    PROCESS ON VALUE-REQUEST.
    FIELD fieldname MODULE modulename.
    2) in ABAP:
    MODULE modulename INPUT.
    " ... your code
    ENDMODULE.

0 Kudos

Did this for House bank

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_hbkid.
gw_dynpread-fieldname = 'P_BUKRS'.
APPEND gw_dynpread TO gt_dynpread.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
TABLES
dynpfields = gt_dynpread.
IF NOT gt_dynpread IS INITIAL.
READ TABLE gt_dynpread INTO gw_dynpread INDEX 1.
IF sy-subrc EQ 0.
SELECT hbkid FROM t012k INTO TABLE gt_t012k WHERE bukrs = gw_dynpread-fieldvalue.
IF sy-subrc EQ 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'P_HBKID'
value_org = 'S'
TABLES
value_tab = gt_t012k
return_tab = gt_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF NOT gt_return IS INITIAL.
READ TABLE gt_return INTO DATA(gw_return) INDEX 1.
IF sy-subrc EQ 0.
p_hbkid = gw_return-fieldval.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

What has to be done for Account Id then?

Can we add two at selection screen on value request

How to proceed further

Sandra_Rossi
Active Contributor

No need of ABAP code.

You only need to:

  1. Define search help with input parameters Company and House bank
  2. Define the two fields in the same DDIC structure (or table)
  3. Link field House bank to your search help, and assign the two fields Company and House bank of the structure to the corresponding input parameters of the search help
  4. Define dynpro fields with the same names as those in the DDIC structure (ZSTRU-COMPANY and ZSTRU-HOUSEBANK for instance) and confirm that they are both linked to the DDIC. If it's a selection screen, just declare the fields PARAMETERS anything TYPE ZSTRU-...

This way, pressing F4 on field House bank will pass automatically both the company code and the House bank fields to the search help.

0 Kudos

Hi. I want this to be done by coding .

What has to be done in this

0 Kudos

If you want to do it by coding, follow instructions given by Satish.

0 Kudos

By the way, if you have a selection screen, and you want to list values of field BHKID from T012K table, based on the other field BUKRS, why don't you just write these two lines of code, and that's done...

PARAMETERS bukrs TYPE t012k-bukrs.
PARAMETERS hbkid TYPE t012k-hbkid.