Need to add icon in ALV

i had declared atype and internal table repcetively,
TYPES : BEGIN OF ty_pr                  ,
          icon     LIKE icon-id         ,
          banfn    LIKE eban-banfn      ,        
          txz01    LIKE eban-txz01      ,             
          ernam    LIKE eban-ernam      ,  
       END OF ty_pr.
DATA : it_pr TYPE STANDARD TABLE OF  ty_pr
       WITH HEADER LINE.
i need to add one icon(not light) in the first column of ALV.Can anyone help me.
Thks,
Manish.

Check the following example it may help u.
report z_example.
TYPE-POOLS: slis,icon.
DATA: x_fieldcat TYPE slis_fieldcat_alv,
      it_fieldcat TYPE slis_t_fieldcat_alv,
      l_layout TYPE slis_layout_alv.
DATA: BEGIN OF itab OCCURS 0,
      vbeln LIKE vbak-vbeln,
      posnr LIKE vbap-posnr,
      icon(1),
     END OF itab.
data:program type sy-repid.
SELECT vbeln
       posnr
       FROM vbap
       UP TO 20 ROWS
       INTO TABLE itab.
LOOP AT itab.
  IF sy-tabix = 1 OR sy-tabix = 2.
    itab-icon = '1'.
  ELSEIF sy-tabix = 10 OR sy-tabix = 20.
    itab-icon = '2'.
  ELSE.
    itab-icon = '3'.
  ENDIF.
  MODIFY itab INDEX sy-tabix.
ENDLOOP.
program = sy-repid.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-hotspot = 'X'.
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.
l_layout-lights_fieldname = 'ICON'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
          i_callback_program = program
          is_layout          = l_layout
          it_fieldcat        = it_fieldcat
     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.
regards

