ALV HELP

My ALV Report Displays Data of Vendor Master
The user needs a functionality. : When Vendor Number on Alv Report is double clicked MK03 should be opened and the Display Vendor Address should be shown for that vendor.
Please guide how should I go about it. There is no parameter id for the Address Check Box in MK03 Screen. So Please dont suggest the set parameter id and call transaction.
thanks

Hello KVC,
Similar kind of reqirement we also got.
Want we can do is record a BDC and run it in all screen mode.
Check this:
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                  RS_SELFIELD TYPE SLIS_SELFIELD.
  DATA: L_LIFN2 TYPE WYT3-LIFN2.
  DATA: L_EKORG TYPE WYT3-EKORG.
*refresh g_t_bdc.
  CASE R_UCOMM.
    WHEN '&IC1'.   "doubleclick
      CHECK RS_SELFIELD-FIELDNAME = 'LIFN2'.
      READ TABLE G_T_WYT3 INDEX RS_SELFIELD-TABINDEX.
      IF SY-SUBRC = 0.
        CLEAR : L_LIFN2.
        SET PARAMETER ID 'LIF' FIELD G_T_WYT3-LIFN2.
        SET PARAMETER ID 'EKO' FIELD G_T_WYT3-EKORG.
        GET PARAMETER ID 'LIF' FIELD L_LIFN2.
        GET PARAMETER ID 'EKO' FIELD L_EKORG.
      ENDIF.
      PERFORM CALL_MK03 USING L_LIFN2 L_EKORG.
  ENDCASE.
ENDFORM.                    " USER_COMMAND
*&      Form  BDC_DYNPRO
*       text
*      -->P_0198   text
*      -->P_0199   text
FORM BDC_DYNPRO USING    PROGRAM
                         DYNPRO.
  CLEAR G_T_BDC.
  G_T_BDC-PROGRAM  = PROGRAM.
  G_T_BDC-DYNPRO   = DYNPRO.
  G_T_BDC-DYNBEGIN = 'X'.
  APPEND G_T_BDC.
ENDFORM.                    " BDC_DYNPRO
*&      Form  BDC_FIELD
*       text
*      -->P_0208   text
*      -->P_G_T_WYT3_LIFN2  text
FORM BDC_FIELD USING    FNAM
                        FVAL.
  IF FVAL <> SPACE.
    CLEAR G_T_BDC.
    G_T_BDC-FNAM = FNAM.
    G_T_BDC-FVAL = FVAL.
    APPEND G_T_BDC.
  ENDIF.
ENDFORM.                    " BDC_FIELD
*&      Form  call_mk03
*       text
*      -->P_LW_LIFN2  text
FORM CALL_MK03 USING    P_L_LIFN2 P_L_EKORG.
  PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0108'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'RF02K-D0110'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'USE_ZAV'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '/00'.
  PERFORM BDC_FIELD       USING 'RF02K-LIFNR'
                                 P_L_LIFN2.
  PERFORM BDC_FIELD       USING 'RF02K-EKORG'
                                 P_L_EKORG.
  PERFORM BDC_FIELD       USING 'RF02K-D0110'
                                'X'.
  PERFORM BDC_FIELD       USING 'USE_ZAV'
                                'X'.
  PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0111'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'RF02K-LIFNR'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '/00'.
  PERFORM BDC_DYNPRO      USING 'SAPLSPO1' '0100'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '=NO'.
  CALL TRANSACTION 'MK03' USING G_T_BDC MODE 'E'.
  CLEAR G_T_BDC.
  REFRESH G_T_BDC.
ENDFORM.                                                    " call_mk03
REgards,
Vasanth

