Sometimes DIR have more than one origin LSMW is poor to upload more than one originals fllowing code upload orginals and set Status.

Excel Structure must :

Doc number Doc type Part Version Document Status Original format * Origin Description Path
0000000000060000000026926 ENG 000 00 NC PDF PDF file z:
ew foldra.pdf
0000000000060000000026926 ENG 000 00 NC XLS native file z:
ew foldra.xlsx
0000000000060000000026926 ENG 000 01 RW WRD native file z:
ew foldr.docx
0000000000060000000026926 ENG 000 02 RW PDF PDF file z:
ew foldr.pdf

* Original format : Must Capital and format must similar in customizing t.code:dc30 (for example word file in dc30 is WRD you must write WRD in this filed)

 *&---------------------------------------------------------------------* *& Report  ZDMS_SET_ORIGINAL_STATUS *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT  ZDMS_SET_ORIGINAL_STATUS. "CONSTANTS STORAGE_NAME TYPE CV_STORAGE_CAT VALUE 'DMS_C1_ST'. TYPES:        BEGIN OF ST_DIR,          DOKAR TYPE DOKAR,          DOKNR TYPE DOKNR,          DOKVR TYPE DOKVR,          DOKTL TYPE DOKTL,          DOKST TYPE DOKST,          DOKTYPE TYPE CHAR3,          ORGDES TYPE CHAR40,          ORGPATH TYPE FILEP,          VISITED TYPE CHAR1,        END OF ST_DIR,        BEGIN OF ST_ERROR_DOCS,          DOKAR TYPE DOKAR,          DOKNR TYPE DOKNR,          DOKVR TYPE DOKVR,          DOKTL TYPE DOKTL,          ERRORMSG TYPE CHAR100,        END OF ST_ERROR_DOCS. PARAMETERS BEG_ROW TYPE i DEFAULT 2. PARAMETERS END_ROW TYPE i DEFAULT 101. PARAMETERS FILEPATH LIKE RLGRAP-FILENAME DEFAULT 'c:phase1.xlsx'. PARAMETERS STRGNAME TYPE CV_STORAGE_CAT DEFAULT 'PPL-PROJ'. DATA: it_documents TYPE TABLE OF st_dir,        wa_documents TYPE st_dir. DATA: it_error_docs TYPE TABLE OF ST_ERROR_DOCS WITH HEADER LINE. *DATA it_file_content TYPE TABLE OF ALSMEX_TABLINE WITH HEADER LINE. *CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' DATA it_file_content TYPE TABLE OF ZKCDE_CELLS WITH HEADER LINE. CALL FUNCTION 'ZKCD_EXCEL_OLE_TO_INT_CONVERT'    EXPORTING      FILENAME                      = FILEPATH      I_BEGIN_COL                   = 1      I_BEGIN_ROW                   = BEG_ROW      I_END_COL                     = 8      I_END_ROW                     = END_ROW    TABLES      INTERN                        = it_file_content * EXCEPTIONS *   INCONSISTENT_PARAMETERS       = 1 *   UPLOAD_OLE                    = 2 *   OTHERS                        = 3            . IF SY-SUBRC  0. * Implement suitable error handling here ENDIF. DATA: current_row TYPE i VALUE 1,        rowCount TYPE i. rowCount = LINES( it_file_content ). WHILE current_row  0. * Implement suitable error handling here ENDIF. FORMAT COLOR COL_BACKGROUND INTENSIFIED. WRITE:/ 'Finished!!'. " Show errors in ALV DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,        GD_LAYOUT    TYPE SLIS_LAYOUT_ALV,        GD_REPID     LIKE SY-REPID,        G_VARIANT TYPE DISVARIANT        . " Remove header row in excel file DELETE IT_ERROR_DOCS INDEX 1. PERFORM field_cat. GD_REPID = SY-REPID. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'    EXPORTING      I_CALLBACK_PROGRAM      = GD_REPID *   I_CALLBACK_TOP_OF_PAGE  = 'TOP-OF-PAGE' "see FORM *   I_CALLBACK_USER_COMMAND = 'USER_COMMAND'      IT_FIELDCAT             = FIELDCATALOG[]      I_SAVE                  = 'X'      IS_VARIANT              = G_VARIANT    TABLES      T_OUTTAB                = IT_ERROR_DOCS    EXCEPTIONS      PROGRAM_ERROR           = 1      OTHERS                  = 2. *&---------------------------------------------------------------------* *&      Form  FIELD_CAT *&---------------------------------------------------------------------* *       text *----------------------------------------------------------------------* *  -->  p1        text *  

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !