ALV to spool display half report

Hi ,
I have generated ALV report which is working fine on foreground but when I execute this report in the background it shows half (some columns are missing) in the generated spool. I need to execute this report in background due to large amount of data. Is this due to the size exceeding more than 255 chars ?
If yes, is there any solution ?

Hi,
You have to configure the printer settings, consult basis people for the same. Also refer to the note as below:
ALV print : Print formatting in the background
SAP Note Number: 674348 
Symptom
Wen you execute a report in the background with a preset printer, a default format is always transferred. In general, this format is too small for the ALV and the table is therefore truncated during printing.
If you would like to change this behavior, you have two options:
1. The format can be changed subsequently either directly in the print dialog box or in the spool display.
2. If you wish the list width to be recalculated, this modification must be implemented in the ALV.
Other terms
ALV Grid Control (CL_GUI_ALV_GRID), REUSE_ALV_GRID_DISPLAY, ALV print: Background, print, print formatting, format, ALV background: Background processing, in the background
Reason and Prerequisites
A print format that was transferred in the background was set as default.
Implementing note 669744 is a prerequisite.
Solution
Implement the source code corrections in accordance with the correction instructions. Then remove the * character in the following lines:
    else.  "Modifikation
     call function 'UNSET_PRINTPARAMETER'      "Y9CK042107
           exporting
                name = 'LAYOUT'
               in_parameters = rs_pri_params
           importing
                out_parameters = rs_pri_params.
This note cannot be implemented using the Note Assistant. Customers must take this modification into consideration when implementing updates at a later stage.
Hope it helps.
Lokesh