Similar Messages

  • End of list in alv help

    hello experts,
    i want to display the following format in the end of the list of the ALV. the report actually has a grid structure and a list header , and now i want to add the following to the end of the list.
                                             bed                   pecess                      she cess
    opening balance
    credit from manufacturer
    credit from dealer
    credit from import
    total credit available
    debit
    closing balance
    The major problem here is the alignment.
    pls kindly help me if there are key words that can used for the aligning in the end-of-the-list.
    so far i have used the ***-typ and ***-info to display but i am not able to achieve what was required.
    And i want to know how to add the variables for eg: in the table above i have three variables to fill each row , but how do i achieve it. plz kindly help me if possible with some sample codes.
    Thanks in Advance.
    Edited by: Arun Pandian on Nov 26, 2008 7:33 AM

    Refer this link:
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    Regards,
    Ravi

  • ALV Help plz urgent

    Hi,
    Can anyone help me with ALV that how to display ALV Column Heading in Multiple Line.
    Means Multiple line Coulmn heading of ALV.
    Please fell free to contact me at
    [email protected]
    Regards,
    Muhammad Usman Malik
    SAP ABAP Consultant
    Siemens Pakistan
    +92-333-2700972

    Welcome to SDN.
    Copy Paste below code and execute the same. The output contains mutiple lines in header but I dont know how to do it in ALV. May be of some help to you.
    REPORT  ztestvib    MESSAGE-ID zz  LINE-SIZE 50.
    TYPE-POOLS: slis.
    DATA: x_fieldcat TYPE slis_fieldcat_alv,
          it_fieldcat TYPE slis_t_fieldcat_alv,
          l_layout TYPE slis_layout_alv,
          x_events TYPE slis_alv_event,
          it_events TYPE slis_t_event.
    DATA: BEGIN OF itab OCCURS 0,
          vbeln LIKE vbak-vbeln,
          posnr LIKE vbap-posnr,
          male TYPE i,
          female TYPE i,
         END OF itab.
    SELECT vbeln
           posnr
           FROM vbap
           UP TO 20 ROWS
           INTO TABLE itab.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-seltext_l = 'VBELN'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 1.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-seltext_l = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 2.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'MALE'.
    x_fieldcat-seltext_l = 'MALE'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 3.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'FEMALE'.
    x_fieldcat-seltext_l = 'FEMALE'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = 3.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_events-name = slis_ev_top_of_page.
    x_events-form = 'TOP_OF_PAGE'.
    APPEND x_events  TO it_events.
    CLEAR x_events .
    l_layout-no_colhead = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        is_layout          = l_layout
        it_fieldcat        = it_fieldcat
        it_events          = it_events
      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.
    *&      Form  top_of_page
          text
    FORM top_of_page.
    *-To display the headers for main list
      FORMAT COLOR COL_HEADING.
      WRITE: / sy-uline(103).
      WRITE: /   sy-vline,
            (8) ' ' ,
                 sy-vline,
            (8)  ' ' ,
                 sy-vline,
            (19) '***'(015) CENTERED,
                 sy-vline.
      WRITE: /   sy-vline,
            (8) 'VBELN'(013) ,
                 sy-vline,
            (8) 'POSNR'(014) ,
                 sy-vline,
            (8) 'MALE'(016) ,
                 sy-vline,
             (8)  'FMALE'(017) ,
                 sy-vline.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page

  • ALV help - Excel sheet comes in blank

    I need help with my ALV implementation.  The ALV displays fine but when I try to view it in Excel, by clicking on the icon, I get blank pages.  Does anybody have any ideas?  Below is the code that I am using to display the ALV.
    FORM display_alv .
      DATA: gr_alv TYPE REF TO cl_salv_table,
            gr_func TYPE REF TO cl_salv_functions,
            gr_columns TYPE REF TO cl_salv_columns_table,
            gr_column TYPE REF TO cl_salv_column_table,
            gr_error TYPE REF TO cx_salv_error.
      TRY.
          CALL METHOD cl_salv_table=>factory
            IMPORTING
              r_salv_table = gr_alv
            CHANGING
              t_table      = it_table.
        CATCH cx_salv_msg INTO gr_error.
      ENDTRY.
      gr_func = gr_alv->get_functions( ).
      gr_func->set_all( abap_true ).
      gr_alv->display( ).
    ENDFORM.                    " display_alv

    Hi,
    have a look at this forum thread:
    (here you´ll find a nice example by Rich Heilman).
    Best regards.

  • ALV help required

    Hi All,
    I require to download the ALV output in excel format using the export button in the toolbar. Can anyone please tell the process how to implement this functionality.
    Regards,
    Mainak

    Hi,
    I have written the below code in WDDOINIT of the main view to enable export functionality. Please suggest if there is any other way.
    DATA:
        lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage.
      DATA:
        lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      DATA: lr_export_settings TYPE REF TO if_salv_wd_export_settings,
    r_table type ref to CL_SALV_WD_CONFIG_TABLE,
            lr_std_func TYPE REF TO if_salv_wd_std_functions.
    lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
      IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
        lr_salv_wd_table_usage->create_component( ).
      ENDIF.
    *... get ALV component
      lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
    *... (1) get ConfigurationModel from ALV Component
      wd_this->r_table = lr_salv_wd_table->get_model( ).
    *... init FunctionSettings
      cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
        r_model = wd_this->r_table ).
      lr_std_func ?= wd_this->r_table.
      lr_std_func->set_export_allowed( abap_true ).

  • ALV help plz

    Hello, my alv contains a lot of fields .So when i scroll to the right ,i lose the first few fields and i do not know which one it is.
    1)How can i make the first 2 fields in my alv static(they do not move) , so that when i scroll to the right ,they are still there?
    2)I want the line colour(in my ALV) to change when i change lines (primary key is the first field)

    Hello,
    Use this link.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
    Cheers,
    Vasanth

  • ALV help on summing

    Hi,
    I have a report which will display the costing data. Now I have to sum on the Basis of Cost Centre and Profit Centre. I do not want the total. I want the line items to be summed on this 2 fields. How would I handle this in ALV Fieldcatalogue.
    Regards,
    Mira

    For the fields that are to be summed, in the field catalog, make sure that they have "do_sum" turned on.
      ls_fcat-do_sum     = 'X'.
    Doing this allows you to do sub-totaling.  At runtime, while ALV is being displayed.  Hightlight one of the columns like "Profit Center", click the subtotal icon. 
    You can either program this kind of functionality directly in the program but useing the parmeter "I_SORT" or the class CL_GUI_ALV_GRID, or something simuluar using the FM for alv grid.
    You could also save this layout as a default variant.
    Regards,
    Rich Heilman

  • ALvs' help

    Hi all,
    I am using 4 structures to populate the data . Already  i have prepared field catlog what are all the fields in 4 structruers.
    I have 4 radio button. if i selct 1 radio button , the data is coming into first structure, and if i selct 2 radiobutton , the data is coming into second structure respetively.
    How can i capture the which structure i am selcted dynamically.
    regards,
    Ajay

    Hi
    if radiubutton 1 = 'x' then execute one structure
    if radiobutton 2 = 'x' then execute structre 2
    like this write the code
    i am sending u a code in that its interctive report not alv
    in this way you can do that one
    in case of ALVs call that Fm grid
    under that radiobutton
    *& Report  ZNNR_REPORT
    REPORT  ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).
    ******DATA DECLARATIONS**********
    DATA : BEGIN OF IT_PLANT OCCURS 0,
            MATNR LIKE MARA-MATNR,
            WERKS LIKE MARC-WERKS,
            PSTAT LIKE MARC-PSTAT,
            EKGRP LIKE MARC-EKGRP,
           END OF IT_PLANT.
    DATA : BEGIN OF IT_PONO OCCURS 0,
            EBELN LIKE EKKO-EBELN,
            EBELP LIKE EKPO-EBELP,
            MATNR LIKE EKPO-MATNR,
            WERKS LIKE EKPO-WERKS,
            LGORT LIKE EKPO-LGORT,
           END OF IT_PONO.
    TABLES EKKO.
    ********END OF DATA DECLARATIONS*********
    ********SELECTION SCREEN DESIGN ***********
    *SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R1 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    *SELECTION-SCREEN END OF LINE.
    ******END OF SELECTION SCREEN DESIGN****************
    *********INITIALIZATION OF SELECTION SCREEN ELEMENTS.*****
    INITIALIZATION.
    P_WERKS = '1000'.
    S_EBELN-LOW = '4500016926'.
    S_EBELN-OPTION = 'EQ'.
    S_EBELN-SIGN = 'I'.
    APPEND S_EBELN.
    CLEAR S_EBELN.
    ************END OF INITIALIZATION***********************
    ***********SCREEN MODIFICATIONS*******************
    AT SELECTION-SCREEN OUTPUT .
      LOOP AT SCREEN .
        IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 's2'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
        IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    *AT SELECTION-SCREEN OUTPUT.
    IF sy-ucomm = 'RB'.
    IF r1 = 'X' and screen-group1 eq 's2'.
       LOOP AT SCREEN.
         IF screen-name = 'p_werks'.
           screen-required = 1. "mandatory field
           MODIFY SCREEN.
         ENDIF.
       ENDLOOP.
    ENDIF.
    *elseIF r2 = 'X' and screen-group1 eq 's1'.
    LOOP AT SCREEN.
       IF screen-name = 's_ebeln'.
         screen-required = 0. "mandatory field
         MODIFY SCREEN.
       ENDIF.
    ENDLOOP.
    *ENDIF.
    ********END OF SCREEN MODIFICATIONS*****************
    ***************SCREEN VALIDATIONS *****************
      SELECT SINGLE *
               FROM EKKO
               INTO EKKO
               WHERE EBELN IN S_EBELN.
      IF SY-SUBRC <> 0.
        SET CURSOR FIELD 'S_EBELN-LOW'.
        MESSAGE E999 WITH TEXT-005.
      ENDIF.
    ********end of screen validation*****************
    START-OF-SELECTION.
    *set pf-status '100'.
      IF R1 EQ 'X'.
        SELECT MATNR
               WERKS
               PSTAT
               EKGRP
           FROM MARC
           INTO TABLE IT_PLANT
           WHERE WERKS = P_WERKS.
        LOOP AT IT_PLANT.
          WRITE : SY-VLINE , 2 IT_PLANT-MATNR COLOR COL_KEY,
                 21 SY-VLINE , 22  IT_PLANT-WERKS COLOR COL_KEY,
                 27 SY-VLINE ,28 IT_PLANT-PSTAT COLOR COL_NORMAL,
                 43 SY-VLINE ,44 IT_PLANT-EKGRP COLOR COL_NORMAL.
        ENDLOOP.
      ENDIF.
      IF R2 EQ 'X'.
        SELECT EBELN EBELP MATNR WERKS LGORT
               FROM EKPO
               INTO TABLE IT_PONO
               WHERE EBELN IN S_EBELN.
        LOOP AT IT_PONO.
          WRITE : SY-VLINE , 2 IT_PONO-EBELN COLOR COL_KEY,
                 12 SY-VLINE , 13 IT_PONO-EBELP COLOR COL_KEY,
                 18 SY-VLINE , 19 IT_PONO-MATNR COLOR COL_NORMAL,
                 37 SY-VLINE , 38 IT_PONO-WERKS COLOR COL_NORMAL,
                 44 SY-VLINE , 45 IT_PONO-LGORT COLOR COL_NORMAL, 49 SY-VLINE..
        ENDLOOP.
      ENDIF.
    TOP-OF-PAGE.
      IF R1 EQ 'X'.
    *ULINE AT /1(48).
        WRITE : SY-VLINE ,2 'MATERIAL NUMBER',
                21 SY-VLINE , 22 'PLANT',
                27 SY-VLINE , 28 'STATUS',
                43 SY-VLINE , 44 'GRUP', 48 SY-VLINE.
        ULINE AT /1(48).
      ENDIF.
      IF R2 EQ 'X'.
        WRITE : SY-VLINE , 2 'PO NUMBER',
               12 SY-VLINE, 13 'ITEM',
               18 SY-VLINE,19 'MATERIAL NUMBER',
               37 SY-VLINE, 38 'PLANT',
               44 SY-VLINE, 45 'GRUP',
               49 SY-VLINE.
        ULINE AT /1(50).
      ENDIF.
    END-OF-PAGE.
      ULINE AT /1(50).
      WRITE :/10 'PAGE NUMBER', SY-PAGNO.
    <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

  • ALV Help-pushbutton?

    Dear all,
    I am unable to select the a field.I am using REUSE_ALV_GRID_DISPLAY.There is no pushbutton on the left side to select the row.if i click on one value in the field than that entire row gets selected.How to get that pushbutton?

    box_fieldname
    box_tabname
    populate above fileds in the layout it will display push button to select the row and  the correponding field will be automatically populated based on the row selection.
    Regards,
    Gopi,
    reward points if helpfull.

  • Unable to display Refreshed editable alv

    hi
    I have developed editable alv which contains 7 colums. the final column is the addition of 4th n 5th cplumn. when i refresh after changing the values, the final column is not changing. but while debugging the changed values are reflected in internal table but its reflected in alv.
    help me out

    in the user_comand form you have to put rs_selfield-refresh = 'X'.
    like this:
    *& Form user_comand
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    rs_selfield-refresh = 'X'.

  • Difference between ALV and Table control

    Hi folks,
    i want to know the major differences between AlV and table controls.
    i know that table control is designed in screen painter, but i want to know the major diff between Table control and ALV.
    helpful answers will be rewarded.
    Regards,
    Naveen

    Hi Naveen,
    Basically ALV is a way to display the output and Table Control is designed in screen painter through which you can get entries in Table Control, can delete some records etc for further processing and  its not use only for Display.
    <b>ALV is Application List viewer:-</b>
    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. 
    In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. 
    <b>TABLE CONTROL:-</b>
    ABAP offers two mechanisms for displaying and using table data in a screen. These mechanisms are table controls and step loops. Table controls and step loops are types of screen tables you can add to a screen in the Screen Painter.
    Rewards if useful.
    Regards,
    Shilpi

  • Finding of  predefined (ALV Reports , BDC Programs ,ALVReports using OOps )

    Hi All
      How to Finding of  predefined (ALV Reports , BDC Programs ,ALVReports using  OOps ) and how to know particular include prog is holing specific logic & how to re-use that includes & Perform .
    Thanks in Adv
    Rgds
    Rafi .V

    Hi,
    Refer this link for ALV oops.
    Re: ALV HELP
    Thanks,
    Anitha

  • ALV Row Separator

    Hello,
    Can any one tell me is it possible to insert a separator in between the ALV rows ?
    This will be used for identifiy & classify some categories of the rows values.
    Please advice. rewards assured
    Thanks!!
    rgds,
    Vishal

    Hi
    Refer this thread
    ALV HELP
    Regards
    Raj

  • How to maintain the column heading in two lines

    for example i have field ACCOUNTING CLEARK
    i want to display this description in alv list
    like ACC
         clk
    Please send the solution for this.
    very urgent
    thanks in advance
    regards
    venu

    hi
    please check my code
    for field KNB1-BUSAB
    i want the description ACC in place of ACC CLK
                           CLK
    means in two lines
    report zfir0098 message-id zz
                    line-size 255
                    line-count 65
                    no standard page heading.
    (C) Copyright <2006> by Eastman Kodak Company - All Rights Reserved.
    Report Name     : ZFIR0098
    Author          : Venugopalreddy.K
    Created on      : 12-MAY-2006
    SIR#            : 086279
    Interface ID#   : RO-01509 - Open AR Aging by Due Date
    Correction#     : D11K947333
    Transaction code: Z_ZFIR0098
    Logical Database: N/A
    SAPScript name  : N/A
    Application Area: FI
    Programs Called : N/A
    Function Modules: REUSE_ALV_VARIANT_F4
                      REUSE_ALV_VARIANT_DEFAULT_GET
                      REUSE_ALV_EVENTS_GET
                      REUSE_ALV_LIST_DISPLAY
                      REUSE_ALV_EVENTS_GET
                      REUSE_ALV_COMMENTARY_WRITE
    Description     : Report to display Open AR with Aging by due
                      date. The open items are displayed by Linked
                      Accounts, Customer Account, Business unit and
                      Posting Date.
    Correction#     SIR#       Modified By                  Date
    D11Kxxxxxx                 xxxxxx xxxx                  MM/DD/YYYY
    Description of change (copy from SIR):
    (text)................................................................
              TABLE DEFINITION                                           *
    tables : t001,    "Company Codes
             knvv,    "Customer Master Sales Data
             bsid,    "Accounting: Secondary Index for Customers
             knkk,    "Customer master credit management: Control area data
             kna1,    "General Data in Customer Master
             knb1,    "Customer Master (Company Code)
             t052,    "Terms of Payment
             tvv1.    "Customer Group 1
                          TYPE POOLS                                     *
    type-pools: slis.
             INTERNAL TABLE DECLARATION
    Internal table for Customer Master (Company Code)
    data :   begin of i_knb1 occurs 0,
               kunnr type knb1-kunnr,
               bukrs type knb1-bukrs,
               busab type knb1-busab,
             end   of i_knb1.
    Internal table for Customer Master Sales Data
    data :   begin of i_knvv occurs 0,
               kunnr type knvv-kunnr,
               vkorg type knvv-vkorg,
               kvgr1 type knvv-kvgr1,
               zterm type knvv-zterm,
             end   of i_knvv.
    Internal table for linked account nos.
    data :   begin of i_knkk occurs 0,
               kunnr type knkk-kunnr,
               kkber type knkk-kkber,
               klimk type knkk-klimk,
               knkli type knkk-knkli,
               sbgrp type knkk-sbgrp,
               grupp type knkk-grupp,
               kdgrp type knkk-kdgrp,
             end   of i_knkk.
    Internal table for Customer's credit limit
    data :   begin of i_knkk_knkli occurs 0,
               kunnr type knkk-kunnr,
               klimk type knkk-klimk,
               knkli type knkk-knkli,
             end   of i_knkk_knkli.
    Internal table for T001 records
    data:    begin of i_t001 occurs 0,
               bukrs type t001-bukrs,
               waers type t001-waers,
             end   of i_t001.
    Internal table for BSID records
    data :   begin of i_bsid occurs 0,
               bukrs type bsid-bukrs,
               kunnr type bsid-kunnr,
               zuonr type bsid-zuonr,
               belnr type bsid-belnr,
               budat type bsid-budat,
               bldat type bsid-bldat,
               waers type bsid-waers,
               shkzg type bsid-shkzg,
               dmbtr type bsid-dmbtr,
               wrbtr type bsid-wrbtr,
               zfbdt type bsid-zfbdt,
               zterm type bsid-zterm,
               zbd1t type bsid-zbd1t,
               zbd2t type bsid-zbd2t,
               zbd3t type bsid-zbd3t,
               kkber type bsid-kkber,
             end   of i_bsid.
    Internal table for Customer Master
    data :   begin of i_kna1 occurs 0,
               kunnr type kna1-kunnr,
               name1 type kna1-name1,
             end   of i_kna1.
    Internal table for Terms of Payment
    data :   begin of i_t052 occurs 0,
               zterm type t052-zterm,
               ztagg type t052-ztagg,
               ztag1 type t052-ztag1,
               ztag2 type t052-ztag2,
               ztag3 type t052-ztag3,
             end   of i_t052.
    Internal table for final output
    data :   begin of i_output occurs 0,
               kunnr1      type bsid-kunnr,
               kunnr       type bsid-kunnr,
               bukrs       type t001-bukrs,
               kdgrp       type knkk-kdgrp,
               name1       type kna1-name1,
               kvgr1       type knvv-kvgr1,
               knkli       type knkk-knkli,
               klimk       type knkk-klimk,
               sbgrp       type knkk-sbgrp,
               zuonr       type bsid-zuonr,
               bldat       type bsid-bldat,
               due_date    type bsid-zfbdt,
               not_due     type bsid-dmbtr,
               curr_due    type bsid-dmbtr,
               due_01_30   type bsid-dmbtr,
               due_31_60   type bsid-dmbtr,
               due_61_90   type bsid-dmbtr,
               due_91_180  type bsid-dmbtr,
               due_181_365 type bsid-dmbtr,
               due_gt_365  type bsid-dmbtr,
               spcol       type bsid-dmbtr,
               tot_due     type bsid-dmbtr,
               tot_ar      type bsid-dmbtr,
               waers       type t001-waers,
               zterm       type bsid-zterm,
               zterm1      type knvv-zterm,
               v_no_days   type i,
               busab       type knb1-busab,
             end   of i_output.
    Internal table for summary data
    data :   begin of i_output_summary occurs 0,
               bukrs       type t001-bukrs,
               kunnr       type bsid-kunnr,
               name1       type kna1-name1,
               kvgr1       type knvv-kvgr1,
               klimk       type knkk-klimk,
               zterm       type knvv-zterm,
               kdgrp       type knkk-kdgrp,
               sbgrp       type knkk-sbgrp,
               busab       type knb1-busab,
               not_due     type bsid-dmbtr,
               curr_due    type bsid-dmbtr,
               due_01_30   type bsid-dmbtr,
               due_31_60   type bsid-dmbtr,
               due_61_90   type bsid-dmbtr,
               due_91_180  type bsid-dmbtr,
               due_181_365 type bsid-dmbtr,
               due_gt_365  type bsid-dmbtr,
               spcol       type bsid-dmbtr,
               tot_due     type bsid-dmbtr,
               tot_ar      type bsid-dmbtr,
               waers       type t001-waers,
             end   of i_output_summary.
    Temporary internal table for KNVV records.
    data :   i_knvv_tmp like i_knvv occurs 0 with header line.
    Temporary internal table for KNKK records.
    data :   i_knkk_tmp like i_knkk occurs 0 with header line.
    Temporary internal table for BSID records.
    data :   i_bsid_tmp like i_bsid occurs 0 with header line.
             FIELD STRING DECLARATION
    Structure to validate selection screen
    data :   begin of v_radio,
               rd1  type c,
               rd2  type c,
               rd3  type c,
             end   of v_radio.
    Structure to validate selection screen
    data :   begin of v_radio1,
               rd1  type c,
               rd2  type c,
               rd3  type c,
             end   of v_radio1.
             Internal Tables for ALV Report
    data:   i_fieldcat_alv      type  slis_t_fieldcat_alv,
            i_sort              type  slis_t_sortinfo_alv,
            i_sort1             type  slis_t_sortinfo_alv,
            i_events            type  slis_t_event,
            v_events            type  slis_alv_event,
            v_fieldcat_alv      type  slis_fieldcat_alv,
            v_sort              like  line of i_sort,
            v_sort1             like  line of i_sort1,
            v_layout            type  slis_layout_alv,
            v_print             type  slis_print_alv,
            i_list_comments     type  slis_t_listheader,
            v_list_comments     like  line of i_list_comments,
            v_variant           like  disvariant,     "Layout-External Use
            v_variant_save      type  c,              "To Store the Varient
            v_variant1          like  disvariant,
            v_exit              type  c.              "Event exit
            Data declaration
    data:   v_paym_days         type  i,
            v_date_diff         type  i,
            v_zterm             type  t052-zterm,
            v_bukrs1            like  bsid-bukrs,
            v_kunnr             like  bsid-kunnr,
            v_kdgrp             like  knkk-kdgrp,
            v_bukrs             like  bsid-bukrs,
            v_name1             like  kna1-name1,
            v_knkli             like  knkk-knkli,
            v_klimk(20)         type  c,
            v_kvgr1             like  knvv-kvgr1,
            v_kkber             like  knkk-kkber,
            v_sbgrp             like  knkk-sbgrp,
            v_busab             like  knb1-busab.
    data:   v_cust_not_due      type  bsid-dmbtr,
            v_cust_curr_due     type  bsid-dmbtr,
            v_cust_due_01_30    type  bsid-dmbtr,
            v_cust_due_31_60    type  bsid-dmbtr,
            v_cust_due_61_90    type  bsid-dmbtr,
            v_cust_due_91_180   type  bsid-dmbtr,
            v_cust_due_181_365  type  bsid-dmbtr,
            v_cust_due_gt_365   type  bsid-dmbtr,
            v_cust_spcol        type  bsid-dmbtr,
            v_cust_tot_due      type  bsid-dmbtr,
            v_cust_tot_ar       type  bsid-dmbtr,
            v_curr              type  t001-waers,
            v_name              type  kna1-name1,
            v_kvgr              type  knvv-kvgr1,
            v_kdgrp1            type  knkk-kdgrp,
            v_klimk1            type  knkk-klimk,
            v_zterm1            type  knvv-zterm,
            v_sbgrp1            type  knkk-sbgrp,
            v_busab1            type  knb1-busab.
    data:   v_repid             like  sy-repid,
            v_flag              type  c.
              CONSTANT DEFINITION
    constants:
            c_sel_x(1)                  type c value 'X',
            c_0(1)                      type c value '0',
            c_1(1)                      type c value '1',
            c_knkli(7)                  type c value 'S_KNKLI',
            c_kdgrp(7)                  type c value 'S_KDGRP',
            c_debit_s(1)                type c value 'S',
            c_credit_h(1)               type c value 'H',
            c_deflt_zterm_y000(4)       type c value 'Y000',
            c_sc01(4)                   type c value 'SC01',
            c_subtotal_text             type slis_formname value
                                                  'ALV_SUBTOTALS',
            c_formname_top_of_page      type slis_formname value
                                                  'F_TOP_OF_PAGE',
            c_formname_top_of_page_summ type slis_formname value
                                                  'F_TOP_OF_PAGE_SUMM'.
                       Selection-screen
    selection-screen begin of block b1 with frame title text-s01.
    parameters     : p_bukrs type t001-bukrs obligatory.
    select-options : s_kvgr1 for knvv-kvgr1,
                     s_sbgrp for knkk-sbgrp,
                     s_busab for knb1-busab,
                     s_budat for bsid-budat,
                     s_kunnr for knvv-kunnr.
    selection-screen end of block b1.
    selection-screen begin of block b2 with frame title text-s02.
    selection-screen begin of line.
    parameters : p_lk_on as checkbox.
    selection-screen comment 5(24)  text-s10 for field p_lk_on.
    selection-screen end of line.
    selection-screen comment 02(67) text-s12.
    selection-screen skip 1.
    selection-screen begin of line.
    parameters      :p_knkli radiobutton  group g1 user-command radi
                                                default 'X'.
    selection-screen comment 5(24)  text-s05 for field p_knkli.
    select-options  :s_knkli for knkk-knkli.
    selection-screen end of line.
    selection-screen begin of line.
    parameters      :p_kdgrp radiobutton  group g1.
    selection-screen comment 5(24)  text-s06 for field p_kdgrp.
    select-options  :s_kdgrp for knkk-kdgrp.
    selection-screen end of line.
    selection-screen begin of line.
    parameters      :p_all_lk radiobutton  group g1.
    selection-screen comment 5(24)  text-s07 for field p_all_lk.
    selection-screen end of line.
    selection-screen end of block b2.
    selection-screen begin of block b3 with frame title text-s03.
    selection-screen begin of line.
    parameters      :p_op_ab radiobutton  group g2.
    selection-screen comment 5(32) text-s08 for field p_op_ab.
    selection-screen end of line.
    selection-screen begin of line.
    parameters      :p_ab radiobutton  group g2.
    selection-screen comment 5(16) text-s09 for field p_ab.
    selection-screen end of line.
    selection-screen end of block b3.
    selection-screen begin of block b4 with frame title text-s11.
    parameters      :p_vari like disvariant-variant.
    selection-screen end of block b4.
    INITIALIZATION
    initialization.
    To initialize the variant
      perform initialize_variant.
    To fetch the default variant for the ALV report
      perform display_default_variant.
         At selection-screen
    at selection-screen.
    To validate company code
      perform check_company_code.
    To validate business unit
      perform check_business_unit.
      move: p_knkli  to v_radio1-rd1,
            p_kdgrp  to v_radio1-rd2,
            p_all_lk to v_radio1-rd3.
      if not s_kvgr1[] is initial and
         not s_sbgrp[] is initial.
        message e045 with text-073.
      endif.
    at selection-screen output.
      move: p_knkli  to v_radio-rd1,
            p_kdgrp  to v_radio-rd2,
            p_all_lk to v_radio-rd3.
    To maintain the select options visiable and invisible
      perform selection_screen_output.
    Check the radio buttons selected in selection screen
      if v_radio1 eq v_radio.
      To maintain the default settings
        perform selection_screen_check.
      endif.
             AT SELECTION-SCREEN ON VALUE-REQUEST
    At Selection Screen Value Request.
    at selection-screen on value-request for p_vari.
    To Display the Existing Variants(Layout).
      perform variant_help_f4 using p_vari.
             Event start-of-selection
    start-of-selection.
    Get the cusomer number
      perform get_knb1_details.
    Get the customer group details
      perform get_knvv_details.
    Get all linked account and credit account details from KNKK
      perform get_linked_accounts_details.
    Get open AR documents from BSID
      perform get_open_ar_details.
    Get the company code and curreny.
      perform get_com_code_curr.
    Get the customer name
      perform get_customer_name.
    Get the payment term days
      perform get_payment_term_days.
    Populate the final table having all the field details
      perform populate_final_table.
    To display the output in alv list.
      perform alv_list_dispaly.
          Form  initialize_variant
          To initialize the ALV Variant
    form initialize_variant.
      clear: v_variant.
      v_repid = sy-repid.
      v_variant-report   = v_repid.
      v_variant-username = sy-uname.
      v_variant_save     = 'A'.
    endform.                    " initialize_variant
          Form  display_default_variant
          To fetch the Default ALV variant
    form display_default_variant.
      if not p_vari is initial.
        v_variant-variant = p_vari.
      endif.
      clear v_variant1.
      v_variant1 = v_variant.
    The function module is used to fetch the default variant
      call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
        exporting
          i_save        = v_variant_save
        changing
          cs_variant    = v_variant1
        exceptions
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          others        = 4.
    Based on the SUBRC value the variant is assigned
      case sy-subrc.
        when 0.
          p_vari = v_variant1-variant.
        when 2.
          clear p_vari.
      endcase.
    endform.                    " display_default_variant
          Form  check_company_code
          Validate Company Code
    form check_company_code.
      select single *
        from t001
       where bukrs eq p_bukrs.
      if sy-subrc ne 0.
        message e339.
      endif.
    endform.                    " check_company_code
          Form  check_business_unit
          Validate Business Unit
    form check_business_unit.
      select single *
        from tvv1
       where kvgr1 in s_kvgr1.
      if sy-subrc ne 0.
        message e045 with text-e01.
      endif.
    endform.                    " check_business_unit
      Form  selection-screen-output
      On selection of corresponding radio button the respective
      Select-option will be high lighted
    form selection_screen_output.
      loop at screen.
        if p_knkli = c_sel_x.
        Credit Account invisible
          if screen-name cs  c_knkli.
            screen-invisible = c_0.
            screen-active    = c_1.
            modify screen.
          endif .
        Customer Group visible
          if screen-name cs  c_kdgrp.
            screen-invisible = c_1.
            screen-active    = c_0.
            modify screen.
          endif.
        elseif p_kdgrp = c_sel_x.
        Credit Account invisible
          if screen-name cs  c_knkli.
            screen-invisible = c_1.
            screen-active    = c_0.
            modify screen.
          endif .
        Customer Group visible
          if screen-name cs  c_kdgrp.
            screen-invisible = c_0.
            screen-active    = c_1.
            modify screen.
          endif.
        elseif p_all_lk = c_sel_x.
        Credit Account invisible
          if screen-name cs  c_knkli.
            screen-invisible = c_1.
            screen-active    = c_0.
            modify screen.
          endif .
        Customer Group invisible
          if screen-name cs  c_kdgrp.
            screen-invisible = c_1.
            screen-active    = c_0.
            modify screen.
          endif.
        endif.
      endloop.
    endform.                    " selection_screen_output
         Form selection_screen_check
         To check the selection screen radio buttons
    form selection_screen_check.
      if p_knkli = c_sel_x.
        if p_op_ab is initial.
          p_op_ab = c_sel_x.
          p_ab = ''.
        endif.
      elseif p_kdgrp = c_sel_x.
        if p_op_ab is initial.
          p_op_ab = c_sel_x.
          p_ab = ''.
        endif.
      elseif p_all_lk = c_sel_x.
        if p_op_ab is initial.
          p_op_ab = c_sel_x.
          p_ab = ''.
        endif.
      endif.
    endform.                    " selection_screen_check
          Form  variant_help_f4
          To get the list of ALV help variants
    form variant_help_f4 using p_variant.
      call function 'REUSE_ALV_VARIANT_F4'
        exporting
          is_variant    = v_variant
          i_save        = v_variant_save
        importing
          e_exit        = v_exit
          es_variant    = v_variant
        exceptions
          not_found     = 1
          program_error = 2
          others        = 3.
      if sy-subrc <> 0.
      If no variants exist
        message s045 with text-e02.
      endif.
      if v_exit is initial.
        p_variant       = v_variant-variant.
      endif.
    endform.                    " variant_help_f4
         Form  get_knb1_details
         To get the Customer number
    form get_knb1_details.
    Fetch data from Customer Master (Company Code)
    based on selection criteria(company code)
      select kunnr bukrs busab
        from knb1
        into table i_knb1
       where bukrs eq p_bukrs.
      if sy-subrc ne 0.
        message i561.
        leave list-processing.
      endif.
    endform.                    " get_knb1_details
         Form  get_knvv_details
         To get the Customer group details
    form get_knvv_details.
      if not i_knb1[] is initial.
        sort i_knb1 by kunnr bukrs.
        delete adjacent duplicates from i_knb1 comparing kunnr bukrs.
      Fecth data from Customer Master Sales Data
      based on internal table I_KNB1 and selection criteria
      (customer group)
        select kunnr vkorg kvgr1 zterm
          from knvv
          into table i_knvv
          for  all entries in i_knb1
         where kunnr eq i_knb1-kunnr
           and kunnr in s_kunnr
           and vkorg eq i_knb1-bukrs.
        if sy-subrc ne 0.
          message i561.
          leave list-processing.
        endif.
      endif.
    endform.                    " get_knvv_details
         Form  get_linked_accounts_details
          To get the linked account details
    form get_linked_accounts_details.
      if not i_knvv[] is initial.
      get unique customer account KUNNR from i_bsid.
        i_knvv_tmp[] = i_knvv[].
        sort i_knvv_tmp by kunnr.
        delete adjacent duplicates from i_knvv_tmp comparing kunnr.
        clear v_kkber.
        concatenate 'C' p_bukrs+1(3) into v_kkber.
        sort i_knvv_tmp by kunnr.
      Fetch the Customer's account number and Customer Group
      details form Customer master credit management based on
      internal table i_bsid_tmp and Credit control area
        select kunnr kkber klimk knkli sbgrp grupp kdgrp
          from knkk
          into table i_knkk
          for  all entries in i_knvv_tmp
         where kunnr eq i_knvv_tmp-kunnr
           and kkber eq v_kkber.
        if not i_knkk[] is initial.
          i_knkk_tmp[] = i_knkk[].
          if p_lk_on = 'X' or not s_knkli[] is initial
                           or not s_kdgrp[] is initial.
            loop at i_knkk_tmp.
              loop at i_knkk where knkli eq i_knkk_tmp-knkli
                               and kunnr ne i_knkk_tmp-knkli.
                exit.
              endloop.
              if sy-subrc ne 0.
                delete i_knkk where knkli eq i_knkk_tmp-knkli.
              endif.
            endloop.
          endif.
          if not s_knkli[] is initial.
            delete i_knkk where not knkli in s_knkli.
          endif.
          if not s_kdgrp[] is initial.
            delete i_knkk where not kdgrp in s_kdgrp.
          endif.
          if not s_sbgrp[] is initial.
            delete i_knkk where not sbgrp in s_sbgrp.
          endif.
        else.
          message i561.
          leave list-processing.
        endif.
      else.
        message i561.
        leave list-processing.
      endif.
    endform.                    " get_linked_accounts_details
         Form  get_com_code_curr
          Get the company code and currency
    form get_com_code_curr .
      select bukrs waers
        from t001
        into table i_t001
       where bukrs eq p_bukrs.
    endform.                    " get_com_code_curr
         Form  get_open_ar_details
          Read BSID for all open AR
    form get_open_ar_details.
      if not i_knkk[] is initial.
        refresh i_knkk_tmp.
        i_knkk_tmp[] = i_knkk[].
        sort i_knkk_tmp by knkli.
        delete adjacent duplicates from i_knkk_tmp comparing kunnr.
      Fetch the from Accounting: Secondary Index for Customers
      based on internal table i_knvv and selection criteria(Posting Date
      -in the Document)
        select bukrs kunnr zuonr belnr budat bldat waers shkzg
               dmbtr wrbtr zfbdt zterm zbd1t zbd2t zbd3t kkber
          from bsid
          into table i_bsid
          for  all entries in i_knkk_tmp
         where bukrs eq p_bukrs
           and kunnr eq i_knkk_tmp-kunnr
           and umskz eq space
           and bstat eq space
           and budat in s_budat.
        if i_bsid[] is initial.
          message i561.
          leave list-processing.
        endif.
      else.
        message i561.
        leave list-processing.
      endif.
    endform.                    " get_open_ar_details
         Form  get_customer_name
          To get the customer name
    form get_customer_name.
      if not i_knvv_tmp[] is initial.
      Get the customer name from KNA1 for all customer
        select kunnr name1
          from kna1
          into table i_kna1
          for  all entries in i_knvv_tmp
         where kunnr = i_knvv_tmp-kunnr.
      endif.
    endform.                    " get_customer_name
         Form  get_payment_term_days
           To get the payment days
    form get_payment_term_days.
      if not i_bsid[] is initial.
        clear i_bsid_tmp.
        refresh i_bsid_tmp.
        i_bsid_tmp[] = i_bsid[].
        sort i_bsid_tmp by zterm.
        delete i_bsid_tmp where shkzg ne c_debit_s.
        if not i_bsid_tmp[] is initial.
        Get the Payment days from T052
          select zterm ztagg ztag1 ztag2 ztag3
            from t052
            into table i_t052
            for all entries in i_bsid
           where zterm = i_bsid-zterm.
        endif.
      endif.
    endform.                    " get_payment_term_days
         Form  populate_final_table
          To polupate final internal table
    form populate_final_table.
      sort i_bsid.
      sort i_kna1 by kunnr.
      sort i_knkk by kunnr.
      sort i_knkk_knkli by kunnr.
      sort i_knvv by vkorg kunnr.
      sort i_t052 by zterm ztag1 ztag2 ztag3.
      sort i_t001 by bukrs.
      loop at i_bsid.
        clear i_knb1.
        read table i_knb1 with key kunnr = i_bsid-kunnr
                                           binary search.
        if not i_knb1-busab in s_busab.
          continue.
        else.
          i_output-busab = i_knb1-busab.
        endif.
        clear i_knvv.
        read table i_knvv with key kunnr = i_bsid-kunnr
                                   vkorg = i_bsid-bukrs
                                          binary search.
        if not i_knvv-kvgr1 in s_kvgr1.
          continue.
        else.
          i_output-kvgr1  = i_knvv-kvgr1.
          i_output-zterm1 = i_knvv-zterm.
        endif.
      To read the data from kna1,knkk and knvv and moving data to final
      internal table i_output.
        perform move_kna1_knkk_knvv.
      To read the data from bsid and t052 and moving data to final
      internal table i_output.
        perform move_bsid_t052.
      To calculate the number of days.
        perform move_no_of_days.
      endloop.
    endform.                    " populate_final_table
         Form  move_kna1_knkk_knvv
         To read the data fron kna1,knkk and knvv
    form move_kna1_knkk_knvv.
      clear i_kna1.
      read table i_kna1 with key kunnr = i_bsid-kunnr
                                         binary search.
      if sy-subrc eq 0.
        i_output-name1 = i_kna1-name1.
      endif.
      clear i_knkk.
      read table i_knkk with key kunnr = i_bsid-kunnr
                                         binary search.
      if sy-subrc eq 0.
        i_output-knkli = i_knkk-knkli.
        i_output-kdgrp = i_knkk-kdgrp.
        i_output-klimk = i_knkk-klimk.
        i_output-sbgrp = i_knkk-sbgrp.
      endif.
    endform.                    " move_kna1_knkk_knvv
         Form  move_bsid_t052
         To read the data from BSID and T052
    form move_bsid_t052.
      move: i_bsid-kunnr  to  i_output-kunnr,
            i_bsid-zuonr  to  i_output-zuonr ,
            i_bsid-zterm  to  i_output-zterm,
            i_bsid-bldat  to  i_output-bldat,
            i_bsid-kunnr  to  i_output-kunnr1.
      read table i_t001 with key bukrs = i_bsid-bukrs
                                         binary search.
      if sy-subrc eq 0.
        move: i_t001-bukrs  to  i_output-bukrs,
              i_t001-waers  to  i_output-waers.
      endif.
      if i_bsid-shkzg eq c_credit_h.
        i_bsid-dmbtr  = - i_bsid-dmbtr.
      endif.
      move i_bsid-dmbtr  to  i_output-tot_ar.
    If base line date is initial, then use Document date.
      if i_bsid-zfbdt is initial.
        i_bsid-zfbdt = i_bsid-bldat.
      endif.
      if i_bsid-shkzg eq c_debit_s.
        clear v_paym_days.
        if not i_bsid-zbd3t is initial.
          v_paym_days = i_bsid-zbd3t.
        elseif not i_bsid-zbd2t is initial.
          v_paym_days = i_bsid-zbd2t.
        elseif not i_bsid-zbd1t is initial.
          v_paym_days = i_bsid-zbd1t.
      if no discount days is existing in BSID the
      take discount days from table T052
        else.
          clear : i_t052,
                  v_zterm.
          if i_bsid-zterm is initial.
            v_zterm = c_deflt_zterm_y000.
          else.
            v_zterm = i_bsid-zterm.
          endif.
          read table i_t052 with key zterm = v_zterm
                                       binary search.
          if sy-subrc eq 0.
            if not i_t052-ztag3 is initial.
              v_paym_days = i_t052-ztag3.
            elseif not i_t052-ztag2 is initial.
              v_paym_days = i_t052-ztag2.
            elseif not i_t052-ztag1 is initial.
              v_paym_days = i_t052-ztag1.
            endif.
          endif.
        endif.
        i_output-due_date = i_bsid-zfbdt + v_paym_days.
      else.
        i_output-due_date = i_bsid-zfbdt.
      endif.
      clear v_date_diff.
      v_date_diff = sy-datum - i_output-due_date.
      i_output-v_no_days = v_date_diff.
    endform.                    " move_bsid_t052
         Form  move_no_of_days
         To read the no of days
    form move_no_of_days.
      if i_knkk-grupp = c_sc01.
        i_output-spcol = i_bsid-dmbtr.
      else.
        if v_date_diff < 0.
          i_output-not_due = i_bsid-dmbtr.
        elseif v_date_diff = 0.
          i_output-curr_due = i_bsid-dmbtr.
        elseif v_date_diff <= 30.
         

  • Help needed for ALV report

    Hi,
    i need to add coloums for the existing report which picks from G/L account.
    in this report I need to add some more columns from COSP-KSTAR, which shows the cost element details from G/L account.
    I need to restrict that cost element number according to the company code.
    Plz see this and let me know the things.
    1. I need to add FISCAL YEAR(COEP-GJAHR) in selection screen.
    2. I need to add column: Employee Cost (CSKS-KOSTL)
    3. add a column Staff Welfare (COSP-KSTAR) this is to restrict for the cost element 3000200 from G/L account
    4. add a column Recruitment restrict for the cost element(COSP-KSTAR) 3100040 from G/L account
    5. add a column Travels (suppressing some cost elements(COSP-KSTAR) and putting into Travels)
    6. add a column Subcontracts restrict for the cost element (COSP-KSTAR)3100360 from G/L account
    7. add a column Communication suppressing some cost elements and putting into Communication)
    8. add a column Rent restrict for the cost element (COSP-KSTAR)3100055 from G/L account
    9. add a column Back end Cost restrict for the cost element (COSP-KSTAR)3100065 from G/L account
    i can hardcode these cost elements.
    i did according to some of our sdn friends guidence but it is going to dump.
    hear i am sending the code what i changed.
    it is giving the error with the select.
    SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO  BEKNZ WKGBTR WOGBTR  FROM
    COEP  INTO TABLE
    IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
    perio in S_PERIO.
    plz try to help me out in this issue.
    hear i am sending the complete code what i worte.
    *& Report  ZPROJECT_PROFIT2
    REPORT  ZPROJECT_PROFIT2.
    *********************MAIN DOCUMENTATION BLOCK*************************
    Project Code           :
    Program Name           :Zproject_profit1.
    Purpose of program     :This report will give the gross margin for a project as
    *a whole based on some selected input criteria.
    Author of program      :JAYA KRISHNA .B.
    INPUT/OUTPUT FILE      :nil
    TYPE-POOLS : SLIS."For ALV display.
    TABLES : COEP,  "CO Object: Line Items  (by period).
             AUFK,   "Order master data.
             csks,    "Cost center master data
             cosp.    "CO Objects
    *&  Include           ZSTRUCTURE
    types:    BEGIN OF TY_COEP ,            "structure of table COEP.
              BUKRS LIKE COEP-BUKRS,
              KOKRS LIKE COEP-KOKRS,
              OBJNR LIKE COEP-OBJNR,
               gjahr like coep-gjahr,
              kstar like coep-kstar,
              OBJNR_N1 LIKE COEP-OBJNR_N1,
              PERIO LIKE COEP-PERIO,
              BEKNZ LIKE COEP-BEKNZ,
              WKGBTR LIKE COEP-WKGBTR,
              WOGBTR LIKE COEP-WOGBTR,
              BELNR LIKE COEP-BELNR,
              END OF TY_COEP,
             BEGIN OF TY_AUFK ,             "structure of table AUFK.
             BUKRS LIKE AUFK-BUKRS,
             KOKRS LIKE AUFK-KOKRS,
             OBJNR LIKE AUFK-OBJNR,
             KTEXT LIKE AUFK-KTEXT,
             ANFAUFNR LIKE AUFK-ANFAUFNR,
             AUFEX LIKE AUFK-AUFEX,
             USER2 LIKE AUFK-USER2,
             USER0 LIKE AUFK-USER0,
             USER1 LIKE AUFK-USER1,
             USER3 LIKE AUFK-USER3,
             USER6 LIKE AUFK-USER6,
             USER7 LIKE AUFK-USER7,
             USER8 LIKE AUFK-USER8,
             ABKRS(10) TYPE C,
             USER9 LIKE AUFK-USER9,
             AUFNR LIKE AUFK-AUFNR,
           END OF TY_AUFK,
           begin of ty_csks,
           kokrs like csks-kokrs,
            kostl like csks-kostl,
            bukrs like csks-bukrs,
            objnr like csks-objnr,
                 end of ty_csks.
    DATA :   BEGIN OF IT_COSP occurs 100,
           OBJNR LIKE COSP-OBJNR,
           GJAHR LIKE COSP-GJAHR,
           KSTAR LIKE COSP-KSTAR,
           END OF IT_COSP.
    DATA : IT_COEP TYPE TABLE OF TY_COEP,     " Declaraton of tables COEP and AUFK.
           IT_AUFK TYPE TABLE OF TY_AUFK,
           IT_CSKS TYPE TABLE OF TY_CSKS.
          IT_COSP TYPE TABLE OF TY_COSP.
    DATA : WA_COEP LIKE LINE OF IT_COEP,      " Declaration of work areas for tables COEP and AUFK.
           WA_AUFK LIKE LINE OF IT_AUFK,
           WA_CSKS LIKE LINE OF IT_CSKS.
          WA_COSP LIKE LINE OF IT_COSP.
    DATA : BEGIN OF IT_DISPLAY OCCURS 0,      " Declaration of display table.
            OBJNR_N1 LIKE COEP-OBJNR_N1,
            OBJNR_N12 LIKE COEP-OBJNR_N1,
            KTEXT1 LIKE AUFK-KTEXT,
            WKGBTR LIKE COEP-WKGBTR,
            WOGBTR LIKE COEP-WOGBTR,
            WKGBTR1  LIKE COEP-WTGBTR,
            WOGBTR1 LIKE COEP-WOGBTR,
            ADDK LIKE COEP-WOGBTR,
            ADDO LIKE COEP-WOGBTR,
            ADDK1 LIKE COEP-WOGBTR,
            ADDO1 LIKE COEP-WOGBTR,
            PROFIT1 LIKE COEP-WOGBTR,
            PROFIT2 LIKE COEP-WOGBTR,
            BEKNZ LIKE COEP-BEKNZ,
            BUKRS LIKE AUFK-BUKRS,
            anfaufnr LIKE AUFK-anfaufnr,
            aufex like aufk-aufex,
            OBJNR LIKE AUFK-OBJNR,
            USER2 LIKE AUFK-USER2,
            USER0 LIKE AUFK-USER0,
            USER1 LIKE AUFK-USER1,
            USER3 LIKE AUFK-USER3,
            USER6 LIKE AUFK-USER6,
            USER7 LIKE AUFK-USER7,
            USER8 LIKE AUFK-USER8,
            ABKRS LIKE AUFK-ABKRS,
            USER9 LIKE AUFK-USER9,
            PERIO LIKE COEP-PERIO,
            AUFNR LIKE AUFK-AUFNR,
            STR(5) TYPE C,
            WORK(10) TYPE C,
           END OF IT_DISPLAY,
      : BEGIN OF IT_DISPLAY1 OCCURS 0,      " Declaration of second display table.
         OBJNR_N1 LIKE COEP-OBJNR_N1,
         OBJNR_N12 LIKE COEP-OBJNR_N1,
         KTEXT1 LIKE AUFK-KTEXT,
         WKGBTR LIKE COEP-WKGBTR,
         WOGBTR LIKE COEP-WOGBTR,
         WKGBTR1  LIKE COEP-WTGBTR,
         WOGBTR1 LIKE COEP-WOGBTR,
         ADDK LIKE COEP-WOGBTR,
         ADDO LIKE COEP-WOGBTR,
         ADDK1 LIKE COEP-WOGBTR,
         ADDO1 LIKE COEP-WOGBTR,
         PROFIT1 LIKE COEP-WOGBTR,
         PROFIT2 LIKE COEP-WOGBTR,
         BEKNZ LIKE COEP-BEKNZ,
         BUKRS LIKE AUFK-BUKRS,
         anfaufnr like aufk-anfaufnr,
         aufex like aufk-aufex,
         OBJNR LIKE AUFK-OBJNR,
         USER2 LIKE AUFK-USER2,
         USER0 LIKE AUFK-USER0,
         USER1 LIKE AUFK-USER1,
         USER3 LIKE AUFK-USER3,
         USER6 LIKE AUFK-USER6,
         USER7 LIKE AUFK-USER7,
         USER8 LIKE AUFK-USER8,
         ABKRS LIKE AUFK-ABKRS,
         USER9 LIKE AUFK-USER9,
         PERIO LIKE COEP-PERIO,
         AUFNR LIKE AUFK-AUFNR,
         STR(5) TYPE C,
         WORK(10) TYPE C,
        END OF IT_DISPLAY1.
    data : it_field type slis_fieldcat_alv,        " Declaration of ALV variables
           it_field_t type slis_t_fieldcat_alv,
            xlayout    TYPE slis_layout_alv.
    data : it_event type slis_t_event,
          wa_event like line of it_event.
    DATA : WA_TOP TYPE SLIS_LISTHEADER,
           IT_TOP TYPE SLIS_T_LISTHEADER.
    data:w_lines type i,
          w_occurs type i,
          STR(5) TYPE C,
          WORK(10) TYPE C.
          constants : c_selection type char20 value 'Selection based on'. " Declaration of a constant.
    selection-screen BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-000.
    SELECT-OPTIONS S_BUKRS FOR AUFK-BUKRS OBLIGATORY.
    SELECT-OPTIONS S_OBJNR FOR AUFK-AUFNR.
    SELECT-OPTIONS S_ANF FOR AUFK-ANFAUFNR.
    SELECT-OPTIONS S_AUFEX FOR AUFK-AUFEX.
    SELECT-OPTIONS S_USER2 FOR AUFK-USER2.
    SELECT-OPTIONS S_USER0 FOR AUFK-USER0.
    SELECT-OPTIONS S_USER1 FOR AUFK-USER1.
    SELECT-OPTIONS S_USER3 FOR AUFK-USER3.
    SELECT-OPTIONS S_USER6 FOR AUFK-USER6.
    SELECT-OPTIONS S_ABKRS FOR AUFK-ABKRS.
    SELECT-options s_gjahr for coep-gjahr obligatory.
    SELECT-OPTIONS S_PERIO FOR COEP-PERIO OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK BLK .
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS : ONSITE RADIOBUTTON GROUP RADI.
    PARAMETERS : OFFSHORE RADIOBUTTON GROUP RADI.
    PARAMETERS : BOTH RADIOBUTTON GROUP RADI.
    SELECTION-SCREEN END OF BLOCK BLK1 .
    start-of-selection.
    *ZAUFK
                                  " Selection of records from aufk to internal table.
    IF ONSITE EQ 'X' .
    SELECT
    BUKRS
    KOKRS
    OBJNR
    KTEXT
    anfaufnr
    aufex
    USER2
    USER0
    USER1
    USER3
    USER6
    USER7
    USER8
    ABKRS
    USER9
    AUFNR
    FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
    anfaufnr IN s_anf AND
    aufex in s_aufex and
    aufnr IN S_OBJNR AND
    USER2 IN S_USER2 AND
    USER0 IN S_USER0 AND
    USER1 IN S_USER1 AND
    USER3 IN S_USER3 AND
    USER6 IN S_USER6 AND
    ABKRS IN S_ABKRS AND
    USER9 EQ 'X' .
    ENDIF.
    IF OFFSHORE EQ 'X'.
    SELECT
    BUKRS
    KOKRS
    OBJNR
    KTEXT
    anfaufnr
    aufex
    USER2
    USER0
    USER1
    USER3
    USER6
    USER7
    USER8
    ABKRS
    USER9
    AUFNR
    FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
    anfaufnr IN S_anf AND
    aufex in s_aufex and
    aufnR IN S_OBJNR AND
    USER2 IN S_USER2 AND
    USER0 IN S_USER0 AND
    USER1 IN S_USER1 AND
    USER3 IN S_USER3 AND
    USER6 IN S_USER6 AND
    ABKRS IN S_ABKRS AND
    USER9 <> 'X'.
    ENDIF.
    IF BOTH EQ 'X'.
    SELECT
    BUKRS
    KOKRS
    OBJNR
    KTEXT
    anfaufnr
    aufex
    USER2
    USER0
    USER1
    USER3
    USER6
    USER7
    USER8
    ABKRS
    USER9
    AUFNR
    FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
    anfaufnr IN S_anf AND
    aufex in s_aufex and
    aufNR IN S_OBJNR AND
    USER2 IN S_USER2 AND
    USER0 IN S_USER0 AND
    USER1 IN S_USER1 AND
    USER3 IN S_USER3 AND
    USER6 IN S_USER6 AND
    ABKRS IN S_ABKRS.
    ENDIF.
    *&  Include           ZCOEP
                                  " Selection of records from coep to internal table.
    SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO  BEKNZ WKGBTR WOGBTR  FROM
    COEP  INTO TABLE
    IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
    perio in S_PERIO.
    *&  Include           ZPROFIT_CALC
                                 " Calculations for income and Profit of the employee.
    if not it_coep[] is initial.
        select objnr gjahr wrttp versn kstar from cosp into TABLE It_cosp for
    all entries in it_coep where objnr = IT_COEP-objnr .
    endif.
      LOOP AT IT_coep INTO WA_coep.
        read table IT_aufk into WA_aufk with key OBJNR = wa_coep-OBJNR.
    case it_cosp-kstar.
    when '3000200'.
    it_cosp-kstar = cosp-kstar.
    when '3100040'.
    it_cosp-kstar = cosp-kstar.
    when '3100360'.
    it_cosp-kstar = cosp-kstar.
    when '3100055'.
    it_cosp-kstar = cosp-kstar.
    when '3100065'.
    it_cosp-kstar = cosp-kstar.
    when '3100115'.
    it_cosp-kstar = cosp-kstar.
    when '3100120'.
    it_cosp-kstar = cosp-kstar.
    when '3100130'.
    it_cosp-kstar = cosp-kstar.
    when '3100135'.
    it_cosp-kstar = cosp-kstar.
    when '3100140'.
    it_cosp-kstar = cosp-kstar.
    when '3100145'.
    it_cosp-kstar = cosp-kstar.
    when '3100150'.
    it_cosp-kstar = cosp-kstar.
    when '3100155'.
    it_cosp-kstar = cosp-kstar.
    when '3100160'.
    it_cosp-kstar = cosp-kstar.
    when '3100165'.
    it_cosp-kstar = cosp-kstar.
    when '3100170'.
    it_cosp-kstar = cosp-kstar.
    endcase.
        IT_DISPLAY-BUKRS = WA_AUFK-BUKRS.
        IT_DISPLAY-anfaufnr = WA_AUFK-anfaufnr.
        it_display-aufex  = wa_aufk-aufex.
        IT_DISPLAY-OBJNR = WA_AUFK-OBJNR.
        IT_DISPLAY-USER2 = WA_AUFK-USER2.
        IT_DISPLAY-USER0 = WA_AUFK-USER0.
        IT_DISPLAY-USER1 = WA_AUFK-USER1.
        IT_DISPLAY-USER3 = WA_AUFK-USER3.
        IT_DISPLAY-USER6 = WA_AUFK-USER6.
        IT_DISPLAY-USER7 = WA_AUFK-USER7.
        IT_DISPLAY-USER8 = WA_AUFK-USER8.
        IT_DISPLAY-ABKRS = WA_AUFK-ABKRS.
        IT_DISPLAY-USER9 = WA_AUFK-USER9.
        IT_DISPLAY-KTEXT1 =  WA_AUFK-KTEXT.
        if WA_AUFK-abkrs = 01.
          IT_DISPLAY-STR = 'TM'.
        ENDIF.
        IF WA_AUFK-ABKRS = 02.
          IT_DISPLAY-STR = 'FP'.
        ENDIF.
        IF WA_AUFK-USER9 = 'X'.
          IT_DISPLAY-WORK = 'ONSITE'.
        ENDIF.
        IF WA_AUFK-USER9 <> 'X'.
          IT_DISPLAY-WORK = 'OFFSHORE'.
        ENDIF.
        it_display-ABKRS = it_display-user7.
        IF wa_coep-BEKNZ = 'S'.
          IT_DISPLAY-WKGBTR = WA_COEP-WKGBTR.
          IT_DISPLAY-WOGBTR = WA_COEP-WOGBTR.
          IT_DISPLAY-ADDK = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR.
          IT_DISPLAY-ADDO = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR.
          IT_DISPLAY-ADDK1 = 0.
          IT_DISPLAY-ADDO1 = 0.
          IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 +  IT_DISPLAY-ADDK.
          IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 +  IT_DISPLAY-ADDO.
          APPEND IT_DISPLAY.
        ENDIF.
        IF WA_COEP-BEKNZ = 'H'.
          IT_DISPLAY-WKGBTR1 = WA_COEP-WKGBTR.
          IT_DISPLAY-WOGBTR1 = WA_COEP-WOGBTR.
          IT_DISPLAY-ADDK1 = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR1.
          IT_DISPLAY-ADDO1 = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR1.
          IT_DISPLAY-ADDK = 0.
          IT_DISPLAY-ADDO = 0.
          IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 +  IT_DISPLAY-ADDK.
          IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 +  IT_DISPLAY-ADDO.
          APPEND IT_DISPLAY.
        ENDIF.
        collect it_display into it_display1.
        clear it_display.
      ENDLOOP.
                        "calc
    *&  Include           ZPROFIT_DISPLAY
      LOOP AT IT_DISPLAY1.                                         "it_display.
        read table IT_COEP into WA_COEP with key OBJNR =
        IT_DISPLAY-OBJNR.
        read table IT_AUFK into WA_AUFK with key aufnr = IT_DISPLAY-aufnr.
        if WA_AUFK-abkrs = 01.
          STR = 'TM'.
        ENDIF.
        IF WA_AUFK-ABKRS = 02.
          STR = 'FP'.
        ENDIF.
        IF WA_AUFK-USER9 = 'X'.
          WORK = 'ONSITE'.
        ENDIF.
        IF WA_AUFK-USER9 <> 'X'.
          WORK = 'OFFSHORE'.
        ENDIF.
      endloop.
      clear it_field.
      it_field-col_pos = 1.
      it_field-fieldname = 'AUFNR'.
      it_field-seltext_l = 'project id.'.
      it_field-outputlen = 15.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 2.
      it_field-fieldname = 'KTEXT1'.
      it_field-seltext_l = 'Project Name'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 3.
      it_field-fieldname = 'USER7'.
      it_field-seltext_l = 'Start Date'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 4.
      it_field-fieldname = 'USER8'.
      it_field-seltext_l = 'End Date'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 5.
      it_field-fieldname = 'USER2'.
      it_field-seltext_l = 'Location'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 6.
      it_field-fieldname = 'USER0'.
      it_field-seltext_l = 'Vertical'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 7.
      it_field-fieldname = 'USER1'.
      it_field-seltext_l = 'Sub_vertical'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 8.
      it_field-fieldname = 'USER3'.
      it_field-seltext_l = 'Technology'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 9.
      it_field-fieldname = 'USER6'.
      it_field-seltext_l = 'Department'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 10.
      it_field-fieldname = 'WORK'.
      it_field-seltext_l = 'Onsite/Offshore'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 11.
      it_field-fieldname = 'STR'.
      it_field-seltext_l = 'T&M/FP'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 12.
      it_field-fieldname = 'KOSTL'.
      it_field-seltext_l = 'EMP COST'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 13.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'STAFF WELFARE'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 14.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'RECRUITMENT'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 15.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'TRAVELS'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 16.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'SUBCONTRACT'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 17.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'COMMUNICATION'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 18.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'RENT'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 19.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'BACKEND COST (PROJECT EXP)'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 20.
      it_field-fieldname = 'ADDO'.
      it_field-seltext_l = 'Direct costs'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 21.
      it_field-fieldname = 'ADDO1'.
      it_field-seltext_l = 'Income'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 22.
      it_field-fieldname = 'PROFIT2'.
      it_field-seltext_l = 'Profit(income-costs)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 23.
      it_field-fieldname = 'ADDK'.
      it_field-seltext_l = 'Direct costs(Grp cur)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 24.
      it_field-fieldname = 'ADDK1'.
      it_field-seltext_l = 'Income(Grp Cur)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 25.
      it_field-fieldname = 'PROFIT1'.
      it_field-seltext_l = 'Profit(income-costs)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      xlayout-zebra = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = 'ZPROJECT_PROFIT1'
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE_PROFIT'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
         IS_LAYOUT                         = xlayout
         IT_FIELDCAT                       =  it_field_t
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
         I_DEFAULT                         = 'X'
         I_SAVE                            = ' '
      IS_VARIANT                        =
      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_DISPLAY1
    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.
      clear it_field_t.
      "it_display.
    FORM USER_COMMAND using r_ucomm like sy-ucomm rs type slis_selfield.
      include zinteractive_profit."Secondary list for calling KO03.
    ENDFORM.                    "USER_COMMAND.
    Thanks & Regards,
    Lakshmi..

    Hi,
    i did according to ur suggession.
    now it is going dump.
    and it is telling like this.
    2629               i_event_name      = 'SUBTOTAL_TEXT'
    2630               is_subtottxt_info = ls_subtot_info
    2631               ip_subtot_line    = lr_data
    2632             changing
    2633               c_subtottxt       = l_subtottxt.
    2634           ls_lvc_data-value = l_subtottxt.
    2635
    2636           append ls_lvc_data to ct_lvc_data.
    2637         endif.
    2638
    2639 ************************************
    2640 * Column per Fieldcat Entry
    2641 ************************************
    2642         clear ls_lvc_data-style.
    2643         loop at it_fcat_local assigning <ls_fcat>
    2644                 where tech ne 'X' and no_out ne 'X'.
    2645           if l_invisible eq 'X'.
    2646             clear l_invisible.
    2647             if <ls_fcat>-do_sum is initial.
    2648               continue.
    2649             else.
    2650               clear ls_lvc_data-col_pos.
    2651             endif.
    2652           endif.
    2653
    2654           add 1 to ls_lvc_data-col_pos.
    2655
    2656           assign component <ls_fcat>-fieldname
    2657                            of structure <ls_data> to <l_field_val
    2658           if sy-subrc ne 0.
    >>>>>             message x000(0k).
    2660           endif.
    2661
    2662 *... work on average
    2663           if <ls_fcat>-do_sum eq 'C'.
    2664             clear l_entries.
    2665
    2666             assign space to <l_unit>.
    2667             if not <ls_fcat>-cfieldname is initial.
    2668               assign component <ls_fcat>-cfieldname
    2669                      of structure <ls_data> to <l_unit>.
    2670             endif.
    2671             if not <ls_fcat>-qfieldname is initial.
    2672               assign component <ls_fcat>-qfieldname
    2673                      of structure <ls_data> to <l_unit>.
    2674             endif.
    2675
    2676             l_from = ls_grpl-index_from.
    2677             l_to   = ls_grpl-index_to.
    2678             if ls_grpl-index_from is initial and
    plz any of u help me to come out with solution.
    Thanks & Regards,
    Lakshmi..

