Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Not uploading more than 150 rows from Excel file to Internal table.

Hi All,

We have a Z program to upload initial stock from excel file to SAP using BAPI. The problem is we have defined row to '65536'. But it is not uploading more than 150 rows at a time. The piece of code is given below.

DATA : it_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
DATA: xcel TYPE TABLE OF alsmex_tabline WITH HEADER LINE.
DATA : gd_scol   TYPE i VALUE '1',
       gd_srow   TYPE i VALUE '3',
       gd_ecol   TYPE i VALUE '256',
       gd_erow   TYPE i VALUE '65536'.
PERFORM upload_excel_file TABLES   gt_out
                              USING   p_file
                                      gd_scol
                                      gd_srow
                                      gd_ecol
                                      gd_erow.
FORM upload_excel_file  TABLES   gt_out
                                   "Insert correct name for <...>
                        USING    p_p_file
                                 p_gd_scol
                                 p_gd_srow
                                 p_gd_ecol
                                 p_gd_erow.
  DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
  DATA : ld_index TYPE i.
  FIELD-SYMBOLS: <fs> TYPE ANY.
  CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
    EXPORTING
      filename    = p_p_file
      i_begin_col = p_gd_scol
      i_begin_row = p_gd_srow
      i_end_col   = p_gd_ecol
      i_end_row   = p_gd_erow
    TABLES
      intern      = lt_intern[].
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  IF lt_intern[] IS INITIAL.
    FORMAT COLOR COL_BACKGROUND INTENSIFIED.
    WRITE:/ 'No Data Uploaded'.
    EXIT.
  ELSE.
    SORT lt_intern BY row col.
    LOOP AT lt_intern.
      MOVE lt_intern-col TO ld_index.
      ASSIGN COMPONENT ld_index OF STRUCTURE gt_out TO <fs>.
      MOVE lt_intern-value TO <fs>.
      AT END OF row.
        APPEND gt_out.
        CLEAR gt_out.
      ENDAT.
    ENDLOOP.
  ENDIF.

ENDFORM.            

Plz tell me, what is the problem here. I want to upload all the rows at a time.

Thanks,

With regards,

Rosaline.

Not what you were looking for? View more on this topic or Ask a question