Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

syntax error

Former Member
0 Likes
900

Hi

I got syntax error in following routine

PERFORM LOAD_EXCEL_FILE  TABLES RECORD
                          USING  FILE
                            CHANGING GV_TEXT.

************************************************************************
*       Form  LOAD_EXCEL_FILE
************************************************************************
FORM LOAD_EXCEL_FILE TABLES   P_UPLOAD
                     USING    P_FILENAME  LIKE RLGRAP-FILENAME
                     CHANGING GV_TEXT TYPE NATXT.

  DATA : IF_INTERN TYPE  KCDE_CELLS OCCURS 0 WITH HEADER LINE.
  DATA : VF_INDEX TYPE I.
  DATA : VF_START_COL TYPE I VALUE '1',
         VF_START_ROW TYPE I VALUE '1',
         VF_END_COL   TYPE I VALUE '256',
         VF_END_ROW   TYPE I VALUE '65536'.

  FIELD-SYMBOLS : <FS>.
  CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
    EXPORTING
      FILENAME                = P_FILENAME
      I_BEGIN_COL             = VF_START_COL
      I_BEGIN_ROW             = VF_START_ROW
      I_END_COL               = VF_END_COL
      I_END_ROW               = VF_END_ROW
    TABLES
      INTERN                  = IF_INTERN
    EXCEPTIONS
      INCONSISTENT_PARAMETERS = 1
      UPLOAD_OLE              = 2
      OTHERS                  = 3.
  IF SY-SUBRC <> 0.
    GV_TEXT = 'Excel file upload error.'.
    EXIT.
  ENDIF.

  IF IF_INTERN[] IS INITIAL.
    GV_TEXT = 'No Data Uploaded'.
  ELSE.
    SORT IF_INTERN BY ROW COL.
    LOOP AT IF_INTERN.
      IF SY-TABIX >= 0.          "Starts AT ROW 0, COL 0.
        MOVE : IF_INTERN-COL TO VF_INDEX.
        ASSIGN COMPONENT VF_INDEX OF STRUCTURE P_UPLOAD TO <FS>.
        MOVE : IF_INTERN-VALUE TO <FS>.
        AT END OF ROW.
          APPEND P_UPLOAD.
          CLEAR P_UPLOAD.
        ENDAT.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDFORM.                    " LOAD_EXCEL_FILE

Syntax errorr is

In PERFORM or CALL FUNCTION "LOAD_EXCEL_FILE", the actual parameter "FILE" is incompatible with the formal parameter "P_FILENAME"

8 REPLIES 8
Read only

Former Member
0 Likes
849

Check how FILE is declared ..

Read only

Former Member
0 Likes
849

Hi,

Check datatype of File.

it should be same in both form and perform.

Read only

Former Member
0 Likes
849

Simple: check how you've defined your parameter FILE. It should be defined as TYPE RLGRAP-FILENAME...

Read only

Former Member
0 Likes
849

HI

Do this

data file type RLGRAP-FILENAME.

PERFORM LOAD_EXCEL_FILE TABLES RECORD

USING FILE

CHANGING GV_TEXT.

************************************************************************

  • Form LOAD_EXCEL_FILE

************************************************************************

FORM LOAD_EXCEL_FILE TABLES P_UPLOAD

USING P_FILENAME TYPE RLGRAP-FILENAME

CHANGING GV_TEXT TYPE NATXT.

Regards

Aditya

Read only

0 Likes
849

i declared like

PARAMETERS: file(30) TYPE c
                      DEFAULT '/export/remote/data.txt'
                      LOWER CASE
                      OBLIGATORY,

Read only

0 Likes
849

Hello

Try:

'C:\export\remote\data.txt'

Read only

0 Likes
849

Hi,

PARAMETERS: file(30) TYPE c

DEFAULT '/export/remote/data.txt'

LOWER CASE

OBLIGATORY,

The filename which you have given in the above statement is not having the correct path. Give the correct path in the above statement. There is no directory of it.

For example :

' D:\sapdb\data\wrk\ID1\dbahist'

Read only

Former Member
0 Likes
849

Hi,

The reaason for this may the actual and formal parameters are matching. Define the Variable FILE in PERFORM statement to be of same type as that defined in FORM statement.

I mean to say in your program declare like following:

DATA: FILE TYPE RLGRAP-FILENAME.