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

Problem IN BDC call transaction method...

former_member130219
Participant
0 Likes
677

Hi

pls check my code for BDC data upload....it gives an error file not found.....

REPORT  ZABHI_CALTRANSC.
 TYPES:   BEGIN OF t_employee,
         pernr        TYPE    p0002-pernr, "Employee Number
         midnm        TYPE    p0002-midnm, "mid name
         rufnm        TYPE    p0002-rufnm, "nick name
         begda(10)    TYPE   c,
         endda(10)    TYPE   c,
        END OF t_employee.
DATA:   it_employee   TYPE  STANDARD TABLE OF t_employee,
        wa_employee   TYPE t_employee,
        it_bdcdata    TYPE bdcdata OCCURS 0 WITH HEADER LINE ,
        i_file_path   TYPE localfile,
        file_name     TYPE string,
        I_SESSIONNAME(12) TYPE c.

SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE title1.
  SELECTION-SCREEN COMMENT 1(10) txt_01.
  PARAMETERS p_fname TYPE rlgrap-filename OBLIGATORY.
*  PARAMETERS p_sess LIKE APQI-GROUPID .
SELECTION-SCREEN END OF BLOCK bk1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
  CLEAR i_file_path.
  PERFORM select_input_file_name.
  MOVE i_file_path TO p_fname.
  file_name = p_fname.

START-OF-SELECTION.

PERFORM BDC_CALL_TRANSACTION_method.
form BDC_CALL_TRANSACTION_method.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename            = file_name
      filetype            = 'ASC'
      has_field_separator = 'X'
    TABLES
      data_tab            = it_employee.
endform.

Thnsk u..

Moderator message - Please post only the relevant portions of code and use code tags

Edited by: Rob Burbank on May 25, 2009 9:57 AM

6 REPLIES 6
Read only

former_member209217
Active Contributor
0 Likes
639

Hi Abhinandan,

PARAMETERS p_fname TYPE rlgrap-filename .

Replace rlgrap-filename with string.

Regards,

Lakshman

Read only

Former Member
0 Likes
639

Dear Abhinandan,

you have used p_file as type rlgrap-filename.

That is fine but you need to transfer this file path into string type variable . for that you need to declare another variable and do some codine . Then it will fine.

E.g.

Data : d_file type string.

Undert Start-of-selection.

If not P_file is initial.

d_file = p_file.

endif.

Then pass this D_file to the function module.

This will help you to solve your problem. feel free to ask if any doubts.

Regards,

Vijay

Read only

Former Member
0 Likes
639

Hi,

in the event at selection-screen on value request for field call the function module

WS_FILENAME_GET so that when you press F4 of the field in the screen it will leads to pop-up asking for file name. Select the file by browsing so that the parameter filename under exporting holds the filepath.

In start-of-selection under GUI_UPLOAD give the path that you got from WS_FILENAME_GET. Hope this will work.

Read only

Former Member
0 Likes
639

Hi,

try like this...

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.

CLEAR i_file_path.

PERFORM select_input_file_name.

MOVE i_file_path TO p_fname.

file_name = p_fname.

START-OF-SELECTION.

PERFORM BDC_CALL_TRANSACTION_method.

form BDC_CALL_TRANSACTION_method.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = file_name

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = it_employee.

endform.

&----


*& Form select_input_file_name

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form select_input_file_name .

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = i_file_path.

endform. " select_input_file_name

Read only

Former Member
0 Likes
639

hi,

try this

selection-screen begin of block b1.

parameters : p_file type rlgrap-filename.

selection-screen end of block b1.

at selection-screen on value-request for p_file.

call function 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

importing

file_name = p_file.

*START-OF-SELECTION.

data : f_file type string.

f_file = p_file.

call function 'GUI_UPLOAD'

exporting

filename = f_file

filetype = 'ASC'

has_field_separator = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = it_data

exceptions

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

others = 17

Read only

former_member130219
Participant
0 Likes
639

Thanks for support ..