Skip to Content
avatar image
Former Member

excel data error ?

hi friends.What did ı do a error?

ı wrote this code.

DATA meta_xl_itab TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.

DATA: lv_filename LIKE rlgrap-filename.

lv_filename = p_file.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = lv_filename

i_begin_col = '1'

i_begin_row = '1'

i_end_col = '200'

i_end_row = '5000'

TABLES

intern = meta_xl_itab.

data : i_contents TYPE SOI_GENERIC_TABLE WITH HEADER LINE.

loop at meta_xl_itab.

MOVE-CORRESPONDING meta_xl_itab to i_contents.

APPEND i_contents.

ENDLOOP.

CALL FUNCTION 'EECRM_GET_EXCELDATA_INTO_STRUC'

EXPORTING

X_EXCELDATA = i_contents

CHANGING

XY_STRUCTURE = i_contents

.

this error = "Type confilict when calling a functon module".

what do ı do?

thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Sep 04, 2008 at 05:40 AM

    Emrah,

    You are getting the error in the i_contents table.

    While populating it, use a work area of type SOI_GENERIC_ITEM instead of defining it with a header line.

    Try the sample code below.

    It works.

    report yh_sample.
    type-poolS soi .
    parameters p_file type rlgrap-filename.
    DATA meta_xl_itab TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA: lv_filename LIKE rlgrap-filename.
    lv_filename = p_file.
    
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    filename = lv_filename
    i_begin_col = '1'
    i_begin_row = '1'
    i_end_col = '200'
    i_end_row = '5000'
    TABLES
    intern = meta_xl_itab.
    data : i_contents TYPE SOI_GENERIC_TABLE.
    data: wa_contents type soi_generic_item.
    loop at meta_xl_itab.
    wa_contents-ROW = meta_xl_itab-ROW.
    wa_contents-column = meta_xl_itab-COL.
    wa_contents-VALUE = meta_xl_itab-VALUE.
    APPEND wa_contents to i_contents.
    ENDLOOP.
    CALL FUNCTION 'EECRM_GET_EXCELDATA_INTO_STRUC'
    EXPORTING
    X_EXCELDATA = i_contents
    CHANGING
    XY_STRUCTURE = i_contents.
    IF SY-SUBRC EQ 0.
    WRITE SY-SUBRC.
    ELSE.
    WRITE SY-SUBRC.
    ENDIF.

    Hope it helps you.

    Regards

    Indu.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 05:41 AM

    Hi,

    In FM "ALSM_EXCEL_TO_INTERNAL_TABLE", the table "INTERN" have the data type of ROW and COLUMN fields as NUMC where as when you call FM "EECRM_GET_EXCELDATA_INTO_STRUC" the table "X_EXCELDATA" has the data type of the fields ROW and COLUMN is CHAR.

    Hope this helps.

    Regards,

    Surinder

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 05:45 AM

    hi,

    try to use this code......

    no need use the function module to convert the data......

    DATA : L_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

    DATA : L_INDEX TYPE I.

    PARAMETERS : STARTCOL TYPE I ,

    STARTROW TYPE I ,

    ENDCOL TYPE I ,

    ENDROW TYPE I .

    PARAMETERS: p_flnam LIKE rlgrap-filename.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_flnam.

    CALL FUNCTION 'F4_FILENAME'

    EXPORTING

    PROGRAM_NAME = sy-repid

    • FIELD_NAME = ' '

    IMPORTING

    file_name = p_flnam .

    MOVE p_flnam TO lv_filename.

    • Uploading the flat file from the desktop

    start-of-selection.

    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

    EXPORTING

    FILENAME = LV_FILENAME

    I_BEGIN_COL = STARTCOL

    I_BEGIN_ROW = STARTROW

    I_END_COL = ENDCOL

    I_END_ROW = ENDROW

    TABLES

    INTERN = L_INTERN

    • 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.

    SORT L_INTERN BY ROW COL.

    LOOP AT L_INTERN.

    MOVE L_INTERN-COL TO L_INDEX.

    ASSIGN COMPONENT L_INDEX OF STRUCTURE ITAB TO <FS>.

    MOVE L_INTERN-VALUE TO <FS>.

    AT END OF ROW.

    APPEND ITAB.

    CLEAR ITAB.

    ENDAT.

    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded