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

get two internal tables data into one file

Hi everybody,

i have two internal tables that contains two kinds of records

ITAB1(detail records), ITAB2(trail records)

i want to transfer these two internal table contents into one file .

i already created a file using <b>open dataset</b> statement

plz guide me how to do this.

regards

Siri

Add comment
10|10000 characters needed characters exceeded

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 04:09 PM

    hi ,

    by using Transfer statement u can transfer data into file .

    syn is : TRANSFER <field> TO <file name>.

    in your case loop at itab1.

    TRANSFER itab1 TO <file name>.

    endloop.

    loop at itab2.

    TRANSFER itab2 TO <file name>.

    endloop.

    Regards

    Ashok P

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      iam unable to create a file . i am getting a run time error in Transfer statement.

      TRANSFER WA_DETAILS TO P_PATH.

      the error is 'WA_DETAILS having non chareter type .

      current progarm is flaged as a unicode program .

      In the unicode contest , type X feilds are seen as non char type , as are structers that contain non char type components' .

      plz suggest me how to do.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 04:07 PM

    no probs,

    if you want your data to passed one after the another internal table,

    LOOP AT ITAB1.

    TRANSFER ITAB1 TO FILENAME.

    ENDLOOP.

    *--TO TRANSFER 2ND TABLE.

    LOOP AT ITAB2.

    TRANSFER ITAB1 TO FILENAME.

    ENDLOOP.

    CLOSE DATASET FILENAME

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 03, 2006 at 04:09 PM

    Try this:

    OPEN DATASET TARGET FOR OUTPUT IN TEXT MODE.

    LOOP AT ITAB1.

    TRANSFER ITAB1 TO TARGET.

    ENDLOOP.

    LOOP AT ITAB2.

    TRANSFER ITAB2 TO TARGET.

    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      iam unable to create a file . i am getting a run time error in Transfer statement.

      TRANSFER WA_DETAILS TO P_PATH.

      the error is <b>'WA_DETAILS having non chareter type .

      current progarm is flaged as a unicode program .

      In the unicode contest , type X feilds are seen as non char type , as are structers that contain non char type components' .</b>

      plz suggest me how to do.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 05:43 PM

    Then you have to open the file in text mode and encoding default. It seems ur program is unicode acitve please do an F1 help on Open Dataset command.U can see the options there.

    Add comment
    10|10000 characters needed characters exceeded