Application Development 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: 

GUI_UPLOAD PROBLEM

former_member196601
Active Participant
0 Kudos

HI

CAN ANYONE TELL ME HOW TO USE GUI_UPLOAD FM.....

WHENEVER IAM TRYIN TO USE THIS FM, IAM GETTING RUNTIME ERRORS???

MY REQUIREMENT IS TO UPLOAD EITHER EXCEL FORMAT OR TXT FORMAT.....

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Naveen,

    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = lv_file
        filetype                      = 'ASC'
        has_field_separator           = '~'
        header_length                 = 0
        read_by_line                  = 'X'
*    DAT_MODE                      = ' '
*    CODEPAGE                      = ' '
        ignore_cerr                   = 'X'
        replacement                   = '#'
*    CHECK_BOM                     = ' '
*    VIRUS_SCAN_PROFILE            =
*    NO_AUTH_CHECK                 = ' '
*  IMPORTING
*    FILELENGTH                    =
*    HEADER                        =
      TABLES
        data_tab                      = data_mat
*  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.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

Regards

Aneesh.

15 REPLIES 15

Former Member
0 Kudos

Naveen,

    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = lv_file
        filetype                      = 'ASC'
        has_field_separator           = '~'
        header_length                 = 0
        read_by_line                  = 'X'
*    DAT_MODE                      = ' '
*    CODEPAGE                      = ' '
        ignore_cerr                   = 'X'
        replacement                   = '#'
*    CHECK_BOM                     = ' '
*    VIRUS_SCAN_PROFILE            =
*    NO_AUTH_CHECK                 = ' '
*  IMPORTING
*    FILELENGTH                    =
*    HEADER                        =
      TABLES
        data_tab                      = data_mat
*  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.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

Regards

Aneesh.

0 Kudos

ANEESH

IAM STILL FACING THE SAME PROBLEM...

RUNTIME ERROR IS SOMETHIN LIKE THIS - "TYPE CONFLICT WHEN CALLING FUNCTION MODULE"

0 Kudos

Naveen,

Paste your code here and a sample file that u r trying to upload(like 2 lines of the file). Maybe I can find out why u r getting the run-time error.

Regards

Aneesh.

0 Kudos

REPORT zind_bdc_xd01

NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA : BEGIN OF i_knvv OCCURS 0,

kunnr LIKE knvv-kunnr,

vkorg LIKE knvv-vkorg,

vtweg LIKE knvv-vtweg,

spart LIKE knvv-spart,

vwerk LIKE knvv-vwerk,

bzirk LIKE knvv-bzirk,

vkbur LIKE knvv-vkbur,

vkgrp LIKE knvv-vkgrp,

kdgrp LIKE knvv-kdgrp,

konda LIKE knvv-konda,

kalks LIKE knvv-kalks,

pltyp LIKE knvv-pltyp,

zterm LIKE knvv-zterm,

taxkd LIKE knvi-taxkd(01),

END OF i_knvv.

INCLUDE bdcrecx1.

SELECTION-SCREEN BEGIN OF BLOCK 001.

PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.

SELECTION-SCREEN END OF BLOCK 001.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

PERFORM 100_get_file.

START-OF-SELECTION.

PERFORM 200_upload_file.

PERFORM open_group.

LOOP AT i_knvv.

PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR' 'RF02D-KTOKD'.

PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field USING 'RF02D-KUNNR' i_knvv-kunnr.

PERFORM bdc_field USING 'RF02D-VKORG' i_knvv-vkorg.

PERFORM bdc_field USING 'RF02D-VTWEG' i_knvv-vtweg.

PERFORM bdc_field USING 'RF02D-SPART' i_knvv-spart.

PERFORM bdc_field USING 'RF02D-KTOKD' '0001'.

PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.

PERFORM bdc_field USING 'BDC_CURSOR' 'KNA1-LAND1'.

PERFORM bdc_field USING 'BDC_OKCODE' '=UPDA'.

PERFORM bdc_field USING 'KNA1-ANRED' 'Company'.

PERFORM bdc_field USING 'KNA1-NAME1' 'Perisoft'.

PERFORM bdc_field USING 'KNA1-SORTL' '1'.

PERFORM bdc_field USING 'KNA1-ORT01' 'Chennai'.

PERFORM bdc_field USING 'KNA1-PSTLZ' '31'.

PERFORM bdc_field USING 'KNA1-LAND1' 'au'.

PERFORM bdc_field USING 'KNA1-SPRAS' 'EN'.

PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.

PERFORM bdc_field USING 'BDC_CURSOR' 'KNA1-LZONE'.

