Skip to Content
author's profile photo Former Member
Former Member

who can tell this:"OPEN DATASET PATH FOR OUTPUT IN LEGACY TEXT MODE CODE "

Who can show me an example,thanks~

I really wants to know "OPEN DATASET PATH FOR OUTPUT IN LEGACY TEXT MODE CODE page"

after "CODE page" parameter.

thanks~~

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:54 AM

    hi,

    check this..

     tables: mara.
    
    data: begin of it_lfa1 occurs 0,
    vendor like lfa1-lifnr,
    land1 like lfa1-land1,
    name1 like lfa1-name1,
    ort01 like lfa1-ort01,
    end of it_lfa1.
    
    selection-screen: begin of block b1 with frame.
    parameters: p_file type rlgrap-filename obligatory.
    selection-screen: end of block b1.
    
    at selection-screen on value-request for p_file.
    
    
    start-of-selection.
    perform transfer_file using p_file.
    
    perform write.
    
    
    form transfer_file using p_p_file.
    data: l_message(30) type c.
    
    ***opening dataset for reading
    open dataset p_p_file for input in text mode encoding default message
    l_message.
    if sy-subrc ne 0.
    message i001(zerr2) with p_p_file.
    endif.
    *******transferring data from file to app server.
    do.
    read dataset p_p_file into it_lfa1.
    if sy-subrc = 0.
    append it_lfa1.
    clear it_lfa1.
    else.
    exit.
    endif.
    enddo.
    *******closing dataset
    close dataset p_p_file.
    
    
    endform. " transfer_file
    
    form write .
    loop at it_lfa1.
    write:/ it_lfa1-vendor,
    it_lfa1-land1,
    it_lfa1-name1,
    it_lfa1-ort01.
    endloop.
    endform. " write

    If Found Help Full Do reward.

    Regards.

    Eshwar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2008 at 09:34 AM

    Hi

    Please check below coding try use this.

    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT

    IGNORING CONVERSION ERRORS.

    IF sy-subrc <> 0.

    WRITE: /2 text-003 , p_file INVERSE COLOR 7.

    EXIT.

    ENDIF.

    LOOP AT i_output ASSIGNING <fs_record>.

    TRY.

    CLEAR l_string.

    l_string = <fs_record>.

    TRANSFER l_string TO p_file.

    CATCH cx_sy_file_io INTO l_rec.

    l_exception = l_rec->get_text( ).

    ENDTRY.

    ENDLOOP.

    IF NOT l_exception IS INITIAL.

    WRITE: /2 text-004 , p_file INVERSE COLOR 7.

    ENDIF.

    CLOSE DATASET p_file.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.