Skip to Content

NUL record in file when downloading from Unix

Hello Experts!

I have a Z program which downloads some Z tables to a file in the application server. Now , I have added a couple of tables to be downloaded, however those tables gets downloaded to the file with an error.

file output with error:

028||0000000001||0000000160||0000000001||PRUEBA

NULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNULNUL

(First record Ok, but second line have NUL Record)

If you debug the program, the internal table contains only 1 record. This is ok, but when you open the file you see that it has the nul record.

The files that were already being downloaded are OK, they do not contain the nul record. All files gets downloaded in the same way

This is the code I'm using

file without errors

OPEN DATASET p_soccat FOR OUTPUT IN TEXT MODE.
  LOOP AT t_soc_cat.
    MOVE-CORRESPONDING t_soc_cat TO wa_cat_soc_cat.
    wa_cat_soc_cat-fil01 = wa_cat_soc_cat-fil02
                                   = '||'.
    TRANSFER wa_cat_soc_cat TO p_soccat.
  ENDLOOP.
  CLOSE DATASET p_soccat.

file with errors

  OPEN DATASET p_relcab FOR OUTPUT IN TEXT MODE.
  LOOP AT t_relcab_cat.
    CLEAR w_relcab_cat_w.
    MOVE-CORRESPONDING t_relcab_cat TO w_relcab_cat_w.
    w_relcab_cat_w-fil01 = w_relcab_cat_w-fil02 =
                           w_relcab_cat_w-fil03 =
                           w_relcab_cat_w-fil04 = '||'.
    TRANSFER w_relcab_cat_w TO p_relcab.
  ENDLOOP.
  CLOSE DATASET p_relcab.

- Adding LENGTH to the transfer line will not work, i have already tried that.

- Users downloads the file accessign the unix server, they are not using any SAP transaction.

Sorry if this is too long, but I tried to explain my issue the best I could.

So, any ideas how to get the file downloaded without the NUL record?

Thanks in advance!

Kind regards!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jul 15, 2011 at 07:02 PM

    Hi,

    please provide the definition of wa_cat_soc_cat . That would be great if you could tell us the elementary predefined data types (C, X, string, xstring, etc.) that are used, not the structures or data elements.

    Thx

    Sandra

    Add a comment
    10|10000 characters needed characters exceeded

    • I see no reason why it would be different between the 2 files.

      The only possibility I see is that t_relcab_cat contains null bytes. Did you check by debug? Did you use somewhere CLEAR ... WITH NULL, or CL_ABAP_CHAR_UTILITIES=>MINCHAR, or a SO_SOLIXTAB_TO_SOLITAB function module, or things like that?

      Or maybe the issue is the way you see the NULNULNUL..., how do you get that? Does NUL correspond to bytes with value 0?

  • Posted on Jul 18, 2011 at 11:45 AM

    I'm closing the thread. It was a user issue when downloading the file from unix. Thank you for your help.

    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.