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

FM 'F4IF_INT_TABLE_VALUE_REQUEST'-return fields

Former Member
0 Likes
5,681

Here is my code:


data :begin of i_dept occurs 0,
kostl like cskt-kostl,
LTEXT like cskt-LTEXT,
end of i_dept.


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
*       DDIC_STRUCTURE         = 'ZRETURN_GP '
        RETFIELD               = 'KOSTL'
*       PVALKEY                = ' '
        DYNPPROG               = 'SY-CPROG '
       DYNPNR                 = '0009'
      DYNPROFIELD            = 'ZRETURN_GP-GOING_TO_DEPT'
*       STEPL                  = 0
*       WINDOW_TITLE           =
*       VALUE                  = ' '
       VALUE_ORG              = 'S'
*     MULTIPLE_CHOICE        = 'X'
*       DISPLAY                = ' '
*       CALLBACK_PROGRAM       = ' '
*       CALLBACK_FORM          = ' '
*       MARK_TAB               =
*     IMPORTING
*       USER_RESET             =
      TABLES
        VALUE_TAB              = I_DEPT
*       FIELD_TAB              =
*       RETURN_TAB             =
*       DYNPFLD_MAPPING        =
     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.

how to declare multiple return fields in this parameter of function module.????

  • DYNPFLD_MAPPING =

i have used POV on a textfield. amd i m calling this function module in POV.

what i want:

when user click on kostl of i_dept( in the help displayed)..then along with field KOSTL....LTEXT field also returns in\

screen field ZRETURN_GP-GOING_TO_DEPT_DESC.

I Have read in the documentation of this function module that in parameter

  • DYNPFLD_MAPPING =

we can declare multiple return fields.

thats is what i want to know....how to declare multiple return fields.???

suggest some methods.

new concepts are also welcome.!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,657

If I understand correctly you want to populate more than one field from this request? There are forum posts about this...finding my favorite eluded me today, so I'm including my little demo example.

In the example below, the table field and the screen field have the same name...they could be different, as in P_carrid, etc. YOu could also have data from different tables...you just need to get all the associated values into a single row in your internal table, which could be built based on DDIC or a type declaration, etc.....Adjust as needed:

parameters : carrid type spfli-carrid,
             connid type spfli-connid,
             fldate type sflight-fldate.

data : itab type table of sflight with header line.
data : fmap type table of dselc with header line.



at selection-screen on value-request for carrid." If it is a selection Screen
*else in PROCESS ON VALUE REQUEST
  select * from sflight into table itab.
  sort itab by carrid connid fldate.
  delete adjacent duplicates from itab
  comparing carrid connid fldate.
  fmap-fldname = 'CARRID'.  "table field
  fmap-dyfldname = 'CARRID'. "screen field name
  append fmap.
  fmap-fldname = 'CONNID'.
  fmap-dyfldname = 'CONNID'.
  append fmap.
  fmap-fldname = 'FLDATE'.
  fmap-dyfldname = 'FLDATE'.
  append fmap.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
     ddic_structure         = 'SFLIGHT'
      retfield               = 'CARIID'
*     PVALKEY                = ' '
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     dynprofield            = 'CARRID'
*     STEPL                  = 0
*     WINDOW_TITLE           =
*     VALUE                  = ' '
     value_org              = 'S'
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
*     CALLBACK_PROGRAM       = ' '
*     CALLBACK_FORM          = ' '
*     MARK_TAB               =
*   IMPORTING
*     USER_RESET             =
    tables
      value_tab              = itab
*     FIELD_TAB              =
*     RETURN_TAB             =
     dynpfld_mapping        = fmap
*   EXCEPTIONS
*     PARAMETER_ERROR        = 1
*     NO_VALUES_FOUND        = 2
*     OTHERS                 = 3
            ." Just Execute this pilot program and verify
  if sy-subrc  eq 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

Edited by: BreakPoint on Dec 22, 2011 2:41 PM

If I understand correctly you want to populate more than one field from this request? There are forum posts about this...finding my favorite eluded me today, so I'm including my little demo example.

