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

Calling FM in methods

Former Member
0 Likes
1,036

Hi Friends,

I am trying to call a GUI_download function module inside a method.

But after executing it is throwing an error message stating that FM does not exists or exceptions raised.

Kindly suggest..

Regards,

Chaitanya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
868

Hi,

Uncomment the EXCEPTIONS part & handle the sy-subrc.

Check in debug mode, which exception is raised.

You might not have some authorization to download on a specific directory.

Best regards,

Prashant

7 REPLIES 7
Read only

Former Member
0 Likes
869

Hi,

Uncomment the EXCEPTIONS part & handle the sy-subrc.

Check in debug mode, which exception is raised.

You might not have some authorization to download on a specific directory.

Best regards,

Prashant

Read only

0 Likes
868

Hi Prashant,

Thanks for the inputs....

the exceptions have been taken care but the problem is that the FM itself is not getting executed.

So how to debug now???

As soon as it reaches to the calling point it comes out saying that the FM does not exists.

Please advice...

Regards,

Chaitanya.

Read only

Former Member
0 Likes
868

Hi Kumar,

It seems you are on 4.6B or lower version. Use WS_DOWNLOAD instead of GUI_DOWNLOAD.

Best regards,

Prashant

Read only

Sougata
Active Contributor
0 Likes
868

Hi,

Don't call the FM inside the method instead call static method GUI_DOWNLOAD of global class CL_GUI_FRONTEND_SERVICES. You can call this directly without instantiating the class.

    call method cl_gui_frontend_services=>gui_download
      exporting
        filename                = ldf_fullpath
        filetype                = 'ASC'
      changing
        data_tab                = gt_outtab
      exceptions
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        not_supported_by_gui    = 22
        error_no_gui            = 23
        others                  = 24.

  if sy-subrc is not initial.
* handle exceptions here...e.g. RAISE EXCEPTION xxx
  endif.

Don't forget to reward points.

Cheers,

Sougata.

Read only

Former Member
0 Likes
868

Hi Sougata,

Thanks a lot!!!!!!!!!!!!!!!!!

Regards,

Chaitanya

Read only

Former Member
0 Likes
868

Hi,

I tired your code and now I am getting an error message saying Error when opening the RFC connection.

Kinldy advice.

Regards,

Chaitanya.

Read only

Sougata
Active Contributor
0 Likes
868

Hi Kumar,

What is the value of sy-subrc after the method <i>cl_gui_frontend_services=>gui_download</i> is called?

Cheers,

Sougata.