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

type conflict error

former_member612655
Participant
0 Likes
2,314
Hi experts,

*include bdcrecx1.

DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.

*       messages of call transaction

DATA:   MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

TYPES : BEGIN OF TY_MARA,

        MATNR TYPE MARA-MATNR,

        BISMT TYPE MARA-BISMT,

        END OF TY_MARA.

DATA : WA_MARA TYPE TY_MARA,

       IT_MARA TYPE TABLE OF TY_MARA WITH HEADER LINE.

*DATA G_XLDATA LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

DATA NODATA.

PARAMETER p_file LIKE ibipparms-path.

START-OF-SELECTION.

DATA V_FILE TYPE STRING.

V_FILE = P_FILE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  CALL FUNCTION 'F4_FILENAME'

    EXPORTING

      program_name  = syst-cprog

      dynpro_number = syst-dynnr

      field_name    = 'P_FILE'

    IMPORTING

      file_name     = p_file.

*start-of-selection.

*V_FILE = P_FILE.

  CALL FUNCTION 'GUI_UPLOAD'

    EXPORTING

      FILENAME                      = V_FILE

     FILETYPE                      = 'ASC'

    HAS_FIELD_SEPARATOR           = 'X '


    TABLES

      DATA_TAB                      = IT_MARA

   EXCEPTIONS

     FILE_OPEN_ERROR               = 1

     FILE_READ_ERROR               = 2

     NO_BATCH                      = 3

     GUI_REFUSE_FILETRANSFER       = 4

     INVALID_TYPE                  = 5

     NO_AUTHORITY                  = 6

     UNKNOWN_ERROR                 = 7

     BAD_DATA_FORMAT               = 8

     HEADER_NOT_ALLOWED            = 9

     SEPARATOR_NOT_ALLOWED         = 10

     HEADER_TOO_LONG               = 11

     UNKNOWN_DP_ERROR              = 12

     ACCESS_DENIED                 = 13

     DP_OUT_OF_MEMORY              = 14

     DISK_FULL                     = 15

     DP_TIMEOUT                    = 16

     OTHERS                        = 17

            .

*  IF SY-SUBRC <> 0.

* Implement suitable error handling here

*  ENDIF.

*

  "CREATE THE SESSION

*  CALL FUNCTION 'BDC_OPEN_GROUP'

*   EXPORTING

**     CLIENT                    = SY-MANDT

**     DEST                      = FILLER8

*     GROUP                     = 'MARA'

**     HOLDDATE                  = FILLER8

*     KEEP                      = 'X'

*     USER                      = SY-UNAME.

**     RECORD                    = FILLER1

**     PROG                      = SY-CPROG

**     DCPFM                     = '%'

**     DATFM                     = '%'

**   IMPORTING

**     QID                       =

**   EXCEPTIONS

**     CLIENT_INVALID            = 1

**     DESTINATION_INVALID       = 2

**     GROUP_INVALID             = 3

**     GROUP_IS_LOCKED           = 4

**     HOLDDATE_INVALID          = 5

**     INTERNAL_ERROR            = 6

**     QUEUE_ERROR               = 7

**     RUNNING                   = 8

**     SYSTEM_LOCK_ERROR         = 9

**     USER_INVALID              = 10

**     OTHERS                    = 11

*            .

**Function Module to upload excel file data to internal table

*CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

*  EXPORTING

*    FILENAME                      = p_file

*    I_BEGIN_COL                   = 1

*    I_BEGIN_ROW                   = 1

*    I_END_COL                     = 100

*    I_END_ROW                     = 100

*  TABLES

*    INTERN                        = G_XLDATA

*          .

*LOOP AT G_XLDATA.

*  CASE G_XLDATA-COL.

*    WHEN 1.

*      IT_MARA-MATNR = G_XLDATA-VALUE.

*    WHEN 2.

*      IT_MARA-BISMT = G_XLDATA-VALUE.

**    WHEN 3.

**      ITAB-STREET = G_XLDATA-VALUE.

**    WHEN 4.

**      ITAB-CITY = G_XLDATA-VALUE.

*      APPEND  IT_MARA.

*      CLEAR IT_MARA.

*  ENDCASE.

* ENDLOOP.



*perform open_group.

LOOP AT IT_MARA INTO WA_MARA.



perform bdc_dynpro      using 'SAPLMGMM' '0060'.

perform bdc_field       using 'BDC_CURSOR'

                              'RMMG1-MATNR'.

perform bdc_field       using 'BDC_OKCODE'

                              '=AUSW'.

perform bdc_field       using 'RMMG1-MATNR'

                              WA_MARA-MATNR.

perform bdc_dynpro      using 'SAPLMGMM' '0070'.

perform bdc_field       using 'BDC_CURSOR'

                              'MSICHTAUSW-DYTXT(01)'.

perform bdc_field       using 'BDC_OKCODE'

                              '/00'.