In the example below, the table field and the screen field have the same name...they could be different, as in P_carrid, etc. YOu could also have data from different tables...you just need to get all the associated values into a single row in your internal table, which could be built based on DDIC or a type declaration, etc.....Adjust as needed:

parameters : carrid type spfli-carrid,
             connid type spfli-connid,
             fldate type sflight-fldate.

data : itab type table of sflight with header line.
data : fmap type table of dselc with header line.



at selection-screen on value-request for carrid." If it is a selection Screen
*else in PROCESS ON VALUE REQUEST
  select * from sflight into table itab.
  sort itab by carrid connid fldate.
  delete adjacent duplicates from itab
  comparing carrid connid fldate.
  fmap-fldname = 'CARRID'.  "table field
  fmap-dyfldname = 'CARRID'. "screen field name
  append fmap.
  fmap-fldname = 'CONNID'.
  fmap-dyfldname = 'CONNID'.
  append fmap.
  fmap-fldname = 'FLDATE'.
  fmap-dyfldname = 'FLDATE'.
  append fmap.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
     ddic_structure         = 'SFLIGHT'
      retfield               = 'CARIID'
*     PVALKEY                = ' '
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     dynprofield            = 'CARRID'
*     STEPL                  = 0
*     WINDOW_TITLE           =
*     VALUE                  = ' '
     value_org              = 'S'
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
*     CALLBACK_PROGRAM       = ' '
*     CALLBACK_FORM          = ' '
*     MARK_TAB               =
*   IMPORTING
*     USER_RESET             =
    tables
      value_tab              = itab
*     FIELD_TAB              =
*     RETURN_TAB             =
     dynpfld_mapping        = fmap
*   EXCEPTIONS
*     PARAMETER_ERROR        = 1
*     NO_VALUES_FOUND        = 2
*     OTHERS                 = 3
            ." Just Execute this pilot program and verify
  if sy-subrc  eq 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

Edited by: BreakPoint on Dec 22, 2011 2:41 PM

15 REPLIES 15
Read only

Former Member
0 Likes
3,656

Hi,

Where is data in i_dept do you have written any select statement for fetching data into i_dept ?

if you write select statement your problem is over.

Regards,

Sanjay Gogikar.

Read only

Former Member
0 Likes
3,658

If I understand correctly you want to populate more than one field from this request? There are forum posts about this...finding my favorite eluded me today, so I'm including my little demo example.

In the example below, the table field and the screen field have the same name...they could be different, as in P_carrid, etc. YOu could also have data from different tables...you just need to get all the associated values into a single row in your internal table, which could be built based on DDIC or a type declaration, etc.....Adjust as needed:

parameters : carrid type spfli-carrid,
             connid type spfli-connid,
             fldate type sflight-fldate.

data : itab type table of sflight with header line.
data : fmap type table of dselc with header line.



at selection-screen on value-request for carrid." If it is a selection Screen
*else in PROCESS ON VALUE REQUEST
  select * from sflight into table itab.
  sort itab by carrid connid fldate.
  delete adjacent duplicates from itab
  comparing carrid connid fldate.
  fmap-fldname = 'CARRID'.  "table field
  fmap-dyfldname = 'CARRID'. "screen field name
  append fmap.
  fmap-fldname = 'CONNID'.
  fmap-dyfldname = 'CONNID'.
  append fmap.
  fmap-fldname = 'FLDATE'.
  fmap-dyfldname = 'FLDATE'.
  append fmap.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
     ddic_structure         = 'SFLIGHT'
      retfield               = 'CARIID'
*     PVALKEY                = ' '
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     dynprofield            = 'CARRID'
*     STEPL                  = 0
*     WINDOW_TITLE           =
*     VALUE                  = ' '
     value_org              = 'S'
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
*     CALLBACK_PROGRAM       = ' '
*     CALLBACK_FORM          = ' '
*     MARK_TAB               =
*   IMPORTING
*     USER_RESET             =
    tables
      value_tab              = itab
