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: 

hi Abapers

0 Kudos

"GUI_UPLOAD" ERROR: file not available

instead, i should get something like this.

1 ACCEPTED SOLUTION

thank u all 🙂

i have been resolved.

and also try a flat file without any spaces in it, it worked for me!!

17 REPLIES 17

Tomas_Buryanek
Active Contributor

Did you tried to debug it? For example put a break point (in debugger) on that error message (ID + number).

-- Tomas --

0 Kudos

i tried putting break point on 'gui_upload' but its going to debugger after the error message is shown.

former_member617564
Participant
0 Kudos

Please share code.

Regards,

Chitme

0 Kudos
here is the code:

TYPES: BEGIN OF TY_FILE,
  MBRSH TYPE MARA-MBRSH,
  MTART TYPE MARA-MTART,
  MAKTX TYPE MAKT-MAKTX,
  MEINS TYPE MARA-MEINS,
  END OF TY_FILE.


  DATA: I_FILE TYPE TABLE OF TY_FILE,
        WA_FILE TYPE TY_FILE.
  DATA: LV_MSG TYPE STRING.


  DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
  DATA: BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.


CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = 'D:\bdc.txt'
   FILETYPE                      = 'ASC'
*   HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  TABLES
    DATA_TAB                      = I_FILE
* EXCEPTIONS
*   
          .
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 I_FILE INTO WA_FILE.


perform bdc_dynpro      using 'SAPLMGMM' '0060'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMMG1-MTART'.
perform bdc_field       using 'BDC_OKCODE'
                              '=AUSW'.
perform bdc_field       using 'RMMG1-MBRSH'
                              WA_FILE-MBRSH.
perform bdc_field       using 'RMMG1-MTART'
                              WA_FILE-MTART.
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 'MAKT-MAKTX'
                              WA_FILE-MAKTX.
perform bdc_field       using 'BDC_CURSOR'
                              'MARA-MEINS'.
perform bdc_field       using 'MARA-MEINS'
                              'KGS'.
perform bdc_field       using 'MARA-MTPOS_MARA'
                              'NORM'.

CALL TRANSACTION 'MM01'
       USING BDCDATA
             UPDATE 'A'
             MODE 'A'
             MESSAGES INTO BDCMSGCOLL.

CLEAR WA_FILE.
REFRESH BDCDATA.
CLEAR BDCDATA.
REFRESH BDCMSGCOLL.
CLEAR BDCMSGCOLL.

ENDLOOP.

form bdc_dynpro using program dynpro.
  clear bdcdata.
  bdcdata-program  = program.
  bdcdata-dynpro   = dynpro.
  bdcdata-dynbegin = 'X'.
  append bdcdata.
endform.

form bdc_field using fnam fval.
  if fval <> space.
    clear bdcdata.
    bdcdata-fnam = fnam.
    bdcdata-fval = fval.
    append bdcdata.
  endif.
endform.

former_member617564
Participant
0 Kudos

Please share code

Regards,

Chitme

0 Kudos

Hi,

which message id and number is the program raising?

former_member617564
Participant
0 Kudos

Hi Shwetha,

Please maintain your text file in below format.put tab space between two items.

test-file.txt

Regards,

Chitme

former_member617564
Participant
0 Kudos

Also please check your file name path in the desktop.

Regards,

Chitme

0 Kudos

Hi,

i have saved flat file same as you have shown, and i even tried saving your file and uploading and still m getting this error, is it because m working on ides server installed??

and how do you debug the error msg.

Sandra_Rossi
Active Contributor

Please use a meaningful title so that to attract attention, like "GUI_UPLOAD file not available error".

Uploading a file from the frontend works only if your run the program interactively, it won't work in background.

Note that function module GUI_UPLOAD is superseded with CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD (that won't change anything to the execution though, but it may be of some interest in future releases (who knows)).

SachinArtani
Participant

Hi shweta.ph, Try following -

1. Change title of Question

2. Use formatting as suggested by chandchitme and add only three fields in your file as you are taking only three values from your work area

3. Your file path should be in caps, like this -

FILENAME                      = 'D:\BDC.TXT'

0 Kudos

Hi Sachin Artani,

Still not working.

FredericGirod
Active Contributor

maybe you have set to refuse this file in the security option of the SAPGui configuration

And the second window of your question is related to the SapGui Security

Sandra_Rossi
Active Contributor
0 Kudos

Maybe you use a virtualization app which limits the access. Anyway ask your administrator to help you, because we don't have access to your system/landscape...

p244500
Active Contributor
0 Kudos

Hi,

What is the file path which your giving? According to your screen it will be E:\FlatFiles.txt is it correct? Are you passing same name and path to upload FM as well?

thank u all 🙂

i have been resolved.

and also try a flat file without any spaces in it, it worked for me!!

0 Kudos

Thank you very much for giving the solution.