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: 

Export Data To Fixed Length File

Former Member
0 Kudos

Hello,

I have a requirement to export a couple of files that need to be in a fixed length format.

I've tried opening the dataset and writing the records passing the column that the records should appear:

WRITE /, field1, 10 field2, etc...

I've also tried to do it through SAP_CONVERT_TO_CSV_FORMAT and the text version as well.

Is there a predefined function that will allow me to export as fixed length?

Thank you in advance

1 ACCEPTED SOLUTION
3 REPLIES 3

Former Member
0 Kudos

Hi Jeff,

Can you expalin in more details as what is your exact requirement.

Regards,

Atish

former_member223537
Active Contributor
0 Kudos

Hi Jeff,

Following is the code to do the same:

DATA: file TYPE string VALUE `flights.dat`, 
      wa   TYPE spfli. 

FIELD-SYMBOLS TYPE x. 

OPEN DATASET file FOR OUTPUT IN BINARY MODE. 

SELECT * 
       FROM spfli 
       INTO wa. 
  ASSIGN wa TO CASTING. 
  TRANSFER TO file. 
* TRANSFER LENGTH 200 to file.

ENDSELECT. 

CLOSE DATASET file.

Best regards,

Prashant