Skip to Content
avatar image
Former Member

Reading the Archiving Directory

Hi All,

i have a requirement wherein i need to display the files present in the Archiving Unix directory.

any FM available for this??

Regards,

priya.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 02:09 PM

    Hi, Priya

    can u try this.

    CALL FUNCTION 'Z_UNIX_SEND_COMMAND'.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 02:16 PM

    Hi Priya, U can aslo check this

    FUNCTION Z_UNIX_SEND_COMMAND .

    *"----


    ""Local interface:

    *" IMPORTING

    *" REFERENCE(SCRIPT) LIKE SXPGCOLIST-PARAMETERS

    *" EXPORTING

    *" REFERENCE(SUBRC) LIKE SY-SUBRC

    *" TABLES

    *" TAB_RS STRUCTURE BTCXPM

    *"----


    DATA: c_script_dataset type sxpgcolist-parameters,

    c_unix_command TYPE SXPGCOLIST-NAME,

    c_script type sxpgcolist-parameters,

    c_msg(100) TYPE c,

    c_script_directory(200) TYPE c

    VALUE '/var/fusion/interfaces'.

    .

    DATA: t_btcxpm TYPE STANDARD TABLE OF btcxpm WITH HEADER LINE.

    CLEAR: t_btcxpm, t_btcxpm[].

    c_script = script.

    • access UNIX script file

    CONCATENATE c_script_directory '/ucmd'(002)

    sy-uname sy-UZEIT '.script'(003)

    INTO c_script_dataset.

    TRANSLATE c_script_dataset TO LOWER CASE.

    • open dataset (script file) and fill with data

    OPEN DATASET c_script_dataset

    FOR OUTPUT

    IN TEXT MODE

    MESSAGE c_msg.

    IF sy-subrc <> 0.

    MESSAGE i013(zm) WITH c_msg.

    EXIT.

    ENDIF.

    • save command

    • TRANSLATE c_script TO LOWER CASE.

    TRANSFER c_script TO c_script_dataset.

    • close dataset

    CLOSE DATASET c_script_dataset.

    c_unix_command = 'ZSH'.

    CALL FUNCTION 'SXPG_CALL_SYSTEM'

    EXPORTING

    COMMANDNAME = c_unix_command

    ADDITIONAL_PARAMETERS = c_script_dataset

    • IMPORTING

    • STATUS =

    • EXITCODE =

    TABLES

    EXEC_PROTOCOL = t_btcxpm

    EXCEPTIONS

    NO_PERMISSION = 1

    COMMAND_NOT_FOUND = 2

    PARAMETERS_TOO_LONG = 3

    SECURITY_RISK = 4

    WRONG_CHECK_CALL_INTERFACE = 5

    PROGRAM_START_ERROR = 6

    PROGRAM_TERMINATION_ERROR = 7

    X_ERROR = 8

    PARAMETER_EXPECTED = 9

    TOO_MANY_PARAMETERS = 10

    ILLEGAL_COMMAND = 11

    OTHERS = 12

    .

    IF sy-subrc eq 0.

    tab_rs[] = t_btcxpm[].

    ELSE.

    tab_rs-message = 'command failed'.

    append tab_rs.

    ENDIF.

    subrc = sy-subrc.

    • remove file

    c_unix_command = 'ZRM'.

    CALL FUNCTION 'SXPG_CALL_SYSTEM'

    EXPORTING

    COMMANDNAME = c_unix_command

    ADDITIONAL_PARAMETERS = c_script_dataset

    • IMPORTING

    • STATUS =

    • EXITCODE =

    TABLES

    EXEC_PROTOCOL = t_btcxpm

    EXCEPTIONS

    NO_PERMISSION = 1

    COMMAND_NOT_FOUND = 2

    PARAMETERS_TOO_LONG = 3

    SECURITY_RISK = 4

    WRONG_CHECK_CALL_INTERFACE = 5

    PROGRAM_START_ERROR = 6

    PROGRAM_TERMINATION_ERROR = 7

    X_ERROR = 8

    PARAMETER_EXPECTED = 9

    TOO_MANY_PARAMETERS = 10

    ILLEGAL_COMMAND = 11

    OTHERS = 12

    .

    IF sy-subrc eq 0.

    IF sy-subrc eq 0.

    tab_rs[] = t_btcxpm[].

    endif.

    ELSE.

    tab_rs-message = 'command failed'.

    append tab_rs.

    ENDIF.

    ENDFUNCTION.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 02:18 PM

    Hi,

    use the below class in the AT SELECTION SCREEN ON VALUE REQUEST for G_PATH.

    CALL METHOD cl_gui_frontend_services=>directory_browse

    CHANGING

    selected_folder = g_path.

    Here is the example code

    http://www.sapdevelopment.co.uk/file/file_disall.htm

    Regards

    Sudheer

    Add comment
    10|10000 characters needed characters exceeded