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

Extracting data from two fields in a input parameter

Former Member
0 Likes
2,233

Input Parameters for House bank and Account ID business want description.

Table - T012T

House bank - HBKID + Text1

Account ID + Text1

Suppose there is Account ID input parameter and at runtime for search help we want the account Id data plus description of it which means two fields in one input parameter

1 ACCEPTED SOLUTION
Read only

Velu
Explorer
1,893

Hi Nidhi,

If I have understood your question correctly. You would like to get F4 help for two fields 1) House bank (HBKID) and Account ID (HKTID). For both the fields you would like to have T012T-TEXT1 along with HBKID or HKTID.

If so follow the below steps for your requirement, ( I have shown for HBKID, follow the same approach for other filed too)

    SELECT HBKID,
           TEXT1,
      FROM T012T
      INTO TABLE @DATA(lt_houbk_f4).

    IF NOT lt_houbk_f4[] IS INITIAL.
          CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
            EXPORTING
              retfield        = 'HBKID'
              dynpprog        = sy-repid
              dynpnr          = '1000'
              dynprofield     = 'S_HBKID' ( Considering this Select option name )
              value_org       = 'S'
            TABLES
              value_tab       = lt_houbk_f4
              return_tab      = lt_return
            EXCEPTIONS
              parameter_error = 1
              no_values_found = 2
              OTHERS          = 3.
          IF lt_return[] IS NOT INITIAL.
            READ lt_return INTO DATA(ls_return) INDEX 1.
	    IF sy-subrc = 0.	
                s_auskt-low = ls_return-fieldval.
	    ENDIF.
         ENDIF.
   ENDIF.                            
6 REPLIES 6
Read only

Velu
Explorer
1,894

Hi Nidhi,

If I have understood your question correctly. You would like to get F4 help for two fields 1) House bank (HBKID) and Account ID (HKTID). For both the fields you would like to have T012T-TEXT1 along with HBKID or HKTID.

If so follow the below steps for your requirement, ( I have shown for HBKID, follow the same approach for other filed too)

    SELECT HBKID,
           TEXT1,
      FROM T012T
      INTO TABLE @DATA(lt_houbk_f4).

    IF NOT lt_houbk_f4[] IS INITIAL.
          CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
            EXPORTING
              retfield        = 'HBKID'
              dynpprog        = sy-repid
              dynpnr          = '1000'
              dynprofield     = 'S_HBKID' ( Considering this Select option name )
              value_org       = 'S'
            TABLES
              value_tab       = lt_houbk_f4
              return_tab      = lt_return
            EXCEPTIONS
              parameter_error = 1
              no_values_found = 2
              OTHERS          = 3.
          IF lt_return[] IS NOT INITIAL.
            READ lt_return INTO DATA(ls_return) INDEX 1.
	    IF sy-subrc = 0.	
                s_auskt-low = ls_return-fieldval.
	    ENDIF.
         ENDIF.
   ENDIF.                            
Read only

Former Member
0 Likes
1,893

but what if the two fields are from two different tables?

Read only

michael_piesche
Active Contributor
0 Likes
1,893

If you check Table T012T, the used search help for field H_T012K for field HKTID with the possible input parameters BUKRS, HBKID and HKTID does this already for you giving also the TEXT1 as output.

So, in case you have created a Z-Report, you need to use the above search help to help choose the right account id.

1. As a PARAMETER:

PARAMETERS pa_acc TYPE hktid MATCHCODE OBJECT H_T012K.

2. As a SELECT-OPTIONS:

TABLES t012t.
SELECT-OPTIONS so_acc FOR t012t-hktid.

3. If you need the BUKRS and HBKID also automatically filled by the choice of the account:

TABLES t012t.
SELECT-OPTIONS so_buk for t012t-bukrs. " NO-EXTENSION NO INTERVALS "NO-DISPLAY. 
SELECT-OPTIONS so_bnk for t012t-hbkid. " NO-EXTENSION NO INTERVALS "NO-DISPLAY.
SELECT-OPTIONS so_acc for t012t-hktid. " NO-EXTENSION NO INTERVALS. 

You can make the select-options for BUKRS and HBKID either non-visible (option NO-DISPLAY), or with reduced select-options (NO-EXTENSION, NO INTERVALS) or only readable if you dont want the user to mess around with invalid combinations of the three, see the following for coding:

INITIALIZATION.
  LOOP AT SCREEN.
    IF screen-name CP 'SO_BNK*'
    OR screen-name CP 'SO_BUK*'
      screen-input = '0'.
      MODIFY SCREEN.
      EXIT.
    ENDIF.
  ENDLOOP. 

Search help H_T012K:

Let me know if this already solves your problem, of whether you have a different setup.

Read only

Velu
Explorer
0 Likes
1,893

First, prepare an internal table with data from both tables. And the use the FM F4IF_INT_TABLE_VALUE_REQUEST for F4 help.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,893

What means "two fields in one input parameter"?

The key of table T012T is company, bank, account (and language of course), why do you ignore the company as the codes are company-dependent?

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,893

Same answer as Michael, but saying it simply with code and without explanation. NB: if you prefer to do it in a complex way, use F4IF_INT_TABLE_VALUE_REQUEST.

PARAMETERS bukrs TYPE t012t-bukrs.
PARAMETERS hbkid TYPE t012t-hbkid.
PARAMETERS hktid TYPE t012t-hktid.

Nothing else.

Run it, press F4 no HKTID field, choose and the selected line will fill all input fields :