Similar Messages

  • How to add Icons to ALV Reprt?

    Hi,
    I need to display icons (red, yellow) in my ALV Report in the first column in my report.
    In my field catalog fieldcat-icon = 'X' has been taken into consideration, but still I am not able to see in my report. In the final internal table that is to display I created a field for this Icon type ICON_D. Is this the correct procedure to work with or else kindly let me know how to proceed?
    Regards,
    Raghu Ram.

    This is the code that has been incorporated in order to display Icon in the ALV Report.
    *                     TABLES Declarations                             *
    Tables: PROJ,             " Project definition
            PRPS,             " WBS (Work Breakdown Structure) Element Master Data
            ICON.
    *                     TYPE POOLS                                      *
    TYPE-POOLS: SLIS,        " Globale Typen für generische Listbausteine
                ICON.
    *                     ALV Data Declarations                           *
    DATA:
      GT_FIELDCAT       TYPE   SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
      GT_REPID          TYPE   SY-REPID.
    *                     Type Declarations                               *
    TYPES:
    * STRUCTURE OF TABLE PROJ
      BEGIN OF TY_PROJ,
        PSPNR      TYPE PROJ-PSPNR,
        PSPID      TYPE PROJ-PSPID,
        POST1      TYPE PROJ-POST1,
        OBJNR      TYPE PROJ-OBJNR,
        VERNR      TYPE PROJ-VERNR,
        VERNA      TYPE PROJ-VERNA,
      END OF TY_PROJ,
    * STRUCTURE OF TABLE PRPS
      BEGIN OF TY_PRPS,
        PSPNR      TYPE PRPS-PSPNR,
        POSID      TYPE PRPS-POSID,
        POST1      TYPE PRPS-POST1,
        OBJNR      TYPE PRPS-OBJNR,
        PSPHI      TYPE PRPS-PSPHI,
        VERNR      TYPE PRPS-VERNR,
      END OF TY_PRPS,
      BEGIN OF TY_FINAL,
        LIGHT       TYPE ICON_D,
        PSPNR       TYPE PROJ-PSPNR,
        PSPID       TYPE PROJ-PSPID,
        POST1       TYPE PROJ-POST1,
        OBJNR       TYPE PROJ-OBJNR,
        VERNR       TYPE PROJ-VERNR,
        VERNA       TYPE PROJ-VERNA,
        PSPNR_1     TYPE PRPS-PSPNR,
        POSID       TYPE PRPS-POSID,
        POST1_1     TYPE PRPS-POST1,
        OBJNR_1     TYPE PRPS-OBJNR,
        PSPHI       TYPE PRPS-PSPHI,
        VERNR_1     TYPE PRPS-VERNR,
      END OF TY_FINAL.
    *                     Internal Table Declarations                     *
    DATA:
        IT_PROJ  TYPE STANDARD TABLE OF TY_PROJ,
        IT_PRPS  TYPE STANDARD TABLE OF TY_PRPS,
        IT_FINAL TYPE STANDARD TABLE OF TY_FINAL.
    *                    Work Area Declarations                            *
    DATA:
        WA_PROJ  TYPE TY_PROJ,
        WA_PRPS  TYPE TY_PRPS,
        WA_FINAL TYPE TY_FINAL.
    *                          Selection Screen                           *
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
      SELECT-OPTIONS:   S_PSPNR FOR PROJ-PSPNR.
    SELECTION-SCREEN END OF BLOCK BLK.
    *                          Start Of Selection                         *
    START-OF-SELECTION.
      PERFORM DATA_RETREVIAL.
      PERFORM BUILD_FIELDCAT.
      PERFORM DISPLAY_ALV.
    *                          Data Retrevial Logic                       *
    *&      Form  DATA_RETREVIAL
    form DATA_RETREVIAL .
    DATA: status_icon TYPE icons-text,
          icon_name(20) TYPE c,
          icon_text(10) TYPE c.
      ICON_NAME = 'ICON_RED_LIGHT'.
      ICON_TEXT = 'RED'.
      CALL FUNCTION 'ICON_CREATE'
        EXPORTING
          name                        = ICON_NAME
         TEXT                         = ICON_TEXT
    *     INFO                        = ' '
         ADD_STDINF                   = 'X'
       IMPORTING
         RESULT                       = STATUS_ICON
       EXCEPTIONS
         ICON_NOT_FOUND               = 1
         OUTPUTFIELD_TOO_SHORT        = 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.
      SELECT PSPNR
             PSPID
             POST1
             OBJNR
             VERNR
             VERNA
             FROM PROJ
             INTO TABLE IT_PROJ
             WHERE PSPNR IN S_PSPNR.
        SELECT PSPNR
               POSID
               POST1
               OBJNR
               PSPHI
               VERNR
               FROM PRPS
               INTO TABLE IT_PRPS
               FOR ALL ENTRIES IN IT_PROJ
               WHERE PSPHI EQ IT_PROJ-PSPNR.
          LOOP AT IT_PROJ INTO WA_PROJ.
            LOOP AT IT_PRPS INTO WA_PRPS.
              WA_FINAL-PSPNR    =  WA_PROJ-PSPNR.
              WA_FINAL-PSPID    =  WA_PROJ-PSPID.
              WA_FINAL-POST1    =  WA_PROJ-POST1.
              WA_FINAL-OBJNR    =  WA_PROJ-OBJNR.
              WA_FINAL-VERNR    =  WA_PROJ-VERNR.
              WA_FINAL-VERNA    =  WA_PROJ-VERNA.
              WA_FINAL-PSPNR_1  =  WA_PRPS-PSPNR.
              WA_FINAL-POSID    =  WA_PRPS-POSID.
              WA_FINAL-POST1_1  =  WA_PRPS-POST1.
              WA_FINAL-OBJNR_1  =  WA_PRPS-OBJNR.
              WA_FINAL-PSPHI    =  WA_PRPS-PSPHI.
              WA_FINAL-VERNR_1  =  WA_PRPS-VERNR.
              WA_FINAL-light     = STATUS_ICON.
              APPEND WA_FINAL TO IT_FINAL.
             CLEAR: WA_FINAL.
            ENDLOOP.
          ENDLOOP.
    endform.                    " DATA_RETREVIAL
    *                          Field Catalog                              *
    *&      Form  BUILD_FIELDCAT
    form BUILD_FIELDCAT .
    *  DATA: FIELDCAT    TYPE GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'LIGHTS'.
          GT_FIELDCAT-SELTEXT_M = 'STAUTS'.
          GT_FIELDCAT-COL_POS   = 0.
          GT_FIELDCAT-ICON      = 'X'.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPNR'.
          GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION(INTERNAL)'.
          GT_FIELDCAT-COL_POS   = 1.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPID'.
          GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION'.
          GT_FIELDCAT-COL_POS   = 2.
          GT_FIELDCAT-OUTPUTLEN = 24.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'POST1'.
          GT_FIELDCAT-SELTEXT_M = 'PROJECT DESC'.
          GT_FIELDCAT-COL_POS   = 3.
          GT_FIELDCAT-OUTPUTLEN = 40.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'OBJNR'.
          GT_FIELDCAT-SELTEXT_M = 'Object number'.
          GT_FIELDCAT-COL_POS   = 4.
          GT_FIELDCAT-OUTPUTLEN = 22.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'VERNR'.
          GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
          GT_FIELDCAT-COL_POS   = 5.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'VERNA'.
          GT_FIELDCAT-SELTEXT_M = 'Responsible Person Desc'.
          GT_FIELDCAT-COL_POS   = 6.
          GT_FIELDCAT-OUTPUTLEN = 25.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPNR_1'.
          GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
          GT_FIELDCAT-COL_POS   = 7.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'POSID'.
          GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
          GT_FIELDCAT-COL_POS   = 8.
          GT_FIELDCAT-OUTPUTLEN = 24.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'POST1_1'.
          GT_FIELDCAT-SELTEXT_M = 'WBS DESC'.
          GT_FIELDCAT-COL_POS   = 9.
          GT_FIELDCAT-OUTPUTLEN = 40.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'OBJNR_1'.
          GT_FIELDCAT-SELTEXT_M = 'Object number'.
          GT_FIELDCAT-COL_POS   = 10.
          GT_FIELDCAT-OUTPUTLEN = 22.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'PSPHI'.
          GT_FIELDCAT-SELTEXT_M = 'Currnet Projct'.
          GT_FIELDCAT-COL_POS   = 11.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
          GT_FIELDCAT-FIELDNAME = 'VERNR_1'.
          GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
          GT_FIELDCAT-COL_POS   = 12.
          GT_FIELDCAT-OUTPUTLEN = 8.
        APPEND GT_FIELDCAT TO GT_FIELDCAT.
        CLEAR GT_FIELDCAT.
    endform.                    " BUILD_FIELDCAT
    *                          Display ALV Grid                           *
    *&      Form  DISPLAY_ALV
    form DISPLAY_ALV .
      GT_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                 = GT_REPID
    *     I_CALLBACK_PF_STATUS_SET          = ' '
    *     I_CALLBACK_USER_COMMAND           = ' '
    *     I_CALLBACK_TOP_OF_PAGE            = ' '
    *     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *     I_CALLBACK_HTML_END_OF_LIST       = ' '
    *     I_STRUCTURE_NAME                  =
    *     I_BACKGROUND_ID                   = ' '
    *     I_GRID_TITLE                      =
    *     I_GRID_SETTINGS                   =
    *     IS_LAYOUT                         =
         IT_FIELDCAT                        = GT_FIELDCAT[]
    *     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_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.                    " DISPLAY_ALV

  • Need to add checkbox in alv header Not  in grid

    Dear Guru's,
                       My question is i want to add checkbox on top of alv grid ie on top of page .
    my requriement is for SD module- status of order -Mass Update.
    suppose status checkbox on header is HFSC is checked ( check box),
    for all the sales order which are showed on the alv grid must be updated with this status for which i am calling trasaction VA02 in program and doing changes but i am not able to create checkbox on header .
    Again i have already used ALV without classesso please give me solution accordinglly . Thanks in advance.

    Hi,
    For working with top of page we generally use SLIS_LISTHEADER right.
    In this type the first field is
    type - which can accept values as follows
               H - Heading
               S - Selection
               A - Action
    May be the options Selection or Action may help u.

  • Adding icon to ALV Coulmn  in powerlists (POWL)

    Hi Experts,
      I have one requirement in POWL. For one Column in ALV i need to add ICON.
    Can any body help in this problem.
    Regards,
    Sri

    Thx Chandra for promt reply,
    I know your given field name. But i am not getting 100% clarity.
    Let me explain what i have return  in my progrm.
    In FieldCatalog method:
    *Comments
      wa_fieldcat-colid = 'COMMENT'.
      wa_fieldcat-colpos = '13'.
      wa_fieldcat-col_visible = abap_true.
      wa_fieldcat-enabled = abap_true.
       wa_fieldcat-icon_src_ref  = 'COMMENT'.
      wa_fieldcat-header = 'Approver Comments'.
      wa_fieldcat-allow_filter = abap_true.
      wa_fieldcat-allow_sort = abap_true.
      INSERT wa_fieldcat INTO TABLE it_fieldcat[].
    can clarify in this one.
    Advance thx for helping.

  • ADD ICON

    IN alv I NEED TO ADD ICON THAT WHEN I CLICK ON IT
    IT PRINT SMARTFORM LAYOUT
    DO TOU KNOW ?
    THANKS

    Hi Liat,
    For ALV grid function module. Below is the code i have written to display list of contacts. the user has able to select mutliple contacts displayed in the screen and select the Button 'PRINT CONTRACT' to print smartform.
    If need complete code give me your mail id, i will send you.
    My code works for Tcode VA42.
    You have to create GUI status in SE41 to display button on tool bar.
    Display output in a ALV Grid
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
           I_CALLBACK_PROGRAM                = gs_repid
           I_CALLBACK_PF_STATUS_SET          = 'ALV_STATUS'
           I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
           IS_LAYOUT                         = gs_layout
           IT_FIELDCAT                       = gt_fieldcat
           IT_SORT                           = gs_sort
           I_SAVE                            = 'A'
         TABLES
           T_OUTTAB                          = it_cntrt
         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 user_command USING l_ucomm      LIKE sy-ucomm
                            l_selfield   TYPE slis_selfield.
      RANGES: r_kappl FOR nast-kappl,
              r_objky FOR nast-objky,
              r_kschl FOR nast-kschl,
              r_nacha FOR nast-nacha.
      DATA: l_jobname  TYPE TBTCJOB-JOBNAME,
            l_jobcount TYPE TBTCJOB-JOBCOUNT,
            l_repid    TYPE sy-repid,
            l_print_params TYPE PRI_PARAMS,
            l_arc_params   TYPE ARC_PARAMS,
            l_valid        TYPE c,
            l_retcode      TYPE sy-subrc,
            l_blines       TYPE i.
      CASE l_ucomm.
      Process button seleted
        WHEN c_sform.
        process selected records.
          LOOP AT it_cntrt INTO wa_cntrt.
             IF wa_cntrt-box = 'X'.
              place output type in the contract
                PERFORM bdc_output USING wa_cntrt
                                   CHANGING l_retcode.
                IF l_retcode = 0.
                add record for jobground job
                  r_objky-sign   = 'I'.
                  r_objky-option = 'EQ'.
                  r_objky-low    = wa_cntrt-vbeln.
                  APPEND r_objky.
                ENDIF.
                CLEAR: wa_cntrt, l_retcode, r_objky.
             ENDIF.
          ENDLOOP.
        WHEN c_dclick.
        set contract number id with the selected contract
          SET PARAMETER ID 'AUN' FIELD l_selfield-value.
          SET PARAMETER ID 'KTN' FIELD l_selfield-value.
        call va42 tcode when double click on contract
          CALL TRANSACTION c_tcode AND SKIP FIRST SCREEN.
      ENDCASE.
      DESCRIBE TABLE r_objky LINES l_blines.
    IF NOT r_objky[] IS INITIAL.
      IF l_blines > 0.
        Background job name.
          CONCATENATE 'XCM_INDEXATION' sy-uname '_' sy-uzeit
                 INTO l_jobname.
        Application
          r_kappl-sign   = 'I'.
          r_kappl-option = 'EQ'.
          r_kappl-low    = 'V1'.
          APPEND r_kappl.
        Message Type
          r_kschl-sign   = 'I'.
          r_kschl-option = 'EQ'.
          r_kschl-low    = c_kschl.
          APPEND r_kschl.
        Message transmission medium
          r_nacha-sign   = 'I'.
          r_nacha-option = 'EQ'.
          r_nacha-low    = '1'.
          APPEND r_nacha.
          l_repid = sy-repid.
        Print Parameters
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              DESTINATION                  = p_print
              MODE                         = c_batch
              NO_DIALOG                    = 'X'
              REPORT                       = l_repid
              EXPIRATION                   = 2
              IMMEDIATELY                  = 'X'
              NEW_LIST_ID                  = 'X'
            IMPORTING
              OUT_ARCHIVE_PARAMETERS       = l_arc_params
              OUT_PARAMETERS               = l_print_params
              VALID                        = l_valid
            EXCEPTIONS
              ARCHIVE_INFO_NOT_FOUND       = 1
              INVALID_PRINT_PARAMS         = 2
              INVALID_ARCHIVE_PARAMS       = 3
              OTHERS                       = 4.
          IF SY-SUBRC <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        opening the job
          CALL FUNCTION 'JOB_OPEN'
            EXPORTING
              JOBNAME                = l_jobname
            IMPORTING
              JOBCOUNT               = l_jobcount
           EXCEPTIONS
             CANT_CREATE_JOB        = 1
             INVALID_JOB_DATA       = 2
             JOBNAME_MISSING        = 3
             OTHERS                 = 4.
          IF SY-SUBRC <> 0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        Job submit
          SUBMIT rsnast00 TO SAP-SPOOL
                          USER sy-uname
                          WITH s_kappl IN r_kappl
                          WITH s_objky IN r_objky
                          WITH s_kschl IN r_kschl
                          WITH s_nacha IN r_nacha
                          WITH p_print  EQ p_print
             VIA JOB l_jobname NUMBER l_jobcount
             SPOOL PARAMETERS l_print_params
             WITHOUT SPOOL DYNPRO
             AND RETURN.
          IF sy-subrc <> 0.
          display message when error in scheduling background job
            MESSAGE E016 WITH 'Error scheduling Job'.
          ENDIF.
        Job close
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              JOBCOUNT                          = l_jobcount
              JOBNAME                           = l_jobname
              STRTIMMED                         = 'X'
           EXCEPTIONS
             CANT_START_IMMEDIATE              = 1
             INVALID_STARTDATE                 = 2
             JOBNAME_MISSING                   = 3
             JOB_CLOSE_FAILED                  = 4
             JOB_NOSTEPS                       = 5
             JOB_NOTEX                         = 6
             LOCK_FAILED                       = 7
             OTHERS                            = 8.
          IF SY-SUBRC <> 0.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
      ENDIF.
    ENDFORM.
    FORM bdc_output USING    wa_cntrt  TYPE ty_cntrt
                    CHANGING l_retcode TYPE sy-subrc.
    DATA: l_nast TYPE TABLE OF nast,
           it_nast TYPE TABLE OF nast,
           w_nast TYPE nast,
           l_cellno(2) TYPE n,
           l_vbelv TYPE vbfa-vbelv,
           l_vbpa  TYPE vbpa,
           l_yes(1),
           l_temp(40) TYPE c,
           l_lines    TYPE i,
           l_lesscnt  TYPE i,
           l_less(1),
           l_lines1(2) TYPE n.
        REFRESH: it_nast, l_nast, it_bdc.
        CLEAR: l_nast, w_nast, l_yes, l_cellno,
               it_nast, l_nast, it_bdc.
        PERFORM dyn_scr USING 'SAPMV45A' '0102' 'X'.
          PERFORM dyn_fld USING 'VBAK-VBELN' wa_cntrt-vbeln.
          PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
        PERFORM dyn_scr USING 'SAPMV45A' '4001' 'X'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=HEAD'.
        PERFORM dyn_scr USING 'SAPMV45A' '4002' 'X'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=KDOK'.
        SELECT *
          FROM nast
          INTO CORRESPONDING FIELDS OF TABLE l_nast
         WHERE kappl = c_kappl
           AND objky = wa_cntrt-vbeln.
        IF sy-subrc = 0.
            SORT l_nast BY kschl vstat.
            DESCRIBE TABLE l_nast LINES l_lines.
            LOOP AT l_nast INTO w_nast.
                l_cellno = sy-tabix.
                IF w_nast-kschl = c_kschl AND w_nast-vstat = 0.
                  EXIT.
                ENDIF.
                IF w_nast-kschl > c_kschl OR
                   ( w_nast-kschl = c_kschl AND w_nast-vstat <> 0 ).
                   IF l_less = space.
                     l_cellno = l_cellno - 1.
                   ENDIF.
                   CLEAR l_less.
                  IF l_cellno = 0.
                     l_cellno = 1.
                  ENDIF.
                  l_lines = l_lines + 1.
                  l_lines1 = l_lines.
                  PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
                    CONCATENATE 'DNAST-KSCHL(' l_lines1 ')' INTO l_temp.
                    CONDENSE l_temp.
                    PERFORM dyn_fld USING l_temp 'Y6C4'.
                    CLEAR: l_temp, l_lines, l_lines1.
                    PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
                  EXIT.
                ELSEIF w_nast-kschl < c_kschl.
                  l_less = 'X'.
                  l_lesscnt = l_lesscnt + 1.
                ENDIF.
            ENDLOOP.
        ELSE.
            l_cellno = '01'.
            PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
              CONCATENATE 'DNAST-KSCHL(' l_cellno ')' INTO l_temp.
              CONDENSE l_temp.
              PERFORM dyn_fld USING l_temp 'Y6C4'.
              CLEAR l_temp.
              PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
        ENDIF.
        IF l_less = 'X'.
            l_lesscnt = l_lesscnt + 1.
                  l_cellno = l_lesscnt.
                  l_lines = l_lines + 1.
                  l_lines1 = l_lines.
                  PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
                    CONCATENATE 'DNAST-KSCHL(' l_lines1 ')' INTO l_temp.
                    CONDENSE l_temp.
                    PERFORM dyn_fld USING l_temp 'Y6C4'.
                    CLEAR: l_temp, l_lines, l_lines1.
                    PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
        ENDIF.
        PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
          CONCATENATE 'DV70A-SELKZ(' l_cellno ')' INTO l_temp.
          CONDENSE l_temp.
          PERFORM dyn_fld USING l_temp 'X'.
          CLEAR l_temp.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70P'.
        PERFORM dyn_scr USING 'SAPDV70A' '0101' 'X'.
          PERFORM dyn_fld USING 'NAST-LDEST' p_print.
          PERFORM dyn_fld USING 'NAST-DIMME' 'X'.
          PERFORM dyn_fld USING 'NAST-TDARMOD' '1'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70B'.
        PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
          CONCATENATE 'DV70A-SELKZ(' l_cellno ')' INTO l_temp.
          CONDENSE l_temp.
          PERFORM dyn_fld USING l_temp 'X'.
          CLEAR l_temp.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70I'.
        PERFORM dyn_scr USING 'SAPDV70A' '0102' 'X'.
          PERFORM dyn_fld USING 'NAST-VSZTP' '1'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70B'.
        PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
          PERFORM dyn_fld USING 'BDC_OKCODE' '=V70S'.
        CALL TRANSACTION c_tcode USING it_bdc
                                 MODE c_mode     "'N'
                                 UPDATE c_updat  "'A'
                                 MESSAGES INTO it_mesg.
        IF sy-subrc = 0.
          l_retcode = 0.
        ENDIF.
    ENDFORM.                    " bdc_output
    *&      Form  dyn_scr
          text
         -->P_0642   text
         -->P_0643   text
         -->P_0644   text
    FORM dyn_scr USING    P_0642
                          P_0643
                          P_0644.
        MOVE:  p_0642 TO wa_bdc-program,
               p_0643 TO wa_bdc-dynpro,
               p_0644 TO wa_bdc-dynbegin.
        APPEND wa_bdc TO it_bdc.
        CLEAR wa_bdc.
    ENDFORM.                    " dyn_scr
    *&      Form  dyn_fld
          text
         -->P_0654   text
         -->P_0655  text
    FORM dyn_fld USING    P_0654
                          P_0655.
       MOVE: p_0654 TO wa_bdc-fnam,
             p_0655 TO wa_bdc-fval.
       APPEND wa_bdc TO it_bdc.
       CLEAR wa_bdc.
    ENDFORM.                    " dyn_fld
    FORM alv_sort.
      DATA: wa_sortcat  TYPE slis_sortinfo_alv.
      WA_SORTCAT-SPOS      = 1.
      WA_SORTCAT-FIELDNAME = 'KUNNR'.
      WA_SORTCAT-UP        = 'X'.
      WA_SORTCAT-EXPA      = 'X'.
    Appending gd_sortcat-tabname
      APPEND WA_SORTCAT TO gs_sort.
      CLEAR wa_sortcat.
      WA_SORTCAT-SPOS      = 2.
      WA_SORTCAT-FIELDNAME = 'VBELN'.
      WA_SORTCAT-UP        = 'X'.
      WA_SORTCAT-EXPA      = 'X'.
    Appending gd_sortcat-tabname
      APPEND WA_SORTCAT TO gs_sort.
      WA_SORTCAT-SPOS      = 3.
      WA_SORTCAT-FIELDNAME = 'VUNTDAT'.
      WA_SORTCAT-UP        = 'X'.
      WA_SORTCAT-EXPA      = 'X'.
    Appending gd_sortcat-tabname
      APPEND WA_SORTCAT TO gs_sort.
    ENDFORM.                    " alv_sort

  • Add Icon to pa30 trans.

    Hi all,
    I need to add icon to the GUI status - MMOD - Application Toolbar.
    its must be repair or not?how can i do it with out repair?

    There don't appear to be any dynamic functions in the GUI status (ECC5), so my bet would be that you'll have to repair it.

  • Need to Add a button in ALV Tool Bar

    Hi,
    I have a requirement where in i need to add a button to a standard ALV report. Its using the class CL_GUI_ALV_GRID. There is a Badi for the report. The Report is co05n and the Badi is WORKORDER_INFOSYSTEM . I am getting the handle of
    CL_GUI_ALV_GRID object reference before screen display. Any guidance on how to add new button now to that toolbar?
    Any help will be rewarded.
    Thank you.
    regards,
    Deepthi lakshmi.A.

    Dear Deepthi Lakshmi.A.,
    Refer the standard program BCALV_GRID_05                  Add a Self-Defined Button to the Toolbar.
    PROGRAM BCALV_GRID_05.
    Purpose:
    ~~~~~~~~
    Demonstrate the creation of an own toolbar button.
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    The report shows a list of flights of one airline.
    Select one or more lines and press the 'Detail'-Button to popup
    a dialog window with related bookings.
    Essential steps (Search for '§')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1.Apply steps for event handling for events TOOLBAR and
      USER_COMMAND (see example for print events)
    2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
    3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
    4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
    INCLUDE .
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA: ok_code LIKE sy-ucomm,
          gt_sflight TYPE TABLE OF sflight,
          gt_sbook TYPE TABLE OF sbook,
          g_repid LIKE sy-repid,
          g_max type i value 100,
          gs_layout   TYPE lvc_s_layo,
          cont_on_main   TYPE scrfname VALUE 'BCALVC_TOOLBAR_D100_C1',
          cont_on_dialog TYPE scrfname VALUE 'BCALVC_TOOLBAR_D101_C1',
          grid1  TYPE REF TO cl_gui_alv_grid,
          grid2  TYPE REF TO cl_gui_alv_grid,
          custom_container1 TYPE REF TO cl_gui_custom_container,
          custom_container2 TYPE REF TO cl_gui_custom_container,
          event_receiver TYPE REF TO lcl_event_receiver.
    Set initial dynpro
    SET SCREEN 100.
    LOCAL CLASSES: Definition
    *===============================================================
    class lcl_event_receiver: local class to
                            define and handle own functions.
    Definition:
    ~~~~~~~~~~~
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
                IMPORTING e_object e_interactive,
        handle_user_command
            FOR EVENT user_command OF cl_gui_alv_grid
                IMPORTING e_ucomm.
      PRIVATE SECTION.
    ENDCLASS.
    lcl_event_receiver (Definition)
    *===============================================================
    LOCAL CLASSES: Implementation
    *===============================================================
    class lcl_event_receiver (Implementation)
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    § 2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA: ls_toolbar  TYPE stb_button.
    E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
    This class has got one attribute, namly MT_TOOLBAR, which
    is a table of type TTB_BUTTON. One line of this table is
    defined by the Structure STB_BUTTON (see data deklaration above).
    A remark to the flag E_INTERACTIVE:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            'e_interactive' is set, if this event is raised due to
            the call of 'set_toolbar_interactive' by the user.
            You can distinguish this way if the event was raised
            by yourself or by ALV
            (e.g. in method 'refresh_table_display').
            An application of this feature is still unknown...
    append a separator to normal toolbar
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    append an icon to show booking table
        CLEAR ls_toolbar.
        MOVE 'BOOKINGS' TO ls_toolbar-function.
        MOVE icon_employee TO ls_toolbar-icon.
        MOVE 'Show Bookings'(111) TO ls_toolbar-quickinfo.
        MOVE 'Detail'(112) TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.
      METHOD handle_user_command.
    § 3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
        DATA: lt_rows TYPE lvc_t_row.
        CASE e_ucomm.
          WHEN 'BOOKINGS'.
            CALL METHOD grid1->get_selected_rows
                     IMPORTING et_index_rows = lt_rows.
            CALL METHOD cl_gui_cfw=>flush.
            IF sy-subrc ne 0.
    add your handling, for example
              CALL FUNCTION 'POPUP_TO_INFORM'
                   EXPORTING
                        titel = g_repid
                        txt2  = sy-subrc
                        txt1  = 'Error in Flush'(500).
            else.
                      perform show_booking_table tables lt_rows.
            ENDIF.
        ENDCASE.
      ENDMETHOD.                           "handle_user_command
    ENDCLASS.
    lcl_event_receiver (Implementation)
    *===================================================================
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    The instance grid2 is freed not until the program exits from the
    main screen.
    (It is created only once during the first selection of SBOOK,
    no matter how many times the second window is called).
      CALL METHOD custom_container1->free.
      IF not custom_container2 is initial.
        CALL METHOD custom_container2->free.
      ENDIF.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc ne 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = g_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in Flush'(500).
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.
    *&      Module  PBO_100  OUTPUT
          text
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      g_repid = sy-repid.
      IF custom_container1 is initial.
    select data from table SFLIGHT
        PERFORM select_table_sflight CHANGING gt_sflight.
    create a custom container control for our ALV Control
        CREATE OBJECT custom_container1
            EXPORTING
                container_name = cont_on_main
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc ne 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
               EXPORTING
                    titel = g_repid
                    txt2  = sy-subrc
                    txt1  = 'The control could not be created'(510).
        ENDIF.
    create an instance of alv control
        CREATE OBJECT grid1
               EXPORTING i_parent = custom_container1.
    Set a titlebar for the grid control
        gs_layout-grid_title = 'Flights'(100).
    allow to select multiple lines
        gs_layout-sel_mode = 'A'.
        CALL METHOD grid1->set_table_for_first_display
             EXPORTING i_structure_name = 'SFLIGHT'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_sflight.
    ->Create Object to receive events and link them to handler methods.
    When the ALV Control raises the event for the specified instance
    the corresponding method is automatically called.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR grid1.
        SET HANDLER event_receiver->handle_toolbar FOR grid1.
    § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
        CALL METHOD grid1->set_toolbar_interactive.
      ENDIF.                               "IF grid1 IS INITIAL
      CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.
    ENDMODULE.                             " PBO_100  OUTPUT
    *&      Module  PAI_100  INPUT
          text
    MODULE pai_100 INPUT.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                             " PAI_100  INPUT
    *&      Module  PBO_0101  OUTPUT
          text
    MODULE pbo_0101 OUTPUT.
      IF custom_container2 is initial.
    (the data from sbook is already selected)
    create a custom container control for our ALV Control
        CREATE OBJECT custom_container2
            EXPORTING
                container_name = cont_on_dialog
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc ne 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
               EXPORTING
                    titel = g_repid
                    txt2  = sy-subrc
                    txt1  = 'The control could not be created'(510).
        ENDIF.
    create an instance of alv control
        CREATE OBJECT grid2
               EXPORTING i_parent = custom_container2.
    change title
        gs_layout-grid_title = 'Bookings'(101).
        gs_layout-sel_mode = ' '.
        CALL METHOD grid2->set_table_for_first_display
             EXPORTING i_structure_name = 'SBOOK'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_sbook.
      ELSE.
        CALL METHOD grid2->refresh_table_display.
      ENDIF.                               "IF custom_container2 IS INITIAL.
      CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid2.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc ne 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = g_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in Flush'(500).
      ENDIF.
    ENDMODULE.                             " PBO_0101  OUTPUT
    *&      Form  SELECT_TABLE_SFLIGHT
          text
         <--P_GT_SFLIGHT  text
    FORM select_table_sflight CHANGING p_gt_sflight LIKE gt_sflight[].
      SELECT * FROM sflight INTO TABLE p_gt_sflight up to g_max rows.
    ENDFORM.                               " SELECT_TABLE_SFLIGHT
    *&      Form  SELECT_TABLE_SBOOK
          text
         -->P_LS_SFLIGHT  text
         <--P_GT_SBOOK  text
    FORM select_table_sbook USING    p_ls_sflight LIKE LINE OF gt_sflight
                            CHANGING p_gt_sbook LIKE gt_sbook[].
      DATA: lt_sbook LIKE gt_sbook[].
    Select data from sbook according to a line of sflight
    and append that data to table p_gt_sbook
      SELECT * FROM  sbook INTO TABLE lt_sbook
             WHERE  carrid  = p_ls_sflight-carrid
             AND    connid  = p_ls_sflight-connid
             AND    fldate  = p_ls_sflight-fldate.
      APPEND LINES OF lt_sbook TO p_gt_sbook.
    ENDFORM.                               " SELECT_TABLE_SBOOK
    *&      Module  PAI_0101  INPUT
          text
    MODULE pai_0101 INPUT.
      CASE ok_code.
        WHEN 'RETURN'.
          LEAVE TO SCREEN 0.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                             " PAI_0101  INPUT
    *&      Form  show_booking_table
          text
         -->P_ET_INDEX_ROWS  text
    FORM show_booking_table TABLES p_et_index_rows
                                    STRUCTURE lvc_s_row.
      DATA: ls_selected_line LIKE lvc_s_row,
            lf_row_index TYPE lvc_index,
            ls_sflight LIKE LINE OF gt_sflight.
      CLEAR gt_sbook[].
      LOOP AT p_et_index_rows INTO ls_selected_line.
        lf_row_index = ls_selected_line-index.
    read selected row from internal table gt_sflight
        READ TABLE gt_sflight INDEX lf_row_index INTO ls_sflight.
    select corresponding lines of table sbook
    and append new lines to global table
        PERFORM select_table_sbook USING ls_sflight
                                   CHANGING gt_sbook.
      ENDLOOP.
    call dialog screen and display new alv control
      CALL SCREEN 101 STARTING AT 10 5.
    ENDFORM.                               " show_booking_table
    Regards,
    Naveen.

  • Need to Add field EKET-EINDT and EKET-SLFDT to ME2M Report output in ALV

    Hi All,
    I need to add fields EKET-EINDT and EKET-SLFDT to the output of program ME2M Transaction.
    I have appended the structure MEREP_OUTTAB_PURCHDOC with these fields. and it is coming in the ALV output field catalog.
    I need these fields output only for ALV display only.
    Please let me know which enhancement i need to write code to enhance the output with these filed values added to the ALV internal table
    Thanks in Advance
    Arun

    Hi All,
    I am able to get the field EINDT and SLFDT into the structure using Append structure and is also getting displayed in the output in ALV.
    But i need to know how to add code for filling these fields and passing into ALV. I need to know the Enhancement spot.
    Please let me know how to achieve this scenario
    Thanks
    Arun

  • How to add icon field in the alv grid output

    Hi Experts,
    i need to add one icom column in the alvgrid.That icon if the contract is inacitve then it should shows inactive symbol.if the contract is account assignment lock then it should show that lock symbol.Please send me the any code or approach.
    Thanks,
    Venkat.

    Hello Venkat
    Set<b> ls_fcat-icon = 'X' </b> in the fieldcatalog for the column where you want to display icons. In addition, add the following statement to your report:
    TYPE-POOLS: icon.  " replaces INCLUDE <icon>.
    Do not use the coded values (e.g. '@01@') but the "normal" icon names, e.g. <b>ICON_DETAIL</b>.. In order to see the icon names call transaction SE38/SA38 and run report <b>RSTXICON</b>.
    Regards
      Uwe

  • Need to be displayed in ALV grid

    Dear All,
    Below is my Program's code which is working accordingly. But in this code I am generating output as Basic list display.  But  I want my output to be displayed in ALV only. So from where I will start. Where to add code for Alv in my existing code. Can anybody help me out on the same.
    Regards,
    Abhay.
    REPORT  zfi_temp_rfkopr00
            MESSAGE-ID FR
           LINE-SIZE  132
           NO STANDARD PAGE HEADING.
    Report Name : Vendor Open Items Ageing Report
    Purpose : This report displays the Vendor Open Items based on
    different Ageing days (Calculated by taking the Base
    Line date and the days mentioned in Payment Terms)
    D A T A B A S E T A B L E S D E C L A R A T I O N
    TABLES: lfa1, " Vendor Master (General)
    t001, " Company Codes
    rfpdo.
    I N T E R N A L T A B L E S D E C L A R A T I O N S *
    Internal Table for Vendor Open Items Data
    DATA: BEGIN OF int_bsik OCCURS 0,
    lifnr LIKE bsik-lifnr, " Vendor Number
    name1 LIKE lfa1-name1, " Vendor Name
    shkzg LIKE bsik-shkzg, " Dr/Cr Indicator
    belnr LIKE bsik-belnr, " Document Number
    xblnr LIKE bsik-xblnr, " Ref Doc No
    blart LIKE bsik-blart, " Document Type
    zfbdt LIKE bsik-zfbdt, " Base Line Date
    zbd1t LIKE bsik-zbd1t,                                      " Due date1
    zbd2t LIKE bsik-zbd2t,                                      " Due Date2
    zbd3t LIKE bsik-zbd3t,                                      " Due Date3
    waers LIKE bsik-waers, " Currency
    dmbtr LIKE bsik-dmbtr, " Amount in Local Curr
    END OF int_bsik.
    Internal Table for Amounts Sum Up Data
    DATA: BEGIN OF int_final OCCURS 0,
    lifnr LIKE bsik-lifnr, " Vendor Number
    name1 LIKE lfa1-name1, " Vendor Name
    total1 LIKE bsik-dmbtr, " Amount in Local Curr
    total2 LIKE bsik-dmbtr, " Amount in Local Curr
    total3 LIKE bsik-dmbtr, " Amount in Local Curr
    total4 LIKE bsik-dmbtr, " Amount in Local Curr
    total5 LIKE bsik-dmbtr, " Amount in Local Curr
    total6 LIKE bsik-dmbtr, " Amount in Local Curr
    total LIKE bsik-dmbtr, " Amount in Local Curr
    END OF int_final.
    D A T A D E C L A R A T I O N S
    DATA : v_flag, " Flag
    v_gtotal1 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal2 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal3 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal4 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal5 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal6 LIKE bsik-dmbtr, " Amount Totals
    v_gtotal LIKE bsik-dmbtr, " Amount Totals
    v_subtotal1 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal2 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal3 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal4 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal5 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal6 LIKE bsik-dmbtr, " Amount Totals
    v_subtotal LIKE bsik-dmbtr, " Amount Totals
    v_date LIKE bsik-zfbdt, " Due Date
    v_tage1(4), " Age 30 days
    v_tage2(4), " Age 60 days
    v_tage3(4), " Age 90 days
    v_fir(15), " Column Text1
    v_sec(15), " Column Text2
    v_thir(15), " Column Text3
    v_four(17), " Column Text4
    v_fidd(4), " Days field1
    v_sedd(4), " Days field2
    v_thdd(4), " Days field3
    v_fodd(4), " Days field4
    v_str TYPE sy-lisel, " String
    v_str1(11), " String
    v_tage(3), " String
    v_date1(10). " Date field
    R A N G E D E C L A R A T I O N S
    RANGES: r_date1 FOR bsik-zfbdt, " Date Range 1
    r_date2 FOR bsik-zfbdt, " Date Range 2
    r_date3 FOR bsik-zfbdt, " Date Range 3
    r_date4 FOR bsik-zfbdt. " Date Range 4
    S E L E C T I O N S C R E E N *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr. "Vendor account
    PARAMETERS: p_bukrs LIKE t001-bukrs. "Co. Code
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: p_allgst LIKE rfpdo-allgstid OBLIGATORY DEFAULT sy-datum.
    "Open items at key date
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS: p_tage1 LIKE rfpdo1-allgfael DEFAULT '30',
    p_tage2 LIKE rfpdo1-allgfael DEFAULT '60',
    p_tage3 LIKE rfpdo1-allgfael DEFAULT '90',
    p_tage4 LIKE rfpdo1-allgfael DEFAULT '120'.
    SELECTION-SCREEN END OF BLOCK b3.
    A T S E L E C T I O N S C R E E N *
    AT SELECTION-SCREEN.
    Validate the screen fields
      PERFORM validate_flds.
    S T A R T O F S E L E C T I O N *
    START-OF-SELECTION.
    Fetch main data
      PERFORM fetch_data.
    T O P O F P A G E
    Header
    TOP-OF-PAGE.
      PERFORM header.
    E N D O F P A G E
    Footer
    END-OF-PAGE.
      ULINE.
    T O P O F P A G E D U R I N G L I N E S E L E C T I O N *
    Top of Page in Secondary List
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM header1.
    A T L I N E S E L E C T I O N *
    AT LINE-SELECTION.
    Perform Line Selections
      PERFORM line_selection.
    E N D O F S E L E C T I O N
    END-OF-SELECTION.
    List generation
      PERFORM basic_list.
    *& Form validate_flds
    Validation of Selection Screen fields
    FORM validate_flds .
    Validate Vendor Code
      CLEAR lfa1-lifnr.
      SELECT lifnr UP TO 1 ROWS
      INTO lfa1-lifnr
      FROM lfa1
      WHERE lifnr IN s_lifnr AND
      spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH 'Invalid Vendor Code range'(023).
      ENDIF.
    Validate Company Code
      CLEAR t001-bukrs.
      SELECT bukrs UP TO 1 ROWS
      INTO t001-bukrs
      FROM t001
      WHERE bukrs = p_bukrs AND
      spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e021. " Invalid Company Code range
      ENDIF.
      IF ( p_tage1 > p_tage2 ) OR ( p_tage1 > p_tage3 ) OR
      ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 1 greater'(004)
        'than Column# 2 or 3 or 4'(005).
      ENDIF.
    *column 2
      IF ( p_tage2 > p_tage3 ) OR ( p_tage1 > p_tage4 ).
        MESSAGE e999 WITH 'Column 2 greater'(006)
        'than Column# 3 or 4'(007).
      ENDIF.
    *column3
      IF ( p_tage3 > p_tage4 ).
        MESSAGE e999 WITH 'Column 3 greater'(008)
        'than Column#4'(009).
      ENDIF.
    ENDFORM. " validate_flds
    *& Form fetch_data
    Fetching Data from Database Tables
    FORM fetch_data .
    Date Range Population
      r_date1-sign = 'I'.
      r_date1-option = 'BT'.
      r_date1-low = p_allgst.
      r_date1-high = r_date1-low + p_tage1.
      APPEND r_date1.
      r_date2-sign = 'I'.
      r_date2-option = 'BT'.
      r_date2-low = r_date1-high + 1.
      r_date2-high = r_date1-low + p_tage2.
      APPEND r_date2.
      r_date3-sign = 'I'.
      r_date3-option = 'BT'.
      r_date3-low = r_date2-high + 1.
      r_date3-high = r_date1-low + p_tage3.
      APPEND r_date3.
      r_date4-sign = 'I'.
      r_date4-option = 'BT'.
      r_date4-low = r_date3-high + 1.
      r_date4-high = r_date1-low + p_tage4.
      APPEND r_date4.
    Select the Vendor Open Items data from BSIK
      SELECT l~lifnr
      l1~name1
      b~waers
      b~dmbtr
      b~zfbdt
      b~zbd1t
      b~zbd2t
      b~zbd3t
      b~belnr
      b~xblnr
      b~shkzg
      b~blart
      INTO CORRESPONDING FIELDS OF TABLE int_bsik
      FROM lfb1 AS l INNER JOIN lfa1 AS l1
      ON llifnr = l1lifnr
      INNER JOIN bsik AS b
      ON llifnr = blifnr AND
      lbukrs = bbukrs
      WHERE l~lifnr IN s_lifnr AND
      l~bukrs = p_bukrs AND
      b~zfbdt LE p_allgst.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH 'No Data found'(027).
      ENDIF.
    Removing the date limit to get the due items in the past
      DELETE int_bsik WHERE
      ( blart NE 'RE' AND blart NE 'KR' ) OR
      shkzg NE 'H'.
      SORT int_bsik BY lifnr.
    ENDFORM. " fetch_data
    *& Form header
    Display the Report Columns
    FORM header .
      v_tage1 = p_tage1 + 1.
      v_tage2 = p_tage2 + 1.
      v_tage3 = p_tage3 + 1.
      v_fidd = p_tage1.
      v_sedd = p_tage2.
      v_thdd = p_tage3.
      v_fodd = p_tage4.
      MOVE v_fodd0(4) TO v_fodd1(3).
      v_fodd+0(1) = space.
      CONCATENATE '1 to'(010) v_fidd INTO v_fir.
      CONCATENATE v_tage1 ' to '(011) v_sedd INTO v_sec.
      CONCATENATE v_tage2 ' to '(011) v_thdd INTO v_thir.
      CONCATENATE v_tage3 ' to '(011) space v_fodd INTO v_four.
    Standard header
      CLEAR: v_date1, v_str, v_str1, v_tage.
      WRITE p_allgst TO v_date1.
      MOVE p_tage4 TO v_tage.
      CONCATENATE '>' v_tage text-025 INTO v_str1.
      CONCATENATE
      'Summary of Ageing Analysis for Vendor Open Invoices as on'(013)
      v_date1 INTO v_str SEPARATED BY space.
    CALL FUNCTION 'Z_STANDARD_HEADER'
       EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 = v_str.
      FORMAT COLOR OFF.
      WRITE : /1(168) sy-uline.
      FORMAT COLOR 1 INTENSIFIED.
      WRITE :/1 sy-vline, 13 sy-vline, 49 sy-vline,
      50(101) 'Invoices Due For(In Days)'(014) CENTERED,
      151 sy-vline, 168 sy-vline .
      WRITE :/1 sy-vline, 2(11) 'Vendor#'(015) CENTERED,
      13 sy-vline ,14(35) 'Vendor Name'(016) CENTERED,
      49 sy-vline,
      50(101) sy-uline,151 sy-vline,
      152(16) 'Total'(017) CENTERED,
      168 sy-vline.
      WRITE : /1 sy-vline,13 sy-vline, 49 sy-vline,
      50(16) v_fir CENTERED, 66 sy-vline,
      67(16) v_sec CENTERED, 83 sy-vline,
      84(16) v_thir CENTERED, 100 sy-vline,
      101(16) v_four CENTERED, 117 sy-vline,
      118(16) v_str1 CENTERED, 134 sy-vline,
      135(16) 'Already Overdue'(018) CENTERED,151 sy-vline,
      168 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(168) sy-uline.
    ENDFORM. " header
    *& Form basic_list
    Display the Basic List
    FORM basic_list .
      NEW-PAGE LINE-SIZE 168.
      LOOP AT int_bsik.
        CLEAR v_date.
        IF int_bsik-zbd3t <> ' '.
          v_date = int_bsik-zfbdt + int_bsik-zbd3t.
        ELSE.
          IF int_bsik-zbd2t <> ' '.
            v_date = int_bsik-zfbdt + int_bsik-zbd2t.
          ELSE.
            v_date = int_bsik-zfbdt + int_bsik-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsik-zbd1t = ' '.
          v_date = int_bsik-zfbdt.
        ENDIF.
        IF v_date IN r_date1.
          int_final-total1 = int_final-total1 + int_bsik-dmbtr.
        ELSEIF v_date IN r_date2.
          int_final-total2 = int_final-total2 + int_bsik-dmbtr.
        ELSEIF v_date IN r_date3.
          int_final-total3 = int_final-total3 + int_bsik-dmbtr.
        ELSEIF v_date IN r_date4.
          int_final-total4 = int_final-total4 + int_bsik-dmbtr.
        ELSEIF v_date > r_date4-high.
          int_final-total5 = int_final-total5 + int_bsik-dmbtr.
        ELSEIF v_date < p_allgst.
          int_final-total6 = int_final-total6 + int_bsik-dmbtr.
        ENDIF.
        AT END OF lifnr.
          v_flag = 1.
        ENDAT.
        IF v_flag = 1.
          int_final-lifnr = int_bsik-lifnr.
          int_final-name1 = int_bsik-name1.
          int_final-total = int_final-total1 + int_final-total2 +
          int_final-total3 + int_final-total4 + int_final-total5 +
          int_final-total6.
          APPEND int_final.
          v_gtotal1 = v_gtotal1 + int_final-total1.
          v_gtotal2 = v_gtotal2 + int_final-total2.
          v_gtotal3 = v_gtotal3 + int_final-total3.
          v_gtotal4 = v_gtotal4 + int_final-total4.
          v_gtotal5 = v_gtotal5 + int_final-total5.
          v_gtotal6 = v_gtotal6 + int_final-total6.
          v_gtotal = v_gtotal + int_final-total.
          WRITE: /1 sy-vline,
          2 int_final-lifnr COLOR 4 INTENSIFIED ON,
          13 sy-vline,
          14 int_final-name1 COLOR 4 INTENSIFIED ON,
          49 sy-vline.
          DATA : v_rem.
          v_rem = sy-tabix MOD 2.
          IF v_rem NE 0.
            FORMAT COLOR 2 INTENSIFIED.
            WRITE : 50 int_final-total1 CURRENCY int_bsik-waers,
            66 sy-vline,
            67 int_final-total2 CURRENCY int_bsik-waers,
            83 sy-vline,
            84 int_final-total3 CURRENCY int_bsik-waers,
            100 sy-vline,
            101 int_final-total4 CURRENCY int_bsik-waers,
            117 sy-vline,
            118 int_final-total5 CURRENCY int_bsik-waers,
            134 sy-vline,
            135 int_final-total6 CURRENCY int_bsik-waers,
            151 sy-vline,
            152 int_final-total CURRENCY int_bsik-waers,
            168 sy-vline.
          ELSE.
            WRITE : 50 int_final-total1 CURRENCY int_bsik-waers,
            66 sy-vline,
            67 int_final-total2 CURRENCY int_bsik-waers,
            83 sy-vline,
            84 int_final-total3 CURRENCY int_bsik-waers,
            100 sy-vline,
            101 int_final-total4 CURRENCY int_bsik-waers,
            117 sy-vline,
            118 int_final-total5 CURRENCY int_bsik-waers,
            134 sy-vline,
            135 int_final-total6 CURRENCY int_bsik-waers,
            151 sy-vline,
            152 int_final-total CURRENCY int_bsik-waers,
            168 sy-vline.
          ENDIF.
          FORMAT COLOR OFF.
          HIDE int_final.
          CLEAR int_final.
          v_flag = 0.
        ENDIF.
        AT LAST.
          WRITE : /1(168) sy-uline.
          FORMAT COLOR 3 INTENSIFIED.
          WRITE : /1 sy-vline, 2(47) 'GRAND TOTAL'(022) CENTERED,
          49 sy-vline, 50 v_gtotal1 CURRENCY int_bsik-waers,
          66 sy-vline, 67 v_gtotal2 CURRENCY int_bsik-waers,
          83 sy-vline, 84 v_gtotal3 CURRENCY int_bsik-waers,
          100 sy-vline,101 v_gtotal4 CURRENCY int_bsik-waers,
          117 sy-vline,118 v_gtotal5 CURRENCY int_bsik-waers,
          134 sy-vline,135 v_gtotal6 CURRENCY int_bsik-waers,
          151 sy-vline,152 v_gtotal CURRENCY int_bsik-waers,
          168 sy-vline.
          HIDE : v_gtotal1,
          v_gtotal2,
          v_gtotal3,
          v_gtotal4,
          v_gtotal5,
          v_gtotal6,
          v_gtotal.
        ENDAT.
        FORMAT COLOR OFF.
      ENDLOOP.
      WRITE : /1(168) sy-uline.
    ENDFORM. " basic_list
    *& Form line_selection
    When double clicked on the line display the seconday list
    FORM line_selection .
      NEW-PAGE LINE-SIZE 206.
    Sy-lsind = 1.
      DATA : v_rem,v_cnt LIKE sy-tabix.
      v_cnt = 0.
      SORT int_bsik BY belnr zfbdt.
      LOOP AT int_bsik WHERE lifnr EQ int_final-lifnr.
        v_rem = v_cnt MOD 2.
        CLEAR v_date.
        IF int_bsik-zbd3t <> ' '.
          v_date = int_bsik-zfbdt + int_bsik-zbd3t.
        ELSE.
          IF int_bsik-zbd2t <> ' '.
            v_date = int_bsik-zfbdt + int_bsik-zbd2t.
          ELSE.
            v_date = int_bsik-zfbdt + int_bsik-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsik-zbd1t = ' '.
          v_date = int_bsik-zfbdt.
        ENDIF.
        IF v_rem NE 0.
          FORMAT COLOR 2 INTENSIFIED.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
          12 sy-vline,13 int_bsik-lifnr,
          23 sy-vline,24 int_bsik-name1,
          59 sy-vline,60 int_bsik-xblnr,
          76 sy-vline,77 int_bsik-zfbdt,
          87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
          138 sy-vline,155 sy-vline,
          172 sy-vline, 189 sy-vline,
          190 int_bsik-dmbtr CURRENCY int_bsik-waers,
          206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date > r_date4-high.
            v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date < p_allgst.
            v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ENDIF.
          FORMAT COLOR OFF.
        ELSE.
          WRITE :/1 sy-vline, 2 int_bsik-belnr,
          12 sy-vline,13 int_bsik-lifnr,
          23 sy-vline,24 int_bsik-name1,
          59 sy-vline,60 int_bsik-xblnr,
          76 sy-vline,77 int_bsik-zfbdt,
          87 sy-vline.
          WRITE : 104 sy-vline,121 sy-vline,
          138 sy-vline,155 sy-vline,
          172 sy-vline,189 sy-vline,
          190 int_bsik-dmbtr CURRENCY int_bsik-waers,
          206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 = v_subtotal1 + int_bsik-dmbtr.
            WRITE : 88 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 = v_subtotal2 + int_bsik-dmbtr.
            WRITE : 105 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 = v_subtotal3 + int_bsik-dmbtr.
            WRITE : 122 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 = v_subtotal4 + int_bsik-dmbtr.
            WRITE : 139 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date > r_date4-high.
            v_subtotal5 = v_subtotal5 + int_bsik-dmbtr.
            WRITE : 156 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ELSEIF v_date < p_allgst.
            v_subtotal6 = v_subtotal6 + int_bsik-dmbtr.
            WRITE : 173 int_bsik-dmbtr CURRENCY int_bsik-waers.
          ENDIF.
        ENDIF.
        FORMAT COLOR OFF.
        v_cnt = v_cnt + 1.
      ENDLOOP.
      WRITE : /1(206) sy-uline.
      v_subtotal = v_subtotal1 + v_subtotal2 + v_subtotal3
      + v_subtotal4 + v_subtotal5 + v_subtotal6.
      FORMAT COLOR 3 INTENSIFIED.
      WRITE : /1 sy-vline,
      2(85) 'Total'(017) CENTERED CURRENCY int_bsik-waers ,
      87 sy-vline,
      88 v_subtotal1 CURRENCY int_bsik-waers,
      104 sy-vline,
      105 v_subtotal2 CURRENCY int_bsik-waers,
      121 sy-vline,
      122 v_subtotal3 CURRENCY int_bsik-waers,
      138 sy-vline,
      139 v_subtotal4 CURRENCY int_bsik-waers,
      155 sy-vline,
      156 v_subtotal5 CURRENCY int_bsik-waers,
      172 sy-vline,
      173 v_subtotal6 CURRENCY int_bsik-waers,
      189 sy-vline,
      190 v_subtotal CURRENCY int_bsik-waers,
      206 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(206) sy-uline.
      CLEAR : v_subtotal,v_subtotal1,v_subtotal2,v_subtotal3,
      v_subtotal4,v_subtotal5,v_gtotal1,v_gtotal2,v_gtotal3,
      v_gtotal4, v_gtotal5,v_gtotal,v_subtotal6,v_gtotal6.
    ENDFORM. " line_selection
    *& Form header1
    Secondary List Header
    FORM header1 .
    Standard header
      CLEAR: v_date1, v_str, v_str1, v_tage.
      WRITE p_allgst TO v_date1.
      MOVE p_tage4 TO v_tage.
      CONCATENATE '>' v_tage text-025 INTO v_str1.
      CONCATENATE
      'Details of Ageing Analysis for Vendor Open Invoices as on'(024)
      v_date1 INTO v_str SEPARATED BY space.
    CALL FUNCTION 'Z_STANDARD_HEADER'
       EXPORTING
         title1 = 'Saudi International Petrochemical Company'(012)
         title2 = v_str.
      FORMAT COLOR 1 INTENSIFIED.
      WRITE :/1(206) sy-uline.
      WRITE :/1 sy-vline,12 sy-vline ,
      23 sy-vline,59 sy-vline,76 sy-vline,87 sy-vline,
      88(101) 'Invoices Due For(In Days)'(014) CENTERED,
      189 sy-vline,206 sy-vline.
      WRITE : /1 sy-vline, 2(10) 'Doc Number'(021) CENTERED,
      12 sy-vline, 13(10) 'Vendor#'(015) CENTERED,
      23 sy-vline, 24(35) 'Vendor Name'(016) CENTERED,
      59 sy-vline, 60(16) 'Ref invoice#'(019) CENTERED,
      76 sy-vline, 77(10) 'Inv dt'(020) CENTERED,
      87 sy-vline, 88(101) sy-uline,
      189 sy-vline,190(16) 'Total'(017) CENTERED,
      206 sy-vline.
      WRITE : /1 sy-vline, 12 sy-vline,
      23 sy-vline,59 sy-vline,
      76 sy-vline,87 sy-vline,
      88(16) v_fir CENTERED, 104 sy-vline,
      105(16) v_sec CENTERED, 121 sy-vline,
      122(16) v_thir CENTERED, 138 sy-vline,
      139(16) v_four CENTERED, 155 sy-vline,
      156(16) v_str1 CENTERED,
      172 sy-vline,
      173(16) 'Already Overdue'(018) CENTERED,
      189 sy-vline,
      206 sy-vline.
      FORMAT COLOR OFF.
      WRITE : /1(206) sy-uline.
    ENDFORM.                                                    " header1

    Hi Abhay,
    After moving the whole data into final internal table, pass that internal table to function module REUSE_ALV_GRID_DISPLAY.
    before that you need to build field catalog and have to build layout with all the required columns.
    Go through the below links for your reference.
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV? http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV? http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV? http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    http://www.sap-img.com/abap/what-is-alv-programming.htm
    http://www.sap-img.com/abap-function.htm
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
    http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
    http://www.sap-img.com/abap-function.htm
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
    iii. I_callback_user_command : routine where the function codes are handled
    iv. I_structure name : name of the dictionary table
    v. Is_layout : structure to set the layout of the report
    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table
    iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
    declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events
    for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
    Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block
    II. it_fieldcat : field catalog
    III. i_tabname : internal table name with output data
    IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the
    output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field
    names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output
    ii. t_outtab_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary)
    E. ref_tabname : table (dictionary)
    F. key(1) : column with key-color
    G. icon(1) : icon
    H. symbol(1) : symbol
    I. checkbox(1) : checkbox
    J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    <b>Reward points for helpful answers,</b>
    Satish

  • Regarding icons in alv (with out using oops concept)

    i have generated an alv report.for that key field is vbeln .i have to add an icon coloumn before vbeln and have some icon for that coloumn to show that its a key field. how would i di that. and i have used macros to bulid fieldcatalog. now i have to add extra coloumn that too it should be in first position. since i have 20 fields and vbeln being first coloumn and i have to add icon coloumn before that.

    there is atable in the dictionary ICON.
    IN UR PROGRAM, in the structure declare
    a variable like ICON-NAME as first field.
    and pass it in the field catalog.
    while entering values u pass the value in to the variable u will get the required icon.
    u need to pass the id.
    check the table u can find the name.

  • Two Icons on ALV tree in same row

    Hi all,
    I need to show 2 ICONS instead of regular one icon on ALV Tree,at the same node like the easy cost planning on CJ20N.
    I use the SALV Tree.
    Thanks,
    Omer g

    Hi Omer,
    You can achieve this by playing with is_node_layout and it_item_layout parameters of the method add_node:
    set item-layout
      data: lt_item_layout type lvc_t_layi,
               ls_item_layout type lvc_s_layi.
      ls_item_layout-t_image = '@01@'.
      ls_item_layout-fieldname = o_tree->c_hierarchy_column_name.
      append ls_item_layout to lt_item_layout.
    add node
      l_node_text =  'node_text'.
      data: ls_node type lvc_s_layn.
      ls_node-n_image   = '@02@'.
      ls_node-exp_image = '@02@'.
      call method o_tree->add_node
        exporting
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_outtab
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        importing
          e_new_node_key   = p_node_key.
    Hope it helps,
    Kr

  • How to write ICONS in ALV TOP of Page

    Hai experts,
    How to ICON in ALV  Top of PAGE
    i want to wrire
    ICON_LED_RED for cancellation Invioce
    ICON_LED_GREEN for  Invioce
    but i pass this values to wa_header-info it comes  @5C@ @5B@
    thanks
    sitaram

    Hi...
       I think this code is help full for u....
    *& Report ZFI_TEST *
    REPORT ZFI_ICON_TEST MESSAGE-ID zz .
    *& TABLES DECLARATION *
    TABLES: vbak.
    *& TYPE POOLS DECLARATION *
    TYPE-POOLS: slis.
    *& INTERNAL TABLE DECLARATION *
    DATA: BEGIN OF itab OCCURS 0,
    icon TYPE icon-id, "itab-icon = '@08@' -> Green ; '@09@' -> Yellow ; '@0A@' -> Red
    vbeln LIKE vbak-vbeln,
    audat LIKE vbak-audat,
    vbtyp LIKE vbak-vbtyp,
    auart LIKE vbak-auart,
    augru LIKE vbak-augru,
    netwr LIKE vbak-netwr,
    waerk LIKE vbak-waerk,
    END OF itab.
    *INTERNAL TABLE FOR FIELD CATALOG
    DATA: wa_fieldcat TYPE slis_fieldcat_alv,
    it_fieldcat TYPE slis_t_fieldcat_alv.
    IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
    WITH HEADER LINE,
    *INTERNAL TABLE FOR EVENTS
    DATA: it_event TYPE slis_t_event,
    wa_event TYPE slis_alv_event,
    *INTERNAL TABLE FOR SORTING
    it_sort TYPE slis_t_sortinfo_alv,
    wa_sort TYPE slis_sortinfo_alv,
    *INTERNAL TABLE FOR LAYOUT
    wa_layout TYPE slis_layout_alv.
    *& VARIABLE DECLARATION *
    DATA : v_repid TYPE sy-repid,
    v_pagno(4) TYPE n,
    v_date(8) TYPE c.
    *& CONSTANTS *
    CONSTANTS: c_x TYPE c VALUE 'X'.
    *& SELECTION SCREEN *
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
    s_vbtyp FOR vbak-vbtyp DEFAULT 'C'.
    SELECTION-SCREEN: END OF BLOCK b1.
    SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-003.
    PARAMETERS: p_list RADIOBUTTON GROUP rad1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-004.
    PARAMETERS: p_grid RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN: END OF BLOCK b2.
    AT SELECTION-SCREEN.
    PERFORM validate_screen.
    *& START OF SELECTION *
    START-OF-SELECTION.
    CLEAR: itab, itab[].
    V_REPID = SY-REPID.
    PERFORM get_data.
    PERFORM display_data.
    *& END OF SELECTION *
    END-OF-SELECTION.
    *--DO ALV Process
    v_repid = sy-repid.
    *--Sort the Output Fields
    PERFORM sort_fields.
    *--Build Field catalog for the Output fields
    PERFORM BUILD_FIELDCAT.
    *--Set the Layout for ALV
    PERFORM set_layout.
    *& Form GET_DATA
    text
    TO GET THE DATA FROM TABLES INTO ITAB
    FORM get_data .
    SELECT vbeln
    audat
    vbtyp
    auart
    augru
    netwr
    waerk
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM vbak
    WHERE vbeln IN s_vbeln AND
    audat > '04.04.2005'
    AND netwr > 0.
    LOOP AT itab.
    IF itab-netwr < 10000.
    itab-icon = '@08@'.
    ELSEIF itab-netwr > 10000 AND itab-netwr < 100000.
    itab-icon = '@09@'.
    ELSEIF itab-netwr > 100000.
    itab-icon = '@0A@'.
    ENDIF.
    MODIFY itab INDEX sy-tabix.
    ENDLOOP.
    ENDFORM. " GET_DATA
    *& Form sort_fields
    FORM sort_fields .
    CLEAR wa_sort.
    wa_sort-fieldname = 'VBTYP'.
    wa_sort-spos = '1'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    CLEAR wa_sort.
    wa_sort-fieldname = 'NETWR'.
    wa_sort-spos = '2'.
    wa_sort-up = 'X'.
    wa_sort-subtot = 'X'.
    APPEND wa_sort TO it_sort.
    ENDFORM. " sort_fields
    *& Form set_layout
    FORM set_layout .
    IF p_list = c_x .
    wa_layout-window_titlebar = 'LIST DISPLAY'(016).
    wa_layout-zebra = 'X'.
                    +
                    +
    ALV LIST DISPLAY
    PERFORM list_display TABLES itab.
              o
                    +
                    + ALV GRID DISPLAY
    ELSEIF p_grid = c_x.
    wa_layout-window_titlebar = 'GRID DISPLAY'(017).
    wa_layout-zebra = 'X'.
    PERFORM grid_display TABLES itab.
    ENDIF.
    ENDFORM. " set_layout
    *& Form list_display
    FORM list_display TABLES p_itab .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = wa_layout
    it_fieldcat = it_fieldcat[]
    it_sort = it_sort[]
    i_save = 'U'
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " list_display
    *& Form GRID_DISPLAY
    FORM grid_display TABLES p_itab .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = wa_layout
    it_fieldcat = it_fieldcat[]
    it_sort = it_sort[]
    it_events = it_event
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " GRID_DISPLAY
    *& Form VALIDATE_SCREEN
    text
    --> p1 text
    <-- p2 text
    FORM validate_screen .
    DATA: lv_vbeln LIKE vbak-vbeln.
    IF NOT s_vbeln IS INITIAL.
    SELECT vbeln
    INTO lv_vbeln
    UP TO 1 ROWS
    FROM vbak
    WHERE vbeln IN s_vbeln.
    ENDSELECT.
    IF sy-subrc <> 0.
    MESSAGE e000 WITH 'INVALID SALES DOC'.
    ENDIF.
    ENDIF.
    ENDFORM. " VALIDATE_SCREEN
    *& Form display_data
    text
    --> p1 text
    <-- p2 text
    FORM display_data .
    DEFINE m_fieldcat.
    add 1 to wa_fieldcat-col_pos.
    wa_fieldcat-fieldname = &1.
    wa_fieldcat-ref_tabname = 'VBAK'.
    wa_fieldcat-do_sum = &2.
    wa_fieldcat-cfieldname = &3.
    append wa_fieldcat to it_fieldcat.
    END-OF-DEFINITION.
    DATA:
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv.
    m_fieldcat 'ICON' '' ''.
    m_fieldcat 'VBELN' '' ''.
    m_fieldcat 'AUDAT' '' ''.
    m_fieldcat 'VBTYP' '' ''.
    m_fieldcat 'AUART' '' ''.
    m_fieldcat 'AUGRU' '' ''.
    m_fieldcat 'NETWR' 'C' 'WAERK'.
    m_fieldcat 'WAERK' '' ''.
    ENDFORM. " display_data[/code]
    Regards,
    Rahul
    Edited by: Rahul Reddy on Apr 14, 2008 12:33 PM

  • Display icon in alv report ?

    Hi All,
    I am using class 'cl_gui_alv_grid' to generate an alv report. I want to display status icons like red, yellow and green in one of the coulmns. Please let me know how to achieve the same.
    Regards,
    Navneeth K.

    Try to follow the below code.
    Add
             icon       TYPE  icon-id,             "Status
    to your output table
    Constants
    CONSTANTS: c_green  TYPE icon-id VALUE '@08@',
               c_yellow TYPE icon-id VALUE '@09@',
               c_red    TYPE icon-id VALUE '@0A@'.
    Put your condition in which you want to display which color.
        IF CONDITION.
          MOVE c_yellow TO wa_out-icon.
          MODIFY it_out
                       from wa_out.
       ENDIF.
    Add it in your catalog
    FORM populate_fieldcat USING p_table TYPE c.
    **status
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname     = p_table.
      wa_fieldcat-fieldname   = 'ICON'.
      wa_fieldcat-seltext_l   = text-010.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-icon        = 'X'.
      APPEND wa_fieldcat TO i_fieldcat.
        CALL METHOD g_grid->set_table_for_first_display
          EXPORTING
          I_BUFFER_ACTIVE               =
          I_BYPASSING_BUFFER            =
          I_CONSISTENCY_CHECK           =
            i_structure_name              = 'MARA'
          IS_VARIANT                    =
          I_SAVE                        =
          I_DEFAULT                     = 'X'
            is_layout                      =  gs_layout
          IS_PRINT                      =
          IT_SPECIAL_GROUPS             =
          IT_TOOLBAR_EXCLUDING          =
          IT_HYPERLINK                  =
          IT_ALV_GRAPHICS               =
          IT_EXCEPT_QINFO               =
          CHANGING
            it_outtab                     = it_out[]
          IT_FIELDCATALOG               = T_FIELDCAT
          IT_SORT                       =
          IT_FILTER                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.

  • I have a normal report , i need to make it into ALV,

    Hi,
    i have a normal report and i need to make it into ALV Report in ECC5.0version. when i making it into ALV its giving blank.
    can any one help me out to make below code in to ALV report.
    REPORT ZSAMPLE line-size 260
                      line-count 65
                      no standard page heading.
    ====================================================================
    TABLES *********************************
    ====================================================================
    tables : bseg,
             bkpf,
             kna1,
             bsid,
             bsad,
             knb1.
    data : begin of customer_tab occurs 0,
              kunnr         like kna1-kunnr,
              name1         like kna1-name1,
              flag(1)       type c,
           end of customer_tab.
    data : begin of customerdoc_tab occurs 0,
              kunnr         like kna1-kunnr,
              belnr         like bkpf-belnr,
              gjahr         like bkpf-gjahr,
              monat         like bkpf-monat,
           end of customerdoc_tab.
    data : begin of doc_tab occurs 0,
              belnr         like bkpf-belnr,
              gjahr         like bkpf-gjahr,
              monat         like bkpf-monat,
           end of doc_tab.
    DATA: BEGIN OF BSID_TAB OCCURS 0,
             BUKRS LIKE BSID-BUKRS,
             PRCTR LIKE BSID-PRCTR,
             KUNNR LIKE BSID-KUNNR,
             FLAG(1),
             UMSKZ LIKE BSID-UMSKZ,
             BLART LIKE BSID-BLART,
             BELNR LIKE BSID-BELNR,
             BUZEI LIKE BSID-BUZEI,
             NETDT LIKE BSID-ZFBDT,
             ZFBDT LIKE BSID-ZFBDT,
             BUDAT LIKE BSID-BUDAT,
             BLDAT LIKE BSID-BLDAT,
             BSCHL LIKE BSID-BSCHL,
             DMBTR LIKE BSID-DMBTR,
             SHKZG LIKE BSID-SHKZG,
             ZBD1T LIKE BSID-ZBD1T,
             ZBD2T LIKE BSID-ZBD2T,
             ZBD3T LIKE BSID-ZBD3T,
             REBZG LIKE BSID-REBZG,
             REBZT LIKE BSID-REBZT,
             KOART LIKE BSEG-KOART,
             SK1DT LIKE FAEDE-SK1DT,
             SK2DT LIKE FAEDE-SK2DT,
             DAYSD LIKE SY-TABIX,
          END OF BSID_TAB.
    ranges : r_bukrs for bsid-bukrs,
             r_kunnr for kna1-kunnr.
    ===================================================================
    VARIABLES *******************************
    ===================================================================
    data : v_belnr     like  bseg-belnr,
           v_gjahr     like  bkpf-gjahr,
           v_monat     like  bkpf-monat,
           v_ttlc      type  p,
           v_flag(1)   type  c,
           V_COUNT1(4) TYPE  N,
           V_COUNT2(4) TYPE  N,
           V_COUNT3(4) TYPE  N,
           V_COUNT4(4) TYPE  N,
           V_COUNT5(4) TYPE  N,
           V_COUNT6(4) TYPE  N,
           V_COUNT7(4) TYPE  N,
           V_COUNT8(4) TYPE  N,
           V_COUNT9(4) TYPE  N,
           V_COUNT10(4) TYPE  N,
           V_NET1      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 1
           V_NET2      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 2
           V_NET3      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 3
           V_NET4      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 4
           V_NET5      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 5
           V_NET6      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 6
           V_NET7      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 7
           V_NET8      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 8
           V_NET9      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 9
           V_NET10      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 10
           V_NET11      LIKE  BSID-DMBTR, "CALCULATE CUSTOMER AGE 11
           V_NET       LIKE  BSID-DMBTR, "Total Balance of Customer
           V_ttlNET1   LIKE  BSID-DMBTR,
           V_ttlNET2   LIKE  BSID-DMBTR,
           V_ttlNET3   LIKE  BSID-DMBTR,
           V_ttlNET4   LIKE  BSID-DMBTR,
           V_ttlNET5   LIKE  BSID-DMBTR,
           V_ttlNET6   LIKE  BSID-DMBTR,
           V_ttlNET7   LIKE  BSID-DMBTR,
           V_ttlNET8   LIKE  BSID-DMBTR,
           V_ttlNET9   LIKE  BSID-DMBTR,
           V_ttlNET10   LIKE  BSID-DMBTR,
           V_ttlNET11   LIKE  BSID-DMBTR,
           V_ttlNET    LIKE  BSID-DMBTR,
           v_kunnr     like  bseg-kunnr,
           V_BUTXT     like t001-butxt.
    ===================================================================
    SELECTION SCREEN ****************************
    ===================================================================
    selection-screen begin of block b1 with frame title text-001.
    parameters :     p_bukrs    like bseg-bukrs obligatory.
    select-options : s_kunnr    for  kna1-kunnr,
                     s_BRSCH    for  kna1-BRSCH,
                     s_REGIO    for  kna1-REGIO,
                     s_KTOKD    for  kna1-KTOKD,
                     s_BUSAB    for  knb1-BUSAB.
    selection-screen: end of block b1.
    selection-screen begin of block b2 with frame title text-003.
    PARAMETERS: DAT LIKE SY-DATUM DEFAULT SY-DATUM.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 01(30) TEXT-002.
    SELECTION-SCREEN POSITION POS_LOW.
    *PARAMETERS: RASTBIS1 LIKE RFPDO1-ALLGROGR DEFAULT '000'.
    *PARAMETERS: RASTBIS2 LIKE RFPDO1-ALLGROGR DEFAULT '030'.
    *PARAMETERS: RASTBIS3 LIKE RFPDO1-ALLGROGR DEFAULT '060'.
    *PARAMETERS: RASTBIS4 LIKE RFPDO1-ALLGROGR DEFAULT '090'.
    *PARAMETERS: RASTBIS5 LIKE RFPDO1-ALLGROGR DEFAULT '120'.
    PARAMETERS: RASTBIS1(4) type n DEFAULT '0000'.
    PARAMETERS: RASTBIS2(4) type n DEFAULT '0030'.
    PARAMETERS: RASTBIS3(4) type n DEFAULT '0060'.
    PARAMETERS: RASTBIS4(4) type n DEFAULT '0090'.
    PARAMETERS: RASTBIS5(4) type n DEFAULT '0120'.
    PARAMETERS: RASTBIS6(4) type n DEFAULT '0150'.
    PARAMETERS: RASTBIS7(4) type n DEFAULT '0180'.
    PARAMETERS: RASTBIS8(4) type n DEFAULT '0210'.
    PARAMETERS: RASTBIS9(4) type n DEFAULT '0240'.
    PARAMETERS: RASTBIS0(4) type n DEFAULT '0270'.
    SELECTION-SCREEN END OF LINE.
    Noted item removed as per FI instruction
    PARAMETERS: P_STAND AS CHECKBOX default 'X',
               P_NOTED AS CHECKBOX ,
                P_SPCAL AS CHECKBOX .
    selection-screen: end of block b2.
    selection-screen begin of block b3 with frame.
    PARAMETERS: allgline like RFPDO1-allgline .
    Parameters : p_balyes type c radiobutton group grp9 default 'X',
                 p_balno  type c radiobutton group grp9.
    selection-screen: end of block b3.
    Check for the Select option
    AT SELECTION-SCREEN.
    IF P_STAND = '' AND P_SPCAL = '' .
      MESSAGE E398(00) WITH 'PLEASE CHOOSE AT LEAST ONE G/L INDICATOR!'.
    ENDIF.
    Check for Company code Authorization
      authority-check object 'F_BKPF_BUK'
         ID 'BUKRS' FIELD p_bukrs
         ID 'ACTVT' FIELD '03'.
      if sy-subrc ne 0.
       message e398(00) with 'You are not Authorized for CC ' p_bukrs.
      Endif.
    ===================================================================
    START-OF-SELECTION ****************************
    ===================================================================
    START-OF-SELECTION.
    V_COUNT1 = RASTBIS1 + 1.
    V_COUNT2 = RASTBIS2 + 1.
    V_COUNT3 = RASTBIS3 + 1.
    V_COUNT4 = RASTBIS4 + 1.
    V_COUNT5 = RASTBIS5 + 1.
    V_COUNT6 = RASTBIS6 + 1.
    V_COUNT7 = RASTBIS7 + 1.
    V_COUNT8 = RASTBIS8 + 1.
    V_COUNT9 = RASTBIS9 + 1.
    V_COUNT10 = RASTBIS0 + 1.
    perform extract_data.
    ===================================================================
    At line Selection *****************************
    ===================================================================
    at line-selection.
    if sy-lilli >= 9 .
       refresh r_bukrs.
       move p_bukrs to r_bukrs-low.
       move 'I' to r_bukrs-sign.
       move 'EQ' to r_bukrs-option.
       append r_bukrs.
       refresh r_kunnr.
       move customer_tab-kunnr to r_kunnr-low.
       move 'I' to r_kunnr-sign.
       move 'EQ' to r_kunnr-option.
       append r_kunnr.
       submit ZFARVR0040  and return
        with p_bukrs = p_bukrs
        with dat     = dat
        with p_stand = p_stand
        with p_spcal = P_SPCAL
        with s_kunnr in r_kunnr.
    endif.
    ===================================================================
    Top of Page *******************************
    ===================================================================
    TOP-OF-PAGE.
      SELECT SINGLE BUTXT FROM T001 INTO V_BUTXT
                          WHERE BUKRS = p_BUKRS .
      WRITE:/73'Customers Aging Analysis',140'PAGE NO.',
      SY-PAGNO.
      WRITE:/002 'COMPANY',
             011 P_BUKRS,
             017 V_BUTXT,
             055 allgline centered,
             140 'DATE :',
             150 sy-datum .
      write:/002 'User',
             011 sy-UNAME,
             140 'Time :',
             150 sy-UZEIT.
      SKIP.
      format color col_heading intensified off.
      WRITE:/  SY-ULINE,
                  SY-VLINE,002 'Customer',
              012 SY-VLINE,013 'Name',
              043 SY-VLINE,048 'CURRENT',
              061 SY-VLINE,065 'FROM  ',V_COUNT1,
              079 SY-VLINE,083 'FROM  ',V_COUNT2,
              097 SY-VLINE,101 'FROM  ',V_COUNT3,
              115 SY-VLINE,119 'FROM  ',V_COUNT4,
              133 SY-VLINE,137 'FROM  ',V_COUNT5,
              151 SY-VLINE,155 'FROM  ',V_COUNT6,
              169 SY-VLINE,173 'FROM  ',V_COUNT7,
              187 SY-VLINE,191 'FROM  ',V_COUNT8,
              205 SY-VLINE,209 'FROM  ',V_COUNT9,
              223 SY-VLINE,228 'FROM  ',V_COUNT10,
              243 SY-VLINE,248 'TOTAL',
              268 SY-VLINE.
      WRITE:/      SY-VLINE,002 'Number',
               12  SY-VLINE,
               43  SY-VLINE,
               061 SY-VLINE,065 'TO    ',RASTBIS2,
               079 SY-VLINE,083 'TO    ',RASTBIS3,
               097 SY-VLINE,101 'TO    ',RASTBIS4,
               115 SY-VLINE,119 'TO    ',RASTBIS5,
               133 SY-VLINE,137 'FROM  ',RASTBIS6,
               151 SY-VLINE,155 'FROM  ',RASTBIS7,
               169 SY-VLINE,173 'FROM  ',RASTBIS8,
               187 SY-VLINE,191 'FROM  ',RASTBIS9,
               205 SY-VLINE,209 'FROM  ',RASTBIS0,
               223 SY-VLINE,
               243 SY-VLINE,
               268 SY-VLINE,
               SY-ULINE.
      format color off.
    ===================================================================
    END-OF-SELECTION ***************************
    ===================================================================
    end-of-selection.
    ===================================================================
    Form : Extract_Data *
    ===================================================================
    form extract_data.
    Select the Customers
       Select t1~kunnr t2~name1
         into corresponding fields of table  customer_tab
         from knb1 as t1 inner join kna1 as t2
              on t2~kunnr = t1~kunnr
                   where t1~bukrs = p_bukrs
                     and t1~kunnr in s_kunnr
                     and t1~BUSAB in s_busab
                     and t2~regio in s_regio
                     and t2~BRSCH in s_BRSCH
                     and t2~KTOKD in s_KTOKD.
       if sy-subrc <> 0.
          message e398(00) with 'No Customers Selected'.
       endif.
       sort customer_tab.
       describe table customer_tab lines v_ttlc.
       v_ttlc = v_ttlc + 10.
       loop at customer_tab.
          v_net1 = 0.
          v_net2 = 0.
          v_net3 = 0.
          v_net4 = 0.
          v_net5 = 0.
          v_net6 = 0.
          v_net7 = 0.
          v_net8 = 0.
          v_net9 = 0.
          v_net10 = 0.
          v_net11 = 0.
          v_net  = 0.
          perform calculate_ageing
                    using
                      p_bukrs
                      customer_tab-kunnr
                      dat
                      RASTBIS1
                      RASTBIS2
                      RASTBIS3
                      RASTBIS4
                      RASTBIS5
                      RASTBIS6
                      RASTBIS7
                      RASTBIS8
                      RASTBIS9
                      RASTBIS0
                      P_STAND
                      ' ' "noted item
                      P_SPCAL
                   changing
                      v_net1
                      v_net2
                      v_net3
                      v_net4
                      v_net5
                      v_net6
                      v_net7
                      v_net8
                      v_net9
                      v_net10
                      v_net11
                      v_net.
          if p_balyes = 'X' or v_net > 0.
            format color col_total.
            write:/  sy-vline,
                    002 customer_tab-kunnr,
                    012 SY-VLINE,013(30) customer_tab-name1,
                    043 SY-VLINE,044(16)  v_net1,
                    061 SY-VLINE,062(16)  v_net2,
                    079 SY-VLINE,080(16)  v_net3,
                    097 SY-VLINE,098(16)  v_net4,
                    115 SY-VLINE,116(16)  v_net5,
                    133 SY-VLINE,134(16)  v_net6,
                    151 SY-VLINE,152(16)  v_net7,
                    169 SY-VLINE,170(16)  v_net8,
                    187 SY-VLINE,188(16)  v_net9,
                    205 SY-VLINE,206(16)  v_net10,
                    223 SY-VLINE,224(16)  v_net11,
                    239 SY-VLINE,240(16)  v_net,
                    258 SY-VLINE.
             format color off.
             hide : customer_tab-kunnr.
             v_ttlnet1 = v_ttlnet1 + v_net1.
             v_ttlnet2 = v_ttlnet2 + v_net2.
             v_ttlnet3 = v_ttlnet3 + v_net3.
             v_ttlnet4 = v_ttlnet4 + v_net4.
             v_ttlnet5 = v_ttlnet5 + v_net5.
             v_ttlnet6 = v_ttlnet6 + v_net6.
             v_ttlnet7 = v_ttlnet7 + v_net7.
             v_ttlnet8 = v_ttlnet8 + v_net8.
             v_ttlnet9 = v_ttlnet9 + v_net9.
             v_ttlnet10 = v_ttlnet10 + v_net10.
             v_ttlnet11 = v_ttlnet11 + v_net11.
             v_ttlnet  = v_ttlnet  + v_net.
          endif.
       endloop.
       ULINE.
           format color col_total.
           write:/  sy-vline,
                    012 SY-VLINE,012(30) ' T O T A L',
                    043 SY-VLINE,044(16)  v_ttlnet1,
                    061 SY-VLINE,062(16)  v_ttlnet2,
                    079 SY-VLINE,080(16)  v_ttlnet3,
                    097 SY-VLINE,098(16)  v_ttlnet4,
                    115 SY-VLINE,116(16)  v_ttlnet5,
                    133 SY-VLINE,134(16)  v_ttlnet6,
                    151 SY-VLINE,152(16)  v_ttlnet7,
                    169 SY-VLINE,170(16)  v_ttlnet8,
                    187 SY-VLINE,188(16)  v_ttlnet9,
                    205 SY-VLINE,206(16)  v_ttlnet10,
                    223 SY-VLINE,224(16)  v_ttlnet11,
                    239 SY-VLINE,240(16)  v_ttlnet,
                    258 SY-VLINE.
          format color off.
       ULINE.
    endform.
    Function to Calculate Aging.
    Form calculate_ageing using
                            bukrs
                            kunnr
                            dat
                            RASTBIS1
                            RASTBIS2
                            RASTBIS3
                            RASTBIS4
                            RASTBIS5
                            RASTBIS6
                            RASTBIS7
                            RASTBIS8
                            RASTBIS9
                            RASTBIS0
                            P_STAND
                            P_NOTED
                            P_SPCAL
                          changing
                            v_net1
                            v_net2
                            v_net3
                            v_net4
                            v_net5
                            v_net6
                            v_net7
                            v_net8
                            v_net9
                            v_net10
                            v_net11
                            v_net.
    DATA: BEGIN OF BSID_TAB1 OCCURS 0,
             BUKRS LIKE BSID-BUKRS,
             PRCTR LIKE BSID-PRCTR,
             KUNNR LIKE BSID-KUNNR,
             FLAG(1),
             UMSKZ LIKE BSID-UMSKZ,
             BLART LIKE BSID-BLART,
             BELNR LIKE BSID-BELNR,
             BUZEI LIKE BSID-BUZEI,
             NETDT LIKE BSID-ZFBDT,
             ZFBDT LIKE BSID-ZFBDT,
             BUDAT LIKE BSID-BUDAT,
             BLDAT LIKE BSID-BLDAT,
             BSCHL LIKE BSID-BSCHL,
             DMBTR LIKE BSID-DMBTR,
             SHKZG LIKE BSID-SHKZG,
             ZBD1T LIKE BSID-ZBD1T,
             ZBD2T LIKE BSID-ZBD2T,
             ZBD3T LIKE BSID-ZBD3T,
             REBZG LIKE BSID-REBZG,
             REBZT LIKE BSID-REBZT,
             KOART LIKE BSEG-KOART,
             SK1DT LIKE FAEDE-SK1DT,
             SK2DT LIKE FAEDE-SK2DT,
             DAYSD LIKE SY-TABIX,
          END OF BSID_TAB1.
    RANGES: R_UMSKZ FOR BSID-UMSKZ.
    Data : V_ZFBDT     Like  bsid-ZFBDT,
           V_ZBD1T     Like  bsid-ZBD1T,
           V_ZBD2T     Like  bsid-ZBD2T,
           V_ZBD3T     Like  bsid-ZBD3T,
           V_LINES(8)  TYPE n.
    IF P_NOTED = 'X'.     "CHECK NOTED ITEMS
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'D'.
      APPEND R_UMSKZ.
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'L'.
      APPEND R_UMSKZ.
    ENDIF.
    IF P_STAND = 'X'.    "CHECK STANDARD ITEMS
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = ' '.
      APPEND R_UMSKZ.
    ENDIF.
    IF P_SPCAL = 'X'.    "CHECK SPECIAL G/L TRANSACTION
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'A'.
      APPEND R_UMSKZ.
      R_UMSKZ-SIGN = 'I'.
      R_UMSKZ-OPTION = 'EQ'.
      R_UMSKZ-LOW = 'B'.
      APPEND R_UMSKZ.
    ENDIF.
    SELECT * FROM BSID INTO CORRESPONDING FIELDS OF TABLE BSID_TAB
               WHERE BUKRS = BUKRS AND
                     budat <= dat  AND
                     KUNNR = KUNNR AND
                     UMSKZ in R_UMSKZ.
    SELECT * FROM BSAD appending CORRESPONDING FIELDS OF TABLE BSID_TAB
               WHERE BUKRS = BUKRS AND
                     budat <= dat  AND
                     augdt >= dat  AND
                     KUNNR = KUNNR AND
                     UMSKZ in R_UMSKZ.
    DESCRIBE TABLE BSID_TAB LINES V_LINES.
    LOOP AT BSID_TAB.
        if bsid_tab-BLART = 'DZ'.
          Select single ZFBDT ZBD1T ZBD2T ZBD3T
            into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
            from bsid where BUKRS = BUKRS
                        and kunnr = bsid_tab-kunnr
                        and BELNR = bsid_tab-REBZG.
          if sy-subrc = 0.
             bsid_tab-ZFBDT = V_ZFBDT.
             bsid_tab-ZBD1T = V_ZBD1T.
             bsid_tab-ZBD2T = V_ZBD2T.
             bsid_tab-ZBD3T = V_ZBD3T.
          else.
             Select single ZFBDT ZBD1T ZBD2T ZBD3T
               into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
               from bsad where BUKRS = BUKRS
                           and kunnr = bsid_tab-kunnr
                           and BELNR = bsid_tab-REBZG.
             if sy-subrc <> 0.
               bsid_tab-ZFBDT = V_ZFBDT.
               bsid_tab-ZBD1T = V_ZBD1T.
               bsid_tab-ZBD2T = V_ZBD2T.
               bsid_tab-ZBD3T = V_ZBD3T.
             endif.
          endif.
        endif.
        IF BSID_TAB-SHKZG = 'H'.
          BSID_TAB-DMBTR = BSID_TAB-DMBTR * ( - 1 ).
        ENDIF.
        bsid_tab-netdt = bsid_tab-ZFBDT.
      bsid_tab-netdt = bsid_tab-budat.
        bsid_tab-koart = 'D'.
        MODIFY BSID_TAB.
       PERFORM CALC_DUE_DATE USING BSID_TAB.
        BSID_TAB-DAYSD = DAT - BSID_TAB-NETDT.
        IF BSID_TAB-DAYSD <= RASTBIS1.
          V_NET1 = V_NET1 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS2.
          V_NET2 = V_NET2 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS3.
          V_NET3 = V_NET3 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS4.
          V_NET4 = V_NET4 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
          V_NET5 = V_NET5 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS6.
          V_NET6 = V_NET6 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS7.
          V_NET7 = V_NET7 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
          V_NET8 = V_NET8 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <= RASTBIS9.
          V_NET9 = V_NET9 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD <=  RASTBIS0.
          V_NET10 = V_NET10 + BSID_TAB-DMBTR.
        ELSEIF BSID_TAB-DAYSD >  RASTBIS0.
          V_NET11 = V_NET11 + BSID_TAB-DMBTR.
        ENDIF.
        V_NET = V_NET + BSID_TAB-DMBTR.
        MODIFY BSID_TAB.
    ENDLOOP.
    endform.
    Calculate Due Date
    FORM CALC_DUE_DATE USING P_BSID_TAB STRUCTURE BSID_TAB.
      DATA : REFE TYPE P.
    IF P_BSID_TAB-KOART = 'K' OR P_BSID_TAB-KOART = 'D'.
      IF P_BSID_TAB-ZFBDT IS INITIAL.
        P_BSID_TAB-ZFBDT = P_BSID_TAB-BLDAT.
      ENDIF.
    *Nettofälligkeit bestimmen--
      IF NOT P_BSID_TAB-ZBD3T IS INITIAL.
        REFE = P_BSID_TAB-ZBD3T.
      ELSE.
        IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
          REFE = P_BSID_TAB-ZBD2T.
        ELSE.
          REFE = P_BSID_TAB-ZBD1T.
        ENDIF.
      ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
      IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
      OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
        IF P_BSID_TAB-REBZG IS INITIAL.
          REFE = 0.
        ENDIF.
      ENDIF.
      P_BSID_TAB-NETDT = P_BSID_TAB-ZFBDT + REFE.
    *Skontofälligkeiten bestimmen--
      IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
        P_BSID_TAB-SK2DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD2T.
      ELSE.
        P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
      ENDIF.
      IF NOT P_BSID_TAB-ZBD1T IS INITIAL
      OR NOT P_BSID_TAB-ZBD2T IS INITIAL.
        P_BSID_TAB-SK1DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD1T.
      ELSE.
        P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
      ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
      IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
      OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
        IF P_BSID_TAB-REBZG IS INITIAL.
          P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
          P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
        ENDIF.
      ENDIF.
    ELSE.
       MESSAGE E122 RAISING ACCOUNT_TYPE_NOT_SUPPORTED.
    ENDIF.
    E_FAEDE = FAEDE.
    ENDFORM.

    Hi,
    As vijay said...
    1.Declare One final Internal table which you want to show the data
    2 . populate the fieldcatalog using the FM or Manually using the itab in step1
    3. Collect the Data into final internal table which you created in Step 1.
    4. pass the fieldcat and Internal table to ALV FM.
    chk out the prg below i have created your program but i donn knw wht are the output fields... chk your prg
    *REPORT ZALVTEST .
    REPORT ZSAMPLE line-size 260
    line-count 65
    no standard page heading.
    TYPE-POOLS: SLIS.
    ====================================================================
    TABLES *********************************
    ====================================================================
    tables : bseg,
    bkpf,
    kna1,
    bsid,
    bsad,
    knb1.
    data : begin of customer_tab occurs 0,
    kunnr like kna1-kunnr,
    name1 like kna1-name1,
    flag(1) type c,
    end of customer_tab.
    data : begin of customerdoc_tab occurs 0,
    kunnr like kna1-kunnr,
    belnr like bkpf-belnr,
    gjahr like bkpf-gjahr,
    monat like bkpf-monat,
    end of customerdoc_tab.
    data : begin of doc_tab occurs 0,
    belnr like bkpf-belnr,
    gjahr like bkpf-gjahr,
    monat like bkpf-monat,
    end of doc_tab.
    DATA: BEGIN OF BSID_TAB OCCURS 0,
    BUKRS LIKE BSID-BUKRS,
    PRCTR LIKE BSID-PRCTR,
    KUNNR LIKE BSID-KUNNR,
    FLAG(1),
    UMSKZ LIKE BSID-UMSKZ,
    BLART LIKE BSID-BLART,
    BELNR LIKE BSID-BELNR,
    BUZEI LIKE BSID-BUZEI,
    NETDT LIKE BSID-ZFBDT,
    ZFBDT LIKE BSID-ZFBDT,
    BUDAT LIKE BSID-BUDAT,
    BLDAT LIKE BSID-BLDAT,
    BSCHL LIKE BSID-BSCHL,
    DMBTR LIKE BSID-DMBTR,
    SHKZG LIKE BSID-SHKZG,
    ZBD1T LIKE BSID-ZBD1T,
    ZBD2T LIKE BSID-ZBD2T,
    ZBD3T LIKE BSID-ZBD3T,
    REBZG LIKE BSID-REBZG,
    REBZT LIKE BSID-REBZT,
    KOART LIKE BSEG-KOART,
    SK1DT LIKE FAEDE-SK1DT,
    SK2DT LIKE FAEDE-SK2DT,
    DAYSD LIKE SY-TABIX,
    END OF BSID_TAB.
    ranges : r_bukrs for bsid-bukrs,
    r_kunnr for kna1-kunnr.
    ===================================================================
    VARIABLES *******************************
    ===================================================================
    data : v_belnr like bseg-belnr,
    v_gjahr like bkpf-gjahr,
    v_monat like bkpf-monat,
    v_ttlc type p,
    v_flag(1) type c,
    V_COUNT1(4) TYPE N,
    V_COUNT2(4) TYPE N,
    V_COUNT3(4) TYPE N,
    V_COUNT4(4) TYPE N,
    V_COUNT5(4) TYPE N,
    V_COUNT6(4) TYPE N,
    V_COUNT7(4) TYPE N,
    V_COUNT8(4) TYPE N,
    V_COUNT9(4) TYPE N,
    V_COUNT10(4) TYPE N,
    V_NET1 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 1
    V_NET2 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 2
    V_NET3 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 3
    V_NET4 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 4
    V_NET5 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 5
    V_NET6 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 6
    V_NET7 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 7
    V_NET8 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 8
    V_NET9 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 9
    V_NET10 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 10
    V_NET11 LIKE BSID-DMBTR, "CALCULATE CUSTOMER AGE 11
    V_NET LIKE BSID-DMBTR, "Total Balance of Customer
    V_ttlNET1 LIKE BSID-DMBTR,
    V_ttlNET2 LIKE BSID-DMBTR,
    V_ttlNET3 LIKE BSID-DMBTR,
    V_ttlNET4 LIKE BSID-DMBTR,
    V_ttlNET5 LIKE BSID-DMBTR,
    V_ttlNET6 LIKE BSID-DMBTR,
    V_ttlNET7 LIKE BSID-DMBTR,
    V_ttlNET8 LIKE BSID-DMBTR,
    V_ttlNET9 LIKE BSID-DMBTR,
    V_ttlNET10 LIKE BSID-DMBTR,
    V_ttlNET11 LIKE BSID-DMBTR,
    V_ttlNET LIKE BSID-DMBTR,
    v_kunnr like bseg-kunnr,
    V_BUTXT like t001-butxt.
    ********Declare Data Areas for List Viewer ***********
    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          FIELDCAT_LN LIKE LINE OF FIELDCAT,
          FIELD TYPE SLIS_FIELDNAME,
          COL_POS TYPE I ,
          PGM LIKE SY-REPID,
          FIELD_VALUE(20),
          TABLE_NAME(10).
    ===================================================================
    SELECTION SCREEN ****************************
    ===================================================================
    selection-screen begin of block b1 with frame title text-001.
    parameters : p_bukrs like bseg-bukrs obligatory.
    select-options : s_kunnr for kna1-kunnr,
    s_BRSCH for kna1-BRSCH,
    s_REGIO for kna1-REGIO,
    s_KTOKD for kna1-KTOKD,
    s_BUSAB for knb1-BUSAB.
    selection-screen: end of block b1.
    selection-screen begin of block b2 with frame title text-003.
    PARAMETERS: DAT LIKE SY-DATUM DEFAULT SY-DATUM.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 01(30) TEXT-002.
    SELECTION-SCREEN POSITION POS_LOW.
    *PARAMETERS: RASTBIS1 LIKE RFPDO1-ALLGROGR DEFAULT '000'.
    *PARAMETERS: RASTBIS2 LIKE RFPDO1-ALLGROGR DEFAULT '030'.
    *PARAMETERS: RASTBIS3 LIKE RFPDO1-ALLGROGR DEFAULT '060'.
    *PARAMETERS: RASTBIS4 LIKE RFPDO1-ALLGROGR DEFAULT '090'.
    *PARAMETERS: RASTBIS5 LIKE RFPDO1-ALLGROGR DEFAULT '120'.
    PARAMETERS: RASTBIS1(4) type n DEFAULT '0000'.
    PARAMETERS: RASTBIS2(4) type n DEFAULT '0030'.
    PARAMETERS: RASTBIS3(4) type n DEFAULT '0060'.
    PARAMETERS: RASTBIS4(4) type n DEFAULT '0090'.
    PARAMETERS: RASTBIS5(4) type n DEFAULT '0120'.
    PARAMETERS: RASTBIS6(4) type n DEFAULT '0150'.
    PARAMETERS: RASTBIS7(4) type n DEFAULT '0180'.
    PARAMETERS: RASTBIS8(4) type n DEFAULT '0210'.
    PARAMETERS: RASTBIS9(4) type n DEFAULT '0240'.
    PARAMETERS: RASTBIS0(4) type n DEFAULT '0270'.
    SELECTION-SCREEN END OF LINE.
    Noted item removed as per FI instruction
    PARAMETERS: P_STAND AS CHECKBOX default 'X',
    P_NOTED AS CHECKBOX ,
    P_SPCAL AS CHECKBOX .
    selection-screen: end of block b2.
    selection-screen begin of block b3 with frame.
    PARAMETERS: allgline like RFPDO1-allgline .
    Parameters : p_balyes type c radiobutton group grp9 default 'X',
    p_balno type c radiobutton group grp9.
    selection-screen: end of block b3.
    Check for the Select option
    AT SELECTION-SCREEN.
    IF P_STAND = '' AND P_SPCAL = '' .
    MESSAGE E398(00) WITH 'PLEASE CHOOSE AT LEAST ONE G/L INDICATOR!'.
    ENDIF.
    Check for Company code Authorization
    authority-check object 'F_BKPF_BUK'
    ID 'BUKRS' FIELD p_bukrs
    ID 'ACTVT' FIELD '03'.
    if sy-subrc ne 0.
    message e398(00) with 'You are not Authorized for CC ' p_bukrs.
    Endif.
    ===================================================================
    START-OF-SELECTION ****************************
    ===================================================================
    START-OF-SELECTION.
    V_COUNT1 = RASTBIS1 + 1.
    V_COUNT2 = RASTBIS2 + 1.
    V_COUNT3 = RASTBIS3 + 1.
    V_COUNT4 = RASTBIS4 + 1.
    V_COUNT5 = RASTBIS5 + 1.
    V_COUNT6 = RASTBIS6 + 1.
    V_COUNT7 = RASTBIS7 + 1.
    V_COUNT8 = RASTBIS8 + 1.
    V_COUNT9 = RASTBIS9 + 1.
    V_COUNT10 = RASTBIS0 + 1.
    perform extract_data.
    Build Field Catalogs **************************
      PERFORM BUILD_FIELDCAT.
    *******Start List Viewer *******************************
      PERFORM START_LIST_VIEWER.
    ===================================================================
    At line Selection *****************************
    ===================================================================
    at line-selection.
    if sy-lilli >= 9 .
    refresh r_bukrs.
    move p_bukrs to r_bukrs-low.
    move 'I' to r_bukrs-sign.
    move 'EQ' to r_bukrs-option.
    append r_bukrs.
    refresh r_kunnr.
    move customer_tab-kunnr to r_kunnr-low.
    move 'I' to r_kunnr-sign.
    move 'EQ' to r_kunnr-option.
    append r_kunnr.
    submit ZFARVR0040 and return
    with p_bukrs = p_bukrs
    with dat = dat
    with p_stand = p_stand
    with p_spcal = P_SPCAL
    with s_kunnr in r_kunnr.
    endif.
    ===================================================================
    Top of Page *******************************
    ===================================================================
    TOP-OF-PAGE.
    SELECT SINGLE BUTXT FROM T001 INTO V_BUTXT
    WHERE BUKRS = p_BUKRS .
    WRITE:/73'Customers Aging Analysis',140'PAGE NO.',
    SY-PAGNO.
    WRITE:/002 'COMPANY',
    011 P_BUKRS,
    017 V_BUTXT,
    055 allgline centered,
    140 'DATE :',
    150 sy-datum .
    write:/002 'User',
    011 sy-UNAME,
    140 'Time :',
    150 sy-UZEIT.
    SKIP.
    format color col_heading intensified off.
    WRITE:/ SY-ULINE,
    SY-VLINE,002 'Customer',
    012 SY-VLINE,013 'Name',
    043 SY-VLINE,048 'CURRENT',
    061 SY-VLINE,065 'FROM ',V_COUNT1,
    079 SY-VLINE,083 'FROM ',V_COUNT2,
    097 SY-VLINE,101 'FROM ',V_COUNT3,
    115 SY-VLINE,119 'FROM ',V_COUNT4,
    133 SY-VLINE,137 'FROM ',V_COUNT5,
    151 SY-VLINE,155 'FROM ',V_COUNT6,
    169 SY-VLINE,173 'FROM ',V_COUNT7,
    187 SY-VLINE,191 'FROM ',V_COUNT8,
    205 SY-VLINE,209 'FROM ',V_COUNT9,
    223 SY-VLINE,228 'FROM ',V_COUNT10,
    243 SY-VLINE,248 'TOTAL',
    268 SY-VLINE.
    WRITE:/ SY-VLINE,002 'Number',
    12 SY-VLINE,
    43 SY-VLINE,
    061 SY-VLINE,065 'TO ',RASTBIS2,
    079 SY-VLINE,083 'TO ',RASTBIS3,
    097 SY-VLINE,101 'TO ',RASTBIS4,
    115 SY-VLINE,119 'TO ',RASTBIS5,
    133 SY-VLINE,137 'FROM ',RASTBIS6,
    151 SY-VLINE,155 'FROM ',RASTBIS7,
    169 SY-VLINE,173 'FROM ',RASTBIS8,
    187 SY-VLINE,191 'FROM ',RASTBIS9,
    205 SY-VLINE,209 'FROM ',RASTBIS0,
    223 SY-VLINE,
    243 SY-VLINE,
    268 SY-VLINE,
    SY-ULINE.
    format color off.
    ===================================================================
    END-OF-SELECTION ***************************
    ===================================================================
    end-of-selection.
    ===================================================================
    Form : Extract_Data *
    ===================================================================
    form extract_data.
    Select the Customers
    Select t1~kunnr t2~name1
    into corresponding fields of table customer_tab
    from knb1 as t1 inner join kna1 as t2
    on t2~kunnr = t1~kunnr
    where t1~bukrs = p_bukrs
    and t1~kunnr in s_kunnr
    and t1~BUSAB in s_busab
    and t2~regio in s_regio
    and t2~BRSCH in s_BRSCH
    and t2~KTOKD in s_KTOKD.
    if sy-subrc <> 0.
    message e398(00) with 'No Customers Selected'.
    endif.
    sort customer_tab.
    describe table customer_tab lines v_ttlc.
    v_ttlc = v_ttlc + 10.
    loop at customer_tab.
    v_net1 = 0.
    v_net2 = 0.
    v_net3 = 0.
    v_net4 = 0.
    v_net5 = 0.
    v_net6 = 0.
    v_net7 = 0.
    v_net8 = 0.
    v_net9 = 0.
    v_net10 = 0.
    v_net11 = 0.
    v_net = 0.
    perform calculate_ageing
    using
    p_bukrs
    customer_tab-kunnr
    dat
    RASTBIS1
    RASTBIS2
    RASTBIS3
    RASTBIS4
    RASTBIS5
    RASTBIS6
    RASTBIS7
    RASTBIS8
    RASTBIS9
    RASTBIS0
    P_STAND
    ' ' "noted item
    P_SPCAL
    changing
    v_net1
    v_net2
    v_net3
    v_net4
    v_net5
    v_net6
    v_net7
    v_net8
    v_net9
    v_net10
    v_net11
    v_net.
    if p_balyes = 'X' or v_net > 0.
    format color col_total.
    write:/ sy-vline,
    002 customer_tab-kunnr,
    012 SY-VLINE,013(30) customer_tab-name1,
    043 SY-VLINE,044(16) v_net1,
    061 SY-VLINE,062(16) v_net2,
    079 SY-VLINE,080(16) v_net3,
    097 SY-VLINE,098(16) v_net4,
    115 SY-VLINE,116(16) v_net5,
    133 SY-VLINE,134(16) v_net6,
    151 SY-VLINE,152(16) v_net7,
    169 SY-VLINE,170(16) v_net8,
    187 SY-VLINE,188(16) v_net9,
    205 SY-VLINE,206(16) v_net10,
    223 SY-VLINE,224(16) v_net11,
    239 SY-VLINE,240(16) v_net,
    258 SY-VLINE.
    format color off.
    hide : customer_tab-kunnr.
    v_ttlnet1 = v_ttlnet1 + v_net1.
    v_ttlnet2 = v_ttlnet2 + v_net2.
    v_ttlnet3 = v_ttlnet3 + v_net3.
    v_ttlnet4 = v_ttlnet4 + v_net4.
    v_ttlnet5 = v_ttlnet5 + v_net5.
    v_ttlnet6 = v_ttlnet6 + v_net6.
    v_ttlnet7 = v_ttlnet7 + v_net7.
    v_ttlnet8 = v_ttlnet8 + v_net8.
    v_ttlnet9 = v_ttlnet9 + v_net9.
    v_ttlnet10 = v_ttlnet10 + v_net10.
    v_ttlnet11 = v_ttlnet11 + v_net11.
    v_ttlnet = v_ttlnet + v_net.
    endif.
    endloop.
    ULINE.
    format color col_total.
    write:/ sy-vline,
    012 SY-VLINE,012(30) ' T O T A L',
    043 SY-VLINE,044(16) v_ttlnet1,
    061 SY-VLINE,062(16) v_ttlnet2,
    079 SY-VLINE,080(16) v_ttlnet3,
    097 SY-VLINE,098(16) v_ttlnet4,
    115 SY-VLINE,116(16) v_ttlnet5,
    133 SY-VLINE,134(16) v_ttlnet6,
    151 SY-VLINE,152(16) v_ttlnet7,
    169 SY-VLINE,170(16) v_ttlnet8,
    187 SY-VLINE,188(16) v_ttlnet9,
    205 SY-VLINE,206(16) v_ttlnet10,
    223 SY-VLINE,224(16) v_ttlnet11,
    239 SY-VLINE,240(16) v_ttlnet,
    258 SY-VLINE.
    format color off.
    ULINE.
    endform.
    Function to Calculate Aging.
    Form calculate_ageing using
    bukrs
    kunnr
    dat
    RASTBIS1
    RASTBIS2
    RASTBIS3
    RASTBIS4
    RASTBIS5
    RASTBIS6
    RASTBIS7
    RASTBIS8
    RASTBIS9
    RASTBIS0
    P_STAND
    P_NOTED
    P_SPCAL
    changing
    v_net1
    v_net2
    v_net3
    v_net4
    v_net5
    v_net6
    v_net7
    v_net8
    v_net9
    v_net10
    v_net11
    v_net.
    DATA: BEGIN OF BSID_TAB1 OCCURS 0,
    BUKRS LIKE BSID-BUKRS,
    PRCTR LIKE BSID-PRCTR,
    KUNNR LIKE BSID-KUNNR,
    FLAG(1),
    UMSKZ LIKE BSID-UMSKZ,
    BLART LIKE BSID-BLART,
    BELNR LIKE BSID-BELNR,
    BUZEI LIKE BSID-BUZEI,
    NETDT LIKE BSID-ZFBDT,
    ZFBDT LIKE BSID-ZFBDT,
    BUDAT LIKE BSID-BUDAT,
    BLDAT LIKE BSID-BLDAT,
    BSCHL LIKE BSID-BSCHL,
    DMBTR LIKE BSID-DMBTR,
    SHKZG LIKE BSID-SHKZG,
    ZBD1T LIKE BSID-ZBD1T,
    ZBD2T LIKE BSID-ZBD2T,
    ZBD3T LIKE BSID-ZBD3T,
    REBZG LIKE BSID-REBZG,
    REBZT LIKE BSID-REBZT,
    KOART LIKE BSEG-KOART,
    SK1DT LIKE FAEDE-SK1DT,
    SK2DT LIKE FAEDE-SK2DT,
    DAYSD LIKE SY-TABIX,
    END OF BSID_TAB1.
    RANGES: R_UMSKZ FOR BSID-UMSKZ.
    Data : V_ZFBDT Like bsid-ZFBDT,
    V_ZBD1T Like bsid-ZBD1T,
    V_ZBD2T Like bsid-ZBD2T,
    V_ZBD3T Like bsid-ZBD3T,
    V_LINES(8) TYPE n.
    IF P_NOTED = 'X'. "CHECK NOTED ITEMS
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'D'.
    APPEND R_UMSKZ.
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'L'.
    APPEND R_UMSKZ.
    ENDIF.
    IF P_STAND = 'X'. "CHECK STANDARD ITEMS
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = ' '.
    APPEND R_UMSKZ.
    ENDIF.
    IF P_SPCAL = 'X'. "CHECK SPECIAL G/L TRANSACTION
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'A'.
    APPEND R_UMSKZ.
    R_UMSKZ-SIGN = 'I'.
    R_UMSKZ-OPTION = 'EQ'.
    R_UMSKZ-LOW = 'B'.
    APPEND R_UMSKZ.
    ENDIF.
    SELECT * FROM BSID INTO CORRESPONDING FIELDS OF TABLE BSID_TAB
    WHERE BUKRS = BUKRS AND
    budat <= dat AND
    KUNNR = KUNNR AND
    UMSKZ in R_UMSKZ.
    SELECT * FROM BSAD appending CORRESPONDING FIELDS OF TABLE BSID_TAB
    WHERE BUKRS = BUKRS AND
    budat <= dat AND
    augdt >= dat AND
    KUNNR = KUNNR AND
    UMSKZ in R_UMSKZ.
    DESCRIBE TABLE BSID_TAB LINES V_LINES.
    LOOP AT BSID_TAB.
    if bsid_tab-BLART = 'DZ'.
    Select single ZFBDT ZBD1T ZBD2T ZBD3T
    into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
    from bsid where BUKRS = BUKRS
    and kunnr = bsid_tab-kunnr
    and BELNR = bsid_tab-REBZG.
    if sy-subrc = 0.
    bsid_tab-ZFBDT = V_ZFBDT.
    bsid_tab-ZBD1T = V_ZBD1T.
    bsid_tab-ZBD2T = V_ZBD2T.
    bsid_tab-ZBD3T = V_ZBD3T.
    else.
    Select single ZFBDT ZBD1T ZBD2T ZBD3T
    into (V_ZFBDT,V_ZBD1T,V_ZBD2T,V_ZBD3T)
    from bsad where BUKRS = BUKRS
    and kunnr = bsid_tab-kunnr
    and BELNR = bsid_tab-REBZG.
    if sy-subrc <> 0.
    bsid_tab-ZFBDT = V_ZFBDT.
    bsid_tab-ZBD1T = V_ZBD1T.
    bsid_tab-ZBD2T = V_ZBD2T.
    bsid_tab-ZBD3T = V_ZBD3T.
    endif.
    endif.
    endif.
    IF BSID_TAB-SHKZG = 'H'.
    BSID_TAB-DMBTR = BSID_TAB-DMBTR * ( - 1 ).
    ENDIF.
    bsid_tab-netdt = bsid_tab-ZFBDT.
    bsid_tab-netdt = bsid_tab-budat.
    bsid_tab-koart = 'D'.
    MODIFY BSID_TAB.
    PERFORM CALC_DUE_DATE USING BSID_TAB.
    BSID_TAB-DAYSD = DAT - BSID_TAB-NETDT.
    IF BSID_TAB-DAYSD <= RASTBIS1.
    V_NET1 = V_NET1 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS2.
    V_NET2 = V_NET2 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS3.
    V_NET3 = V_NET3 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS4.
    V_NET4 = V_NET4 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
    V_NET5 = V_NET5 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS6.
    V_NET6 = V_NET6 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS7.
    V_NET7 = V_NET7 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS5.
    V_NET8 = V_NET8 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS9.
    V_NET9 = V_NET9 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD <= RASTBIS0.
    V_NET10 = V_NET10 + BSID_TAB-DMBTR.
    ELSEIF BSID_TAB-DAYSD > RASTBIS0.
    V_NET11 = V_NET11 + BSID_TAB-DMBTR.
    ENDIF.
    V_NET = V_NET + BSID_TAB-DMBTR.
    MODIFY BSID_TAB.
    ENDLOOP.
    endform.
    Calculate Due Date
    FORM CALC_DUE_DATE USING P_BSID_TAB STRUCTURE BSID_TAB.
    DATA : REFE TYPE P.
    IF P_BSID_TAB-KOART = 'K' OR P_BSID_TAB-KOART = 'D'.
    IF P_BSID_TAB-ZFBDT IS INITIAL.
    P_BSID_TAB-ZFBDT = P_BSID_TAB-BLDAT.
    ENDIF.
    *Nettofälligkeit bestimmen--
    IF NOT P_BSID_TAB-ZBD3T IS INITIAL.
    REFE = P_BSID_TAB-ZBD3T.
    ELSE.
    IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
    REFE = P_BSID_TAB-ZBD2T.
    ELSE.
    REFE = P_BSID_TAB-ZBD1T.
    ENDIF.
    ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
    IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
    OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
    IF P_BSID_TAB-REBZG IS INITIAL.
    REFE = 0.
    ENDIF.
    ENDIF.
    P_BSID_TAB-NETDT = P_BSID_TAB-ZFBDT + REFE.
    *Skontofälligkeiten bestimmen--
    IF NOT P_BSID_TAB-ZBD2T IS INITIAL.
    P_BSID_TAB-SK2DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD2T.
    ELSE.
    P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
    ENDIF.
    IF NOT P_BSID_TAB-ZBD1T IS INITIAL
    OR NOT P_BSID_TAB-ZBD2T IS INITIAL.
    P_BSID_TAB-SK1DT = P_BSID_TAB-ZFBDT + P_BSID_TAB-ZBD1T.
    ELSE.
    P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
    ENDIF.
    *Nichtrechnungsbezogene Gutschriften sind sofort fällig--
    IF P_BSID_TAB-KOART = 'D' AND P_BSID_TAB-SHKZG = 'H'
    OR P_BSID_TAB-KOART = 'K' AND P_BSID_TAB-SHKZG = 'S'.
    IF P_BSID_TAB-REBZG IS INITIAL.
    P_BSID_TAB-SK2DT = P_BSID_TAB-NETDT.
    P_BSID_TAB-SK1DT = P_BSID_TAB-NETDT.
    ENDIF.
    ENDIF.
    ELSE.
    MESSAGE E122 RAISING ACCOUNT_TYPE_NOT_SUPPORTED.
    ENDIF.
    E_FAEDE = FAEDE.
    ENDFORM.
    *&      Form  BUILD_FIELDCAT
    FORM BUILD_FIELDCAT .
      PGM = SY-REPID.
      FIELD      = 'give field name'.
      TABLE_NAME = 'give table name'.
      PERFORM FIELDCAT_FILL USING FIELD.
    and so on for the no. of fields you want to display
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  START_LIST_VIEWER
    FORM START_LIST_VIEWER.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
       I_INTERFACE_CHECK              = ' '
         I_CALLBACK_PROGRAM             = PGM
       I_CALLBACK_PF_STATUS_SET       = ' '
         I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
       I_STRUCTURE_NAME               =
       IS_LAYOUT                      =
         IT_FIELDCAT                    = FIELDCAT
       IT_EXCLUDING                   =
       IT_SPECIAL_GROUPS              =
       IT_SORT                        =
       IT_FILTER                      =
       IS_SEL_HIDE                    =
         I_DEFAULT                      = 'X'
         I_SAVE                         = 'A'
       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
       IR_SALV_LIST_ADAPTER           =
       IT_EXCEPT_QINFO                =
       I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER        =
       ES_EXIT_CAUSED_BY_USER         =
       TABLES
         T_OUTTAB                       = FINAL TAB(OUTPUT STATEMENTS TABLE)
      EXCEPTIONS
        PROGRAM_ERROR                   = 1
        OTHERS                          = 2.
    ENDFORM.                    " START_LIST_VIEWER
    *&      Form  FIELDCAT_FILL
          text
    FORM FIELDCAT_FILL USING FIELD_VALUE.
      ADD 1 TO COL_POS.
      FIELDCAT_LN-REF_TABNAME = TABLE_NAME.
      FIELDCAT_LN-FIELDNAME = FIELD_VALUE.
      FIELDCAT_LN-KEY = SPACE.
      FIELDCAT_LN-DO_SUM = SPACE.
      FIELDCAT_LN-COL_POS = COL_POS.
      FIELDCAT_LN-NO_OUT = SPACE.
      FIELDCAT_LN-QFIELDNAME = SPACE.
      FIELDCAT_LN-HOTSPOT = SPACE.
      APPEND FIELDCAT_LN TO FIELDCAT.
    ENDFORM.                    " FIELDCAT_FILL
    Reward points if you find this helpful
    Regards,
    Harini

Maybe you are looking for

  • Edit in external editor

    I am wondering how I can perform simple editing on pictures administrated with Aperture, such as for instance using a pen or blur tool. Example: I have pictures I administrate with Aperture and upload to flickr via the flickr plugin for Aperture. Now

  • Icloud problem with Keynote

    My keynote presentation would upload to iCloud.  I have Keynote on my iPhone and Keynote (v. 5.20) on my MacBook Pro.  I'm running OS X Mountain Lion 10.8.2.  I dragged the presentation to the iCloud box and I see a "waiting" message underneath.

  • Archivelink Signature Public Exponent

    Hi guys, I am trying to generate a certificate for signing the URL for the Archivelink interface. The documentation stated that the public exponent has to be equal to (2^16)+1. Does anybody know how important that condition is? The reason I am asking

  • Adding No. of Datafiles to TableSpace

    Hi All, I have doubt regarding adding no. of datafiles to Tablespace. I wanna connect my application to Oracle10g database. As a DBA I am going to allocate on separate Tablespace to this new Application. As time will pass the data acumulated by the a

  • My iPhone 6 does not automatically transfer photos to iPhoto, I have to plug it in

    my iPhone 6 does not automatically transfer photos to iPhoto, I have to plug it in