ALV last 10 columns are truncating in background mode

I am using Reuse_alv_list_display function module and running the report in the background mode, the spool is generating fine but the problem is that the last 10 columns of the report are truncating.what will be the possible solution.

The default maximum line width of the spool is 255 characters which means anything more the 255 will be truncated, To display more the 255 characters you have to do two things:
1] select a printer format which outputs more than 255 characters for eg x_65_512 or x_65_1023. If you cannot find any printer which has these formats then you have to ask the basis guys to create Z format for you like Z_65_1023.
2] After you use the above format of the printer when you display the spool there is an option of "DISPLAY IN MAXIMUM WIDTH" in the tool bar. Choose that it will show you the entire output.

Similar Messages

  • Horizontal Scroll on ALV last column

    Hi gurus,
    Let see I can explain my issue.
    I have an ALV with 20 fields, I have put scrolling for 5 columns, to first two ones are frozen. I have set 150px as width for each column. Scrolling is working fine but when I reach the final scroll I can't see the LAST COLUMN (FIELD20), I mean, the column doesn't have the proper width (150px), for the rest columns the width is appearing properly.
    I copy my source code and a image link to more details:
      DATA lo_column TYPE REF TO cl_salv_wd_column.
      lo_column = lo_value->if_salv_wd_column_settings~get_column( 'FIELD' ).
      lo_column->set_fixed_position( cl_wd_abstr_table_column=>e_fixed_position-left ).
      lo_column = lo_value->if_salv_wd_column_settings~get_column( 'FIELD_OCULTO' ).
      lo_column->set_fixed_position( cl_wd_abstr_table_column=>e_fixed_position-left ).
      DATA: lt_columns TYPE salv_wd_t_column_ref,
            ls_column  TYPE salv_wd_s_column_ref.
      CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = lt_columns.
      LOOP AT lt_columns INTO ls_column.
        lo_column = lo_value->if_salv_wd_column_settings~get_column( ls_column-id ).
        lo_column->set_width( '150PX' ).
      ENDLOOP.
      lo_value->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).
    * Cantidad de columnas que ocupan el scroll.
      CALL METHOD lo_value->if_salv_wd_table_settings~set_first_visible_scroll_col
        EXPORTING
          value  = 'FIELD'.
      lo_value->if_salv_wd_table_settings~set_scrollable_col_count( 5 ).
    [http://imageshack.us/photo/my-images/836/abap.jpg/]
    Any idea?
    Regards

    Hi,
    Try adding this:
    DATA l_table TYPE REF TO cl_salv_wd_config_table.
    l_table->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).
    In case this doesn't help, does the problem remain when you try changing the column width to, let's say, 75PX?
    Cheers, Lukas

  • ALV grid on pop-up in background mode

    I have a report calling FM 'MESSAGES_SHOW' , which displays the messages in a pop-up in ALV grid format.
    Now, when I run the report in background, the error messages are not shown.
    Is there anyway to get around it ?

    Try with import parameter
    BATCH_LIST_TYPE = 'L'.

  • Alv out put was truncated while giving print

    hi,
    I have developed one alv report.
    while giving out put for print last columns are truncating.
    How to handle this?
    Thanks in advance,

    Hi,
    There can be many reasons. What is the width of your output list? Many printers takes 255 characters width. Check the printer settings in T-code SPAD to see howmuch width you can print.
    Other option could be, print in landscape format.
    Thanks,
    Vinod.

  • Report execution error with columns,rows truncating

    One of abaper executing report in background and he selected Output device:LOCL and format type:X_65_512/2 but some columns are truncating with that properties.to overcome this can i create new page format or format type? how can i assign page format to device type and device type to output device?
    explain me soonplz
    Thanks

    Hi,
    Pls see in text format in preview mode if that is ok then you have to check your output software format.
    Anil

  • Suppressed some coloum while executing in Background mode

    Hi All
    As I am trying to execute report in foreground mode I am getting ALV output properly with all coloum while I am executing the same report in background mode I am getting same output with some of the coloum is not coming properly.
    Please guide me to resolve the above issue.
    Thanks
    KRISH

    Hi All
    I am executing the custom report in foreground mode ALV output showing all columns for that same report I am executing in background mode some of the ALV output columns are missed out
    For example:
    Standard report output showing 10 columns, but I am executing the same report in background some of the columns are suppressed only I am able to view 5 columns remaining I am not able to view.
    Please help me to resolve the above issue.
    Thanks
    KRISH

  • ALV List only 80 Columns when runinning as background job

    Hello Guys,
    I have a Problem with an ALV List.
    We use the FM REUSE_ALV_HIERSEQ_LIST_DISPLAY for a Document Journal.
    When I run it in foreground it works fine. But when I view the spool in background the list makes a break at excactly 80 signs, but the line size should be about 120.
    In the report the Line-Size is set correctly, even the print parameters seem to be ok. We are running it with X_65_255.
    I saw that there are some SAP Notes to this topic, but on our release (SAP_BASIS 700) the notes are already implemented.
    Has anyone a solution to this topic?
    Thanks and regards
    Roland

    Try this.
    [ALV List only 80 Columns when running in background job|https://forums.sdn.sap.com/click.jspa?searchID=25735042&messageID=5686003]

  • Last Column of ALV gets compressed

    HI ,
    The last column of ALV gets compressed when I manually set my widths to my fields.
    I have a comments section in my Table when the data is huge, So I have to set the width of the field so that the table does not look odd.
    But when I add the same, the last field of my ALV gets compressed. I added one last field to the same ALV table, and last added field is compressed.
    My code for setting the ALV data is as follows.
        lo_table_settings->set_fixed_table_layout( abap_true ).
    LOOP AT t_column INTO w_column.
           IF w_column-id = 'COMMENTS'.
             lr_textview ?= w_column-r_column->get_cell_editor( ).
             lr_textview->set_wrapping( abap_true ).
             lr_textview->set_design(
                 value = cl_wd_text_view=>e_design-label_small
             w_column-r_column->set_width( value = '600' ).
           ELSE.
             w_column-r_column->set_width( value = '100' ).
             lr_header =  w_column-r_column->get_header( ).
             lr_header->set_header_text_wrapping( value = abap_true  ).
           ENDIF.
         ENDLOOP.
    Please help me in this regard.

    Hi Rama,
    The last column of ALV is compressed, the Width of last column is so small that the table looks very awkward.
    The complete data is shown, no data is truncated.
    I already set the condition you mentioned. I placed the same in code in my post.

  • Data in ALV column getting truncated

    Hi All,
    Need help.
    The problem is:
    In my ALV grid(Obj Oriented) there are 15-16 columns.Of this the last column can
    have a maximum length of 1000 characters.I have given outlen in field catalogue as 1000 and also marked cwidth_opt as 'X'.Despite this the data
    in last column is getting tuncated.Please suggest

    Hi,
    You cannot  display total 1000 chars in the cell. I guess when u view the same in Print preview, u can find all 1000 chars.
    But one thing is u cannot view all 1000 chars as it is in the view.
    revrt back if any issues.
    regards,
    Naveen

  • ALV - Excel download Date field sits in the last Column

    Hi,
    I have custom ALV grid report using OOp . From the report i am exporting the results to an EXCEL, but the date columns in the report sits as last column the exported excel.
    Any idea ?
    Thanks
    aRs

    That is the default functionality of the ALV grid, it collects all the similar data types together and then donwloads the data.
    If you don't want that, you will have write code yourself and download the data
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • All the columns of an alv grid report are not downloading in excel in 1 lin

    Hi All,
    I have some 60 columns in my alv grid report and user can download the report using list->export->localfile->spreadsheet.
    What the issue is that all the columns are not downloading in one line, instead they split in two rows.
    Please help.
    Regards,
    Neha Patel

    hi,
    just use this procedure it will solve your problem:
    Firstly export  the data to memory using the FM LIST_FROM_MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_listobject
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE e000(su) WITH text-001.
    ENDIF.
    then i converted it into ASCII using LIST_TO_ASCI,
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = t_xlstab
    listobject = t_listobject
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    IF sy-subrc NE 0.
    MESSAGE e003(yuksdbfzs).
    ENDIF.
    This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
    cl_abap_char_utilities=>horizontal_tab.
    Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
    This will create an excel attachment.
    Sample code for formatting the data for the attachment in excel format.
    u2022     Format the data for excel file download
    LOOP AT t_xlstab INTO wa_xlstab .
    DESCRIBE TABLE t_xlstab LINES lw_cnt.
    CLEAR lw_sytabix.
    lw_sytabix = sy-tabix.
    u2022     If not new line then replace '|' by tabs
    IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
    REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
    WITH cl_abap_char_utilities=>horizontal_tab.
    MODIFY t_xlstab FROM wa_xlstab .
    CLEAR wa_xlstab.
    wa_xlstab = cl_abap_char_utilities=>newline.
    IF lw_cnt NE 0 .
    lw_sytabix = lw_sytabix + 1.
    u2022     Insert new line for the excel data
    INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
    lw_cnt = lw_cnt - 1.
    ENDIF.
    CLEAR wa_xlstab.
    ENDIF.
    ENDLOOP.
    Sample code for creating attachment and sending mail:
    FORM send_mail .
    u2022     Define the attachment format
    lw_doc_type = 'XLS'.
    u2022     Create the document which is to be sent
    lwa_doc_chng-obj_name = 'List'.
    lwa_doc_chng-obj_descr = w_subject. "Subject
    lwa_doc_chng-obj_langu = sy-langu.
    u2022     Fill the document data and get size of message
    LOOP AT t_message.
    lt_objtxt = t_message-line.
    APPEND lt_objtxt.
    ENDLOOP.
    DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
    IF lw_tab_lines GT 0.
    READ TABLE lt_objtxt INDEX lw_tab_lines.
    lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    lwa_doc_chng-obj_langu = sy-langu.
    lwa_doc_chng-sensitivty = 'F'.
    ELSE.
    lwa_doc_chng-doc_size = 0.
    ENDIF.
    u2022     Fill Packing List For the body of e-mail
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = 'RAW'.
    APPEND lt_packing_list.
    u2022     Create the attachment (the list itself)
    DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
    u2022     Fill the fields of the packing_list for creating the attachment:
    lt_packing_list-transf_bin = 'X'.
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = lw_doc_type.
    lt_packing_list-obj_name = 'Attach'.
    lt_packing_list-obj_descr = w_docdesc.
    lt_packing_list-doc_size = lw_tab_lines * 255.
    APPEND lt_packing_list.
    u2022     Fill the mail recipient list
    lt_reclist-rec_type = 'U'.
    LOOP AT t_recipient_list.
    lt_reclist-receiver = t_recipient_list-address.
    APPEND lt_reclist.
    ENDLOOP.
    u2022     Finally send E-Mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = lw_sent_to_all
    TABLES
    packing_list = lt_packing_list
    object_header = lt_objhead
    contents_bin = t_xlstab
    contents_txt = lt_objtxt
    receivers = lt_reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    Hope it will help you
    Regards
    Rahul sharma

  • Multiple Alv in background mode

    Hi all,
    I am executing a program with two ALV's using a splitter container in background mode..It generates a spool with the data of only one alv..It never reflects both the alv's together..
    Please provide with a solution..
    Points will be rewarded...
    Thanks in advance..
    Arun

    Unfortunately, ALV functionality is lost when the program is executed in the background. You'll have to modify the program to use plain WRITE, for example, or run it in the foreground.

  • Last column in HTMLB table gets truncated

    Hi,
       The last column in a HTMLB table gets truncated,i.e, only part of the column is visible. The table's border (along the column) is also not visible.
          I've tried by reducing the number of columns, but the last column always gets truncated.
         This iView has the same properties as other iViews with HTMLB tables, but those iViews display correctly all the HTMLB tables, even when they have much more number of columns.
         I'm new to this and don't have much idea.Does anyone has suggesstions regarding this?

    Hi Sagar,
    First, welcome on the SDN forum!
    About your question: Strip down your code to the absolute minimum required to reproduce your problem. This way maybe you can analyse the problem by yourself. If not, you can still submit this example here (this is also a reason why to strip down the code to a minimum, cause otherwise nobody will read the code if it's longer the necessary).
    Hope it helps
    Detlev

  • The columns are missed in Backgroup job in report program

    Hi experts,
        I have a report program and I  display it by WRITE statement. The total length of the report is about 550, and I set the line-size to 600. When I run it by backgroup job, it can not display the row completedly, the last  10 columns are missed. Do any one know what happpen and how I fixed it? Thanks in advance.
    Best Regards
    Joe

    Hi Kiran,
    I had completed the program and now I am showing you my solution in brief.
    I hvae two programs to meet the solution. First is ZSDR0087 and next is ZSDR0087_RAW_PROGRAM. The former program is just for the purpose of calliing latter program, and latter program is for handling the program logic. The transaction code link to ZSDR0087 They are using a same selection screen.
    Below is the cods of selection screen
    SELECTION-SCREEN BEGIN OF BLOCK sel1 WITH FRAME TITLE text-001.
    PARAMETERS: p_hbad TYPE /bluesky/cshbad-hbad OBLIGATORY MEMORY ID hba."#EC EXISTS
    SELECT-OPTIONS: s_airli FOR /bluesky/mdairlz-airline MODIF ID m4,
                    s_altp FOR /bluesky/mdairlz-altp MODIF ID m4,
                    s_kunnr FOR knvv-kunnr MODIF ID m4,
                    s_prsdt FOR /bluesky/fecpost-prsdt MODIF ID m4,
    *                s_atdat FOR /bluesky/fearde-atdat OBLIGATORY,
                    s_actyp FOR /bluesky/mdacrt-actyp MODIF ID m4,
                    s_mtmcat FOR /bluesky/mdacrt-mtomcat MODIF ID m4,
                    s_regid FOR /bluesky/mdreg-regid MODIF ID m4,
                    s_fenum FOR /bluesky/fehdr-fenum MODIF ID m4.
    PARAMETERS: p_en_ex TYPE c AS LISTBOX VISIBLE LENGTH 10 MODIF ID m4.
    SELECTION-SCREEN END OF BLOCK sel1.
    SELECTION-SCREEN BEGIN OF BLOCK run WITH FRAME TITLE text-003.
    PARAMETERS: p_imm RADIOBUTTON GROUP grp1 DEFAULT 'X' USER-COMMAND comm."Run the program immdiately and show report at frontend
    PARAMETERS: p_batch RADIOBUTTON GROUP grp1, "Run in backgroup job, the result will be saved at application server as .txt file
                p_file  TYPE g_type_file LOWER CASE MODIF ID m1. ".txt File name which will be saved in application server
    PARAMETERS: p_ser RADIOBUTTON GROUP grp1. "Read the data from .txt file in application server
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(14) text-004 FOR FIELD p_txt MODIF ID m2.
    PARAMETERS: p_txt  TYPE g_type_file LOWER CASE MODIF ID m2."Source .txt file in application server
    SELECTION-SCREEN COMMENT 50(14) text-005 FOR FIELD p_del MODIF ID m2.
    PARAMETERS: p_del AS CHECKBOX MODIF ID m2. "The .txt file will be deleted once the report is generated
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK run.
    SELECTION-SCREEN BEGIN OF BLOCK sel2 WITH FRAME TITLE text-002.
    PARAMETERS: p_xls AS CHECKBOX DEFAULT '' MODIF ID m3."Generate the excel file in frontend
    SELECTION-SCREEN END OF BLOCK sel2.
    Main Code in ZSDR0083
    REPORT  zsdr0087 MESSAGE-ID zbluesky_program LINE-SIZE 530 NO STANDARD PAGE HEADING."#EC *
    INCLUDE zsdr0087_top.
    INCLUDE zsdr0087_common_blk.
    INCLUDE zsdr0087_frm.
    START-OF-SELECTION.
      PERFORM handle_report.
    FORM handle_report .
      IF p_imm = 'X' OR p_ser = 'X'.
        PERFORM run_program_without_batch.
      ELSEIF p_batch = 'X'.
        PERFORM submit_to_batch.
      ENDIF.
    ENDFORM.                    " handle_report
    FORM run_program_without_batch .
      DATA: lv_answer TYPE c.
      IF p_ser = 'X' AND p_txt IS INITIAL.
        MESSAGE s029.
        EXIT.
      ENDIF.
      IF p_ser = 'X' AND p_del = 'X' AND p_xls = ''.
        PERFORM popup_to_confirm USING 'Delete file in server' "titlebar
                                       'The file in server will be deleted, are you going to save the data in Excel file?' "question
                                       'SAVE IN EXCEL'"the text in first button
                                       'ICON_XLS' "the icon for first button
                                       'Not Save'
                                       'ICON_WARNING'"the icon for second button
                                       '1'"default button
                                       'X'"display cancel button
                                CHANGING lv_answer.
        CASE lv_answer.
          WHEN '1'.
            p_xls = 'X'.
          WHEN '2'.
            p_xls = ''.
          WHEN 'A'.
            MESSAGE s032.
            EXIT.
        ENDCASE.
      ENDIF.
      SUBMIT zsdr0087_raw_program WITH p_hbad = p_hbad
                                  WITH s_airli IN s_airli
                                  WITH s_altp IN s_altp
                                  WITH s_kunnr IN s_kunnr
                                  WITH s_prsdt IN s_prsdt
                                  WITH s_actyp IN s_actyp
                                  WITH s_mtmcat IN s_mtmcat
                                  WITH s_regid IN s_regid
                                  WITH p_en_ex = p_en_ex
                                  WITH p_imm = p_imm
                                  WITH p_batch = p_batch
                                  WITH p_file = p_file
                                  WITH p_ser = p_ser
                                  WITH p_txt = p_txt
                                  WITH p_del = p_del
                                  WITH p_xls = p_xls
                                  AND RETURN.
    ENDFORM.                    " run_program_without_batch
    FORM submit_to_batch .
      DATA: lv_job_name TYPE tbtcjob-jobname,
            lv_job_number TYPE tbtcjob-jobcount.
      lv_job_name = p_file.
      TRANSLATE lv_job_name TO UPPER CASE.
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = lv_job_name
        IMPORTING
          jobcount         = lv_job_number
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
      IF sy-subrc <> 0.
        MESSAGE e022.
      ENDIF.
      SUBMIT zsdr0087_raw_program WITH p_hbad = p_hbad
                                  WITH s_airli IN s_airli
                                  WITH s_altp IN s_altp
                                  WITH s_kunnr IN s_kunnr
                                  WITH s_prsdt IN s_prsdt
                                  WITH s_actyp IN s_actyp
                                  WITH s_mtmcat IN s_mtmcat
                                  WITH s_regid IN s_regid
                                  WITH p_en_ex = p_en_ex
                                  WITH p_imm = p_imm
                                  WITH p_batch = p_batch
                                  WITH p_file = p_file
                                  WITH p_ser = p_ser
                                  WITH p_txt = p_txt
                                  WITH p_xls = p_xls
                                  VIA JOB lv_job_name NUMBER lv_job_number
                                  AND RETURN.
      IF sy-subrc NE 0.
        MESSAGE e023 WITH 'zsdr0087_raw_program'..
      ENDIF.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = lv_job_number
          jobname              = lv_job_name
          strtimmed            = 'X'
        EXCEPTIONS
          cant_start_immediate = 1
          invalid_startdate    = 2
          jobname_missing      = 3
          job_close_failed     = 4
          job_nosteps          = 5
          job_notex            = 6
          lock_failed          = 7
          OTHERS               = 8.
      IF sy-subrc NE 0.
        MESSAGE e025.
      ELSE.
        MESSAGE s026.
      ENDIF.
    ENDFORM.                    " submit_to_batch
    :OK, Below is main code in program ZSDR0087_RAW_PROGRAM
    REPORT  zsdr0087 MESSAGE-ID zbluesky_program LINE-SIZE 530 NO STANDARD PAGE HEADING."#EC *
    INCLUDE zsdr0087_top.
    INCLUDE zsdr0087_common_blk.
    INCLUDE zsdr0087_frm.
    START-OF-SELECTION.
      IF sy-tcode EQ 'SE38' OR sy-tcode EQ 'SA38'.
        MESSAGE s035.
        EXIT.
      ENDIF.
      CREATE OBJECT go_bluesky_program
        EXPORTING
          i_home_base = p_hbad.
      IF p_imm = 'X' OR p_batch = 'X'.
    ********  Get data from database
        PERFORM get_data_from_db.
        IF p_batch = 'X'.
    *******Save the data the server as .txt file, it will run at backgroup Job
          PERFORM save_data_to_server USING <gt_output>
                                            p_hbad
                                            gv_run_time
                                            gv_run_date
                                            sy-uname
                                            gv_top_folder
                                            p_file
                                            go_bluesky_program->gt_fieldcat_lvc.
          EXIT.
        ENDIF.
      ELSE.
    ******** Get data from server
        PERFORM get_data_from_server.
      ENDIF.
      IF <gt_output> IS ASSIGNED AND <gt_output> IS NOT INITIAL.
        IF p_xls = 'X' AND p_batch = ''.
          PERFORM output_excel.
        ENDIF.
        PERFORM display_report.
      ELSE.
        MESSAGE s004(zbluesky_program).
      ENDIF.
    If parameter p_batch is check, The subroutine save_data_to_server will save the internal table data as .txt file at server.This is run in backgroup.Please set your focus on the function module C13Z_TEXT_WRITE
    FORM save_data_to_server USING ut_internal_table TYPE STANDARD TABLE
                                   u_home_base
                                   u_run_time TYPE syuzeit
                                   u_run_date TYPE sydatum
                                   u_user TYPE syuname
                                   u_top_folder TYPE rsmrgstr-path
                                   u_filename   TYPE g_type_file
                                   ut_fieldcat_lvc   TYPE lvc_t_fcat.
      FIELD-SYMBOLS: <lt_table_dataset> TYPE STANDARD TABLE.
      DATA: lv_table_ref TYPE REF TO data.
      DATA: lv_filename TYPE rcgiedial-iefile.
      DATA: lv_file_pattern TYPE rsmrgstr-name.
      CALL METHOD go_bluesky_program->convert_data_to_dataset_format
        EXPORTING
          it_internal_table = ut_internal_table
          it_fieldcat_lvc   = ut_fieldcat_lvc
        IMPORTING
          et_table_ref      = lv_table_ref.
      ASSIGN lv_table_ref->* TO <lt_table_dataset>.
    *******Create file name
      PERFORM get_filename USING
                 u_home_base
                  u_user
                  u_run_date
                  u_run_time
                  u_filename
        CHANGING lv_filename
                 lv_file_pattern.
    ******Check filename again
      PERFORM check_filename_if_duplicate
                  USING
                     lv_filename
                     u_top_folder
                     lv_file_pattern.
    ******Create dataset path
      CONCATENATE u_top_folder lv_filename INTO lv_filename.
      CALL FUNCTION 'C13Z_TEXT_WRITE'
        EXPORTING
          i_file         = lv_filename
        TABLES
          i_textdata_tab = <lt_table_dataset>
        EXCEPTIONS
          no_permission  = 1
          open_failed    = 2
          ap_file_exists = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
        MESSAGE e021.
      ENDIF.
    ENDFORM.                    " save_data_to_server
    If parameter p_ser is check, The subroutine get_data_from_server will read the data from .txt file in server and put it into internal table. Please focus on the DO looping in the subroutine.It is the codes for reading data from .txt file into internal table.
    FORM get_data_from_server .
      FIELD-SYMBOLS: <lt_table_dataset> TYPE STANDARD TABLE,
                     <ls_line_dataset> TYPE ANY,
                     <field_runtime> TYPE ANY,
                     <field_dataset> TYPE ANY.
      DATA: lv_table_ref TYPE REF TO data,
            lv_line_ref TYPE REF TO data.
      DATA: lv_file TYPE string.
      DATA: ls_file_record TYPE rsfillst.
      DATA: ls_fieldcat_lvc TYPE lvc_s_fcat.
      PERFORM build_output_table.
    ******Get the dataset format(all the fiels are CHAR type)
      CALL METHOD go_bluesky_program->convert_data_to_dataset_format
        EXPORTING
          it_internal_table = <gt_output>
          it_fieldcat_lvc   = go_bluesky_program->gt_fieldcat_lvc
        IMPORTING
          et_table_ref      = lv_table_ref.
      ASSIGN lv_table_ref->* TO <lt_table_dataset>.
      CREATE DATA lv_line_ref LIKE LINE OF <lt_table_dataset>.
      ASSIGN lv_line_ref->* TO <ls_line_dataset>.
      PERFORM get_file_record
                  USING
                     sy-mandt
                     sy-uname
                     p_hbad
                     gv_top_folder
                  CHANGING
                     ls_file_record.
      CONCATENATE ls_file_record-dirname ls_file_record-name INTO lv_file.
      OPEN DATASET lv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
        MESSAGE e030 WITH p_txt.
      ENDIF.
      DO.
        READ DATASET lv_file INTO <ls_line_dataset>.
        IF sy-subrc EQ 0.
          IF <ls_line_dataset> IS NOT INITIAL.
            APPEND <ls_line_dataset> TO <lt_table_dataset>.
            CLEAR <ls_line_dataset>.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET lv_file.
      IF p_del = 'X'.
        DELETE DATASET lv_file.
      ENDIF.
    *  break chengr.
      LOOP AT <lt_table_dataset> ASSIGNING <ls_line_dataset>.
        LOOP AT go_bluesky_program->gt_fieldcat_lvc INTO ls_fieldcat_lvc.
          ASSIGN COMPONENT ls_fieldcat_lvc-fieldname
                             OF STRUCTURE <ls_line_dataset> TO <field_dataset>.
          ASSIGN COMPONENT ls_fieldcat_lvc-fieldname
                             OF STRUCTURE <gs_output> TO <field_runtime>.
          <field_runtime> = <field_dataset>.
        ENDLOOP.
        APPEND <gs_output> TO <gt_output>.
      ENDLOOP.
    At last, I think you understand how to display it in ALV .

  • Data of alv report in  excel file in background processing using open datas

    Hi Experts,
    I have developed report for purchase register . if i execute this report in background process i am not able to get the downloaded file in excel and output is also not coming properly, columns are going to overlap.
    i used open dataset  read dataset and close dataset but still problem is not solved. so if anyone have code with this and also which will have concatenate statement in the code send it.
    Regards,
    Rahul

    Hi Rahul,
    Ur code shud be like below:
    DATA : l_filename2 TYPE string,
                v_extn.
        SPLIT p_filename AT '.xls' INTO l_filename2  v_extn.
        CONCATENATE l_filename2  'downloaded'  INTO l_filename2  SEPARATED BY '_'.
        CONCATENATE l_filename2  'txt'   INTO l_filename2 SEPARATED BY '.'.
        OPEN DATASET l_filename2 IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
        IF sy-subrc <> 0.
          MESSAGE e499(sy) WITH text-e02.
        ENDIF.
        LOOP AT it_order_number INTO wa_order_number.
          TRANSFER wa_order_number TO l_filename2.
        ENDLOOP.
        CLOSE DATASET l_filename2.
    Now, go to tcode AL11 and check it in the Application server itself.
    Hope this helps,
    Regards,
    Arnab.

Maybe you are looking for