Application Development 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: 

Problem with transfering the data to output file

Former Member
0 Kudos

Hi Gurus,

I am reading the data from a file processing it and sending it line by line to output file. I need to write this file to application server and I am using transfer statement for this one. My output file will be input for RFBIBL00 program. Now, the problem is , in the file, there is an extra empty line at the bottom. Its not supposed to be there. The FI posting session is reading it as an additional line item and it is looking for the details like gl account and all others.

Is there any way that we can get rid of this extra empty line? I used concatenate statement before the transfer.

Thanks in advance,

Regards,

Srinivas.

7 REPLIES 7

Former Member
0 Kudos

If the line is empty (initial), don't do the transfer.

Rob

0 Kudos

Hi Rob,

There is no question of empty line, as long as the loop ends , its not transfering any line. still we are getting this extra line.

Thanks,

Srinivas.

0 Kudos

Can you paste your Code..

 
DATA: lv_str       TYPE string,
      lv_char(256) TYPE c,
      lr_descrref  TYPE REF TO cl_abap_typedescr.

FIELD-SYMBOLS: <comp> TYPE ANY.

   OPEN DATASET p_hires FOR OUTPUT IN LEGACY TEXT MODE .
    IF sy-subrc EQ 0.
         LOOP AT lt_hires INTO ls_hires.
        WHILE sy-subrc EQ 0.
          ASSIGN COMPONENT sy-index  OF STRUCTURE ls_hires TO <comp>.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.

          lr_descrref = cl_abap_typedescr=>describe_by_data( <comp> ).
          IF lr_descrref->type_kind = 'P'.
            WRITE <comp> TO lv_char DECIMALS 2.
          ELSE.
            WRITE <comp> TO lv_char.
          ENDIF.
          SHIFT lv_char LEFT DELETING LEADING space.

          IF sy-index NE 1.
            CONCATENATE lv_str lv_char INTO lv_str SEPARATED BY p_del.
          ELSE.
            CONCATENATE lv_str lv_char INTO lv_str.
          ENDIF.
          CLEAR: lv_char.
        ENDWHILE.
        TRY.
* This statement passes the content of data object to the file specified
            TRANSFER lv_str TO p_hires.
          CATCH cx_sy_file_authority .
            FORMAT COLOR 6 ON.
            WRITE:/ 'No authorization to access the Hire file'.
        ENDTRY.
        CLEAR lv_str.
      ENDLOOP.
      CLOSE DATASET p_hires.
   ENDIF.

this is how i do it..

A

0 Kudos

can you post the portion of the code between the OPEN and CLOSE DATASET?

Rob

0 Kudos

Hi Rob, Here is the code that I wrote.

LOOP AT i_sel INTO wa_sel.

DATA: l_number TYPE i.

l_number = l_number + 1.

IF l_number EQ c_one.

PERFORM file_get_name_using_path USING p_dl_o1 p_dl_o2 p_dl_o3 p_dl_u8

CHANGING dateu.

OPEN DATASET dateu FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE c_zero.

MESSAGE e398 WITH 'Cannot Open Output File 't33).

STOP.

ENDIF.

MOVE 'X' TO wa_output-bkz.

ELSE.

MOVE space TO wa_output-bkz.

ENDIF.

.........

..........

COLLECT wa_output INTO i_output.

CLEAR: wa_output.

ENDIF.

ENDIF.

CLEAR: wa_sel.

ENDLOOP.

IF i_output[] IS NOT INITIAL.

LOOP AT i_output INTO wa_output.

CONCATENATE wa_output-bkz

wa_output-bukrs wa_output-bldat wa_output-blart wa_output-xblnr

wa_output-bktxt wa_output-waers wa_output-wwert wa_output-kursf wa_output-newbs

wa_output-newko wa_output-dmbtr wa_output-wrbtr wa_output-newum wa_output-txcty

wa_output-mwskz wa_output-gsber wa_output-zfbdt wa_output-valut wa_output-pernr

wa_output-prctr wa_output-kostl wa_output-aufnr wa_output-vbel2 Wa_output-projk wa_output-werks INTO l_data SEPARATED BY tabchar.

TRANSFER l_data TO dateu.

CLEAR: wa_output, l_data.

ENDLOOP.

CLOSE DATASET dateu.

Thanks,

Srinivas

Message was edited by:

srinivas kari

0 Kudos

Blank lines from I_OUTPUT will generate blank lines in your file. Or even if they are not blank, if none of the fields are concatenated, you will also generate a blank line.

Try:

    IF NOT l_data IS INITIAL.       "<====
      TRANSFER l_data TO dateu.
    ENDIF.

Rob

Former Member
0 Kudos

The problem was solved. It is the issue on the FI side, we can not do on our end , so it was solved.