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: 

Function module for f4 help in presentaion server and application server.

Former Member
0 Kudos

hi guys,

I need to create a function module that will get the file or folder name by f4 help for the file in the presentation server or application server based on the location selected.

For this function module what are the minimum impot parametrs and export parameters required.

i have tried with 'f4_filename' for presentation server

and '/SAPDMC/LSM_F4_SERVER_FILE' for application server.

but i am not able to get this.

can any one help me in this regard ?

cheers,

kumar.

11 REPLIES 11

Former Member
0 Kudos

Hi,

Try this out:

call function 'F4_FILENAME'

exporting

field_name = 'P_FILE'

importing

file_name = p_file.

p_file is the name of the parameter on selection screen.

The same name is given in field_name parameter of 'F4_FILENAME'.

former_member705122
Active Contributor
0 Kudos

Hi,

Check this FM,

F4_DXFILENAME_TOPRECURSION.

link:

Former Member
0 Kudos

Hi,

You can use for persentation server..

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.

PERFORM GET_PC_FILE.

form get_pc_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_FNAME.

endform.

Rgds,

Paras

0 Kudos

This message was moderated.

0 Kudos

>

> use full answers will get awarded properly.

>

> kumar.

All useless posts will be reported appropriately

pk

0 Kudos

hey pk .

try to concentrate on giving the answer not on the useless comments. ok.

0 Kudos

Hi Kumar

For example you have created a function module Z_F4 . Put only Export parameter as

"FILE_NAME TYPE IBIPPARMS-PATH" under EXPORT tab.

Then the code inside the function module will be like

FUNCTION Z_F4.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  EXPORTING
*"     REFERENCE(FILE_NAME) TYPE  IBIPPARMS-PATH
*"----------------------------------------------------------------------

CALL FUNCTION 'F4_FILENAME'
* EXPORTING
*   PROGRAM_NAME        = SYST-CPROG
*   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
 IMPORTING
   FILE_NAME           = FILE_NAME
             .

MESSAGE FILE_NAME TYPE 'I'.

ENDFUNCTION.

And the code in the report pgm will be

DATA FILE TYPE IBIPPARMS-PATH.

CALL FUNCTION 'Z_F4'
 IMPORTING
   FILE_NAME       = FILE
          .

WRITE FILE.

Regards

former_member203501
Active Contributor
0 Kudos

hi use like this ..

if p_presvr = 'X'.

*-- if the file is to be downloaded to presentation server

call function '/SAPDMC/LSM_F4_FRONTEND_FILE'

changing

pathfile = p_file

exceptions

canceled_by_user = 1

system_error = 2

others = 3.

if sy-subrc <> 0.

if sy-batch = 'X'.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into v_msg.

write / v_msg.

clear v_msg.

stop.

else.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endif.

else.

*-- if the file is to be downloaded to application server

call function '/SAPDMC/LSM_F4_SERVER_FILE'

exporting

directory = '/'

filemask = '*'

importing

serverfile = p_file

exceptions

canceled_by_user = 1

others = 2.

if sy-subrc <> 0.

if sy-batch = 'X'.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into v_msg.

write / v_msg.

clear v_msg.

stop.

else.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endif.

endif.

Former Member
0 Kudos

Hi,

You can use the function Module "F4_DXFILENAME_TOPRECURSION"

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = 'A' " application server

I_SERVER = ' ' " server name

  • I_PATH =

  • FILEMASK = '.'

  • FILEOPERATION = 'R'

IMPORTING

  • O_LOCATION_FLAG =

  • O_SERVER =

O_PATH = W_PATH

" Path name ex: W_PATH TYPE DXFIELDS-LONGPATH.

  • ABEND_FLAG =

  • EXCEPTIONS

  • RFC_ERROR = 1

  • ERROR_WITH_GUI = 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.

do it like this , definetly your problem will be solved.

Regards,

Chiru.

Former Member
0 Kudos

Hi,

use this.


 CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      def_path         = w_directory
      mask             = ',*.CSV,*.*.'
      mode             = 'O'
      title            = text-m01
    IMPORTING
      filename         = p_file
    EXCEPTIONS
      inv_winsys       = 1
      no_batch         = 2
      selection_cancel = 3
      selection_error  = 4
      OTHERS           = 5.

Thanks & Regards,

Krishna..

Former Member
0 Kudos

Thanks to all for the support.

solved myself.

Thanks & Regards,

kumar.