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: 

Supressing message from function module

Former Member
0 Kudos
259

Hi all,

I m using function 'WS_DOWNLOAD' to download some data.

If no records are downloaded then I m getting message that '0 bytes transferreed'.

Now I want to supress the messages i.e. it should not display this message, only if it more than o bytes then only it should show this message .

Is there any function module of sy- field to supress the particular message.

Rgds,

Umesh

7 REPLIES 7

Former Member
0 Kudos
221

its of no use to execute the Function Module if the internal table is empty.

so check this first. if the ITAB is not empty,then only call the FM,by this way you can overcome that problem.

<b>IF ITAB[] IS NOT INITIAL.</b>

 CALLL FUNCTION 'WS_DOWNLOAD'..


 TABLES 
   DATATAB = <b>ITAB</b>

<b>ENDIF.</b>

if you do so you dont get that message any more

Message was edited by: Srikanth Kidambi

Former Member
0 Kudos
221

Hello Umesh,

It is very simple.

Check the boby of the itab before calling the Fm

Ie)

If NOT ITAB[] IS INITIAL.

CALL FM...

ENDIF.

If useful reward.

Vasanth

former_member223537
Active Contributor
0 Kudos
221

Hi,

GUI_DOWNLOAD has an EXPORT parameter FILELENGTH.

If FILELENGTH = 0.

else.

  • Display Message

Endif.

Best regards,

Prashant

Former Member
0 Kudos
221

Hi All,

Thanks for reply.

My problem is that if there is any data in the file then

by passing empty table I m clearing that file.

So can;t use if itab[] is initial.

Basically while clearing the file that table will be initial only so I have to execute that to clear the file.

So I want to supree this message .

Hope u all understand .

regds,

Umesh

Former Member
0 Kudos
221

comment the SY-SUBRC check after u call the FM 'WS_DOWNLOAD' so that all the messages will be supressed

comment this

.

*  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*  ENDIF.
 

Former Member
0 Kudos
221

Hi,

write below logic

if not itab[] is initial.

call function 'WS_DOWNLOAD''

endif.

by this logic u can supress message

or

you have to copy FM to Z and make req changes.

Regards

amole

former_member223537
Active Contributor
0 Kudos
221

Hi Umesh,

<b>FM SCMS_AO_TABLE_GET_BYTES, has an export parameters FILELENGTH. This return the number of bytes transferred</b>

CALL SCMS_AO_TABLE_GET_BYTES

EXPORTING ...

IMPORTING = L_LENGTH

TABLES = ITAB

EXceptions ....

IF L_LENGTH GT 0.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE = ' '

  • CODEPAGE = ' '

FILENAME = 'C:\ABC.TXT'

  • FILETYPE = 'ASC'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • filelength =

TABLES

data_tab = itab

  • FIELDNAMES =

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10

.

IF sy-subrc <> 0.

..

ENDIF.

ENDIF.

Best regards,

Prashant

PS : Please reward all helpful answers

Message was edited by: Prashant Patil