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

BDC error handling

Former Member
0 Likes
464

Hi,

i want to upload the data through excel into sap suggest me with function module,

if there is any error occurs while uploading need to handle and download the errors into excel file.

thanks in advance,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
440

Hi,

for uploading data from excel file...You can go with function module

ALSM_EXCEL_TO_INTERNAL_TABLE

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = p_file
      i_begin_col             = 1
      i_begin_row             = 1
      i_end_col               = 5
      i_end_row               = 4
    TABLES
      intern                  = t_tab
    EXCEPTIONS
      inconsistent_parameters = 1
      upload_ole              = 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.

  LOOP AT t_tab.
    ASSIGN COMPONENT t_tab-col OF STRUCTURE _mara TO <fs_mara>.
    WRITE t_tab-value TO <fs_mara>.
    AT END OF row.
      APPEND t_mara.
    ENDAT.

  ENDLOOP.

If any errors in the bdc... capture them into table of type BDCMSGCOLL and then download it using

GUI_DOWNLOAD.

regards

padma

3 REPLIES 3
Read only

Former Member
0 Likes
441

Hi,

for uploading data from excel file...You can go with function module

ALSM_EXCEL_TO_INTERNAL_TABLE

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = p_file
      i_begin_col             = 1
      i_begin_row             = 1
      i_end_col               = 5
      i_end_row               = 4
    TABLES
      intern                  = t_tab
    EXCEPTIONS
      inconsistent_parameters = 1
      upload_ole              = 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.

  LOOP AT t_tab.
    ASSIGN COMPONENT t_tab-col OF STRUCTURE _mara TO <fs_mara>.
    WRITE t_tab-value TO <fs_mara>.
    AT END OF row.
      APPEND t_mara.
    ENDAT.

  ENDLOOP.

If any errors in the bdc... capture them into table of type BDCMSGCOLL and then download it using

GUI_DOWNLOAD.

regards

padma

Read only

bpawanchand
Active Contributor
0 Likes
440

Hi

Regards

Pavan

Read only

Former Member
0 Likes
440

Hi,

Use 'ALSM_EXCEL_TO_INTERNAL_TABLE' to upload the data from excel format.

and capture the errors into an internal table and download using gui_download.

Hope this helps,

Vijay