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

Regarding parameter passing through the bdc

Former Member
0 Likes
906

plz check bellow code

PARAMETERS: p_fname TYPE localfile.

calling upload

EXPORTING

FILENAME = p_fname

FILETYPE = 'DAT'

TABLES

DATA_TAB = itab.

ENDFORM.

if i pass filename (p_fname) to parameter i am not getting the output path to select the file plz give me proper suggestion .

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
856

Hi,

If you want popup to come for selecting the file name from your pc,you can use ws_filename_get function module in at selection-screen on value-request.

PARAMETERS: p_fname LIKE rlgrap-filename.

CONSTANTS : c_0 TYPE c VALUE '0',

c_mask(5) TYPE c VALUE ',..'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_path = p_fname

mask = c_mask

mode = c_0

title = 'FIlename'

IMPORTING

filename = p_file

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

plz check bellow code

PARAMETERS: p_fname TYPE localfile.

calling upload

EXPORTING

FILENAME = p_fname

FILETYPE = 'DAT'

TABLES

DATA_TAB = itab.

ENDFORM.

if i pass filename (p_fname) to parameter i am not getting the output path to select the file plz give me proper suggestion .

7 REPLIES 7
Read only

Former Member
0 Likes
856

Hello ,

Try this one.

PARAMETERS: FILENAME LIKE EPSF-EPSDIRNAM.

DATA: FILENAME LIKE  RLGRAP-FILENAME.

  FILENAME = P_FILENAME.
  CLEAR P_RC.

  CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
*   CODEPAGE                      = ' '
      FILENAME                      = FILENAME
      FILETYPE                      = 'ASC'
*   HEADLEN                       = ' '
*   LINE_EXIT                     = ' '
*   TRUNCLEN                      = ' '
*   USER_FORM                     = ' '
*   USER_PROG                     = ' '
*   DAT_D_FORMAT                  = ' '
* IMPORTING
*   FILELENGTH                    =
    TABLES
      DATA_TAB                      = P_ITAB_DATA
    EXCEPTIONS
      CONVERSION_ERROR              = 1
      FILE_OPEN_ERROR               = 2
      FILE_READ_ERROR               = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      OTHERS                        = 10
            .
  IF SY-SUBRC <> 0.
    P_RC = SY-SUBRC.
  ENDIF.

Regards,

Vasanth

Read only

Former Member
0 Likes
856

hi,

U need to declare the filename as

p_fname like rlgrap-filename.

Then it will work for the localfile.

Read only

Former Member
0 Likes
856

HI,

U should decalre file name like

PARAMETERS: P_NAME LIKE rlgrap-filename.

Then pass the parameter to FM

rewards points if help full

Regards

Suresh.D

Read only

Former Member
0 Likes
856

Hi,

Use p_fname like rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.

CALL FUNCTION 'F4_FILENAME'
EXPORTING
FIELD_NAME = PATH
IMPORTING
FILE_NAME = P_FNAME.

Hope this helps.

Regards,

Richa

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
857

Hi,

If you want popup to come for selecting the file name from your pc,you can use ws_filename_get function module in at selection-screen on value-request.

PARAMETERS: p_fname LIKE rlgrap-filename.

CONSTANTS : c_0 TYPE c VALUE '0',

c_mask(5) TYPE c VALUE ',..'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_path = p_fname

mask = c_mask

mode = c_0

title = 'FIlename'

IMPORTING

filename = p_file

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

Read only

Former Member
0 Likes
856

Hi Anil,

Try this. Hope this is what you need.

DATA: IT_TAB TYPE FILETABLE,

GD_SUBRC TYPE I. " For string return code

******************Selection screen definition*************************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS: P_FILE LIKE RLGRAP-FILENAME.

SELECTION-SCREEN END OF BLOCK B1.

************************************************************************

****lOGIC FOR OPENING TEXT FILE AND STORING IT IN INTERNAL TABLE*****

************************************************************************

***********************AT SELECTION-SCREEN***************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

REFRESH: IT_TAB.

*Opens File Open Dialog Box for selecting input file.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = 'Select File'

DEFAULT_FILENAME = '*.txt'

MULTISELECTION = ' '

CHANGING

FILE_TABLE = IT_TAB

RC = GD_SUBRC.

  • Loop on the internal table and get the file name

LOOP AT IT_TAB INTO P_FILE.

EXIT. " Loop only once

ENDLOOP.

At the end of execution....the parameter p_file will contain the address of the local file that you selected through the interactive screen.

Reward Pts if helpful.

Regards,

Kirti Bhushan

Read only

Former Member
0 Likes
856

Hi,

CALL FUNCTION 'F4_FILENAME' "For upload of the program

EXPORTING

field_name = 'P_FILE'

IMPORTING

file_name = p_file.

Regards

null