Skip to Content
avatar image
Former Member

UPLOADING

how to upload data from an excel sheet to presentation system.

Regards,

Phaninder Gollapudi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Nov 01, 2007 at 06:36 AM

    presentaion or application

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 01, 2007 at 06:36 AM

    Hi,

    Use Function Module " ALSM_EXCEL_TO_INTERNAL_TABLE ".

    Regards,

    Prashant

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 01, 2007 at 06:37 AM

    hi,

    check this sample code

    TABLES:zmatnr.

    TYPE-POOLS truxs.

    DATA : itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.

    DATA row LIKE alsmex_tabline-row.

    data : gi_final like zmatnr occurs 0 with header line.

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

    PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY.

    SELECTION-SCREEN END OF BLOCK b1.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname.

    PERFORM search.

    START-OF-SELECTION.

    perform process.

    form process.

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    filename = pfname

    i_begin_col = 1

    i_begin_row = 2

    i_end_col = 12

    i_end_row = 65000

    TABLES

    intern = itab

    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.

    describe table itab lines itab_count.

    row = 1.

    loop at itab.

    if itab-row <> row.

    append gi_final.

    clear gi_final.

    endif.

    case itab-col.

    when '1'.

    gi_final-MATNR = itab-value.

    when '2'.

    gi_final-Maktx = itab-value.

    endcase.

    row = itab-row.

    endloop.

    append gi_final.

    clear gi_final.

    endform.

    FORM search .

    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

    EXPORTING

    static = 'X'

    CHANGING

    file_name = pfname.

    ENDFORM.

    regards

    siva

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 01, 2007 at 06:39 AM

    hi,

    do you want to uplaod an excel from desktop to the sap system??

    if yes then use FM 'TEXT_CONVERT_XLS_TO_SAP'

    hope this helps

    taher

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 01, 2007 at 06:54 AM

    data:IT_EXCEL LIKE TABLE OF ALSMEX_TABLINE WITH HEADER LINE.

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

    PARAMETERS: P_FILE TYPE LOCALFILE OBLIGATORY .

    SELECTION-SCREEN END OF BLOCK B1.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

    EXPORTING

    STATIC = 'X'

    CHANGING

    FILE_NAME = P_FILE.

    START-OF-SELECTION.

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    FILENAME = P_FILE

    I_BEGIN_COL = 1 "From 1st Column

    I_BEGIN_ROW = 2 "From 2nd row

    I_END_COL = 6 "Till 6th Column

    I_END_ROW = 65536 "Till Row

    TABLES

    INTERN = IT_EXCEL

    EXCEPTIONS

    INCONSISTENT_PARAMETERS = 1

    UPLOAD_OLE = 2

    OTHERS = 3.

    CLEAR IT_EXCEL.

    DESCRIBE TABLE IT_EXCEL.

    IF SY-TFILL = 0.

    MESSAGE I937. "NO DATA UPLOADED

    STOP.

    ENDIF.

    LOOP AT IT_EXCEL.

    CASE IT_EXCEL-COL.

    WHEN '0001'.

    MOVE: IT_EXCEL-VALUE TO RECORD1-MATNR_005.

    WHEN '0002'.

    MOVE: IT_EXCEL-VALUE TO WK_WERKS.

    CONDENSE WK_WERKS NO-GAPS.

    TRANSLATE WK_WERKS TO UPPER CASE.

    MOVE: WK_WERKS TO RECORD1-WERKS_006.

    MOVE: WK_RJ_STGLOC TO RECORD1-ALORT_007.

    CLEAR: WK_WERKS,

    WK_RJ_STGLOC.

    WHEN '0003'.

    MOVE: IT_EXCEL-VALUE TO RECORD1-BUDAT_002.

    WHEN '0004'.

    MOVE: IT_EXCEL-VALUE TO RECORD1-BKTXT_004.

    WHEN '0005'.

    MOVE: IT_EXCEL-VALUE TO RECORD1-ERFMG_007.

    WHEN '0006'.

    MOVE: IT_EXCEL-VALUE TO RECORD1-ERFMG_008.

    ENDCASE.

    AT END OF ROW.

    APPEND RECORD1.

    CLEAR RECORD1.

    ENDAT.

    ENDLOOP.

    Hope this may help u.

    reward points if usefull 😊

    Add comment
    10|10000 characters needed characters exceeded