Displying ALV in bakground.

Dear All,
I have created one report containing ALV, BAPI & BDC.
Now when I am running the report in the foreground then I am able to see the ALV report but when I run that report in the background I am no able to see the ALV report.
Is there a way to see that report in background?
If so please tell me.
Waiting for ur valuable replies.
Reg,
Nishu

Hi Nishu,
You will be able to see the ALV output in SPOOL i.e.
tcode SP01.
Also, refer the following code :
*&      Module  status_0100  OUTPUT
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'TB000'.
  IF m_custom_container IS INITIAL.
*\ For backgroung processing
    IF cl_gui_alv_grid=>offline( ) IS INITIAL.
      CREATE OBJECT m_custom_container
             EXPORTING container_name = container_main.
      CREATE OBJECT m_grid
             EXPORTING i_parent = m_custom_container.
    ELSE.
* If it is in backround:
      CREATE OBJECT m_grid
             EXPORTING i_parent = m_doc_container.
    ENDIF.
*// For backgroung processing
    CALL METHOD m_grid->set_table_for_first_display
         EXPORTING
                   i_structure_name  = 'IT_MDPS'
                   is_layout         = wa_layout
                   is_variant        = wa_variant
                   i_save            = 'A'
                   it_special_groups = it_fieldgroups
         CHANGING
                   it_outtab         = it_mdps
                   it_fieldcatalog   = it_fieldcat.
    CREATE OBJECT event_receiver.
    SET HANDLER event_receiver->handle_hotspot_click FOR m_grid.
  ELSE.
    CALL METHOD m_grid->refresh_table_display
       EXPORTING i_soft_refresh = 'X'.
  ENDIF.
ENDMODULE.                 " status_0100  OUTPUT
<b>Reward points if it helps.</b>
Message was edited by: Amit Mishra