*     FIELD_TAB              =
*     RETURN_TAB             =
     dynpfld_mapping        = fmap
*   EXCEPTIONS
*     PARAMETER_ERROR        = 1
*     NO_VALUES_FOUND        = 2
*     OTHERS                 = 3
            ." Just Execute this pilot program and verify
  if sy-subrc  eq 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

Edited by: BreakPoint on Dec 22, 2011 2:41 PM

Read only

0 Likes
3,656

I have used select statement to fill intenal table i_dept:


select distinct kostl ltext from cskt into table i_dept.

Yes BreakPoint (nice name), i want to populate more than one screen field from this request!

data : fmap type table of dselc with header line.

is DSELC is some standart table?

how to get information about these type of tables?

Read only

0 Likes
3,656

abhishek,

think of this dselc as a mapping structure. which maps to your screen fields from the search help field. So, you dont have to worry about what is present in designing of dselc.

just pass the field name and screenfield name to this structure.

Read only

0 Likes
3,656

just double click on dselc (it's defined in DDIC)...you'll see:

FLDNAME DYNFNAM CHAR 132 0 Field name

FLDINH SHVALUE_D CHAR 132 0 Field contents, min./max. value

DYFLDNAME DYNFNAM CHAR 132 0 Field name

glad you like the name...I've also used Short Dump, but that's too alliterative.

Edited by: BreakPoint on Dec 22, 2011 6:40 PM

Read only

0 Likes
3,656

Here is my code:

and still its not working.i dont know how to debug function module.


SELECT DISTINCT KOSTL LTEXT
        FROM CSKT INTO CORRESPONDING FIELDS OF
      TABLE I_DEPT.

    FMAP-FLDNAME = 'KOSTL'.  "table field
    FMAP-DYFLDNAME = 'ZRETURN_GP-DEPT_CD'. "screen field name
    APPEND FMAP.

FMAP-FLDNAME = 'LTEXT'.  "table field
    FMAP-DYFLDNAME = 'ZRETURN_GP-DEPT_CD_DESC'. "screen field name
    APPEND FMAP.



    "FUNCTION MODLUE FOR F4 HELP
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
*       DDIC_STRUCTURE         = 'ZRETURN_GP '
        RETFIELD               = 'KOSTL'
*       PVALKEY                = ' '
        DYNPPROG               = 'SY-CPROG '
       DYNPNR                 = '0009'
      DYNPROFIELD            = 'ZRETURN_GP-DEPT_CD'
*       STEPL                  = 0
*       WINDOW_TITLE           =
*       VALUE                  = ' '
       VALUE_ORG              = 'S'
*     MULTIPLE_CHOICE        = 'X'
*       DISPLAY                = ' '
*       CALLBACK_PROGRAM       = ' '
*       CALLBACK_FORM          = ' '
*       MARK_TAB               =
*     IMPORTING
*       USER_RESET             =
      TABLES
        VALUE_TAB              = I_DEPT
*       FIELD_TAB              =
*       RETURN_TAB             =
      DYNPFLD_MAPPING        = FMAP

     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.

Read only

0 Likes
3,656

this entire ZRETURN_GP-DEPT_CD is your screen field name?

Read only

0 Likes
3,656

this entire ZRETURN_GP-DEPT_CD is your screen field name?

YES, zreturn_gp is my ztable.

and i have screen fields like this.

Read only

0 Likes
3,656

Abhishekh.

please explain more about NOT WORKING. is it not displaying the values or its not returning the values?

Read only

0 Likes
3,656

please explain more about NOT WORKING. is it not displaying the values or its not returning the values?

its displaying values in pop up. but when i select kostl..only this field return to screen field.

my requirement when i click on kostl...along with kostl ltext also return to screen field 'ZRETURN_GP-DEPT_CD_DESC'.

KOSTL should return to 'ZRETURN_GP-DEPT_CD'.

LTEXT should return to 'ZRETURN_GP-DEPT_CD_DESC'.

Read only

0 Likes
3,656

how many fields are you displaying on that search help popup, just two?? if yes,

write like this.

FMAP-FLDNAME = 'F0001'."'KOSTL'.  "table field ==>changed this
    FMAP-DYFLDNAME = 'ZRETURN_GP-DEPT_CD'. "screen field name
    APPEND FMAP.
 
FMAP-FLDNAME = 'F0002'."'LTEXT'.  "table field ==>changed this 
    FMAP-DYFLDNAME = 'ZRETURN_GP-DEPT_CD_DESC'. "screen field name
    APPEND FMAP.

will work

Read only

0 Likes
3,656

yuppiee.....super thanks all.

but one last doubt.

why we are passing this value in table field name 'F0001'.

instead of field name 'KOSTL'.

also can it is possible with this FM..that when user press f4...

> first a pop up comes asking for no of entries, kostl...to optimise the result.

just like pop up appears when user press f4 on MATNR Field of MARA table.

Edited by: abhishek1345 on Dec 23, 2011 10:12 AM

Edited by: abhishek1345 on Dec 23, 2011 10:50 AM

Read only

0 Likes
3,656

Read the Example 3: documentation of parameter CALLBACK_PROGRAM & CALLBACK_FORM and please close the other thread.

Kesav

Read only

Former Member
0 Likes
3,656

Hai,

Try this code.

Types: begin of ty_kna1,

Kunnr type kna1-kunnr,

Name1 type kna1-name1,

End of ty_kna1.

Data : it_kna1 type table of ty_kna1.

Select kunnr name1 from kna1 into table it_kna1 where kunnr = p_kunnr.

DATA: IT_RETURN1 TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

  • DDIC_STRUCTURE = ' '

RETFIELD = 'KUNNR'

  • PVALKEY = ' '

DYNPPROG = sy-repid

DYNPNR = sy-dynnr

  • DYNPROFIELD = ' '

  • STEPL = 0

  • WINDOW_TITLE =

value = '*'

value_org = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = it_kna1

  • FIELD_TAB =

RETURN_TAB = IT_RETURN1

  • DYNPFLD_MAPPING =

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3

.

IF SY-SUBRC = 0.

READ TABLE it_KNA1 INTO wa_KNA1 WITH KEY KUNNR = IT_RETURN1-fieldval.

IF sy-subrc = 0.

KUNNR = wa_KNA1-KUNNR.

ENDIF.

ENDIF.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
3,656

Is this what you wanted


report abc.
types: begin of ty,
         matnr type matnr,
        werks type werks_d,
       end of ty.
data: it2 type standard table of dselc,
      wa2 type dselc.
data: it type standard table of ty,
      wa_return type ddshretval,
      i_return type standard table of ddshretval,
      repid type sy-repid,
      dynnr type sy-dynnr.

parameters:
         p_matnr   type mara-matnr,
         p_werks    type marc-werks.

at selection-screen output.
  loop at screen.
    if screen-name = 'P_WERKS'.
      screen-input = '0'.
      screen-DISPLAY_3D = 'X'.
      modify screen.
    endif.
  endloop.

at selection-screen on value-request for p_matnr.

  repid = sy-repid.
  dynnr = sy-dynnr.

  select matnr werks
              from marc up to 20 rows
              into table it.
  check sy-subrc = 0.
  wa2-fldname = 'F0001'.
  wa2-dyfldname = 'P_MATNR'.
  append wa2 to it2.

  wa2-fldname = 'F0002'.
  wa2-dyfldname = 'P_WERKS'.
  append wa2 to it2.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield        = 'WERKS'
            dynpprog        = repid
            dynpnr          = dynnr
            dynprofield     = 'P_WERKS'
            value_org       = 'S'
            display         = 'F'
       tables
            value_tab       = it
            dynpfld_mapping = it2
       exceptions
            parameter_error = 1
            no_values_found = 2
            others          = 3.

I did not notice one of your open regarding the same question. Please close it to avoid the confusion. Reported !!!

Edited by: Keshav.T on Dec 23, 2011 12:09 PM