Maybe you are looking for

  • How to call a business graphics from a SAPGUI program?

    Dear experts, I'm new to WebDynpro for ABAP. I was able to create a working WebDynpro application that shows a simple bar-chart. Nice. What I would like to realize is a bar chart as a pop-up when I click a button on an ALV table element. This ALV tab

  • Delivers - Send Requests to an External Email

    Is there a way to send a request in an iBot to an external email. So if the user does not exist in the Catalog and hence has no Active Delivery profile. Can one still send the request to an external user's email? Thanks

  • IDM  Email  Escalation

    Hi, I have a requirment where in when a job is changed and no action is taken till 5 days by his manager ,a mail should be send to the user's manager and after 15 days another mail should be send to managers manager ,if still no action is been taken

  • Unable to access Firewall (tab turns grey). What is happening?

    I recently upgraded from Lion to Mountain Lion. Before the upgrade I was able to change my Firewall settings. Now, every time I access Security & Privacy (after unlocking) and click on the Firewall tab I am unable to to anything. It remains unaccessi

  • HTTP Proxy Configuration

    Hi, I'm testing out Aqualogic Pages behind a firewall. Does anyone know how to configure a HTTP proxy? I'm seeing the following error with external RSS Data Sources (internal ones work fine): INFO   | jvm 1    | 2007/08/16 13:27:58 | Caused by: com.b