Similar Messages

  • Hw 2 display ALV in Table control

    Hi experts,
    hw we cn display alv output in a tabl cntrl. is dere ny specific fnctn module or v hav 2 use som odr method.
    hlpful answrs 'll b suitbly rewrded....

    Hi Rohit,
    You cant display ALV in Table control.
    Both are used for specific requirements and they cant be merged.
    Could you let us know, why do you want to disply ALV in Table control ?
    Best regards,
    Prashant

  • Query urgent help need

    hi friends,
    Could u please help me how to do this
    tables : knb1,     "customer master (companycode)
             kna1,     "genaral data in customer master
             knvp.     "customer master partener functions
            zvarv.    "Program Hard Coded Values support table
           TYPE-POOLS DEFINATION
    type-pools : slis.
           TYPES DECLARATION
          Customer Master Company code Data
    types : begin of t_knb1,
              kunnr like knb1-kunnr,
              akont like knb1-akont,
            end of t_knb1.
    data : i_knb1 type t_knb1 occurs 0 with header line .
          Customer Master
    types : begin of t_kna1,
              kunnr like kna1-kunnr,
              name1 like kna1-name1,
              stras like kna1-stras,
              ort01 like kna1-ort01,
              stcd1 like kna1-stcd1,
              pstlz like kna1-pstlz,
            end of t_kna1.
    data  : i_kna1 type t_kna1 occurs 0 with header line.
          Customer Partner Functions
    types : begin of t_knvp,
              kunnr like knvp-kunnr,
              vkorg like knvp-vkorg,
              parvw like knvp-parvw,
              kunn2 like knvp-kunn2,
            end of t_knvp.
    data : i_knvp type t_knvp occurs 0 with header line.
          Output data
    types : begin of t_output,
              recordtype      type c,
              soldtocust(10)  type c,
              payer(10)       type c,
              sequence(5)     type n,
              custname(35)    type c,
              custaddress(35) type c,
              custcity(35)    type c,
              taxid(16)       type c,
              postalcode(5)   type c,
              branch          type c,
              delivery(3)     type c,
            end of t_output.
    data : i_output type t_output occurs 0 with header line.
          ZVARV Table
    *types : begin of t_zvarv,
             zobject1 like zvarv-zobject1,
             zobject2 like zvarv-zobject2,
             zseqnumb like zvarv-zseqnumb,
             zobjval  like zvarv-zobjval,
           end of t_zvarv.
    *data : i_zvarv  type  t_zvarv occurs 0 with header line.
          Error messages and total records
    types : begin of t_error_log,
              message(200) type c,
            end of t_error_log.
    data : i_error_log type t_error_log occurs 0 with header line.
         Field catalog
    data : t_fieldcat_tab type slis_t_fieldcat_alv with header line.
    Variables
    data : "v_aufsd like i_zvarv-zobjval,   "Central order block for cust
           v_knb1 type t_knb1,             "Customer master company code
           v_kna1 type t_kna1,             "Customer master
           v_knvp type t_knvp,             "Customer masterpartenerfunctions
           v_output type t_output,         "Output data
           v_error_log type t_error_log,   "Error data
           v_sequence(5) type n,           "Total records
           v_line type i,                  "Message
           v_count type i,                 "Counter for KNA1 records
           v_count1 type i,                "Counter for KNVP records
           v_result(100) type c,           "Totals for KNA1
           v_result1(100) type c,          "Totals for KNVP
           v_vkorg like knvp-vkorg.        "Message for Validation
    Constants
    data : c_program(30) type c value 'ZSDI0215', " Program Name
           c_parvw_rg    like  knvp-parvw value 'RG', "Partner type
           c_aufsd(2)    type c value 'CD'.    "Central order block for Cust
                       Selection-screen
    selection-screen begin of block b1 with frame title text-001.
    parameters       : p_vkorg like knvp-vkorg obligatory. "Sales Org
    select-options   : s_akont for knb1-akont obligatory default
                           '0001050100'.      "Reconciliation Account
    selection-screen end of block b1.
    selection-screen begin of block b2 with frame title text-002.
    parameters       : p_alv as checkbox,
                       p_df as checkbox.
    selection-screen end of block b2.
    selection-screen begin of block b3 with frame title text-003.
    parameters : p_lfile like  filetextci-fileintern
                   default 'Z_IO01989_CUSTOMER_MASTER_DATA', " Logical file
                 p_pfile like  rfpdo-rfbifile.               " Physical File
    selection-screen end of block b3.
         At selection-screen
    at selection-screen on p_vkorg.
    Validation of Sales Organization
      select single vkorg
        into v_vkorg
        from tvko
        where vkorg = p_vkorg.
      if v_vkorg is initial.
         message e045 with text-030.
      endif.
         Start-of-selection
    start-of-selection.
    Fetch data
      perform get_data.
    Processing the data
      perform process_data.
        End-of-Selection
    end-of-selection.
      if p_alv eq 'X'.
    Field catalog
        perform f_prepare_fieldcat.
    Disply  alv report
        perform f_display_report.
    Disply error log
        perform f_error_log.
    elseif p_df eq 'x'.
    Disply logical file & physical file
        perform f_logical_file.
        perform f_physical_file.
      else.
    Display the list
        perform f_list_display.
    Disply logical file & physical file
       perform f_logical_file.
       perform f_physical_file.
      endif.
         Form  get_data
         Fetch data and store in internal tables
    form get_data .
    Get zvarv data.
      perform get_zvarv.
    Get knb1 data
      perform get_knb1.
    Get kna1 data
      perform get_kna1.
    Get knvp data
      perform get_knvp.
    endform.                   " get_data
         form  get_zvarv
         zvarv data
    form get_zvarv .
    Fetch data from zvarv.
    select zobject1 zobject2 zseqnumb zobjval
       from zvarv
       into table i_zvarv
      where zobject1 eq c_program.
    sort i_zvarv by zobject2.
    endform.                    " get_zvarv
         form  get_knb1
         Get KNB1 data
    form get_knb1 .
    Fetch data from knb1.
      select kunnr akont
        from knb1
        into table i_knb1
       where akont in s_akont.
      describe table i_knb1 lines v_line.
    endform.                                                    " get_knb1
          Form  get_kna1
          Get KNB1 data
    form get_kna1 .
    Fetch data from kna1.
      select kunnr name1 stras ort01 stcd1 pstlz
        from kna1
        into table i_kna1
        for all entries in i_knb1
       where kunnr = i_knb1-kunnr and
       aufsd ne 'cd'."v_aufsd.
    endform.                                                    " get_kna1
          Form  get_knvp
          Get KNVP data
    form get_knvp .
    Fetch data from knvp
      select kunnr parvw kunn2 vkorg
        from knvp
        into table i_knvp
        for all entries in i_knb1
       where kunnr = i_knb1-kunnr
       and vkorg = p_vkorg
       and parvw = c_parvw_rg.
    endform.                    " get_knvp
          Form  process_data
          Processing output data
    form process_data .
    Get AUFSD value from ZVARV
      perform zvarv_read.
    loop at i_knb1.
        read table i_kna1 with key kunnr = i_knb1-kunnr.
        if sy-subrc ne 0.
         concatenate: 'in kna1 no record found for Customer number'
                       i_knb1-kunnr
                       into v_result separated by space.
          move v_result to v_error_log-message.
          append v_error_log to i_error_log.
          v_count = v_count + 1.
        else.
        move :  i_kna1-name1 to i_output-custname,
                i_kna1-stras to i_output-custaddress,
                i_kna1-ort01 to i_output-custcity,
                i_kna1-stcd1 to i_output-taxid,
                i_kna1-pstlz to i_output-postalcode.
    append i_output
    endif.
       loop at i_knvp where kunnr eq knb1-kunnr.
        read table i_knvp  with key kunnr = i_knb1-kunnr.
        if sy-subrc <> 0.
          concatenate : 'in knvp no record found for customer number'
                         v_knb1-kunnr
                         into v_result1 separated by space.
          move v_result1 to v_error_log-message.
          append v_error_log to i_error_log.
          v_count1 = v_count1 + 1.
         else.
      Move the knvp data to output
         move : i_knvp-kunnr to i_output-soldtocust,
                i_knvp-kunn2 to i_output-payer.
    append i_output
    endif.
         endloop.
        v_sequence = v_sequence + 1.
    Move non table related data to output
        move : 'C'          to i_output-recordtype,
                v_sequence  to i_output-sequence,
               '1'          to i_output-branch,
               'ABC'        to i_output-delivery.
    append i_output.
    endif.
    endloop.
    when i execute this one same data is displaying two times
    for example total records is two
    first record displaying two times and second one is displaying two times
    please tell me how to do
    regards
    harshavi

    Hi ,
    first check all APPEND stmts ?. In any report u have to maintain one BASE internal table .
    If u are working on KUNNR level , So maintain one final Internal table with all KUNNRS then Process all the data for final output.
    regards
    prabhu

  • How to show all table fields in correct alv disply

    Hi all,
    This is my report that disply in ALV . but this is only displying the join table (t_p0001_p0002) fields.i want to disply the other two table fields i.e t_pa0315 and t_pa0007.what is the logic to ALV disply the other two table fields like the table t_pa0001_pa0002.pls help me regarding this.
    send me the code its urgent.
    thanks!
    Vipin
    pls find the code below:->
    REPORT Y_WP03 .
    DEFINE m_fieldcat.
      add 1 to ls_fieldcat-col_pos.
      ls_fieldcat-fieldname   = &1.
      ls_fieldcat-ref_tabname = &2.
      append ls_fieldcat to lt_fieldcat.
    END-OF-DEFINITION.
    TYPE-POOLS: slis.                      " ALV Global types
    tables:pa0001,
           pa0315,
           pa0007,
           disvariant.
         Selection-Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    *SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS: s_pernr FOR pa0001-pernr.            " Personnel No
    SELECT-OPTIONS: s_orgeh FOR pa0001-orgeh .           " Organization unit
    SELECT-OPTIONS: s_werks FOR pa0001-werks.            " Personnel Area
    SELECT-OPTIONS: s_plans FOR pa0001-plans.            " Position
    SELECT-OPTIONS: s_ebeln FOR pa0315-ebeln.            " Purchase order
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK b2k2 WITH FRAME TITLE text-002.
    *SELECT-OPTIONS: s_var FOR disvariant-variant.
    PARAMETERS: p_disva1 LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK b2k2.
                     Type Definition                                     *
    TYPES :
    BEGIN OF ty_pa0001_pa0002,
        pernr TYPE pa0001-pernr , " Personnel no.
        endda TYPE pa0001-endda , " end date
        begda TYPE pa0001-begda , " start date
        bukrs TYPE pa0001-bukrs , " company code
        werks TYPE pa0001-werks , " Personnnel area
        persg TYPE pa0001-persg , " Employee group
        persk TYPE pa0001-persk , " Employee subgroup
        btrtl TYPE pa0001-btrtl , " Personnnel subarea
        abkrs TYPE pa0001-abkrs , " Payroll area
        kostl TYPE pa0001-kostl , " cost center
        orgeh TYPE pa0001-orgeh , " Organizational Unit
        plans TYPE pa0001-plans , " Position
        nachn TYPE pa0002-nachn , " Last name
        vorna TYPE pa0002-vorna , " First name
        midnm TYPE pa0002-midnm , " Middle name
      END   OF ty_pa0001_pa0002 ,
    BEGIN OF ty_pa0315,
       pernr TYPE pa0315-pernr , " Personnel no.
       kostl TYPE pa0315-kostl , " Sending cost center
       lstar TYPE pa0315-lstar , " Activity type
       werks TYPE pa0315-werks , " Plant
       lifnr TYPE pa0315-lifnr , " Vendor number
       ebeln TYPE pa0315-ebeln , " Sending pruchase ord
       ebelp TYPE pa0315-ebelp , " Sending PO item
       lstnr TYPE pa0315-lstnr , " Activity number
    END   OF ty_pa0315,
    BEGIN  OF ty_pa0007,
      pernr TYPE pa0007-pernr,
      schkz TYPE pa0007-schkz,
    END  OF ty_pa0007.
    *BEGIN  OF ty_pa0002,
    pernr TYPE pa0002-pernr,
    nachn TYPE pa0002-nachn,
    vorna TYPE pa0002-vorna,
    midnm TYPE pa0002-midnm,
    *END  OF ty_pa0002.
                     Data Declaration                                    *
    DATA :
      t_pa0001_pa0002 TYPE STANDARD TABLE OF ty_pa0001_pa0002 ,
      w_pa0001_pa0002 TYPE ty_pa0001_pa0002 ,
      t_pa0315 TYPE STANDARD TABLE OF ty_pa0315 ,
      w_pa0315 TYPE ty_pa0315 ,
      t_pa0007 TYPE STANDARD TABLE OF ty_pa0007 ,
      w_pa0007 TYPE ty_pa0007 .
    t_pa0002 TYPE STANDARD TABLE OF ty_pa0002 ,
    w_pa0002 TYPE ty_pa0002 .
    START-OF-SELECTION .
      SELECT a~pernr
             a~endda
             a~begda
             a~bukrs
             a~werks
             a~persg
             a~persk
             a~btrtl
             a~abkrs
             a~kostl
             a~orgeh
             a~plans
             b~nachn
             b~vorna
             b~midnm
             INTO TABLE t_pa0001_pa0002
             FROM pa0001 AS a INNER JOIN pa0002 AS b
             ON apernr = bpernr
             WHERE a~pernr IN s_pernr
             AND   a~werks IN s_werks
             AND   a~orgeh IN s_orgeh
             AND   a~plans IN s_plans.
      SORT t_pa0001_pa0002 BY pernr .
      IF NOT t_pa0001_pa0002[] IS INITIAL .
        SELECT pernr
               kostl
               lstar
               werks
               lifnr
               ebeln
               ebelp
               lstnr
               FROM pa0315
               INTO TABLE t_pa0315
               FOR ALL ENTRIES IN t_pa0001_pa0002
               WHERE pernr = t_pa0001_pa0002-pernr
               AND   kostl = t_pa0001_pa0002-kostl
               AND   ebeln IN s_ebeln.
        SELECT pernr
               schkz
               FROM pa0007
               INTO TABLE t_pa0007
               FOR ALL ENTRIES IN t_pa0001_pa0002
               WHERE pernr = t_pa0001_pa0002-pernr.
        SELECT pernr
               nachn
               vorna
               midnm
               FROM pa0002
               INTO TABLE t_pa0002
               FOR ALL ENTRIES IN t_pa0001
               WHERE pernr = t_pa0001-pernr .
      ENDIF.
    PERFORM f_display_data.
    FORM f_display_data.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv.
    Build the field catalog
      m_fieldcat 'PERNR' 'PA0001'.
      m_fieldcat 'NACHN' 'PA0002'.
      m_fieldcat 'VORNA' 'PA0002'.
      m_fieldcat 'MIDNM' 'PA0002'.
      m_fieldcat 'BUKRS' 'PA0001'.
      m_fieldcat 'WERKS' 'PA0001'.
      m_fieldcat 'PERSG' 'PA0001'.
      m_fieldcat 'PERSK' 'PA0001'.
      m_fieldcat 'BTRTL' 'PA0001'.
      m_fieldcat 'ABKRS' 'PA0001'.
      m_fieldcat 'ORGEH' 'PA0001'.
      m_fieldcat 'PLANS' 'PA0001'.
      m_fieldcat 'SCHKZ' 'PA0007'.
      m_fieldcat 'KOSTL' 'PA0315'.
      m_fieldcat 'LSTAR' 'PA0315'.
      m_fieldcat 'WERKS' 'PA0315'.
      m_fieldcat 'LIFNR' 'PA0315'.
      m_fieldcat 'EBELN' 'PA0315'.
      m_fieldcat 'EBELP' 'PA0315'.
      m_fieldcat 'LSTNR' 'PA0315'.
      m_fieldcat 'BEGDA' 'PA0001'.
      m_fieldcat 'ENDDA' 'PA0001'.
    Display the list
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = lt_fieldcat
        TABLES
          t_outtab                = t_pa0001_pa0002.
    ENDFORM.                               " F_DISPLAY_DATA_VBAK
          FORM USER_COMMAND                                             *
    FORM user_command USING u_ucomm     TYPE syucomm
                            us_selfield TYPE slis_selfield.     "#EC CALLED
      CASE u_ucomm.
        WHEN '&IC1'.
          READ TABLE t_pa0001_pa0002 INDEX us_selfield-tabindex INTO
    w_pa0001_pa0002.
          CHECK sy-subrc EQ 0.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND

    Hey,
    Look at ur code.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-cprog
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat = lt_fieldcat
    TABLES
    t_outtab = <b>t_pa0001_pa0002</b>.
    Here you're passing only the join table t_pa0001_pa0002. If you want to display the other tables as well, then u must have an internal table that has the columns of all the 3 tables. Then u need to buil;d the fieldcatalog accordingly and then display that table,
    Cheers,
    Sam

  • ALV grid disply with edit columns in output

    Hi all,
      i am using   CALL METHOD MY_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    to display the output in alv format.there is  3 edit columns in output display.
       if i fill one field & then put 'ENTER' then other two fields of that row should be filled with the appropriate data from the program.still control should be in output display.
    which method i should use to go inside the program when i put 'ENTER' on any field of ALV output disply & how to use those methods inside the program.
    i need some materials regarding OOPS (class, method ) . now i want to put OOPS concept in alv display.
    correct answers will be rewarded.
    Thanks & regards

    Hi,
    Check,
    OOPS
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ABAP Objects
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb#section7 [original link is broken]
    check the below links lot of info and examples r there for OOPS
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    <b>Reward if helpful.</b>

  • How to gve the colors to the TOP-OF-PAGE in ALV Grid Disply..

    i want to give 3 different colors in the top-of-page(there are three different lines each line should disply in different colors)...
      plaese tell me how can i do that...........

    Hi
    Try like this...
    form build_events.
      clear   gv_event.
      refresh i_events.
    Get the ALV events
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type     = 0
        importing
          et_events       = i_events
        exceptions
          list_type_wrong = 1
          others          = 2.
      if sy-subrc = 0.
        sort i_events by name.
      endif.
    Form for Top-of-Page ---------------------------------*
      read table i_events with key name = slis_ev_top_of_page
                                          into gv_event
                                          binary search.
      if sy-subrc = 0.
        move gc_top_of_page to gv_event-form.
        modify i_events from gv_event index sy-tabix.
      endif.
    Form for End-of-List ---------------------------------*
      read table i_events with key name = slis_ev_end_of_list
                                          into gv_event
                                          binary search.
      if sy-subrc = 0.
        move gc_end_of_list to gv_event-form.
        modify i_events from gv_event index sy-tabix.
      endif.
    Specify the ALV layout
      wa_layout-max_linesize = gv_linsz.
      wa_layout-min_linesize = gv_linsz.
    endform.                    " build_events
    form top_of_page_d.                                        
      format color col_heading.
      write: / 'Satyanarayana'
      format color col_total.
      write: / 'Sayana'.
      format reset.
    endform.
    Satya.

  • Alv is not displying

    Hi All
    I am developing one ALV Report in that i am fetching data from diff tables and i am puting all internal table to one final internal table .Now i want to disply that i am using REUSE_ALV_FIELDCATALOG_MERGE FM aft that iam using REUSE_ALV_LIST_DISPLAY to disply but nothing is displying data is coming in to Final itab.
    Can any one help me out.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME         = REPID
          I_INTERNAL_TABNAME     = 'IT_HFINAL'
        CHANGING
          CT_FIELDCAT            = it_fieldcat[]
        EXCEPTIONS
          INCONSISTENT_INTERFACE = 1
          PROGRAM_ERROR          = 2
          OTHERS                 = 3.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       i_callback_program             = REPID
       it_fieldcat                    = it_fieldcat[]
      TABLES
        t_outtab                      = it_hfinal
    EXCEPTIONS
       program_error                  = 1
       OTHERS                         = 2.
    Thanks in Advance
    Regards
    Rao

    Hi,
    When you declare your table it_hfinal,
    decalre with 'occurs 0' when you use 'REUSE_ALV_FIELDCATALOG_MERGE' FM.
    DATA: BEGIN OF it_hfinal OCCURS 0,
               END OF it_hfinal.
    This will make your program work.
    Regards,
    Manoj Kumar P

  • Regarding disply in alv

    have few queries on alv
    1..i want to colout hte columns of my alv display say the first three columns with one colour and then the next three columns witth another colour and so on.
    2.i have just displayed the output on alv and when i am double clicking on any record it is saying <b>Call (PERFORM) to a non-existent routine<b>.
    now what i want i sthat  is there any way by which i can avoid this thing means if user double clicks on any thing nothing should be done adn it should remain at the list.
    3.now i n case i want to have that option where if the user double clicks on any record then it should dispaly the corresonding record like we have in report display at line-selection
    is there some thing like that in alv also.
    Thanks and Regards

    Hi Ashish,
    check the below code to solve u r proble...
    Just create PF STATUS for the below code and execute it...
    *******Declare Data Areas for List Viewer (Begin)***********
    TYPE-POOLS: SLIS.
    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           FIELDCAT_LN LIKE LINE OF FIELDCAT,
           SORTCAT          TYPE SLIS_T_SORTINFO_ALV,
           LAYOUT           TYPE SLIS_LAYOUT_ALV,
           SORTCAT_LN       LIKE LINE OF SORTCAT,
           EVENTCAT         TYPE SLIS_T_EVENT,
           EVENTCAT_LN      LIKE LINE OF EVENTCAT,
           COUNT TYPE I,
            COLCELL TYPE SLIS_FIELDNAME VALUE 'MATNR'.
    DATA: COL_POS TYPE I,
            W_FNAME TYPE DD03L-FIELDNAME.
    ******Declare Data Areas for List Viewer (End)**************
    ******Declare Internal Table to Store Selected Data (Begin)*
    DATA LS_CELLCOLOR TYPE SLIS_T_SPECIALCOL_ALV  WITH HEADER LINE.
    DATA:  BEGIN OF TSPFLI OCCURS 10 ,
              CHECK TYPE SLIS_FIELDNAME,
              COLOR(3),
              COLCELLS TYPE SLIS_T_SPECIALCOL_ALV.
             INCLUDE STRUCTURE SPFLI.
    DATA : END OF TSPFLI.
    *Declare Internal Table to Store Selected Data (Begin) For sflight*
    DATA:
       W_SPFLI LIKE LINE OF TSPFLI.
    DATA : BEGIN OF FS_SFLIGHT,
              CHECK TYPE SLIS_FIELDNAME,
              COLOR(3).
             INCLUDE STRUCTURE SFLIGHT.
    DATA : END OF FS_SFLIGHT.
    DATA
       T_SFLIGHT LIKE
        STANDARD TABLE
              OF FS_SFLIGHT.
    *Declare Internal Table to Store Selected Data (Begin) For sbook*
    DATA:
    W_SFLIGHT LIKE LINE OF T_SFLIGHT.
    DATA : BEGIN OF FS_SBOOK,
              CHECK TYPE SLIS_FIELDNAME.
             INCLUDE STRUCTURE SBOOK.
    DATA : END OF FS_SBOOK.
    DATA
       T_SBOOK LIKE
        STANDARD TABLE
              OF FS_SBOOK.
    ******Declare Internal Table to Store Selected Data (End)***
    *******Select Data into Internal Table (Begin) ***************
    SELECT *
             INTO CORRESPONDING FIELDS OF TSPFLI
            FROM SPFLI.
       APPEND TSPFLI.
       CLEAR TSPFLI.
    ENDSELECT.
    Select Data into Internal Table (End) ****************
    PERFORM BUILD_FIELDCAT4.
    PERFORM BUILD_FIELDCAT6.
    PERFORM BUILD_FIELDCAT7.
    PERFORM BUILD_LISTCAT.
    PERFORM BUILD_EVENTCAT.
    PERFORM START_LIST_VIEWER.
    *&      Form  build_fieldcat4
          text
    FORM BUILD_FIELDCAT4.
       FIELDCAT_LN-FIELDNAME = 'CHECK'.
       APPEND FIELDCAT_LN TO FIELDCAT.
       CLEAR FIELDCAT_LN.
    ENDFORM.                    "BUILD_FIELDCAT4
    *&      Form  build_fieldcat6
          text
    FORM BUILD_FIELDCAT6.
       FIELDCAT_LN-FIELDNAME = 'COLOR'.
       FIELDCAT_LN-OUTPUTLEN = 4.
       APPEND FIELDCAT_LN TO FIELDCAT.
       CLEAR FIELDCAT_LN.
    ENDFORM.                    "build_fieldcat6
    *&      Form  BUILD_FIELDCAT7
          text
    FORM BUILD_FIELDCAT7.
       FIELDCAT_LN-FIELDNAME = 'COLCELLS'.
       APPEND FIELDCAT_LN TO FIELDCAT.
       CLEAR FIELDCAT_LN.
    ENDFORM.                    "build_fieldcat6
    *&      Form  build_listcat
          text
    FORM BUILD_LISTCAT.
       LAYOUT-BOX_FIELDNAME    = 'CHECK'.
       LAYOUT-INFO_FIELDNAME   = 'COLOR'.
       LAYOUT-COLTAB_FIELDNAME = 'COLCELLS'.
    ENDFORM.                    "build_listcat
    *&      Form  BUILD_EVENTCAT
          text
    FORM BUILD_EVENTCAT.
       EVENTCAT_LN-NAME = 'PF_STATUS_SET'.
       EVENTCAT_LN-FORM = 'STATUSSET'.
       APPEND EVENTCAT_LN TO EVENTCAT.
       EVENTCAT_LN-NAME = 'USER_COMMAND'.
       EVENTCAT_LN-FORM = 'USERCOMM'.
       APPEND EVENTCAT_LN TO EVENTCAT.
    ENDFORM.                    "BUILD_EVENTCAT
    *&      Form  STATUSSET
          text
         -->RT_EXTAB   text
    FORM STATUSSET
        USING RT_EXTAB TYPE SLIS_T_EXTAB.
       DATA
         W_EXTAB TYPE SLIS_EXTAB.
       CLEAR RT_EXTAB[].
       W_EXTAB-FCODE = 'SBOOK'.
       APPEND W_EXTAB TO RT_EXTAB.
       SET PF-STATUS 'STATUS' EXCLUDING RT_EXTAB.
    ENDFORM.                    "STATUSSET
    *&      Form  START_LIST_VIEWER
          text
    FORM START_LIST_VIEWER.
       DATA: PGM LIKE SY-REPID.
       PGM = SY-REPID.
       CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
              I_CALLBACK_PROGRAM       = PGM
              i_callback_pf_status_set = ' '
            I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
                I_STRUCTURE_NAME         = 'SPFLI'
                  IS_LAYOUT                = LAYOUT
              IS_VARIANT               = ' '
                IT_EVENTS                = EVENTCAT
              IT_EVENT_EXIT            =
            TABLES
                 T_OUTTAB                 = TSPFLI
            EXCEPTIONS
                 PROGRAM_ERROR            = 1
                 OTHERS                   = 2.
    ENDFORM.                    "START_LIST_VIEWER
    *&      Form  USERCOMM
          text
         -->UCOMM      text
         -->SELFIELD   text
    FORM USERCOMM USING UCOMM LIKE SY-UCOMM
                         SELFIELD TYPE SLIS_SELFIELD.
       CLEAR FIELDCAT[].
       CASE UCOMM.
         WHEN 'SFLIGHT'.
           CLEAR T_SFLIGHT[].
           LOOP AT TSPFLI INTO W_SPFLI.
             IF W_SPFLI-CHECK EQ 'X'.
               SELECT *
                 FROM SFLIGHT
            APPENDING CORRESPONDING FIELDS OF TABLE T_SFLIGHT
                WHERE CARRID = W_SPFLI-CARRID
                  AND CONNID = W_SPFLI-CONNID.
               W_SPFLI-CHECK = '1'.
               W_SPFLI-COLOR = 'C21'.
               MODIFY TSPFLI FROM W_SPFLI TRANSPORTING CHECK COLOR.
             ENDIF.
           ENDLOOP.
           PERFORM BUILD_FIELDCAT9.
           PERFORM BUILD_EVENTCAT1.
           PERFORM START_LIST_VIEWER1.
       ENDCASE.
       SELFIELD-REFRESH = 'X'.
    ENDFORM.                    "USERCOMM
    *&      Form  START_LIST_VIEWER1
          text
    FORM START_LIST_VIEWER1.
       DATA: PGM LIKE SY-REPID.
       PGM = SY-REPID.
       CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_INTERFACE_CHECK              = ' '
           I_CALLBACK_PROGRAM             = PGM
          I_CALLBACK_PF_STATUS_SET       = ' '
          I_CALLBACK_USER_COMMAND        = ' '
          I_STRUCTURE_NAME               = 'SFLIGHT'
                IS_LAYOUT                = LAYOUT
           IT_FIELDCAT                    = FIELDCAT
          IT_SORT                        =
           IT_EVENTS                      =  EVENTCAT
         TABLES
           T_OUTTAB                       = T_SFLIGHT
        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.                    "START_LIST_VIEWER1
    *&      Form  BUILD_EVENTCAT1
          text
    FORM BUILD_EVENTCAT1.
       CLEAR EVENTCAT[].
       EVENTCAT_LN-NAME = 'PF_STATUS_SET'.
       EVENTCAT_LN-FORM = 'STATUSSET1'.
       APPEND EVENTCAT_LN TO EVENTCAT.
       CLEAR EVENTCAT_LN.
       EVENTCAT_LN-NAME = 'USER_COMMAND'.
       EVENTCAT_LN-FORM = 'USERCOMM1'.
       APPEND EVENTCAT_LN TO EVENTCAT.
    ENDFORM.                    "BUILD_EVENTCAT
    *&      Form  STATUSSET1
          text
         -->RT_EXTAB   text
    FORM STATUSSET1
        USING RT_EXTAB TYPE SLIS_T_EXTAB.
       DATA
         W_EXTAB TYPE SLIS_EXTAB.
       CLEAR RT_EXTAB[].
       W_EXTAB-FCODE = 'SFLIGHT'.
       APPEND  W_EXTAB TO RT_EXTAB.
       SET PF-STATUS 'STATUS' EXCLUDING RT_EXTAB.
    ENDFORM.                    "STATUSSET
    *.................................USERCOMM1..................
    FORM USERCOMM1 USING UCOMM LIKE SY-UCOMM
                         SELFIELD TYPE SLIS_SELFIELD.
       CLEAR FIELDCAT[].
       CASE UCOMM.
         WHEN 'SBOOK'.
           CLEAR T_SBOOK[].
           LOOP AT T_SFLIGHT INTO W_SFLIGHT.
             IF W_SFLIGHT-CHECK EQ 'X'.
               SELECT *
                 FROM SBOOK
            APPENDING CORRESPONDING FIELDS OF TABLE T_SBOOK
                WHERE CARRID = W_SFLIGHT-CARRID
                  AND CONNID = W_SFLIGHT-CONNID
               AND FLDATE = W_SFLIGHT-FLDATE.
               W_SFLIGHT-CHECK = '1'.
               W_SFLIGHT-COLOR = 'C81'.
               MODIFY T_SFLIGHT FROM W_SFLIGHT TRANSPORTING CHECK COLOR.
             ENDIF.
           ENDLOOP.
           PERFORM BUILD_FIELDCAT9.
           PERFORM BUILD_EVENTCAT2.
           PERFORM START_LIST_VIEWER2.
       ENDCASE.
       SELFIELD-REFRESH = 'X'.
    ENDFORM.                                                   " USERCOMM1
    *&      Form  BUILD_FIELDCAT9
          text
    FORM BUILD_FIELDCAT9.
       CLEAR FIELDCAT[].
       FIELDCAT_LN-FIELDNAME = 'CHECK'.
       APPEND FIELDCAT_LN TO FIELDCAT.
       CLEAR FIELDCAT_LN.
       LAYOUT-BOX_FIELDNAME    = 'CHECK'.
    ENDFORM.                    "BUILD_FIELDCAT8
    *&      Form  START_LIST_VIEWER2
          text
    FORM START_LIST_VIEWER2.
       DATA: PGM LIKE SY-REPID.
       PGM = SY-REPID.
       CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_INTERFACE_CHECK              = ' '
          I_BYPASSING_BUFFER             =
          I_BUFFER_ACTIVE                = ' '
           I_CALLBACK_PROGRAM             = PGM
          I_CALLBACK_PF_STATUS_SET       = ' '
          I_CALLBACK_USER_COMMAND        = ' '
          I_STRUCTURE_NAME               = 'SBOOK'
           IS_LAYOUT                      = LAYOUT
           IT_FIELDCAT                    = FIELDCAT
          IT_SORT                        =
          IT_FILTER                      =
          IS_SEL_HIDE                    =
           IT_EVENTS                      = EVENTCAT
         TABLES
           T_OUTTAB                       = T_SBOOK
        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.                    "START_LIST_VIEWER1
    *&      Form  BUILD_EVENTCAT2
          text
    FORM BUILD_EVENTCAT2.
       CLEAR EVENTCAT[].
       EVENTCAT_LN-NAME = 'PF_STATUS_SET'.
       EVENTCAT_LN-FORM = 'STATUSSET2'.
       APPEND EVENTCAT_LN TO EVENTCAT.
    ENDFORM.                    "BUILD_EVENTCAT
    *&      Form  STATUSSET1
          text
         -->RT_EXTAB   text
    FORM STATUSSET2
        USING RT_EXTAB TYPE SLIS_T_EXTAB.
       DATA
         W_EXTAB TYPE SLIS_EXTAB.
       CLEAR RT_EXTAB[].
       W_EXTAB-FCODE = 'SFLIGHT'.
       APPEND  W_EXTAB TO RT_EXTAB.
       W_EXTAB-FCODE = 'SBOOK'.
       APPEND  W_EXTAB TO RT_EXTAB.
       SET PF-STATUS 'STATUS' EXCLUDING RT_EXTAB.
    ENDFORM.                    "STATUSSET
    Reward points if it is helpful...
    Regards,
    Omkar.
    Message was edited by:
            Omkaram Yanamala

  • ALV Grid not displying properly when spool is generated by print button

    Hi All,
    When print button is used to genarate spool of the ALV Grid, then in the spool the end of page content is getting over lapped on the main lines. Please let me know how to display end of page content without geting overlapped on the lines.
    Below is the code which I have written.
    <cut>
    Edit: Please see next post.
    Thanks in Advance!
    Regards,
    Preethi G
    Edited by: Julius Bussche on Feb 14, 2010 9:15 AM

    Hi All,
    Sorry. Please ignore my first post. When print button is used to generate spool then in the spool file the end of page content is getting overlapped on the main lines. Please let me know to solve this.
    Thanks in Advance!
    Below is the code written
    ALV Grid display
    alv_layout-colwidth_optimize = 'X'.
      alv_layout-zebra             = 'X'.
      wa_print_info-no_print_listinfos  = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
            i_grid_title             = ''
            i_callback_pf_status_set = 'FRM_SET_STATUS'
            i_callback_user_command  = 'FRM_USER_COMMAND'
            is_layout                = alv_layout
            it_events                = i_events
            it_fieldcat              = alv_fieldcat
            is_print                 = wa_print_info
          TABLES
            t_outtab                 = it_payroll
          EXCEPTIONS
            program_error            = 1
            OTHERS                   = 2.
    End of Page and End of list
    IF sy-pagno = 0.
        s_pageno = 1.
      ELSE.
        s_pageno = sy-pagno.
      ENDIF.
      CLEAR: i_list_comments[].
      SKIP.
      SKIP.
      CONCATENATE 'u85AAu8D44u4E13u5458' '________' 'HRSu7ECFu7406' '________' 'u4EBAu529Bu8D44u6E90u603Bu76D1'
    '________'  'u7EE9u6548u8D22u52A1u603Bu76D1' '________' 'u603Bu7ECFu7406' '________'''INTO s_out
      SEPARATED BY space.
      NEW-LINE.
      WRITE AT (sy-linsz) s_out CENTERED.
      SKIP.
      CONCATENATE  s_pageno '-' v_pagsum  'u9875' INTO
       w_list_comments-info SEPARATED BY space.
      NEW-LINE.
      WRITE  AT (sy-linsz) w_list_comments-info CENTERED.
    Edited by: Julius Bussche on Feb 14, 2010 9:16 AM
    Tried to fix formatting a bit.

  • ALV Grid disply?

    Hi Guru's,
    Developed a report to include fields like Model Number, Serial Number, Construction, Maintenance Plant, Plant section, Status inclusive, Status Exclusive, Customer, End Customer and SH Contract Release in the existing standard report IK17(Display measurement documents). The report has been developed by making a copy of the standard report as ZIK17 as the above mentioned additional fields need to be added into the standard functionality of IK17. All these fields Model Number, Serial Number, Construction, Maintenance Plant, Plant section, Customer, End Customer and SH Contract Release are fetched using tables like EQUI and IHPA.
    In this is there any Function Module for Status inclusive and exclusive fields are fetched the data?
    Finally all the fields are displayed using ALV grid display?
    Regards,
    SIVA

    Hi Siva,
    Also check the below FM's
    BAPI_EQUI_GETSTATUS
    BAPI_EQUI_GETDETAIL
    BAPI_EQUI_GETLIST
    Hope it helps you.
    Regards,
    Anki Reddy

  • Disply variants  in ALV LIST disply

    Hi Experts,
    I have created a ALV list display variant in 4.5B version and it isn’t working in ECC6 environment. Is there way to make it work in ECC6?
    What might be the issue?
    Thanks,
    Mohamed.

    Hi Sampath,
          First change the variant with new values and save it.
          Go to SE38 and give the program name and click on the variants radiobutton and then click on change button give the variant name.
    then click on the Utilities menu ---> Transport Request and then give the variant name for the appropriate program name and then execute. Then select the checkbox in the pop up and click on the continue button, and then it will ask the transport request. save the transport and release it.
    Hope it helps,
    Reward if useful.
    Thanks,
    Srinivas

  • Page No in ALV GRID Header disply ?

    Hi,
    How to display the page No in ALV GRID Header display.
    Thanks & Regards,
    Amir.

    hai
    I think u can use this funtion... Using this funtion u can find som solution for ur problem
    *&      Form  BUILD_EVENTTAB
          text
         -->P_EVENTS[]  text                                             *
    form build_eventtab using p_events type slis_t_event.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = p_events.
      read table p_events with key name = slis_ev_top_of_page
                               into ls_event.
      if sy-subrc = 0.
        move formname_top_of_page to ls_event-form.
        append ls_event to p_events.
      endif.
    endform.                               " BUILD_EVENTTAB
    *&      Form  BUILD_COMMENT
          text
         -->P_HEADING[]  text                                            *
    form build_comment using p_heading type slis_t_listheader.
      data: hline type slis_listheader,
            text(60) type c,
            test_date TYPE string,
           test_date1 TYPE string,
           sep(20) type c.
      clear: hline, text.
      hline-typ  = 'H'.
      write: text-101 to text+23.
      hline-info = text.
      append hline to p_heading.
      clear text.
      write: 'User: ' to text,
             sy-uname to text+6,
             'Date: ' to text+25,
             sy-datum to text+31,
             'Page: ' to text+50,
             sy-pagno to text+56.
      hline-info = text.
      append hline to p_heading.
    endform.                    " BUILD_COMMENT
          FORM TOP_OF_PAGE                                              *
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = heading.
    endform.
    regard
    nawa

  • How to declare top of page in alv grid disply

    Hi
    Can any ine let me know how to declare the top -of -page??
    Arun Joseph

    Hi , check this one u will get easily .
    *& Report  ZMM_ANNEXURE4_ALV
    REPORT  ZMM_ANNEXURE4_ALV1.
    TYPE-POOLS SLIS .
    TABLES : J_1IEXCHDR,
             J_1IEXCDTL,
             J_1IGRXSUB,  " FOR QTY
             LFA1,    " Vendor Master
             ADRC,    " Vendor Address
             MSEG,    " Batch - Identification Marks
             MKPF.    "
    DATA : IT_J_1IEXCHDR LIKE J_1IEXCHDR OCCURS 0 WITH HEADER LINE.
    DATA : IT_MSEG LIKE MSEG OCCURS 0 WITH HEADER LINE.
    DATA : IT_J_1IEXCDTL LIKE J_1IEXCDTL OCCURS 0 WITH HEADER LINE.
    DATA : IT_J_1IGRXSUB LIKE J_1IGRXSUB OCCURS 0 WITH HEADER LINE.
    DATA : IT_MSGE LIKE MSEG OCCURS 0 WITH HEADER LINE.
    DATA : IT_LFA1 LIKE LFA1 OCCURS 0 WITH HEADER LINE.
    DATA : IT_ADRC LIKE ADRC OCCURS 0 WITH HEADER LINE.
    DATA : IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE.
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          it_listheader type slis_t_listheader,
          it_events     type slis_t_event,
          it_fieldcat type slis_t_fieldcat_alv,
          gd_tab_group type slis_t_sp_group_alv,
          IS_layout    type slis_layout_alv,
          SELL_MODE TYPE SLIS_T_SP_GROUP_ALV,
          gd_repid     like sy-repid.
    INCLUDE <symbol>.
    INCLUDE <icon>.
    *DATA : TEXT1(100) TYPE C.
    *DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : V_FIELDCAT  TYPE SLIS_FIELDCAT_ALV.
    DATA : V_QTY LIKE EKPO-MENGE.
    DATA : V_VAL LIKE MARA-NTGEW.   " For calculation of Qty
    DATA : V_VAL1 TYPE STRING.      " For calculation of Qty
    DATA : V_Q  TYPE STRING.        " Variable for calculating
                                    " burning loss
    DATA : V_WST TYPE STRING.       " Variable 4 WasteM.
    DATA : V_WST1 TYPE STRING.      " Variable 4 WasteM.
    DATA : V_SCPGN LIKE MSEG-MENGE.
    DATA : V_WUNIT TYPE STRING.
    DATA : V_QFPG1 TYPE STRING.
    DATA : V_QFPG2 TYPE STRING.
    DATA : V_AQTY TYPE STRING.
    DATA : V_QTYR LIKE J_1IEXCDTL-MENGE.
    DATA : V_QTYR1 TYPE STRING.
    DATA : V_UNTQT TYPE STRING.
    DATA : V_MEINS LIKE MSEG-MEINS.
    DATA : V_MEINS1 LIKE MSEG-MEINS.
    DATA : V_SCPGN1 TYPE STRING.
    DATA : V_WSTMQ LIKE MSEG-MENGE.
    DATA : V_WSTMQ1 TYPE STRING.
    DATA : V_QFPGN LIKE MARA-NTGEW.
    DATA : V_VALQ LIKE MARA-NTGEW.
    DATA : V_UNITQ LIKE MARA-MEINS.
    DATA : V_WGHT TYPE STRING.
    DATA : V_WGHT1 TYPE STRING.
    DATA : V_CHARG LIKE MSEG-CHARG.
    DATA: TEXT   TYPE STRING.
    DATA: TEXT1  TYPE STRING.
    DATA: TEXT2  TYPE STRING.
    DATA :TEXT3  TYPE STRING.
    DATA :TEXT4  TYPE STRING.
    DATA:dat_frt(30).
    SELECTION-SCREEN ************
    SELECTION-SCREEN COMMENT /80(50) VER.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE tit2.
    SELECT-OPTIONS: P_CHLN FOR IT_J_1IEXCDTL-EXNUM. "NO-EXTENSION
                                      "NO INTERVALS OBLIGATORY.
    SELECT-OPTIONS: P_DATE FOR IT_J_1IEXCHDR-BUDAT. "NO-EXTENSION
                                      "NO INTERVALS OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK blk2.
    SELECTION-SCREEN COMMENT /72(60) run.
    DATA : BEGIN OF IT_FINAL OCCURS 1,
            BUDAT  type d,   "1 Date of issue
            MAKTX(40)  TYPE C,   "2Material Desc
            CHAPID(22) TYPE C,
            MENGE(18)   TYPE C,   "4 Qty removed weight
            CHARG(25)  TYPE C,         "5 Identification Marks
            ADRS(55)  TYPE C," 6For Vendor Address
            EXNUM  LIKE J_1IEXCHDR-EXNUM,   "7 Challan No. & Date
            ADDLDATA1(40) TYPE C, "8 NatureProcessReq
           DOCNO  LIKE J_1IEXCHDR-DOCNO,   "10 Document No.
            CPUDT  TYPE D,  "9 Date of Receipt
            V_QTY1(40)   TYPE C,    "10QtyofProcessedFinishedGoods
            BURNING(12) TYPE C,             "11 Burning Loss
            WST_M(20) TYPE c,    "12 Qty of waste material
            ADDLDATA2(18) TYPE C,"13 Invoice No.&Date
            V_PARTIC(25)  TYPE C," 14Particulars of Payment
           ADDLDATA2 LIKE J_1IEXCHDR-ADDLDATA2,"15 Invoice No.&Date
    END OF IT_FINAL.
    PERFORM INITIALZATION1.
    PERFORM GET_DATA.
    PERFORM CALL_FORM.
    *&      Form  INITIALZATION
          text
    -->  p1        text
    <--  p2        text
    form INITIALZATION1 .
         CLEAR  IT_FINAL.
         CLEAR  IT_J_1IEXCHDR.
         CLEAR  IT_MSEG.
         CLEAR  IT_J_1IEXCDTL.
         CLEAR  IT_J_1IGRXSUB.
         CLEAR  IT_ADRC.
         CLEAR  V_Q.
         CLEAR  V_SCPGN.
         CLEAR  V_WST.
         CLEAR  V_QFPG1.
         CLEAR  V_QFPG2.
         CLEAR  V_VAL.
         CLEAR  V_VAL1.
         CLEAR  V_AQTY.
         CLEAR  V_WUNIT.
         CLEAR  V_QTYR.
         CLEAR  V_UNTQT.
         CLEAR  V_SCPGN1.
         CLEAR  V_MEINS.
         CLEAR  V_WSTMQ.
         CLEAR  V_WSTMQ1.
         CLEAR  V_QFPGN.
         CLEAR  V_VALQ.
         CLEAR  V_UNITQ.
         CLEAR  V_WGHT.
         CLEAR  V_WGHT1.
         CLEAR  IT_FINAL[].
         CLEAR  IT_J_1IEXCHDR[].
         CLEAR  IT_MSEG[].
         CLEAR  IT_J_1IEXCDTL[].
         CLEAR  IT_J_1IGRXSUB[].
    endform.                    " INITIALZATION
    *****INITIALIZATION
    INITIALIZATION.
      tit2 = 'Selection Criteria'.
      CONCATENATE sy-datum6(2) '.' sy-datum4(2) '.' sy-datum+0(4) INTO
                    dat_frt.
      CONCATENATE 'User ID : ' sy-uname ' Client ID : ' sy-mandt
                    ' Run Date : ' dat_frt
                    INTO run SEPARATED BY space.
      ver = 'Developed by CMC Limited. '.
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    form GET_DATA .
    IF P_DATE <> ''.
    SELECT *
             FROM J_1IEXCHDR
             INTO TABLE IT_J_1IEXCHDR
             WHERE BUDAT IN P_DATE AND
                   TRNTYP = '57FC' AND    " Transaction type
                   SRGRP = 40.            " Series Group
    ENDIF.
    IF P_CHLN <> ''.
        SELECT *
             FROM J_1IEXCHDR
             INTO TABLE IT_J_1IEXCHDR
             WHERE EXNUM IN P_CHLN AND
                   TRNTYP = '57FC' AND    " Transaction type
                   SRGRP = 40.            " Series Group
    ENDIF.
          select *
                   FROM J_1IEXCDTL
                   INTO TABLE IT_J_1IEXCDTL
                         WHERE EXDAT IN P_DATE    " Document No.
                         AND TRNTYP  = '57FC'.
                         " Transaction type for subcontracting
    LOOP AT IT_J_1IEXCHDR.
    MOVE-CORRESPONDING IT_J_1IEXCHDR TO IT_FINAL.
    select MATNR  MAKTX CHAPID MENGE MEINS ADDLDATA1 EXNUM
      FROM J_1IEXCDTL
      INTO (IT_J_1IEXCDTL-MATNR, IT_FINAL-MAKTX,
            IT_FINAL-CHAPID,V_QTYR,  V_UNTQT,
            IT_J_1IEXCDTL-ADDLDATA1, IT_J_1IEXCDTL-EXNUM)
            WHERE DOCNO = IT_J_1IEXCHDR-DOCNO    " Document No.
    AND TRNTYP  = '57FC'
    " Transaction type for subcontracting
    AND   RDOC2 = IT_J_1IEXCHDR-RDOC.           " Material Doc No.
       IT_FINAL-MAKTX      =  IT_J_1IEXCDTL-MAKTX.   " Material Desc
       IT_FINAL-CHAPID     =  IT_J_1IEXCDTL-CHAPID.  " Tariff Clasifi
        IT_FINAL-MENGE      =  IT_J_1IEXCDTL-MENGE.
       IT_FINAL-MEINS      =  IT_J_1IEXCDTL-MEINS.
       IT_FINAL-ADDLDATA1  =  IT_J_1IEXCDTL-ADDLDATA1. " Nature of proc
    V_QTYR1 = V_QTYR.
    CONCATENATE V_QTYR1 V_UNTQT INTO IT_FINAL-MENGE SEPARATED BY ''.
    IF V_UNTQT = 'EA'.
          SELECT SINGLE NTGEW GEWEI        " VALUE, UNIT
                 FROM   MARA
                 INTO  (V_VALQ, V_UNITQ)
                 WHERE MATNR = IT_J_1IEXCDTL-MATNR.
                 V_WGHT = V_VALQ * V_QTYR.
                 V_WGHT1 = V_WGHT.
    CONCATENATE V_WGHT1 V_UNITQ INTO V_WGHT1 SEPARATED BY ''.
    CONCATENATE IT_FINAL-MENGE V_WGHT1 INTO IT_FINAL-MENGE
    SEPARATED BY ' / '.
       ENDIF.
       SELECT SINGLE CHARG                " Batch No.
               FROM MSEG
               INTO V_CHARG
                WHERE MBLNR = IT_J_1IEXCHDR-RDOC  AND  " Material Doc No.
                     MATNR = IT_J_1IEXCDTL-MATNR AND
                     SHKZG = 'H'.   " H- CREDIT
        IT_FINAL-CHARG = V_CHARG.
        CLEAR V_CHARG.
        SELECT SINGLE REC_QTY MBLNR  " Qtywaste material,mat docno.
              FROM J_1IGRXSUB
              INTO (IT_J_1IGRXSUB-REC_QTY, IT_J_1IGRXSUB-MBLNR)
              WHERE EXNUM  = IT_J_1IEXCHDR-EXNUM." AND
                EXC_ZEILE = IT_J_1IEXCHDR-ZEILE.
         SELECT SINGLE MENGE         " QTY OF WASTE MATERIAL
               FROM  MSEG
               INTO  V_SCPGN        " VARIABLE STORING QTY OF WASTE MTRL.
               WHERE MBLNR = IT_J_1IGRXSUB-MBLNR
                     AND BWART = 545.
         V_WST = V_SCPGN.
    SELECT SINGLE MENGE MEINS        " QTY OF WASTE MATERIAL
               FROM  MSEG
               INTO  (V_WSTMQ, V_MEINS) "VARIABLE STORING QTYOFWASTEMTRL.
               WHERE MBLNR = IT_J_1IGRXSUB-MBLNR
                     AND BWART = 101.
               V_WSTMQ1 = V_WSTMQ.
    CONCATENATE V_WSTMQ1 V_MEINS INTO V_SCPGN1.
    ADDING UNIT 'KG' INTO WASTE MATERIAL.
    CONCATENATE V_WST 'KG' INTO IT_FINAL-WST_M.
        SELECT SINGLE MATNR
                FROM MSEG
                INTO IT_MSEG-MATNR
                WHERE MBLNR = IT_J_1IGRXSUB-MBLNR
                AND BWART = 101.
    IF RECEIVED QTY IS IN EA THEN IT SHOULD COME IN KG ALSO
         SELECT SINGLE NTGEW GEWEI        " VALUE, UNIT
                FROM MARA
                INTO (V_VAL, V_WUNIT)
                WHERE MATNR = IT_MSEG-MATNR.
                V_VAL1 = V_VAL.
    CONCATENATE V_VAL1 V_WUNIT INTO V_QFPG1 SEPARATED BY ''.
               IT_FINAL-V_QTY1 = V_VAL * IT_J_1IGRXSUB-REC_QTY.
                V_QFPG2 = V_VAL * IT_J_1IGRXSUB-REC_QTY.
                V_QFPGN = V_QFPG2.
    CONCATENATE V_QFPG2 V_WUNIT INTO V_QFPG2.
                V_AQTY = IT_J_1IGRXSUB-REC_QTY.
    IF V_QFPGN <> 0.
    CONCATENATE V_SCPGN1 V_QFPG2 INTO IT_FINAL-V_QTY1 SEPARATED BY ' / '.
    ELSE.
           IT_FINAL-V_QTY1 = V_SCPGN1.
    ENDIF.
    BURNING LOSS
    *Burning Loss = Qty-removed - ( Qty of processed finished goods +
                                   Qty of waste material)
    V_Q = V_QTYR - ( V_QFPGN + V_SCPGN ).
    IF V_Q GE 0.
    CONCATENATE V_Q 'KG' INTO IT_FINAL-BURNING
    SEPARATED BY ''.
    ELSE.
          V_Q = 0.
          IT_FINAL-BURNING = V_Q.
    ENDIF.
    MOVE-CORRESPONDING IT_J_1IEXCHDR TO IT_FINAL.
    IT_FINAL-ADDLDATA1  =  IT_J_1IEXCDTL-ADDLDATA1. " Nature of proc
    APPEND IT_FINAL.
    endselect.
    LOOP AT IT_FINAL.
        SELECT SINGLE adrnr                          "Adress Number
               FROM lfa1
               INTO IT_LFA1-adrnr
               WHERE lifnr = IT_J_1IEXCHDR-LIFNR.
       SELECT              " Vendor Address
              SINGLE name1 street city1 post_code1 tel_number fax_number
              house_num1
              FROM adrc
              INTO (IT_ADRC-name1,IT_ADRC-street,IT_ADRC-city1,
              IT_ADRC-post_code1,
              IT_ADRC-tel_number,IT_ADRC-fax_number,IT_ADRC-house_num1)
              WHERE addrnumber = it_lfa1-adrnr.
    CONCATENATION OF VENDOR NAME & ADDRESS INTO ONE FIELD i.e ADRS.
       CONCATENATE IT_ADRC-NAME1 IT_ADRC-STREET IT_ADRC-CITY1
                   IT_ADRC-POST_CODE1
                   INTO IT_FINAL-ADRS SEPARATED BY ''.
         MODIFY IT_FINAL.
    ENDLOOP.
    ***************CLEAR STATEMENT
         CLEAR  IT_FINAL.
         CLEAR  IT_J_1IEXCHDR.
         CLEAR  IT_MSEG.
         CLEAR  IT_J_1IEXCDTL.
         CLEAR  IT_J_1IGRXSUB.
         CLEAR  IT_ADRC.
         CLEAR  V_Q.
         CLEAR  V_SCPGN.
         CLEAR  V_WST.
         CLEAR  V_QFPG1.
         CLEAR  V_QFPG2.
         CLEAR  V_VAL.
         CLEAR  V_VAL1.
         CLEAR  V_AQTY.
         CLEAR  V_WUNIT.
         CLEAR  V_QTYR.
         CLEAR  V_UNTQT.
         CLEAR  V_SCPGN1.
         CLEAR  V_MEINS.
         CLEAR  V_WSTMQ.
         CLEAR  V_WSTMQ1.
         CLEAR  V_QFPGN.
         CLEAR  V_VALQ.
         CLEAR  V_UNITQ.
         CLEAR  V_WGHT.
         CLEAR  V_WGHT1.
    ENDLOOP.
    CLEAR  IT_J_1IEXCHDR[].
    CLEAR  IT_MSEG[].
    CLEAR  IT_J_1IEXCDTL[].
    CLEAR  IT_J_1IGRXSUB[].
    endform.                    " GET_DATA
    ADD
    form alv_events using events type slis_t_event.
      data : wa_events type slis_alv_event.
      clear wa_events.
      wa_events-name = 'TOP_OF_PAGE'.
      wa_events-form = 'TOP_OF_PAGE'.
      append wa_events to it_events.
    endform.                    "alv_events
    *FORM FOR TOP OF PAGE
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_listheader.
    endform.                    "top_of_page
    FORM fill_fieldcat  USING f d o t to p c.
      data wa_fieldcat type slis_fieldcat_alv.
      statics pos like sy-index value 1.
      pos = pos + 1.
      clear wa_fieldcat.
      MOVE : 1     TO   WA_FIELDCAT-ROW_POS,
             POS   TO   WA_FIELDCAT-COL_POS,
             F     TO   WA_FIELDCAT-FIELDNAME,
             D     TO   WA_FIELDCAT-SELTEXT_L,
             O     TO   WA_FIELDCAT-OUTPUTLEN,
             T     TO   WA_FIELDCAT-TABNAME,
             TO    TO   WA_FIELDCAT-DO_SUM,
             P     TO   WA_FIELDCAT-FIX_COLUMN,
             C     TO   WA_FIELDCAT-EMPHASIZE.
    move : 1     to   wa_fieldcat-row_pos,
            pos   to   wa_fieldcat-col_pos,
            f     to   wa_fieldcat-fieldname,
            d     to   wa_fieldcat-seltext_l,
            o     to   wa_fieldcat-outputlen,
            t     to   wa_fieldcat-tabname,
            to    to   wa_fieldcat-do_sum,
            p     to   wa_fieldcat-fix_column.
      append wa_fieldcat to it_fieldcat.
    ENDFORM.                    " fill_fieldcat
    *&      Form  CALL_FORM
          text
    -->  p1        text
    <--  p2        text
    form CALL_FORM .
    perform alv_header using it_listheader.
    perform alv_events using it_events.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               =  SY-REPID
       I_INTERNAL_TABNAME           =  'IT_FINAL'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = IT_FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    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 Columns Heading
    LOOP AT IT_FIELDCAT INTO V_FIELDCAT.
        CASE V_FIELDCAT-FIELDNAME.
          WHEN 'BUDAT'.
              V_FIELDCAT-SELTEXT_L = 'Date of Issue'.
          WHEN 'MAKTX'.
              V_FIELDCAT-SELTEXT_L = 'Description of goods (inputs)'.
          WHEN 'CHAPID'.
              V_FIELDCAT-SELTEXT_L = 'Tarrif Classification'.
          WHEN 'MENGE'.
              V_FIELDCAT-SELTEXT_L =  'Quantity Removed '.
          WHEN 'CHARG'.
              V_FIELDCAT-SELTEXT_L = 'Identification Marks, If any'.
          WHEN 'ADRS'.
             V_FIELDCAT-SELTEXT_L =
               'Premises/Factory to which goods removed'.
          WHEN 'EXNUM'.
             V_FIELDCAT-SELTEXT_L = 'Challan No.'.
          WHEN 'ADDLDATA1'.
             V_FIELDCAT-SELTEXT_L = 'Nature of Processing required'.
          WHEN 'CPUDT'.
           V_FIELDCAT-SELTEXT_L = 'Date of Receipt'.
          WHEN 'V_QTY1'.
              V_FIELDCAT-SELTEXT_L = 'Qty of Processed Finished Goods '.
          WHEN 'BURNING'.
              V_FIELDCAT-SELTEXT_L = 'Process Loss'.
          WHEN 'WST_M'.
         V_FIELDCAT-SELTEXT_L = 'Quantity of Waste Material'.
          WHEN 'ADDLDATA2'.
                 V_FIELDCAT-SELTEXT_L = 'Invoice No. & Date'.
          WHEN 'V_PARTIC'.
                 V_FIELDCAT-SELTEXT_L = 'Particulars of Payment of Duty'.
            V_FIELDCAT-REF_FIELDNAME = 'ERSDA'.
            V_FIELDCAT-REF_TABNAME   = 'J_1IEXCDTL'.
            WHEN OTHERS. CONTINUE.
        ENDCASE.
        V_FIELDCAT-SELTEXT_S = V_FIELDCAT-SELTEXT_L.
        V_FIELDCAT-SELTEXT_M = V_FIELDCAT-SELTEXT_L.
        MODIFY IT_FIELDCAT FROM V_FIELDCAT.
    ENDLOOP.
    perform fill_layout_structure.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       I_CALLBACK_TOP_OF_PAGE            = 'TOP-OF-PAGE'
       IS_LAYOUT                         = IS_LAYOUT
       IT_FIELDCAT                       =  IT_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
       I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = IT_EVENTS
      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                          =  IT_FINAL
    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.                    " CALL_FORM
    *&      Form  FILL_LAYOUT_STRUCTURE
          text
    -->  p1        text
    <--  p2        text
    form FILL_LAYOUT_STRUCTURE .
    data: wa_event       type slis_alv_event,
          wa_listheader  type slis_t_listheader.
      clear is_layout.
      is_layout-zebra = 'X'.
    SELL_MODE = 'D'.
    endform.                    " FILL_LAYOUT_STRUCTURE
    *&      Form  ALV_HEADER
          text
         -->P_IT_LISTHEADER  text
    form ALV_HEADER  using    p_it_listheader.
    data : wa_listheader  type slis_listheader.
      TEXT = 'Annexure - IV'.
      clear wa_listheader.
      wa_listheader-typ = 'H'.
      move  TEXT  to  wa_listheader-info.
      append wa_listheader to it_listheader.
    TEXT1 = 'Account of Removal of inputs or partially processed goods'.
      clear wa_listheader.
      wa_listheader-typ = 'S'.
      move  TEXT1
      to  wa_listheader-info.
      append wa_listheader to it_listheader.
    TEXT2 = 'under Sub Rule 5a of Rule of CENVAT Credit Rules, 2002'.
      clear wa_listheader.
      wa_listheader-typ = 'S'.
      move  TEXT2  to  wa_listheader-info.
      append wa_listheader to it_listheader.
    TEXT3 = '(to be maintened by assessee who sends raw '.
    clear wa_listheader.
      wa_listheader-typ = 'S'.
      move  TEXT3  to  wa_listheader-info.
      append wa_listheader to it_listheader.
    TEXT4 = 'materials/semifinished  goods.'.
    clear wa_listheader.
      wa_listheader-typ = 'S'.
      move  TEXT4  to  wa_listheader-info.
      append wa_listheader to it_listheader.
    endform.                    " ALV_HEADER
    Regards,
    Gulrez Alam

  • Field not present in the Field Catalog also getting displayed in the ALV

    Hi Experts,
    I am trying to display some to an ALV grid. But since i don't need all the fields from the internal table, i have deleted those fields from the field catalog. But in-spite of doing this the field heading is still getting displayed. I am not able to figure out the reason for this. Also note that the i have not deleted that field from my internal table which contains the actual data.
    Regards,
    Kush

    Hi,
    If your giving your internal table to the below field then ALV try to disply those many coloumn.
    wa_fcat-tabname    = 'IT_OUTPUT'.
    You can add for that field name.
    wa_fcat--NO_OUT = 'X'.
    Please check the field name on the output will be same as before column name .

  • Fields are getting displayed two times in alv grid

    Hi experts,
    I have developed an interactive alv.
    in basic list i have given two push buttons.
    if first button is selected it should display one list and second button is selected another list.
    I am displaying all the three lists using the FM 'REUSE_ALV_GRID_DISPLAY'.
    my problem is if select any of the button it is displying the data correctly,
    but if I come back to the basic list and click on the same button it is displaying each field two times(in two columns).
    and if click the same button third time it is displaying the fields three times(3 columns).
    can anybody tell me how to avoid this.
    Thanks,
    Sudheer

    HI,
    It seems like REFRESH of internal tables is missing. Please check and correct.
    Thanks,
    Vinod.

Maybe you are looking for