PERFORM bdc_field USING 'BDC_OKCODE' '=UPDA'.

PERFORM bdc_field USING 'KNA1-LZONE' '0000000001'.

PERFORM bdc_dynpro USING 'SAPMF02D' '0315'.

PERFORM bdc_field USING 'BDC_CURSOR' i_knvv-vwerk.

PERFORM bdc_field USING 'BDC_OKCODE' '=RW'.

PERFORM bdc_field USING 'KNVV-KZAZU' 'X'.

PERFORM bdc_field USING 'KNVV-VSBED' '02'.

PERFORM bdc_field USING 'KNVV-VWERK' 'AU10'.

PERFORM bdc_field USING 'KNVV-ANTLF' '9'.

PERFORM bdc_dynpro USING 'SAPMF02D' '0310'.

PERFORM bdc_field USING 'BDC_CURSOR' 'KNVV-PLTYP'.

PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field USING 'KNVV-BZIRK' i_knvv-bzirk.

PERFORM bdc_field USING 'KNVV-AWAHR' '100'.

PERFORM bdc_field USING 'KNVV-VKBUR' i_knvv-vkbur.

PERFORM bdc_field USING 'KNVV-VKGRP' i_knvv-vkgrp.

PERFORM bdc_field USING 'KNVV-KDGRP' i_knvv-kdgrp.

PERFORM bdc_field USING 'KNVV-WAERS' 'AUD'.

PERFORM bdc_field USING 'KNVV-KONDA' i_knvv-konda.

PERFORM bdc_field USING 'KNVV-KALKS' i_knvv-kalks.

PERFORM bdc_field USING 'KNVV-PLTYP' i_knvv-pltyp.

PERFORM bdc_dynpro USING 'SAPMF02D' '0315'.

PERFORM bdc_field USING 'BDC_CURSOR' 'KNVV-LPRIO'.

PERFORM bdc_field USING 'BDC_OKCODE' '=VW'.

PERFORM bdc_field USING 'KNVV-KZAZU' 'X'.

PERFORM bdc_field USING 'KNVV-VSBED' '02'.

PERFORM bdc_field USING 'KNVV-VWERK' i_knvv-vwerk.

PERFORM bdc_field USING 'KNVV-ANTLF' '9'.

PERFORM bdc_dynpro USING 'SAPMF02D' '0320'.

PERFORM bdc_field USING 'BDC_CURSOR' 'KNVV-ZTERM'.

PERFORM bdc_field USING 'BDC_OKCODE' '=UPDA'.

PERFORM bdc_field USING 'KNVV-ZTERM' i_knvv-zterm.

PERFORM bdc_dynpro USING 'SAPMF02D' '1350'.

PERFORM bdc_field USING 'KNVI-TAXKD(01)' i_knvv-taxkd.

PERFORM bdc_transaction USING 'XD01'.

ENDLOOP.

PERFORM close_group.

&----


*& Form 100_get_file

&----


FORM 100_get_file .

CALL FUNCTION 'WS_FILENAME_GET'

IMPORTING

filename = p_file.

ENDFORM. " 100_get_file

&----


*& Form 200_UPLOAD_FILE

&----


FORM 200_upload_file .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_FILE

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = I_KNVV.

ENDFORM. " 200_UPLOAD_FILE

0 Kudos

hi,

u cant pass p_file.

u have to take another variable type string.

and copy p_file in that.

DATA: LOC_FILENAME TYPE STRING.

LOC_FILENAME = P_FILE.

and pass LOC_FILENAME as code given by me.

Message was edited by:

Dhwani shah

0 Kudos

Hi,

DATA : S_FILE TYPE STRING.

s_file = p_file.

pass this p_file to gui_upload function module.

because here u need to pass string type but in ur exmple p_file is rlgrap-filename type.

rgds,

bharat.

0 Kudos

Naveen,

Since you are using the perform statement for your GUI_UPLOAD, you cannot pass p_file as the input parameter for the FM. Try using some other parameter into which you can copy the contents of p_file.

Regards

Aneesh.

0 Kudos

THANKS

0 Kudos

THANX

0 Kudos

hi,

if it useful to u and ur problem got solved than plz reward pionts and close this thread.

0 Kudos

THANKS

Former Member
0 Kudos

hi,

like this

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = LOC_FILENAME

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = ITAB

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.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Kudos

DHWANI SHAH

I TRIED... STILL IAM GETTING THE RUNTIME RERROR THAT I HAVE STATED ABOVE...

0 Kudos

hi,

can u tell what is type of ur file name? may b its because of import-export data type mis matching.

Former Member
0 Kudos

file name should be of type string and translate to upper case.