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

absolute function

Former Member
0 Likes
1,441

hi,

Some one please help in finding the equivalent function module for WS_QUERY.

Girish.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,314

Hi,

The Equivalent Function Module for WS_QUERY-File Exist in ABAP 4.7 is CL_GUI_FRONTEND_SERVICES=>FILE_EXIST or WS_QUERY-Directory Exist is CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST.

Sample code for Replacement of WS_QUERY-File Exists is::

data: WK_DIRECTRY(128) TYPE C .

  • CALL FUNCTION 'WS_QUERY'

  • EXPORTING

  • FILENAME = WK_DIRECTRY

  • QUERY = 'FE'

  • IMPORTING

  • RETURN = RC

  • EXCEPTIONS

  • INV_QUERY = 1

  • NO_BATCH = 2

  • FRONTEND_ERROR = 3

  • OTHERS = 4.

<b>Repleacement Function module is :</b>

DATA: W_FILENAME TYPE STRING,

W_RESULT TYPE C.

W_FILENAME = WK_DIRECTRY.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST

EXPORTING

FILE = W_FILENAME

RECEIVING

RESULT = W_RESULT

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

WRONG_PARAMETER = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-* MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF W_RESULT IS INITIAL.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST

EXPORTING

DIRECTORY = W_FILENAME

RECEIVING

RESULT = W_RESULT

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

WRONG_PARAMETER = 3

NOT_SUPPORTED_BY_GUI = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

ENDIF.

ENDIF.

IF W_RESULT = 'X'.

RC = '1'.

ELSE.

RC = '0'.

ENDIF.

9 REPLIES 9
Read only

Former Member
0 Likes
1,314

Your topic subject and your question inside look like two different things. What do you want to do? May be that will get you more answers, instead of asking for an alternative for WS_QUERY.

Read only

0 Likes
1,314

hi srinivas,

i am upgrading one program when i am doing EPC it is showing that ws_query is absolute and replace it with the other one can you guide me to that answer,

thanx,

Girish

Read only

0 Likes
1,314

You should use the methods of class CL_GUI_FRONTEND_SERVICES

or use function modules from function group

SFES

as suggested by the WS_QUERY FM documentation.

Regards

Raja

Read only

0 Likes
1,314

I am sorry, I misunderstood when you said ABSOLUTE instead of OBSOLETE. I thought you were looking for the ABS command and inside you were talking about WS_QUERY, that is why I got confused.

Read only

Former Member
0 Likes
1,314

"Obsolete" doesn't mean that it won't work; just that you shouldn't use it in new development. If it's in an existing program you can just leave it.

Rob

Read only

Former Member
0 Likes
1,315

Hi,

The Equivalent Function Module for WS_QUERY-File Exist in ABAP 4.7 is CL_GUI_FRONTEND_SERVICES=>FILE_EXIST or WS_QUERY-Directory Exist is CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST.

Sample code for Replacement of WS_QUERY-File Exists is::

data: WK_DIRECTRY(128) TYPE C .

  • CALL FUNCTION 'WS_QUERY'

  • EXPORTING

  • FILENAME = WK_DIRECTRY

  • QUERY = 'FE'

  • IMPORTING

  • RETURN = RC

  • EXCEPTIONS

  • INV_QUERY = 1

  • NO_BATCH = 2

  • FRONTEND_ERROR = 3

  • OTHERS = 4.

<b>Repleacement Function module is :</b>

DATA: W_FILENAME TYPE STRING,

W_RESULT TYPE C.

W_FILENAME = WK_DIRECTRY.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST

EXPORTING

FILE = W_FILENAME

RECEIVING

RESULT = W_RESULT

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

WRONG_PARAMETER = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-* MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF W_RESULT IS INITIAL.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST

EXPORTING

DIRECTORY = W_FILENAME

RECEIVING

RESULT = W_RESULT

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

WRONG_PARAMETER = 3

NOT_SUPPORTED_BY_GUI = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

ENDIF.

ENDIF.

IF W_RESULT = 'X'.

RC = '1'.

ELSE.

RC = '0'.

ENDIF.

Read only

0 Likes
1,314

Hi Ashok,

Thanx for ur Tip but my WS_QUERY looks like below

CALL FUNCTION 'WS_QUERY'

EXPORTING

query = 'WS'

IMPORTING

return = l_opsys

EXCEPTIONS

inv_query = 1

no_batch = 2

frontend_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

MOVE sy-subrc TO p_subrc.

EXIT.

ENDIF.

ENDIF.

These parameters r not like u gave,

so,how can i proceed with this function module plz help me,

Girish.

Read only

0 Likes
1,314

your code would return the plafortm (example win32 , etc).

use the following code.

data: nplatform type i.

  call method cl_gui_frontend_services=>get_platform
    receiving
      platform             = nplatform
    exceptions
      error_no_gui         = 1
      cntl_error           = 2
      not_supported_by_gui = 3
      others               = 4.

  if sy-subrc <> 0.
    ndone = -1.
  else.
    ndone = 1.
    case nplatform.
      when cl_gui_frontend_services=>platform_windows95.
        return = 'WN32_95'.
      when cl_gui_frontend_services=>platform_windows98.
        return = 'WN32_98'.
      when cl_gui_frontend_services=>platform_nt351.
        return = 'WN32'.
      when cl_gui_frontend_services=>platform_nt40.
        return = 'WN32'.
      when cl_gui_frontend_services=>platform_nt50.
        return = 'WN32'.
      when cl_gui_frontend_services=>platform_mac.
        return = 'MC'.
      when cl_gui_frontend_services=>platform_os2.
        return = 'PM'.
      when cl_gui_frontend_services=>platform_linux.
        return = 'MF'.
      when cl_gui_frontend_services=>platform_hpux.
        return = 'MF'.
      when cl_gui_frontend_services=>platform_tru64.
        return = 'MF'.
      when cl_gui_frontend_services=>platform_aix.
        return = 'MF'.
      when cl_gui_frontend_services=>platform_solaris.
        return = 'MF'.
      when cl_gui_frontend_services=>platform_macosx.
        return = 'MF'.
      when 14. "PLATFORM_WINDOWSXP
        return = 'WN32'.
      when cl_gui_frontend_services=>platform_unknown.
        return = '??'.
      when others.
        return = '??'.
    endcase.
  endif.

Regards

Raja

Read only

0 Likes
1,314

thanx Durairaj Athavan Raja ,

Your code really solved my problem Thank you,

Girish.