perform bdc_dynpro      using 'SAPLMGMM' '0070'.

perform bdc_field       using 'BDC_CURSOR'

                              'MSICHTAUSW-DYTXT(01)'.

perform bdc_field       using 'BDC_OKCODE'

                              '/00'.

perform bdc_dynpro      using 'SAPLMGMM' '0070'.

perform bdc_field       using 'BDC_OKCODE'

                              '/EABBR'.

perform bdc_field       using 'BDC_CURSOR'

                              'MSICHTAUSW-DYTXT(01)'.

perform bdc_dynpro      using 'SAPLMGMM' '0060'.

perform bdc_field       using 'BDC_CURSOR'

                              'RMMG1-MATNR'.

perform bdc_field       using 'BDC_OKCODE'

                              '=ENTR'.

perform bdc_field       using 'RMMG1-MATNR'

                              '1000000015'.

perform bdc_dynpro      using 'SAPLMGMM' '0070'.

perform bdc_field       using 'BDC_CURSOR'

                              'USRM1-AAUSW'.

perform bdc_field       using 'BDC_OKCODE'

                              '=DEF_SKIP'.

perform bdc_field       using 'USRM1-AAUSW'

                              'X'.

perform bdc_dynpro      using 'SAPLMGMM' '0070'.

perform bdc_field       using 'BDC_CURSOR'

                              'MSICHTAUSW-DYTXT(01)'.

perform bdc_field       using 'BDC_OKCODE'

                              '=ENTR'.

perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'

                              'X'.

perform bdc_dynpro      using 'SAPLMGMM' '4004'.

perform bdc_field       using 'BDC_OKCODE'

                              '=BU'.

perform bdc_field       using 'BDC_CURSOR'

                              'MARA-BISMT'.

perform bdc_field       using 'MARA-BISMT'

                              WA_MARA-BISMT.

CALL TRANSACTION 'MM02' USING BDCDATA MODE 'A'.

REFRESH BDCDATA.

ENDLOOP.



FORM BDC_DYNPRO USING PROGRAM DYNPRO.

  CLEAR BDCDATA.

  BDCDATA-PROGRAM  = PROGRAM.

  BDCDATA-DYNPRO   = DYNPRO.

  BDCDATA-DYNBEGIN = 'X'.

  APPEND BDCDATA.

ENDFORM.



*----------------------------------------------------------------------*

*        Insert field                                                  *

*----------------------------------------------------------------------*

FORM BDC_FIELD USING FNAM FVAL.

  IF FVAL <> NODATA.

    CLEAR BDCDATA.

    BDCDATA-FNAM = FNAM.

    BDCDATA-FVAL = FVAL.

    APPEND BDCDATA.

  ENDIF.

ENDFORM.
 my requirement is to upload the data from excel to sap system for that purpose i develope a code like shown in above but i am getting runtime error like " Type conflict when calling the function module" can you please help me to resolve it.

regards.

5 REPLIES 5
Read only

FredericGirod
Active Contributor
0 Likes
1,860

When you have a type conflic with Function Module, SAP creates a dump, this dump could be found in transaction ST22.

In this transaction SAP will gives you the parameter with the incorrect type.

The simple way to solve this, is to double-clic on the paramater in your code, to get the exact declaration made by SAP & uses it in your own code

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,860

Why do you post your question twice? If it's to format the code, you should EDIT your question, not create a new one! Moderator alerted on duplicate.

Moreover, if you have a short dump, attach it, and please don't post "double lines" (blank lines everywhere)

Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
1,860

Try removing trailing space when passing HAS_FIELD_SEPARATOR parameter

Your code:

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                      = V_FILE
     FILETYPE                      = 'ASC'
    HAS_FIELD_SEPARATOR           = 'X '

Fixed code:

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                      = V_FILE
     FILETYPE                      = 'ASC'
    HAS_FIELD_SEPARATOR           = 'X'

HTH

Dominik Tylczynski

Read only

ThangaPrakash
Active Contributor
0 Likes
1,860

bhavani123 Problem is with has field separator.

Below are the possible values for separator as per documentation of the field.

'X': Fields are separated by tabs.

SPACE: Fields are not separated by tabs. In this case, the table must contain either only one single column or all columns must be contained in the file in their full length.

change HAS_FIELD_SEPARATOR = 'X' as there is trailing space in your code which makes it as 2 character field, but HAS_FIELD_SEPARATOR is one character field, so HAS_FIELD_SEPARATOR = 'X' is the correct value.

Read only

dev_parbutteea
Active Contributor
0 Likes
1,860

Hi,

i am getting runtime error like" Type conflict when calling the function module" can you please help me to resolve it.

Isn't it obvious that you must have wrongly declared one or more parameter, table or structure which is passed to the FM?

try declaring IT_MARA as follows:

 DATA : BEGIN OF lt_data OCCURS 0,
           line(50) TYPE c,
         END OF lt_data.

Dev.