Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Excel Download from AL11

Hi Experts,

I am facing an issue downloading AL11 data into the excel. I have a got an ALV report and before the report is getting displayed we are trying to sent the final internal contents to the AL11 directory. So our AL11 file looks something like this.

Coloumn Headings

     Coloumn Data

The '#' (as delimiter) i have annexed so that each data will sit in a cell in the excel. But it is not working. The whole line data is coming in a single cell. I am using the the standard option to download to excel . system -> List -> Save -> Local File. So is it possible to download to excel from AL11 with data in exact cells as we see in ALV ?

P.S. I am on 4.6 C

B.R.

replied

One more trick.....

DATA: message TYPE string .
   DATA: number TYPE n LENGTH 3 .

   DATA: my_string TYPE string .

   CONSTANTS: c_max_cols TYPE i VALUE 300 .

   OPEN DATASET dataset_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT MESSAGE message . " Output type


   TRANSFER '<style>'  TO dataset_path .
   TRANSFER 'table, th, td {  border: 1px solid black;  border-collapse: collapse}' TO dataset_path .

   TRANSFER 'th {  text-decoration: underline; text-transform: capitalize; font-style: italic;}' TO dataset_path .
   TRANSFER '</style>'  TO dataset_path .

   TRANSFER '<TABLE>' TO dataset_path .

   TRANSFER '<TR>' TO dataset_path .

* Headings
   DO c_max_cols TIMES .

     TRANSFER '<TH>' TO dataset_path .

     number = sy-index .

     CONCATENATE 'Head-' number INTO my_string RESPECTING BLANKS .

     TRANSFER my_string TO dataset_path  .

     TRANSFER '</TD>' TO dataset_path .

   ENDDO .

   TRANSFER '</TR>' TO dataset_path .

* Detail lines
   DO 20 TIMES .

     TRANSFER '<TR>' TO dataset_path .

     DO c_max_cols TIMES .

       TRANSFER '<TD>' TO dataset_path .

       number = sy-index .

       TRANSFER number TO dataset_path .

       TRANSFER '</TD>' TO dataset_path .

     ENDDO .

     TRANSFER '</TR>' TO dataset_path .

   ENDDO .

   TRANSFER '</TABLE>' TO dataset_path .

   CLOSE DATASET dataset_path .


html :



Excel:


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question