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: 

Can F4IF_INT_TABLE_VALUE_REQUEST FM return a value in a global variable?

marcela_martinez
Participant
0 Kudos

Hi everybody,

I need to use F4IF_INT_TABLE_VALUE_REQUEST FM because I have to let users select an specific option before choosing another value. The point is that I need to save in a program global variable what the user selects, and decide something with it in the program.

Is it possible that F4IF_INT_TABLE_VALUE_REQUEST FM returns the value in a sinple variable or it has to be paramter?

I look in a lot of previous threads but I didn't find anything, and I don't know if it's possible.

Thanks and kind regards,

MMP.

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos

Hi,

Sure you can. All you need to do is to store what the function returns in your global variable. It don't need to be returned back to screen field.


DATA: BEGIN OF VALUES OCCURS 0,
         CARRID TYPE SPFLI-CARRID,
         CONNID TYPE SPFLI-CONNID,
       END OF VALUES.

DATA: VALUES_TAB TYPE TABLE OF VALUES,
          G_VALUE TYPE SPFLI-CONNID.  "global variable to store what is returned

"in PAI first populate your table
  SELECT  CARRID CONNID
    FROM  SPFLI
    INTO  CORRESPONDING FIELDS OF TABLE VALUES_TAB
    UP TO 10 ROWS.

"then call the function but don't return the value to screen field
"If you specify the import parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the useru2019s selection is
"returned to the corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
"selection is returned into the table instead.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            RETFIELD         = 'CONNID'
            VALUE_ORG        = 'S'
       TABLES
            VALUE_TAB        = VALUES_TAB
            RETURN_TAB      = RETURN_TAB.

"now simply read first row of return tab and store the value returned there in some global var
READ RETURN_TAB INDEX 1.
MOVE RETURN_TAB-FIELDVAL TO G_VALUE.

Regards

Marcin

2 REPLIES 2

MarcinPciak
Active Contributor
0 Kudos

Hi,

Sure you can. All you need to do is to store what the function returns in your global variable. It don't need to be returned back to screen field.


DATA: BEGIN OF VALUES OCCURS 0,
         CARRID TYPE SPFLI-CARRID,
         CONNID TYPE SPFLI-CONNID,
       END OF VALUES.

DATA: VALUES_TAB TYPE TABLE OF VALUES,
          G_VALUE TYPE SPFLI-CONNID.  "global variable to store what is returned

"in PAI first populate your table
  SELECT  CARRID CONNID
    FROM  SPFLI
    INTO  CORRESPONDING FIELDS OF TABLE VALUES_TAB
    UP TO 10 ROWS.

"then call the function but don't return the value to screen field
"If you specify the import parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the useru2019s selection is
"returned to the corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
"selection is returned into the table instead.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            RETFIELD         = 'CONNID'
            VALUE_ORG        = 'S'
       TABLES
            VALUE_TAB        = VALUES_TAB
            RETURN_TAB      = RETURN_TAB.

"now simply read first row of return tab and store the value returned there in some global var
READ RETURN_TAB INDEX 1.
MOVE RETURN_TAB-FIELDVAL TO G_VALUE.

Regards

Marcin

marcela_martinez
Participant
0 Kudos

Thank you very much for the answer. My problem was solved with your suggestion.

Kind regards,

M.