Error in uploaded excel file into internal table through FM ‘ALSM_EXCEL_TO_INTERNAL_TABLE’

Hi, I have this ABAP code with me:

Please help to resolve this issue, required images are provided at the end.

REPORT ztest_009.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT001.
  PARAMETERSp_radio1 RADIOBUTTON GROUP rad1 DEFAULT ‘X’ USER-COMMAND rad,
              p_radio2 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT002.
  PARAMETERSp_file TYPE localfile.
  PARAMETERSp_run AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION ‘F4_FILENAME’
    IMPORTING
      file_name p_file.

AT SELECTION-SCREEN.

  IF p_radio1 ‘X’ AND  p_file IS INITIAL.
    MESSAGE ‘Please upload Excel File for excecution’ TYPE ‘E’.
  ENDIF.

START-OF-SELECTION.

  DATAvend_data_t        TYPE TABLE OF ztmd_lve_ven_vsr,
        vend_data_s        TYPE ztmd_lve_ven_vsr,
        filename           TYPE rlgrapfilename,
        display_errors_t   TYPE TABLE OF string,
        display_errors_s   TYPE string,
        excel_t            TYPE TABLE OF alsmex_tabline,
        excel_s            TYPE alsmex_tabline,
        lt_output          TYPE TABLE OF ztmd_lve_ven_vsr,
        lt_duplicate_check TYPE TABLE OF ztmd_lve_ven_vsr.
*        split_lifnr        TYPE char10.

  filename p_file.

  CALL FUNCTION ‘ALSM_EXCEL_TO_INTERNAL_TABLE’
    EXPORTING
      filename    filename
      i_begin_col 1
      i_begin_row 2
      i_end_col   5
      i_end_row   1000
    TABLES
      intern      excel_t
*  EXCEPTIONS
*     INCONSISTENT_PARAMETERS       = 1
*     UPLOAD_OLE  = 2
*     OTHERS      = 3
    .
  IF sysubrc <> 0.
* Implement suitable error handling here

    MESSAGE‘upload excel’ TYPE ‘E’.

  ENDIF.

  CLEARexcel_s.
  LOOP AT excel_t INTO excel_s.
    CASE excel_scol.
      WHEN 1.
        vend_data_slifnr excel_svalue.
      WHEN 2.
        vend_data_sltsnr excel_svalue.
      WHEN 3.
        vend_data_szind excel_svalue.
      WHEN 4.
        IF excel_svalue IS NOT INITIAL.
          SPLIT excel_svalue AT ‘.’ INTO DATA(dayDATA(monthDATA(year).
          vend_data_szvalfrom year && month && day” Convert to YYYYMMDD
        ENDIF.
      WHEN 5.
        IF excel_svalue ‘X’.
          DELETE FROM ztmd_lve_ven_vsr WHERE lifnr vend_data_slifnr AND ltsnr vend_data_sltsnr.
        ENDIF.

    ENDCASE.
    APPEND vend_data_s TO vend_data_t.

    CLEARvend_data_s.

  ENDLOOP.

 

Facing issues as data is mismatched in uploaded excel file and my internal table vend_data_t.

Uploaded excel file:

image (1).jpg

Internal table: vend_data_t:

image (2).jpg

Data in table excel_t:

image (8).png

Scroll to Top