Similar Messages

  • Spool Display of Report Status

    Hi Friends
    My report program runs in back ground job. One internal table collects all messages (error messages and status messages) at execution.
    I need to display this internal table content as a spool display. Spool number has to be generated with this internal table content. So that I can see the content in transaction SP01.
    Can any one help me to achieve this?
    Thanks
    Hari

    Hi,
    I think u just need to write your internal table content.
    And when you run this report in back ground job, it will have a spool.
    Regards,

  • Probelm of displaying alv fields in Spool display

    In report using alv grid,
    i am able to see all columns in normal output displauy
    but in spool display some last columns are not displaying,
    so what could be the problem?
    Edited by: samdup on Apr 9, 2010 1:51 PM

    In your print spool, check the spool no. you want to print.
    Then click on the small print button (Shift F1 - print with changed parameters). 
    At the bottom of the pop up screen, under spool request, you may need to adjust your Format to view more columns.  Mine is currently set to X_65_200 and it just depends on what print devices you have set up.  You can give this a try to see it helps or not.
    Good luck,
    Cindy

  • Field symbol has not yet been defined-ALV Grid Display in Report

    Hi all,
              Iam calling a Function module for ALV grid display in Report programming. Its throwing the Error message Field Symbol has not yet defined. Can any one suggest what i have to do regarding it?

    Hi,
    <li> This is problem with fieldcatalog.
    <li> Check field names or table name in small letters in quotes while building fieldcatalog internal table
    <li> Check the fieldcatalog internal table , whether it has same fields as in data table which is shown using GRID_DISPLAY function module.
    Thanks
    Venkat.O

  • ALV display in report

    Hi All,
    I m trying to display ALV in report using classes but i m not able to do it. I have used following classes for alv display along with its method.
    1. cl_gui_custom_container
    2.  cl_gui_alv_grid and its method set_table_for_first_display
    I have tried to display in module pool using classes and i have succeeded but now i m trying wid report using the same classes but i m not able to display ALV
    Please provide me solution and if there exists another classes to display ALV along wid its methods.
    Regards,
    Parag

    Hi,
    in the report program also you have to call a screen and in the PBo write the code for display of ALV
    Please check the below program:
    REPORT  z271837_alv_grid_container              .
    Important Classes : CL_GUI_ALV_GRID and CL_GUI_CUSTOM_CONTAINER.
    *Steps To Use ALV Grid in a Program :
    *1. Declare reference variables for,
          Container (class CL_GUI_CUSTOM_CONTAINER) and
          Grid (class CL_GUI_ALV_GRID)
    *2. Create Standard Screen and a container on that screen
    *3. Call the screen which has been created
    *4. Instantiate the container control and the ALV Grid Control in PBO of the screen
    Tables
    TABLES : mara.
    TYPE-POOLS : slis.
    Data declarations
    DATA : fg_error TYPE flag.
    TYPES : BEGIN OF x_mara,
             matnr TYPE mara-matnr,
             erdda TYPE mara-ersda,
             ernam TYPE mara-ernam,
             mtart TYPE mara-mtart,
             matkl TYPE mara-matkl,
            END OF x_mara.
    Declare reference variables:
    DATA : cl_grid      TYPE REF TO cl_gui_alv_grid,
           cl_container TYPE REF TO cl_gui_custom_container.
    DATA : it_mara TYPE TABLE OF x_mara,
           wa_fieldcat TYPE lvc_s_fcat,  "  occurs 1.
           it_fieldcat TYPE TABLE OF lvc_s_fcat.
    Selection Screen.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_matnr FOR mara-matnr.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETER : rb_list TYPE char1 RADIOBUTTON GROUP r1,
                rb_grid TYPE char1 RADIOBUTTON GROUP r1 DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK b2.
    START-OF-SELECTION.
      CLEAR fg_error.
      REFRESH it_mara.
    *Get the data which is to be displayed into one internal table
      SELECT matnr
             ersda
             ernam
             mtart
             matkl
       FROM mara
       INTO TABLE it_mara
       WHERE matnr IN s_matnr.
      IF sy-subrc NE 0.
        MESSAGE s000(zi) WITH text-s01.
        fg_error = 'X'.
        EXIT.
      ENDIF.
    END-OF-SELECTION.
      CHECK fg_error IS INITIAL.
    build the field catalog
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-row_pos = 1.
      wa_fieldcat-col_pos = 1.
      wa_fieldcat-SCRTEXT_M = 'Material'.
      wa_fieldcat-outputlen = 18.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'ERSDA'.
      wa_fieldcat-row_pos = 1.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-SCRTEXT_M = 'ERSDA'.
      wa_fieldcat-outputlen = 18.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'ERNAM'.
      wa_fieldcat-row_pos = 1.
      wa_fieldcat-col_pos = 3.
      wa_fieldcat-SCRTEXT_M = 'Creator'.
      wa_fieldcat-outputlen = 18.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'MTART'.
      wa_fieldcat-row_pos = 1.
      wa_fieldcat-col_pos = 4.
      wa_fieldcat-SCRTEXT_M = 'Material Type'.
      wa_fieldcat-outputlen = 18.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'MATKL'.
      wa_fieldcat-row_pos = 1.
      wa_fieldcat-col_pos = 5.
      wa_fieldcat-SCRTEXT_M = 'Material Desc'.
      wa_fieldcat-outputlen = 50.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    Call the screen with container to display ALV
      CALL SCREEN 100.
    PBO and PAI modules code along with ALV container and display methods
      INCLUDE z271837_alv_grid_container_o01.
    ***INCLUDE Z271837_ALV_GRID_CONTAINER_O01 .
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS '0100'.
    SET TITLEBAR 'xxx'.
    Instantiate the container control and the ALV Grid
    Control in PBO of the screen
      IF cl_container IS INITIAL.
    Instantiate the container control
        CREATE OBJECT cl_container
          EXPORTING
       PARENT                      =
            container_name              = 'C1_CONTAINER'
       STYLE                       =
       LIFETIME                    = lifetime_default
       REPID                       =
       DYNNR                       =
       NO_AUTODEF_PROGID_DYNNR     =
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Instantiate the ALV grid
        CREATE OBJECT cl_grid
          EXPORTING
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
            i_parent          = cl_container  " Container object created above
       I_APPL_EVENTS     = space
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_NAME            =
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    *For displaying the data, call the method "set_table_for_first_display"
    *of object reference of CL_GUI_ALV_GRID
        CALL METHOD cl_grid->set_table_for_first_display
    EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
          CHANGING
            it_outtab                     = it_mara
            it_fieldcatalog               = it_fieldcat
       IT_SORT                       =
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 3
       others                        = 4
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
    *Refresh grid display
      CALL METHOD cl_grid->refresh_table_display.
      CASE sy-ucomm.
        WHEN 'BACK'.
    Comes back to the previous screen
          SET SCREEN 0.
        WHEN 'EXIT'
        OR 'CANCEL'.
    Exit from the application/program
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Reward if useful
    Regards
    Shiva

  • Display two reports in ALV grid

    Hi,
    i have written a program to display a list from a table in ALV grid control...can someone tell me how to display 2 reports side by side in the same screen.
    thanks in advance...

    See the simple example :
    REPORT z_alv_block_list.
    Type-pools
    TYPE-POOLS: slis.
    Data declarations.
    DATA: BEGIN OF t_vbak OCCURS 0,
            vbeln TYPE vbeln,
            bstnk TYPE vbak-bstnk,
            erdat TYPE vbak-erdat,
            kunnr TYPE vbak-kunnr,
          END OF t_vbak.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln  TYPE vbeln,
            matnr  TYPE vbap-matnr,
            netpr  TYPE vbap-netpr,
            waerk  TYPE vbap-waerk,
            kwmeng TYPE vbap-kwmeng,
            meins  TYPE vbap-meins,
          END OF t_vbap.
    DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
    DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
    DATA: v_repid         TYPE syrepid.
    DATA: s_layout        TYPE slis_layout_alv.
    DATA: v_tabname       TYPE slis_tabname.
    DATA: t_events        TYPE slis_t_event.
    start-of-selection event.
    START-OF-SELECTION.
      v_repid = sy-repid.
    Get the fieldcatalog for the first block
      PERFORM get_fieldcat1 CHANGING t_fieldcatalog1.
    Get the fieldcatalog for the second block
      PERFORM get_fieldcat2 CHANGING t_fieldcatalog2.
    Get the data for the first block
      SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
             INTO TABLE t_vbak
             FROM vbak WHERE vbeln > '0060000100'.
    Get the data for the second block
      SELECT vbeln matnr netpr waerk kwmeng meins UP TO 10
    ROWS
             INTO TABLE t_vbap
             FROM vbap WHERE vbeln > '0060000100'.
    init
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
           EXPORTING
                i_callback_program = v_repid.
    First block
      v_tabname = 'ITAB1'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog1
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbak.
    Second block
      v_tabname = 'ITAB2'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog2
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbap.
    *Display
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
          FORM GET_FIELDCAT1                           
          Get the field catalog for the first block    
    FORM get_fieldcat1 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer purchase order.
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'BSTNK'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'BSTNK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Creation date.
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'ERDAT'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'ERDAT'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'KUNNR'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'KUNNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.
          FORM GET_FIELDCAT2                           
          Get the field catalog for the second block   
    FORM get_fieldcat2 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Material number
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'MATNR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MATNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Net price
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'NETPR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'NETPR'.
      s_fieldcatalog-cfieldname    = 'WAERK'.
      s_fieldcatalog-ctabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Currency.
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'WAERK'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'WAERK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Quantity
      s_fieldcatalog-col_pos       = '5'.
      s_fieldcatalog-fieldname     = 'KWMENG'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'KWMENG'.
      s_fieldcatalog-qfieldname    = 'MEINS'.
      s_fieldcatalog-qtabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    UOM
      s_fieldcatalog-col_pos       = '6'.
      s_fieldcatalog-fieldname     = 'MEINS'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MEINS'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.

  • Maximum line display in reports ex : Normal or ALV.

    Hi ,
          I like to know maximum lines display in reports normal classsical or ALV report .Can any one let me know .
    regards,
    veera

    Hey Veera,
    This is Ravi this side.
    In SAP there is concept of pages.
    There is no maximum no. of lines for the entire o/p as the o/p itself is divided into pages.
    However each page has its own size.
    The maximum for a page is 60,000
    Ravi

  • Page breaks appear in the spool output of report when run in the background

    Hi All,
    Report is using fm 'REUSE_ALV_GRID_DISPLAY' to display the report. parameters passed to this fm for display are :it_fieldcat,is_layout,it_events,t_outtab.
    Page breaks appear in the spool output when report is run in the background.These page breaks needs to be removed. When executed in the background, the excel extract should be the same as if pulling directly from the report itself.
    How to remove the page breaks in background?
    Thanks & Regards,
    Abhishek Singh

    Hi
    You can use the below code , which the reprt run in background. If you run the report in background thenyou need to use  'REUSE_ALV_LIST_DISPLAY'
    if sy-batch = ' '.
    call 'REUSE_ALV_GRID_DISPLAY'.
    else.
    call 'REUSE_ALV_LIST_DISPLAY'.
    endif.
    if you are using OO alv then write this code..
    CALL METHOD cl_gui_alv_grid=>offline
    RECEIVING e_offline = off.
    IF off IS INITIAL.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    ENDIF.
    Regards

  • How to display a report in tree format

    hai can any one send me the code to display the report in a tree format
    if i take example of customer numbers as tree branches and if i click each customer number the tree should expand showing all sales orders for a customer
    ragrds
    afzal

    use FM HR_ALV_HIERSEQ_LIST_DISPLAY
    there are 2 internal table , one for header and one for detail
    below is code for reference
    REPORT  zinsd_quot_cont.
    TYPES : BEGIN OF ty_vbak,
             vbeln TYPE      vbeln_va,
             vkorg TYPE      vkorg,
             vtweg TYPE      vtweg,
             spart TYPE      spart,
             vkbur TYPE     vkbur,
             vkgrp TYPE     vkgrp,
             angdt  TYPE angdt_v,
             bnddt  TYPE bnddt,
             kunnr  TYPE kunnr,
             kwmeng TYPE kwmeng,
             meins  TYPE meins,
             kunwe  TYPE kunnr,
             name1  TYPE  name1_gp  ,
             name2  TYPE  name1_gp  ,
             sel(1),
             expand(1),
             salesdocument TYPE bapivbeln-vbeln,
             message TYPE bapi_msg,
            END   OF ty_vbak.
    DATA :  w_vbak TYPE ty_vbak,
            t_vbak TYPE TABLE OF ty_vbak.
    DATA :  w_update TYPE ty_vbak,
            t_update TYPE TABLE OF ty_vbak.
    TYPES : BEGIN OF ty_kna1,
             kunnr  TYPE      kunnr,
             name1  TYPE  name1_gp  ,
            END   OF ty_kna1.
    DATA :  w_kna1 TYPE ty_kna1,
            t_kna1 TYPE TABLE OF ty_kna1.
    TYPES : BEGIN OF ty_vbap,
            vbeln      TYPE vbeln_va,
            posnr      TYPE posnr_va,
            matnr      TYPE matnr,
            matkl      TYPE matkl,
            werks      TYPE werks_ext,
            kwmeng TYPE kwmeng,
            meins      TYPE meins,
            mvgr5  TYPE     mvgr5,
            maktx  TYPE     maktx,
            END   OF ty_vbap.
    DATA :  w_vbap TYPE ty_vbap,
            t_vbap TYPE TABLE OF ty_vbap.
    TYPES : BEGIN OF ty_makt,
             matnr TYPE     matnr,
             maktx TYPE     maktx,
            END   OF ty_makt.
    DATA :  w_makt TYPE ty_makt,
            t_makt TYPE TABLE OF ty_makt.
    TYPES : BEGIN OF ty_sum,
            vbeln      TYPE vbeln_va,
            kwmeng TYPE kwmeng,
            END   OF ty_sum.
    DATA :  w_sum TYPE ty_sum,
            t_sum TYPE TABLE OF ty_sum.
    TYPES : BEGIN OF ty_vbpa,
            vbeln     TYPE vbeln,
            posnr     TYPE posnr,
            parvw     TYPE parvw,
            kunnr     TYPE kunnr,
            END   OF ty_vbpa.
    DATA :  w_vbpa TYPE ty_vbpa,
            t_vbpa TYPE TABLE OF ty_vbpa.
    TYPES : BEGIN OF ty_vbup,
            vbeln      TYPE vbeln,
            posnr  TYPE posnr ,
            gbsta      TYPE gbsta  ,
            END   OF ty_vbup.
    DATA :  w_vbup TYPE ty_vbup,
            t_vbup TYPE TABLE OF ty_vbup.
    TYPE-POOLS slis.
    DATA: t_fieldcatalog  TYPE slis_t_fieldcat_alv,
          w_fieldcatalog TYPE slis_fieldcat_alv,
          w_layout    TYPE slis_layout_alv,
          gs_keyinfo  TYPE slis_keyinfo_alv.
    DATA: g_tabname_header TYPE slis_tabname,
          g_tabname_item   TYPE slis_tabname.
      data definition
          Batchinputdata of single transaction
    DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
          messages of call transaction
    DATA:   messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
    DATA : g_lines TYPE i.
    *Selection Screen
    TABLES : vbak,vbap.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS s_vkorg FOR vbak-vkorg. " Sales Org
    SELECT-OPTIONS s_vtweg FOR vbak-vtweg. " Dist Channel
    SELECT-OPTIONS s_spart FOR vbak-spart. " Division
    SELECT-OPTIONS s_vkbur FOR vbak-vkbur. " Sales Off
    SELECT-OPTIONS s_vkgrp FOR vbak-vkgrp. " Sales Grp
    SELECT-OPTIONS s_matkl FOR vbap-matkl. " Mat Grp
    SELECT-OPTIONS s_werks FOR vbap-werks. " Plant
    SELECT-OPTIONS s_period FOR vbak-angdt. " Sales Off
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      PERFORM f_getdata.
      PERFORM f_initdata.
    END-OF-SELECTION.
      PERFORM f_createalv.
      PERFORM f_dispalv.
    *&      Form  f_getdata
          text
    -->  p1        text
    <--  p2        text
    FORM f_getdata .
    *Sales Header
      SELECT
        vbeln
        vkorg
        vtweg
        spart
        vkbur
        vkgrp
        angdt     
        bnddt
        kunnr
      INTO TABLE t_vbak
      FROM vbak
      WHERE
        vkorg IN s_vkorg      " Sales Org
        AND vtweg IN s_vtweg  " Dist Channel
        AND spart IN s_spart  " Division
        AND vkbur IN s_vkbur  " Sales Off
        AND vkgrp IN s_vkgrp  " Sales Grp
        AND angdt IN s_period
        AND bnddt IN s_period
        AND auart = 'ZQMO'
        AND vbtyp = 'B'.
    *CUST NAME
      SELECT
         kunnr
         name1
      INTO TABLE t_kna1
      FROM kna1
      FOR ALL ENTRIES IN t_vbak
      WHERE
       kunnr = t_vbak-kunnr
    *Sales Item
      SELECT
        vbeln     
        posnr     
        matnr     
        matkl     
        werks     
        kwmeng
        meins
        mvgr5
      INTO TABLE t_vbap
      FROM vbap
      FOR ALL ENTRIES IN t_vbak
      WHERE
       vbeln = t_vbak-vbeln
       AND matkl IN  s_matkl  " Mat Grp
       AND werks IN  s_werks  " Plant
    *Partners
      SELECT
       vbeln     
       posnr     
       parvw     
       kunnr     
      INTO TABLE t_vbpa
      FROM vbpa
      FOR ALL ENTRIES IN t_vbak
      WHERE
        vbeln = t_vbak-vbeln.
      IF t_vbpa[] IS NOT INITIAL.
        SELECT
            kunnr
            name1
         APPENDING TABLE t_kna1
         FROM kna1
         FOR ALL ENTRIES IN t_vbpa
         WHERE
          kunnr = t_vbpa-kunnr
      ENDIF.
    *Status - Sales Doc
      SELECT
        vbeln     
        posnr
        gbsta
      INTO TABLE t_vbup
      FROM vbup
      FOR ALL ENTRIES IN t_vbap
      WHERE
       vbeln = t_vbap-vbeln
       AND posnr = t_vbap-posnr
       AND gbsta NE 'C'.
      SELECT
          matnr
          maktx
      INTO TABLE t_makt
      FROM makt
      FOR ALL ENTRIES IN t_vbap
      WHERE
       matnr = t_vbap-matnr
       AND spras = 'E'.
    ENDFORM.                    " f_getdata
    *&      Form  f_initdata
          text
    -->  p1        text
    <--  p2        text
    FORM f_initdata .
      SORT t_vbap BY vbeln DESCENDING.
    *delete all closed stat items
      LOOP AT t_vbap INTO w_vbap.
        READ TABLE t_vbup INTO w_vbup
        WITH KEY
         vbeln = w_vbap-vbeln
         posnr = w_vbap-posnr.
        IF sy-subrc <> 0.
          DELETE t_vbap.
          CONTINUE.
        ELSE.
          READ TABLE t_makt INTO w_makt
          WITH
          KEY matnr = w_vbap-matnr.
          IF sy-subrc = 0.
            w_vbap-maktx = w_makt-maktx.
            MODIFY t_vbap FROM w_vbap.
          ENDIF.
        ENDIF.
      ENDLOOP.
    *find the total quantity
      LOOP AT t_vbap INTO w_vbap.
        w_sum-vbeln = w_vbap-vbeln.
        w_sum-kwmeng = w_vbap-kwmeng.
        COLLECT w_sum INTO t_sum.
        CLEAR w_sum.
      ENDLOOP.
    *populate header
      LOOP AT t_vbak INTO w_vbak.
      Quantity - Total
        READ TABLE t_sum INTO w_sum
        WITH KEY
         vbeln = w_vbak-vbeln.
        IF sy-subrc = 0.
          w_vbak-kwmeng = w_sum-kwmeng.
        ELSE.
          CLEAR w_vbak-kwmeng.
        ENDIF.
      UoM
        READ TABLE t_vbap INTO w_vbap
        WITH KEY
         vbeln = w_vbak-vbeln.
        IF sy-subrc = 0.
          w_vbak-meins = w_vbap-meins.
        ELSE.
          CLEAR w_vbak-meins.
        ENDIF.
      Partner
        READ TABLE t_vbpa INTO w_vbpa
        WITH KEY
         vbeln = w_vbak-vbeln
         parvw = 'WE'.
        IF sy-subrc = 0.
          w_vbak-kunwe = w_vbpa-kunnr.
        ELSE.
          CLEAR w_vbak-kunwe.
        ENDIF.
      SHIP TO PARTY NAME
        READ TABLE t_kna1 INTO w_kna1
        WITH KEY
         kunnr = w_vbak-kunwe.
        IF sy-subrc = 0.
          w_vbak-name2 = w_kna1-name1.
        ENDIF.
      CUST NAM - SOLD TO PARTY
        READ TABLE t_kna1 INTO w_kna1
        WITH KEY
         kunnr = w_vbak-kunnr.
        IF sy-subrc = 0.
          w_vbak-name1 = w_kna1-name1.
        ENDIF.
        MODIFY t_vbak FROM w_vbak.
      ENDLOOP.
      DELETE t_vbak WHERE kwmeng IS INITIAL.
      SORT t_vbak BY vbeln DESCENDING.
      SORT t_vbap BY vbeln  DESCENDING posnr ASCENDING.
    ENDFORM.                    " f_initdata
    *&      Form  f_createalv
          Create Field Cat.
    -->  p1        text
    <--  p2        text
    FORM f_createalv .
      g_tabname_header = 't_vbak'.
      g_tabname_item   = 't_vbap' .
      CLEAR gs_keyinfo.
      gs_keyinfo-header01 = 'VBELN'.
      gs_keyinfo-item01   = 'VBELN'.
    *VBAK
      w_fieldcatalog-fieldname = 'VBELN'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Sales Document'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'VKORG'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Sales Org'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'VTWEG'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Dist Channel'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'SPART'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Division'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'VKBUR'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Sales Office'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'VKGRP'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Sales GRP'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'KUNNR'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Sold to Party'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'NAME1'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-outputlen    = 35.
      w_fieldcatalog-seltext_l = 'Sold to Party Code - Name'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'KUNWE'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Ship to Party'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'NAME2'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Ship Party Code - Name'.
      w_fieldcatalog-outputlen    = 35.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'KWMENG'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Quantity'.
      w_fieldcatalog-outputlen    = 25.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'MEINS'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'UoM'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'SALESDOCUMENT'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Document'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'MESSAGE'.
      w_fieldcatalog-tabname   = 't_vbak'.
      w_fieldcatalog-seltext_l = 'Log'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
    *VBAP
      w_fieldcatalog-fieldname = 'POSNR'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'POS'.
      w_fieldcatalog-outputlen    = 6.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'MATNR'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'Material'.
      w_fieldcatalog-outputlen    = 18.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'MAKTX'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'Material Desc'.
      w_fieldcatalog-outputlen    = 40.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'MATKL'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'Material Grp'.
      w_fieldcatalog-outputlen    = 9.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'MVGR5'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'MCNO'.
      w_fieldcatalog-outputlen    = 4.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'WERKS'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'Plant'.
      w_fieldcatalog-outputlen    = 91.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'KWMENG'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'Quantity'.
      w_fieldcatalog-outputlen    = 25.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
      w_fieldcatalog-fieldname = 'MEINS'.
      w_fieldcatalog-tabname   = 't_vbap'.
      w_fieldcatalog-seltext_l = 'UoM'.
      APPEND w_fieldcatalog TO t_fieldcatalog.
      CLEAR: w_fieldcatalog.
    LAYOUT
    w_layout-colwidth_optimize  = 'X'.
      w_layout-zebra  = 'X'.
      w_layout-expand_fieldname = 'EXPAND'.
      w_layout-box_fieldname  = 'SEL'.
      w_layout-box_tabname  = 't_vbak'.
    ENDFORM.                    " f_createalv
    *&      Form  f_dispalv
          Call ALV
    -->  p1        text
    <--  p2        text
    FORM f_dispalv .
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
         EXPORTING
          i_callback_program             = sy-repid
          i_callback_pf_status_set       = 'SET_PF_STATUS'
          i_callback_user_command        = 'USER_COMMAND'
          is_layout                      = w_layout
          it_fieldcat                    = t_fieldcatalog
        IT_EXCLUDING                   =
        IT_SPECIAL_GROUPS              =
        IT_SORT                        =
        IT_FILTER                      =
        IS_SEL_HIDE                    =
        I_SCREEN_START_COLUMN          = 0
        I_SCREEN_START_LINE            = 0
        I_SCREEN_END_COLUMN            = 0
        I_SCREEN_END_LINE              = 0
        I_DEFAULT                      = 'X'
        I_SAVE                         = ' '
        IS_VARIANT                     =
        IT_EVENTS                      =
        IT_EVENT_EXIT                  =
           i_tabname_header               = g_tabname_header
           i_tabname_item                 = g_tabname_item
           is_keyinfo                     = gs_keyinfo
         TABLES
           t_outtab_header                = t_vbak
           t_outtab_item                  = t_vbap
        EXCEPTIONS
          program_error                  = 1
          OTHERS                         = 2
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    " f_dispalv
    *&      Form  set_pf_status
          PF stat
         -->RT_EXTAB   text
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZINSD_QUOT_CONT_ST'.
    ENDFORM.                    "set_pf_status
    *&      Form  user_command
          Process List UCOMM
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.
      REFRESH t_update.
      IF r_ucomm = 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
      IF r_ucomm = 'EXECUTE'.
        LOOP AT t_vbak INTO w_update
        WHERE
         sel = 'X'
         AND salesdocument = ' '.
          APPEND w_update TO t_update.
        ENDLOOP.
        IF t_update[] IS NOT INITIAL.
          LOOP AT t_update INTO w_update.
           PERFORM f_bapi_contract_createfromdata USING w_update.
            PERFORM f_bdc_contract_from_quotation.
            MODIFY t_update FROM w_update.
          ENDLOOP.
        ELSE.
        ENDIF.
        PERFORM f_dispalv.
      ENDIF.
      IF r_ucomm  = '&IC1'.
        IF rs_selfield-sel_tab_field = 't_vbak-VBELN'.
          SET PARAMETER ID 'AGN' FIELD rs_selfield-value.
          CALL TRANSACTION 'VA23' AND SKIP FIRST SCREEN.
        ENDIF.
        IF rs_selfield-sel_tab_field = 't_vbak-SALESDOCUMENT' AND
           rs_selfield-value NE ' '.
          SET PARAMETER ID 'KTN' FIELD rs_selfield-value.
          CALL TRANSACTION 'VA43' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM.                    "user_command
    *&      Form  F_BAPI_CONTRACT_CREATEFROMDATA
          BAPI CALL
         -->P_W_UPDATE  text
    FORM f_bapi_contract_createfromdata  USING  p_w_update  STRUCTURE w_update .
      DATA : w_contract_header_in  TYPE bapisdhd1  ,
             w_contract_header_inx TYPE bapisdhd1x ,
             t_contract_items_in   TYPE TABLE OF  bapisditm   WITH HEADER LINE,
             t_contract_items_inx  TYPE TABLE OF  bapisditmx  WITH HEADER LINE,
             t_contract_partners   TYPE TABLE OF  bapiparnr   WITH HEADER LINE,
             t_return              TYPE TABLE OF  bapiret2    WITH HEADER LINE.
      CLEAR : w_contract_header_in,
              w_contract_header_inx.
      REFRESH : t_contract_items_in,
                t_contract_items_inx,
                t_contract_partners,
                t_return.
      w_contract_header_in-doc_type   = 'ZCNT'.
      w_contract_header_in-sales_org  = p_w_update-vkorg.
      w_contract_header_in-distr_chan = p_w_update-vtweg.
      w_contract_header_in-division   = p_w_update-spart.
      w_contract_header_in-ct_valid_f = p_w_update-angdt.
      w_contract_header_in-ct_valid_t = p_w_update-bnddt.
      w_contract_header_inx-doc_type  = 'X'.
      w_contract_header_inx-sales_org = 'X'.
      w_contract_header_inx-distr_chan = 'X'.
      w_contract_header_inx-division  = 'X'.
      w_contract_header_inx-ct_valid_f = 'X'.
      w_contract_header_inx-ct_valid_t = 'X'.
      LOOP AT t_vbap INTO w_vbap
      WHERE
        vbeln = p_w_update-vbeln.
        t_contract_items_in-material = w_vbap-matnr.
        t_contract_items_in-plant    = w_vbap-werks.
        t_contract_items_in-target_qty = w_vbap-kwmeng.
        t_contract_items_in-target_qu  = w_vbap-meins.
        t_contract_items_in-ref_doc    = w_vbap-vbeln.
        t_contract_items_in-ref_doc_it = w_vbap-posnr.
        t_contract_items_in-ref_doc_ca = 'B'.
        t_contract_items_in-prc_group5 = w_vbap-mvgr5.
        t_contract_items_inx-material = 'X'.
        t_contract_items_inx-plant    = 'X'.
        t_contract_items_inx-target_qty = 'X'.
        t_contract_items_inx-target_qu  = 'X'.
        t_contract_items_inx-ref_doc    = 'X'.
        t_contract_items_inx-ref_doc_it = 'X'.
        t_contract_items_inx-ref_doc_ca = 'X'.
        t_contract_items_inx-prc_group5 = 'X'.
        APPEND t_contract_items_in.
        APPEND t_contract_items_inx.
      ENDLOOP.
      LOOP AT t_vbpa INTO w_vbpa
       WHERE
        vbeln =  p_w_update-vbeln.
         AND posnr = w_vbap-posnr.
        t_contract_partners-partn_role = w_vbpa-parvw.
        t_contract_partners-partn_numb = w_vbpa-kunnr.
        t_contract_partners-itm_number = w_vbpa-posnr.
        APPEND t_contract_partners.
      ENDLOOP.
      CALL FUNCTION 'BAPI_CONTRACT_CREATEFROMDATA'
        EXPORTING
      SALESDOCUMENTIN               =
        contract_header_in            = w_contract_header_in
        contract_header_inx           = w_contract_header_inx
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       = ' '
      INT_NUMBER_ASSIGNMENT         = ' '
      BEHAVE_WHEN_ERROR             = ' '
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
        salesdocument                 = p_w_update-salesdocument
    TABLES
        return                        = t_return
        contract_items_in             = t_contract_items_in
        contract_items_inx            = t_contract_items_inx
        contract_partners             = t_contract_partners
      CONTRACT_CONDITIONS_IN        =
      CONTRACT_CONDITIONS_INX       =
      CONTRACT_CFGS_REF             =
      CONTRACT_CFGS_INST            =
      CONTRACT_CFGS_PART_OF         =
      CONTRACT_CFGS_VALUE           =
      CONTRACT_CFGS_BLOB            =
      CONTRACT_CFGS_VK              =
      CONTRACT_CFGS_REFINST         =
      CONTRACT_DATA_IN              =
      CONTRACT_DATA_INX             =
      CONTRACT_TEXT                 =
      CONTRACT_KEYS                 =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
      IF p_w_update-salesdocument NE '   ' .
        p_w_update-message = 'SUCCESS'.
      ELSE.
        READ TABLE t_return INDEX 1.
        p_w_update-message =  t_return-message.
      ENDIF.
      READ TABLE t_vbak INTO w_vbak
      WITH KEY
      vbeln  = p_w_update-vbeln.
      IF sy-subrc = 0.
        MODIFY  t_vbak INDEX sy-tabix FROM p_w_update .
      ENDIF.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDFORM.                    " F_BAPI_CONTRACT_CREATEFROMDATA
    *&      Form  f_bdc_contract_from_Quotation
          BAPI CALL
         -->P_W_UPDATE  text
    FORM f_bdc_contract_from_quotation.
      DATA : l_date TYPE char10.
      REFRESH : messtab, bdcdata.
      CLEAR : messtab, bdcdata.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '0101'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=COPY'.
      PERFORM bdc_field       USING 'VBAK-AUART'
                                   'ZCNT'.
      PERFORM bdc_dynpro      USING 'SAPLV45C' '0100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=RANG'.
      PERFORM bdc_dynpro      USING 'SAPLV45C' '0100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=UEBR'.
      PERFORM bdc_field       USING 'LV45C-VBELN'
                                     w_update-vbeln.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=SICH'.
      IF NOT w_update-angdt IS INITIAL.
        CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
          EXPORTING
            date_internal            = w_update-angdt
          IMPORTING
            date_external            = l_date
          EXCEPTIONS
            date_internal_is_invalid = 1
            OTHERS                   = 2.
        PERFORM bdc_field       USING 'VBAK-GUEBG'
                                       l_date.
      ENDIF.
      IF NOT w_update-bnddt IS INITIAL.
        CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
          EXPORTING
            date_internal            = w_update-bnddt
          IMPORTING
            date_external            = l_date
          EXCEPTIONS
            date_internal_is_invalid = 1
            OTHERS                   = 2.
        PERFORM bdc_field       USING 'VBAK-GUEEN'
                                       l_date.
      ENDIF.
      CALL TRANSACTION 'VA41' USING bdcdata
                       MODE   'E'
                       UPDATE 'S'
                       MESSAGES INTO messtab.
      break abap.
      READ TABLE messtab WITH KEY msgid = 'V1'
                                  msgnr = '311'.
      IF sy-subrc EQ 0.
        w_update-message = 'SUCCESS'.
        w_update-salesdocument = messtab-msgv2.
      ELSE.
        READ TABLE messtab WITH KEY msgtyp = 'E'.
        IF sy-subrc EQ 0.
          DATA : l_info TYPE einfo.
          CLEAR l_info.
          l_info-msgid = messtab-msgid.
          l_info-msgty = messtab-msgtyp.
          l_info-msgno = messtab-msgnr.
          l_info-msgv1 = messtab-msgv1.
          l_info-msgv2 = messtab-msgv2.
          l_info-msgv3 = messtab-msgv3.
          l_info-msgv4 = messtab-msgv4.
          CALL FUNCTION 'MESSAGE_GET_TEXT'
            EXPORTING
              ieinfo        = l_info
              ilangu        = sy-langu
            IMPORTING
              etext         = w_update-message
            EXCEPTIONS
              no_t100_found = 1
              OTHERS        = 2.
        ENDIF.
      ENDIF.
      READ TABLE t_vbak INTO w_vbak WITH KEY vbeln  = w_update-vbeln.
      IF sy-subrc = 0.
        MODIFY  t_vbak INDEX sy-tabix FROM w_update transporting message
                                                                 salesdocument.
      ENDIF.
    ENDFORM.                    " f_bdc_contract_from_Quotation
           Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "bdc_dynpro
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "bdc_field

  • How to send an ALV to Spool

    Dear all,
    Could you please help, my requirement is to send an ALV report as a PDF attachement to a list of email address. My plan is to send the ALV to spool and read it from there and email it. However I have a problem in as much as the ALV is not being sent to spool, furthermore I also get print dialog popup when running the report. Can you please help, i am using CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY and  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' I have browsed here and there are several questions on this topic but they do not address the issue of sending the file to the spool. The partial code is below
    DATA:i_t001 TYPE t001 OCCURS 0,
         pdf    LIKE tline OCCURS 0,
         g_spool   TYPE tsp01-rqident,
         g_program TYPE sy-repid VALUE sy-repid.
    TYPE-POOLS:slis.
    DATA: w_print TYPE slis_print_alv,
          w_print_ctrl TYPE alv_s_pctl.
    PARAMETERS: p_file TYPE string.
    INITIALIZATION.
      p_file = 'H:\TEST_gh.pdf'.
    START-OF-SELECTION.
      rp-def-time-period.
      help1 = behrs DIV 24.
      bdate = ldate - help1.
      help1 = behrs MOD 24.
      help2 = ltime(2) - help1.
      IF help2 LT 0.
        bdate = bdate - 1.
        btime = ltime.
        btime(2) = 24 + help2.
      ELSE.
        btime = ltime.
        btime(2) = help2.
      ENDIF.
      pn-begps = ldate - 1.
      pn-endps = ldate.
    GET pernr.
      loop at p0007 where begda le ldate and endda ge ldate.  "
      endloop.                                              
    * überprüft Arbeitszeitplanregel
    * CHECK schkz.
      CHECK p0007-schkz IN schkz.
      CHECK p0007-zterf IN zterf.        
      CALL FUNCTION 'HR_SEL_STAT_CHECK'
           EXPORTING
                get_pernr    =  pernr-pernr
                get_ldate    =  ldate
                get_bdate    =  bdate
                get_btime    =  btime
                get_psp_flag =  psp_flag
                get_ltime    =  ltime
    *    IMPORTING
    *         NO_PERMIT    =
           TABLES
                get_p0000    =  p0000
                get_p0001    =  p0001
                get_p0002    =  p0002
                get_p0050    =  p0050
                get_p0007    =  p0007
                data_tab     =  data_tab.
    *   End-of-Selection                                                   *
    END-OF-SELECTION.
      loop at data_tab into ls_data_tab.
        ls_data_tab-total_records = '1'.
        ls_data_tab-kostl = p0001-kostl.
        Append ls_data_tab to lt_data_tab.
      endloop.
      DESCRIBE TABLE data_tab LINES lines.
      CALL FUNCTION 'HR_GET_ERROR_LIST'
        TABLES
          error      = errors
          errortexts = errortexts
        EXCEPTIONS
          no_errors  = 1
          OTHERS     = 2.
      IF lines EQ 0 AND sy-subrc EQ 1.
        MESSAGE i050.
        STOP.
      ENDIF.
      LOOP AT errors.
        READ TABLE data_tab WITH KEY errors-pernr.
        IF sy-subrc EQ 0.
          DELETE data_tab INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
      g_repid = sy-repid.
    * fill field catalog for output
      PERFORM fill_fcat USING  fcat
                               g_repid.
    * Listheader
      PERFORM fill_header USING header_alv_wa
                                header_alv.
      FIELD-SYMBOLS <lwa_fcat> like line of fcat.
      LOOP AT fcat ASSIGNING <lwa_fcat>.
        IF <lwa_fcat>-fieldname = 'TOTAL_RECORDS'.
          <lwa_fcat>-do_sum    = 'X'.
        ENDIF.
      ENDLOOP.
    *Right, sort the table and produce sub totals
      wa_sort-spos      = 18.
      wa_sort-fieldname = 'KOSTL'.
      wa_sort-up        = 'X'.
      wa_sort-subtot    = 'X'.
      append wa_sort to it_sort.
    * Layout for REUSE_ALV_GRID_DISPLAY
      s_layout-colwidth_optimize = 'X'.
      s_layout-zebra             = 'X'.
      s_layout-no_author         = 'X'.
    w_print-print = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = g_repid
        "      i_callback_pf_status_set = 'SET_PF_STATUS'
          i_callback_user_command = 'USER_COMMAND'  
          i_callback_top_of_page  = 'TOP_OF_PAGE'
          is_layout               = s_layout           
          it_fieldcat             = fcat
          it_sort                 = it_sort
          i_save                  = 'A'                       
          i_structure_name        = MY_STRUCTURE'
          is_print                = w_print
        TABLES
          t_outtab                = lt_data_tab
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
    ***=====================================================================*
        g_spool = sy-spono.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid = g_spool
          TABLES
            pdf         = pdf.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSE.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename = p_file
              filetype = 'BIN'
            TABLES
              data_tab = pdf.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
            CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
              EXPORTING
                i_callback_program      = g_repid
              "      i_callback_pf_status_set = 'SET_PF_STATUS'
                i_callback_user_command = 'USER_COMMAND'  
                i_callback_top_of_page  = 'TOP_OF_PAGE'
                is_layout               = s_layout           
                it_fieldcat             = fcat
                it_sort                 = it_sort
                i_save                  = 'A'                 
                i_structure_name        = MY_STRUCTURE'
              TABLES
                t_outtab                = lt_data_tab
              EXCEPTIONS
                program_error           = 1.
                ENDIF.
          endif.
        endif.

    Hi Andy ,
    write this code before calling "CONVERT_ABAPSPOOLJOB_2_PDF"
    CALL FUNCTION 'SET_PRINT_PARAMETERS'
         EXPORTING
           destination = 'LOCL' " Printer
           layout      = 'X_65_512/2' "Format "X_65_255
           line_count  = '65' "Line Count
           line_size   = '1024'. "Line Size
    Regards ,
    Yogendra Bhaskar

  • How to display a report in a container

    Hello All,
    There are 2 scenarios:-
    1) On left side navigation panel, I have a tree control. On double click on a node of a tree, I want to display a "report output" on the right panel. I have created the left panel and right panel by splitting the main custom container using splitter control. But I am not able to submit a report output on double click event of tree node as I dont know how to specify the parent container for the report.
    2) I want to divide the custom container into 4 equal parts. Then each part should display four reports which are output of 4 different programs.
    Kindly help me out with his issue.
    Needless to say that points will be awarded
    Thanks n Regards,
    Abhishek

    Hi Abhishek,
    you can't run a program in an container. That's not possible. But you can handle your requirement using one of the following ways:
    Way 1:
    Call the program in the double click event handler method by using the the statement e.g. submit and return. The program is then called in a separate screen(not in the container).
    Way 2:
    Copy the functionnality of the program in e.g. function module(FM). This FM gets the input parameters, processes the input and returns the results. The results are displayed e.g. in an ALV Grid. The steps getting the display results and setting the display data for the ALV are handled in the double click event handler method.
    Best Regards, Edemey

  • Spool Display is incorrect or rather truncated to say

    When i run the report RKO7CO88 the spool output has a few error messgaes that i have to see and check out for.
    But the spool display gets truncated after some length.
    Eg :  "Debit from actual settlement" not allowed (Sys. status CLSD, obje
    After OBJE there should be the Object number which is the most important part of this message. But its getting truncated. Can any one let me know how to by pass this display and get a complete display of the spool output.
    I have tried with various output forms but any pointers would be helpful
    Rgds,
    Sri

    Can you log into your Google mail account on a computer? Try that to be sure your email settings are correct.
    Also, try this link: https://accounts.google.com/DisplayUnlockCaptcha
    Google does inexplicable things from time to time. This may be one of them.

  • Displaying ABAP report on a web browser

    Hi,   I want to develop a code for displaying ABAP report on a web browser.

    Hi Rao,
    Are you looking for running ABAP report from portal / WDA?
    There are lot of similar threads available on SCN: to run ABAP report in WDA.
    Calling a TCODE PA60 from Web dynpro ABAP
    Call TCode MM02 from ALV
    Please search in SCN, hope you may find many threads.
    Regards,
    Rama

  • Memo data type displayed half page continued on next page

    Post Author: j45c
    CA Forum: Crystal Reports
    I am currently using crystal report IX which the memo field only displayed half of the page and continued on the next page. I have set can grow = true, keep object together = false and close border on page break = true.Would like to know how should I solve this by having the memo to filled up the rest of the page before continue display on the next page? Thanks in advance.

    Yes, you can't rely on getting the last entered ID on the next page as it may not be from the same person. I use the Insert-retrieve extension from Tom Muck which does this at the time of insert and stores it in a session variable. But backing up a bit, are 4 different forms really necessary. Most expense form are able to use a single form to capture all pertinent date. I would design a single form, submit it while using the retrieve ID extension, and direct to a summary page. That page would grab the just inserted records, and perform any monetary calculations needed. Also provide a link to an update page, basically a duplicate of the input page but with a recordset and fields Pre-populated. Once it's been input, reviewed and updated if needed, then it can be emailed, printed or exported to what the accounting people need to process it. Future enhancements may include a status indicator that defaults in incomplete. When in this mode, the user can log back in at a later time to complete it. Upon final submission, the record updates to Complete which prevents the user from making further changes. You could also build an admin section for various management tasks, and to enter the status of the request, that would appear in the users profile so they can see if and when they will get paid, or notices that require more info, like receipts.

  • Need ALV LIST for displaying Dynamic Internal Tables

    Hi Guys,
                     I have some thing like 2 Dynamic internal tables.
    Say 1st Internal table will be filled based on some condition.
    say 2nd table will be filled based on some condition.
    When appending the 1st Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
    In the same way when appending the 2nd Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
    My requirement is I need to display all these Internal tables in the output.
    The output should look something like
    1st Internal Table
    some gap
    2nd Internal Table
    some gap
    so on...................
    Is there any standard ALV List, to display all these Internal Tables in such a way.
    Thanks,
    Prasad.

    Hi.
    One thing more here is code which get 10 records from 2 tables and then show them in ALV.
    first when u execute it will show data from ist table.
    when u go back (F3) then it will sow data from 2nd table.
    But if u want to show both ALV on the same screen then u will have to use screen programin and using class u will have to create container and then have to do it.
    But as i above mentioned. that sample code is as below.
    REPORT ztn_test LINE-COUNT 100.
      data: itab_ref type ref to data.
      data: hstr type lvc_title.
    data: tabname like DD02T-TABNAME.
       tabname = 'MARA'. " First Table
      create data itab_ref type standard table of (tabname).
      field-symbols: <itab> type standard table.
      assign itab_ref->* to <itab>.
      select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
      perform showalv.
       tabname = 'KNA1'. " 2nd Table
      create data itab_ref type standard table of (tabname).
      "field-symbols: <itab> type standard table.
      assign itab_ref->* to <itab>.
      select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
      perform showalv.
    form showalv.
    " to show that data in alv
      type-pools: slis.
      data: myalv type ref to cl_gui_alv_grid,    "ALV Grid
            fieldcat type slis_t_fieldcat_alv,    "Field Catalog Table
            ls_fcat type slis_fieldcat_alv,       "Line of Field catalog.
            ls_heading type slis_listheader,      "Line of Heading.
            layout type slis_layout_alv,          "layout of ALV for Heading and Logo.
            event type slis_t_event,              "Event Raising to Display Heading.
            event_str type slis_alv_event.        "Event String.
    type-pools: slis.
    data: heading type slis_t_listheader.       "List Heading.
      if heading[] is initial.
        ls_heading-typ = 'H'.
        ls_heading-info = 'HR: Master Data Change History'.
        append ls_heading to heading.
      endif.
    *  ls_heading-typ = 'A'.
    *  ls_heading-info = ''.
    *  APPEND ls_heading TO heading.
    *                          ALV DISPLAY                        *
    *******Making Layout of ALV
      layout-zebra = 'X'.
      layout-colwidth_optimize = 'X'.
    *Calling function to raise event to display heading and icon above ALV
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 0
       importing
         et_events             = event[]
    * EXCEPTIONS
    *   LIST_TYPE_WRONG       = 1
    *   OTHERS                = 2
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    ******calling TOP_OF_PAGE Event
      read table event with key name = 'TOP_OF_PAGE' into event_str.
      if sy-subrc = 0.
        move: 'TOP_OF_PAGE' to event_str-form.
        modify event from event_str index sy-tabix.
      endif.
    **** Now use this Fuction to display ALV without any Screen Programming.
      call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = 'SAPLZFSL_HR_UTILS' "sy-cprog
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = ' '
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
         i_structure_name                  = tabname
    *   I_BACKGROUND_ID                   = ' '
         i_grid_title                      = hstr   "Heading of ALV Grid.
    *   I_GRID_SETTINGS                   =
         is_layout                         = layout
    *   it_fieldcat                       = fieldcat[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
         i_default                         = 'X'
         i_save                            = 'X'
    *   IS_VARIANT                        =
         it_events                         = event[]
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = <itab>
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.

Maybe you are looking for

  • Display no longer working

    Hi All I have a brand new iMac 27.5". The following problem arose: - working on Safari - Safari disappeared suddenly - Safari application no longer on dock - display turned a darker shade - dialog box indicated to press down on power to shut off comp

  • The launch feature of Creative Media Source 5.

    I need to clarify my question. I was able to install components of the latest version of Creative Media Source 5 from the WEB. All but the Go! feature seem to work OK!? Am I missing something or am I doing something wrong? I hilight that section in t

  • DBACOCKPIT with no data in spacv

    Dear Gurus, I'm running PI 7.1 and when I access DBACOCKPIT there is no data in SPACE section however, there is data in Performance section. I've tried to refresh but it didn't help. SAP_COLLECTOR_FOR_PERFMONITOR job is running each hour. No dumps in

  • Color settings in Compressor

    When I save a H.264 movie from Final Cut 7 the night scenes seem to have a lot of noise now. Is there a way to reduce the noise in the color settings in Compressor?

  • How do I transfer logic 9 to my new Mac Mini?

    I purchased a new 2011 Mac Mini and I need to Install Logic studio from a Mac Book Pro that has the logic app on it, or from the Logic Install Disc's. The Mini does not have a CD/DVD Drive, so what would be the best way to go about getting logic on m