Skip to Content
0
Former Member
Dec 14, 2007 at 07:10 AM

FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' Problem ..

378 Views

i use the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' .

My only and strange problem is that when i execute the report i take the notification that i must save my excel file !!!!

I don't open the file for writing !!!! Look my code to see what happens ...

REPORT YDP_EXAG_TRAP .
TYPE-POOLS TRUXS.

TABLES : YREPORTS.

DATA: BEGIN OF ITAB OCCURS 0 ,
         REPORTNR   LIKE YREPORTS-REPORTNR,
         SALESMAN   LIKE YREPORTS-SALESMAN,
         TITLE      LIKE YREPORTS-TITLE,
         REPCAT     LIKE YREPORTS-REPCAT,
         CDATE      LIKE YREPORTS-CDATE,
         TR_DATE    LIKE YREPORTS-TR_DATE,
         VI_DATE    LIKE YREPORTS-VI_DATE,
         SOFIA      LIKE YREPORTS-SOFIA,
         SOF_HAL    LIKE YREPORTS-SOF_HAL,
         FILENAME   LIKE YREPORTS-FILENAME,
         LAND1      LIKE YREPORTS-LAND1,
         KUNNR      LIKE YREPORTS-KUNNR,
         TR_DATE1   LIKE YREPORTS-TR_DATE1,
         NEW_CUST   LIKE YREPORTS-NEW_CUST,
         RADIO,
       END OF ITAB.

DATA:   W_CHK LIKE ALSMEX_TABLINE-VALUE.


DATA :  MYITAB LIKE TABLE OF ALSMEX_TABLINE WITH HEADER LINE.
*DATA : MYITAB LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

PARAMETERS : S_FILE LIKE RLGRAP-FILENAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FILE.

  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      STATIC    = 'X'
    CHANGING
      FILE_NAME = S_FILE.

START-OF-SELECTION.

  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      FILENAME                = S_FILE
      I_BEGIN_COL             = 1
      I_BEGIN_ROW             = 1
      I_END_COL               = 19
      I_END_ROW               = 19
    TABLES
      INTERN                  = MYITAB
    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 MYITAB.
    CASE MYITAB-ROW.
      WHEN '2'.
        CASE MYITAB-COL.
          WHEN '1'.
            MOVE MYITAB-VALUE TO ITAB-REPORTNR.
          WHEN '3'.
            MOVE MYITAB-VALUE TO ITAB-SALESMAN.
          WHEN '7'.
            MOVE MYITAB-VALUE TO ITAB-TITLE.
        ENDCASE.

      WHEN '7'.
        CASE MYITAB-COL.
          WHEN '1'.
            MOVE MYITAB-VALUE TO ITAB-CDATE.
          WHEN '6'.
            MOVE MYITAB-VALUE TO ITAB-REPCAT.
        ENDCASE.

      WHEN '10'.
        CASE MYITAB-COL.
          WHEN '1'.
            MOVE MYITAB-VALUE TO ITAB-TR_DATE.
          WHEN '6'.
            MOVE MYITAB-VALUE TO ITAB-REPCAT.
        ENDCASE.


      WHEN '13'.
        CASE MYITAB-COL.
          WHEN '1'.
            MOVE MYITAB-VALUE TO ITAB-TR_DATE1.
        ENDCASE.

      WHEN '14'.
        CASE MYITAB-COL.
          WHEN '1'.
            MOVE MYITAB-VALUE TO ITAB-TR_DATE1.
          WHEN '4'.
            MOVE MYITAB-VALUE TO W_CHK.
        ENDCASE.

      WHEN '19'.
        CASE MYITAB-COL.
          WHEN '1'.
            MOVE MYITAB-VALUE TO ITAB-NEW_CUST.
        ENDCASE.


    ENDCASE.
  ENDLOOP.

  APPEND ITAB.


END-OF-SELECTION.

Please help ....

Points will be rewarded .....