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

Replacement for ws_query

Former Member
0 Likes
550

Hi all,

can anyone help me regarding this issue. Requirement is it has to return the path like C:\Program Files\SAP\FrontEnd\sapgui. when iam trying to replace ws_query with its_query, its giving dump and if i use some methods which are there in sdn, i didnt get the required result(path). Thanks in advance

CALL FUNCTION 'WS_QUERY'

EXPORTING

query = 'XP'

IMPORTING

return = p_patout

EXCEPTIONS

inv_query = 1

no_batch = 2

frontend_error = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

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

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

ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
507

Try this

  DATA lv_winsys(10). "Returncode for operating system check
  DATA lv_path LIKE rlgrap-filename VALUE 'C:'. "Default Path
  DATA lv_path2 LIKE rlgrap-filename VALUE 'C:'. "Default Path
  DATA lv_mode VALUE 'O'.
  DATA lv_file LIKE rlgrap-filename.

  DATA lv_title1(24) VALUE 'System-Message: ABORTION'.
  DATA lv_title2(24) VALUE 'System-Message: ABORTION'.
  DATA lv_message1(48) VALUE
              '32-bit Windows Operating-System needed on Client'.
  DATA lv_message2(35) VALUE 'Action aborted due to system error!'.
  DATA lv_title3(14) VALUE 'Select a File:'.
  DATA lv_mask(16) VALUE ',All Files,*.*,.'.

  IF NOT pc_file IS INITIAL.
* Split Filename in Path and Filename
    CALL FUNCTION '/SAPDMC/LSM_PATH_FILE_SPLIT'
      EXPORTING
        pathfile = lv_file
      IMPORTING
        pathname = lv_path2.
*              filename = lv_file.
    IF NOT lv_path2 IS INITIAL.
      lv_path = lv_path2.
    ENDIF.
  ENDIF.

* Check if there is a 32bit Windows system installed on client
  CALL FUNCTION 'WS_QUERY'
    EXPORTING
      query          = 'WS'
    IMPORTING
      return         = lv_winsys
    EXCEPTIONS
      inv_query      = 1
      no_batch       = 2
      frontend_error = 3
      OTHERS         = 4.
* Raise Error if the operating system id different than 32 bit Windows
  IF sy-subrc <> 0 OR lv_winsys(4) <> 'WN32'.
    CALL FUNCTION 'FC_POPUP_ERR_WARN_MESSAGE'
      EXPORTING
        popup_title  = lv_title1
        is_error     = 'X'
        message_text = lv_message1
        start_column = 25
        start_row    = 6.
    EXIT.
  ENDIF.

* Get the File
  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      def_filename     = '*.*'
      def_path         = lv_path
      mask             = lv_mask
      mode             = lv_mode
      title            = lv_title3
    IMPORTING
      filename         = lv_file
    EXCEPTIONS
      inv_winsys       = 1
      no_batch         = 2
      selection_cancel = 3
      selection_error  = 4
      OTHERS           = 5.
  IF sy-subrc <> 0.
    IF sy-subrc <> 3.
      CALL FUNCTION 'FC_POPUP_ERR_WARN_MESSAGE'
        EXPORTING
          popup_title  = lv_title2
          is_error     = 'X'
          message_text = lv_message2
          start_column = 25
          start_row    = 6.
    ENDIF.
  ENDIF.

Read only

Former Member
0 Likes
507

Thanks a lot