Skip to Content
avatar image
Former Member

how can i send data to unix file on application server

1) how can i send data to unix file on application server.

how it is defferent from sending data to .txt file

i will award maximum points .

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

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

    hi Vijay ,

    Go for this hope u may get idea .EVERYTHING IS GATHERD FROM SDN THREADS.

    http://www.sap-img.com/ab008.htm

    REPORT ZUNIX.

    DATA UNIXCMD(50) TYPE C.

    DATA: BEGIN OF ITAB occurs 0,

    LINE(200),

    end of ITAB.

    PARAMETERS UNIXCOMM LIKE UNIXCMD

    DEFAULT 'ls -ls /usr/sap/trans/data' LOWER CASE.

    • Executing the system commands witin ABAP.

    call 'SYSTEM' id 'COMMAND' field UNIXCOMM

    id 'TAB' field ITAB-SYS.

    EDITOR-CALL FOR ITAB DISPLAY-MODE.

    2) just check out this .

    Here is a sample, This program will upload a comma delimited file from app server, and break it up into specific fields of an ITAB.

    report zrich_0001

    no standard page heading.

    parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.csv'.

    data: begin of itab occurs 0,

    fld1(20) type c,

    fld2(20) type c,

    fld3(20) type c,

    end of itab.

    data: wa(2000) type c.

    start-of-selection.

    open dataset d1 for input in text mode.

    if sy-subrc = 0.

    do.

    read dataset d1 into wa.

    if sy-subrc <> 0.

    exit.

    endif.

    split wa at ',' into itab-fld1 itab-fld2 itab-fld3.

    append itab.

    enddo.

    endif.

    close dataset d1.

    3)

    parameters: p_file like rlgrap-filename obligatory

    default '/usr/sap/upload.xls'.

    types: begin of t_data,

    vbeln like vbap-vbeln,

    posnr like vbap-posnr,

    matnr like vbap-matnr,

    werks like vbap-werks,

    megne like vbap-zmeng,

    end of t_data.

    data: it_data type standard table of t_data,

    wa_data type t_data.

    open dataset p_file for output in text mode encoding default.

    if sy-subrc ne 0.

    write:/ 'Unable to open file:', p_file.

    else.

    do.

    read dataset p_file into wa_data.

    if sy-subrc ne 0.

    exit.

    else.

    append wa_data to it_data.

    endif.

    enddo.

    close dataset p_file.

    endif.

    4)

    data : begin of ifile occurs 0,

    text(1023) type c,

    end of ifile.

    form add_header .

    concatenate 'Lotid' ','

    'PTC in' ','

    'PTC in qty' ','

    'PTC out' ','

    'PTC out qty' ','

    'Invoice#' ','

    'Invoice date' ','

    'Invoice qty' ','

    into ifile-text.

    append ifile. clear ifile.

    endform. " add_header

    form add_details .

    loop at aud_details.

    move aud_details-fkimg to aud_details-fkimg1.

    concatenate

    aud_details-lotid ','

    aud_details-stagestarttime ','

    aud_details-stagestartqty ','

    aud_details-stageendtime ','

    aud_details-totalnetshipmentsmain ','

    aud_details-vbeln ','

    aud_details-fkdat ','

    aud_details-fkimg1 ','

    into ifile-text.

    append ifile. clear ifile.

    endloop.

    endform. " add_details

    open dataset outpath for output in text mode encoding default.

    if sy-subrc = 0.

    loop at ifile.

    transfer ifile to outpath.

    endloop.

    endif.

    close dataset outpath.

    Note : move qty fields to char fields and concatenate.

    Reward Points if helpful.

    Thanks

    Naveen khan

    Thanks

    Naveen khan

    Message was edited by:

    Pattan Naveen

    Message was edited by:

    Pattan Naveen

    Add comment
    10|10000 characters needed characters exceeded