Regarding doubt in Report

Hi All,
In Datamodel query ..
I need to eliminate one or two tables based on some conditon ..
In lexical parameter.. we can write conditon .. wht abt tables?
Kindly let me know how can we achieve the above funcitonality.
Thanks
Ali

user633508 wrote:
In lexical parameter.. we can write conditon .. wht abt tables?Hi Ali,
Yes, you can use lexicals anywhere in the query model.
Just like when you set up the where clause variable, you will have to have a valid default from clause in order for it to validate properly. Also, you have to make sure that the fields in the select clause are all available at runtime too.
For example, if you have set up a user parameter 'from_clause' and set the default value (like you did for your from clause parameter), you would set the runtime value in the before-report trigger based on whatever input parameter you are using.
Create a user parameter called from_clause and set it's default value to 'from table1 t'. Then in the before-report trigger place:
If :parameter.inparm = 1 Then
   :parameter.from_clause := 'From table1 t';
Else
   :parameter.from_clause := 'From table2 t';
End If;Then, in your data model, you would use the parameter in the same way as you did with the where clause parameter.
Select
   t.field1,
   t.field2
&from_clause
&where_clauseIf the same fields are not available in both tables, you will have to do the same thing with your Select clause and build it on the fly too.
Good luck,
- James
Edited by: James M on Sep 17, 2010 7:54 AM
added "parameter." to the If statement.

Similar Messages

  • Regarding events in reports

    Hi guys,
    i got a doubt in reports on events
    how many events are there in reports.....
    and what's the function of them...can any one help me plzzzz
    regards
    venu

    hi,
    events:
    http://www.sap-img.com/abap/events-related-to-reporting.htm
    Events in Classical Reports
    Initialization.
    At selection-screen.
    At selection-screen on <field>.
    Start-of-selection.
    Top-of-page.
    End-of-page.
    End-of-selection.
    Initialization.
    We can initialize the selection-screen with calculated default values under this event.
    Initialization.
    s_date-high = sy-datum.
    s_date-low = sy-datum - 15.
    Append s_date.
    At selection-screen.
    We can validate all the inputs on selection screen fields under this event.
    At selection-screen.
    If s_carrid-low is initial or s_connid-low is initial or s_date is initial.
    < ... code for validation... >.
    Endif.
    At selection-screen on <field>.
    We can validate a particular field input on selection screen under this event.
    At selection-screen on s_carrid.
    If s_carrid-low < > &#37521;H&#12539;
    <&#12539;code for validation&#12539;
    Endif.
    Start-of-selection.
    By default the program is under this event.
    If any of the other event comes before
    &#20840;elect&#12539;ndselect.&#12539;statements, then to break
    that event, we require this S-O-S event.
    Start-of-selection.
    Select * from &#12539;
    &#12539;&#12539;
    Endselect.
    Top-of-page.
    If we need some portion of the output (like
    column headings) to appear in all the pages,
    then we use this event.
    Top-of-page.
    Write:/ &#33307;arrier&#12539;10 &#33307;onnection&#12539;20 &#33337;ate&#12539;
    If there is no external output statement before
    &#31109;op-of-page&#12539;event, then this event will not
    work.
    End-of-page.
    Once the cursor reaches the last line of the
    page, automatically this event will be triggered.
    Report Zxxx line-count 25(3).
    In this case line numbers 23, 24 and 25 are
    reserved for footer.
    Once the cursor reaches 23rd line, this event
    will be triggered.
    End-of-page.
    Write:/ sy-uline(75).
    Write:/ &#31109;his is end of page:&#12539;sy-pagno.
    Write:/ sy-uline(75).
    End-of-selection.
    This event is used for concluding part of List.
    End-of-selection.
    Write:/ &#31109;his is end of the Report&#12539;
    Additional events in interactive reports
    The following additional events are applicable to secondary lists.
    Top-of-page during line-selection.
    At line-selection.
    At user-command.
    These additional events are triggered when u perform some action on the basic lists.
    example:
    REPORT zwk22671 LINE-COUNT 40(3)
    LINE-SIZE 200
    NO STANDARD PAGE HEADING.
    TABLES : mkpf , "MATERIAL DOCUMENT
    mseg , "DOCUMENT SEGMENT : MATERIAL
    t156t , "MOVEMENT TYPE TEXT
    makt. "MATERIAL DESCRIPTIONS
    *STRUCTURE OF INTERNAL TABLES
    DATA : BEGIN OF xtab,
    mblnr TYPE mkpf-mblnr , "DOCUMENT NUMBER
    mjahr TYPE mkpf-mjahr , "YEAR
    budat TYPE mkpf-budat , "POST DATE
    blart TYPE mkpf-blart , "DOCUMENT TYPE
    END OF xtab.
    DATA : BEGIN OF ytab,
    mblnr TYPE mseg-mblnr , "DOCUMENT NUMBER
    mjahr TYPE mseg-mjahr , "YEAR
    zeile TYPE mseg-zeile , "ITEM NUMBER
    bwart TYPE mseg-bwart , "MOVEMENT TYPE
    btext TYPE t156t-btext , "MOVEMENT DESCRIPTION
    matnr TYPE mseg-matnr , "MATERIAL NUMBER
    maktx TYPE makt-maktx , "MATERIAL DESCRIPTION
    meins TYPE mseg-meins , "UNIT OF MEASURE
    menge TYPE mseg-menge , "QUANTITY
    dmbtr TYPE mseg-dmbtr , "AMOUNT
    END OF ytab.
    *INTERNAL TABLE DECLARATION
    DATA : i_tab1 LIKE STANDARD TABLE OF xtab WITH HEADER LINE. "INTERNAL TABLE 1 : CONTAINS MATERIAL DETAILS
    DATA : i_tab2 LIKE STANDARD TABLE OF ytab WITH HEADER LINE. "INTERNAL TABLE 2 : CONTAINS ITEMWISE MATERIAL DETAILS
    *VARIABLES
    DATA : v_color TYPE sy-tabix , "FOR SETTING COLOR FORMATS DURING GENERATING REPORT
    v_field(20) , "FOR STORING THE CLICKED FIELD NAME
    v_value(20) , "FOR STORING THE CLICKED FIELD VALUE
    v_mblnr TYPE mkpf-mblnr , "FOR VALIDATING DOCUMENT NUMBER
    v_mjahr TYPE mkpf-mjahr , "FOR VALIDATING DOCUMENT YEAR
    v_bwart TYPE mseg-bwart , "FOR VALIDATING MOVEMENT TYPE
    v_matnr TYPE mseg-matnr . "FOR VALIDATING MATERIAL NUMBER
    **SELECTION-SCREEN
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_mblnr FOR mkpf-mblnr , "DOCUMENT NUMBER
    s_mjahr FOR mkpf-mjahr OBLIGATORY, "DOCUMENT YEAR
    s_bwart FOR mseg-bwart NO INTERVALS NO-EXTENSION, "MOVEMENT TYPE
    s_matnr FOR mseg-matnr . "MATERIAL NUMBER
    SELECTION-SCREEN : END OF BLOCK blk1.
    AT SELECTION-SCREEN
    AT SELECTION-SCREEN.
    PERFORM validation. "PERFORMS VALIDATION OF SELECTION-SCREEN FIELDS
    *TOP-OF-PAGE
    TOP-OF-PAGE.
    PERFORM header. "CREATES HEADER FOR THE BASIC LIST
    *END-OF-PAGE
    END-OF-PAGE. "CREATES FOOTER FOR THE BASIC AND SECONDARY LIST
    PERFORM footer.
    *START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM generation_basic. "GENERATES REPORT FOR BASIC LIST WHICH CONTAINS DOCUMENT NO , DOCUMENT YEAR
    "POST DATE , DOCUMENT TYPE.
    *END-OF-SELECTION
    END-OF-SELECTION.
    PERFORM report_basic. "DISPLAY REPORT FOR BASIC LIST
    *AT LINE-SELECTION
    AT LINE-SELECTION.
    PERFORM generation_secondary. "GENERATES REPORT FOR SECONDARY LIST BASED ON THE DOCUMENT NUMBER AND DOCUMENT YEAR
    "WHICH CONTAINS DOCUMENT NO , YEAR , ITEM NO , MOVEMENT TYPE , MOVEMENT DESCRIPTION ,
    "MATERIAL NUMBER , MATERIAL DESC , UNIT OF MEASURE , QUANTITY AND AMOUNT
    *TOP-OF-PAGE DURING LINE-SELECTION
    TOP-OF-PAGE DURING LINE-SELECTION.
    PERFORM header_secondary. "CREATES HEADER FOR THE SECONDARY LIST
    *AT USER-COMMAND
    AT USER-COMMAND.
    PERFORM user_secondary. "SUBROUTINE FOR HANDLING USER EVENTS
    FORM validation .
    *VALIDATING MATERIAL DOCUMENT NUMBER
    SELECT SINGLE mblnr
    INTO v_mblnr
    FROM mkpf
    WHERE mblnr IN s_mblnr.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT DOCUMENT NUMBER' TYPE 'E'.
    ENDIF.
    *VALIDATING MATERIAL DOCUMENT YEAR
    SELECT SINGLE mjahr
    INTO v_mjahr
    FROM mkpf
    WHERE mjahr IN s_mjahr.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT MATERIAL DOCUMENT YEAR' TYPE 'E'.
    ENDIF.
    *VALIDATING MOVEMENT TYPE
    SELECT SINGLE bwart
    INTO v_bwart
    FROM mseg
    WHERE bwart IN s_bwart.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT MOVEMENT TYPE' TYPE 'E'.
    ENDIF.
    *VALIDATING MATERIAL NUMBER
    SELECT SINGLE matnr
    INTO v_matnr
    FROM mseg
    WHERE matnr IN s_matnr.
    IF sy-subrc NE 0.
    MESSAGE 'ENTER CORRECT MATERIAL NUMBER' TYPE 'E'.
    ENDIF.
    ENDFORM. " VALIDATION
    FORM header .
    WRITE :/30 'MATERIAL DOCUMENTS' COLOR 1. "TITLE OF BASIC LIST
    WRITE :/1(89) sy-uline.
    FORMAT COLOR 1.
    WRITE :/1 sy-vline ,
    3 'DOCUMENT NUMBER' ,
    23 sy-vline ,
    25 'YEAR' ,
    45 sy-vline ,
    47 'POST DATE' ,
    67 sy-vline ,
    69 'DOCTYP' ,
    89 sy-vline .
    FORMAT RESET.
    WRITE :/1(89) sy-uline.
    ENDFORM. " HEADER
    FORM footer .
    IF sy-lsind EQ 0. "CHECKS WHICH LIST IS IT BASIC LIST OR SECONDARY (AND NO. OF SECONDARY LIST)
    WRITE :/1(89) sy-uline.
    ELSEIF sy-lsind EQ 1.
    WRITE :/1(192) sy-uline.
    ENDIF.
    ENDFORM. " FOOTER
    FORM generation_basic .
    SELECT mkpf~mblnr "DOCUMENT NUMBER
    mkpf~mjahr "DOCUMENT YEAR
    mkpf~budat "POST DATE
    mkpf~blart "DOCUMENT TYPE
    INTO TABLE i_tab1
    FROM mkpf INNER JOIN mseg ON mkpfmjahr EQ msegmjahr AND
    mkpfmblnr EQ msegmblnr
    WHERE mkpf~mblnr IN s_mblnr
    AND mkpf~mjahr IN s_mjahr
    AND mseg~bwart IN s_bwart
    AND mseg~matnr IN s_matnr.
    IF sy-subrc NE 0.
    WRITE :/ 'MATERIAL DATA NOT FOUND'.
    ENDIF.
    DELETE ADJACENT DUPLICATES FROM i_tab1 COMPARING mblnr mjahr.
    ENDFORM. " GENERATION_BASIC
    FORM report_basic .
    LOOP AT i_tab1.
    v_color = sy-tabix MOD 2.
    IF v_color EQ 0.
    FORMAT COLOR 1 INTENSIFIED OFF.
    ELSE.
    FORMAT COLOR 2 INTENSIFIED OFF.
    ENDIF.
    WRITE :/1 sy-vline ,
    3 i_tab1-mblnr ,
    23 sy-vline ,
    25 i_tab1-mjahr ,
    45 sy-vline ,
    47 i_tab1-budat ,
    67 sy-vline ,
    69 i_tab1-blart ,
    89 sy-vline .
    HIDE : i_tab1-mblnr , i_tab1-mjahr. "STORING THE VALUE OF FIELDS CLICKED IN SYSTEM AREA
    ENDLOOP.
    FORMAT RESET.
    WRITE :/1(89) sy-uline.
    ENDFORM. " REPORT_BASIC
    FORM generation_secondary .
    IF sy-lsind EQ 1.
    SET PF-STATUS 'DISPLAY'.
    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED
    CASE v_field.
    WHEN 'I_TAB1-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED
    SELECT mseg~mblnr "DOCUMENT NUMBER
    mseg~mjahr "DOCUMENT YEAR
    mseg~zeile "ITEM NUMBER
    mseg~bwart "MOVEMENT TYPE
    t156t~btext "MOVEMENT DESCRIPTION
    mseg~matnr "MATERIAL NUMBER
    makt~maktx "MATERIAL DESCRIPTION
    mseg~meins "UNIT OF MEASURE
    mseg~menge "QUANTITY
    mseg~dmbtr "AMOUNT
    INTO TABLE i_tab2
    FROM ( ( mseg INNER JOIN t156t
    ON msegbwart EQ t156tbwart )
    INNER JOIN makt
    ON msegmatnr EQ maktmatnr )
    WHERE mseg~mblnr EQ i_tab1-mblnr
    AND mseg~mjahr EQ i_tab1-mjahr
    AND t156t~spras EQ sy-langu
    AND makt~spras EQ sy-langu.
    DELETE ADJACENT DUPLICATES FROM i_tab2 COMPARING mblnr mjahr.
    WHEN OTHERS.
    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.
    ENDCASE.
    LOOP AT i_tab2.
    v_color = sy-tabix MOD 2.
    IF v_color EQ 0.
    FORMAT COLOR 1 INTENSIFIED OFF.
    ELSE.
    FORMAT COLOR 2 INTENSIFIED OFF.
    ENDIF.
    WRITE :/1 sy-vline ,
    3 i_tab2-mblnr ,
    12 sy-vline ,
    14 i_tab2-mjahr ,
    19 sy-vline ,
    21 i_tab2-zeile ,
    30 sy-vline ,
    32 i_tab2-bwart ,
    40 sy-vline ,
    42 i_tab2-btext ,
    72 sy-vline ,
    74 i_tab2-matnr ,
    94 sy-vline ,
    96 i_tab2-maktx ,
    146 sy-vline ,
    148 i_tab2-meins ,
    153 sy-vline ,
    155 i_tab2-menge ,
    170 sy-vline ,
    172 i_tab2-dmbtr ,
    192 sy-vline .
    ENDLOOP.
    WRITE :/1(192) sy-uline.
    FORMAT RESET.
    ELSEIF sy-lsind EQ 2.
    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED
    CASE v_field.
    WHEN 'I_TAB2-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED
    SET PARAMETER ID : "SETTING PARAMETER ID FOR DOCUMENT NUMBER AND YEAR.
    'MBN' FIELD i_tab2-mblnr ,
    'MJA' FIELD i_tab2-mjahr.
    CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN. "CALLING TRABSACTION CODE 'MBO3'.
    WHEN OTHERS.
    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.
    ENDCASE.
    ENDIF.
    ENDFORM. " GENERATION_SECONDARY
    FORM header_secondary .
    WRITE :/50 'ITEMWISE MATERIAL DOCUMENTS' COLOR 1.
    WRITE :/1(192) sy-uline.
    FORMAT COLOR 1.
    WRITE :/1 sy-vline ,
    3 'DOCUMENT NO' ,
    12 sy-vline ,
    14 'YEAR' ,
    19 sy-vline ,
    21 'ITEM NO.' ,
    30 sy-vline ,
    32 'MOV TYP' ,
    40 sy-vline ,
    42 'MOV DESCRIPTION' ,
    72 sy-vline ,
    74 'MATERIAL NO' ,
    94 sy-vline ,
    96 'MATERIAL DESCRIPTION' ,
    146 sy-vline ,
    148 'UOM' ,
    153 sy-vline ,
    155 'QUANTITY' ,
    170 sy-vline ,
    172 'AMOUNT' ,
    192 sy-vline .
    WRITE :/1(192) sy-uline.
    FORMAT RESET.
    ENDFORM. " HEADER_SECONDARY
    *FORM user_secondary .
    IF sy-ucomm EQ 'DISPLAY'. "EXECUTES ONLY IF 'DISPLAY DOCUMENTS' ITEM IS CLICKED ON APPLICATION TOOL BAR.
    IF sy-lsind EQ 2.
    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED
    CASE v_field.
    WHEN 'I_TAB2-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED
    SET PARAMETER ID :
    'MBN' FIELD i_tab2-mblnr ,
    'MJA' FIELD i_tab2-mjahr.
    CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN.
    WHEN OTHERS.
    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.
    ENDCASE.
    ENDIF.
    LEAVE PROGRAM.
    ENDIF.
    ENDFORM. " USER_SECONDARY

  • Doubt on report

    hello friends iam working as an abap consultant as a fresher, so iam having doubts on reports basing on for all entries. material, sales, purchase tables are there for all these i have created internal tables for each and finally i have created one final internal table. for all these i want the exact coding without using subroutines there is a problem in the loop condition for me.
    thank you guys
    iam expecting answer.
    girish saripalli.

    Hi Girish,
    Imagine I wrote this description for you and asked you for help. Will it be possible to answer without any specifics? What report are you writing? What are you showing in the output? What is your input? How did you define your internal tables? What problem are you facing?
    Without any of those details, it will be very difficult to give any intelligent response. Please provide the details so that the forum can help.
    Regards,
    Srinivas
    Welcome to SDN!!!

  • Doubt in Reports

    Hi guys,
      Im new to this as well to ABAP.i got a doubt in reports...generally every standard report has a transaction code, if i need to know from which script this report has been linked..how can i find it out?? if u dont mind could u pls post me fastly...n i thank all the members to be helpful...
    regards
    kalpana

    Hi.  First, all ABAP related questions  should be asked in the ABAP forum.
    To answer the question, you can use SE93 to check this, also you can find out by using table TSTC in SE16. 
    Welcome to SDN!
    Regards,
    Rich Heilman

  • Doubt in report painter (how to add new columns?)

    Hi all,
    I have a  doubt in report painter, i have copied the report 12kst1c to a zreport and also the form to a zform.
    I want to add the PO relese indicator desc as a column in report output.
    Is the above possible in report paintaer.
    also please tell me the transaction codes i tried with cje2 and cje3.
    Thanks in advance,
    Sathanbabu Mathan Kumar.

    Hello Santhan,
    Where you able to find a solution to this.If so please help me I have similar requirement.
    Thanks Arjun

  • Doubt regarding scheduling of reports

    Hi All,
    I have a Discoverer Report, which has 7 different worksheets. Each worksheet takes approximately 5-6 hours to complete, so I scheduled this report.
    Now the ques is if I have scheduled to run this report, all the worksheets will run parallely at the scheduled time or they will be run one by one.
    When will the output be available to me ?
    Regards,
    Ankur
    Edited by: Ankur (10951073) on Jun 11, 2009 12:38 AM

    Hi ankur,
    'if I have scheduled to run this report, all the worksheets will run parallely at the scheduled time or they will be run one by one'According to my personal experience and what i know.I can say is when you schedule it will ask you, do you want to schedule one sheet or multiple sheets.
    For example:-As said you have 7 worksheets(sheets) in a workbook then you have to mention all the 7 worksheets names in the schedule and select the time,date and repeated schedule or not. The path is
    File/Manage Workbooks/Scheduling
    The limit on the number of scheduled workbooks restricts the number of scheduled workbooks that can be maintained at any one time. As the Discoverer manager, you specify this limit on the "Privileges dialog: Privileges tab". If the user exceeds their limit, Discoverer Plus displays a message and the workbook is not scheduled.
    The job_queue_processes value controls the maximum number of jobs that can be run at any one time on the server.
    Hope this helps you.
    Best Wishes,
    Kranthi.

  • Doubt regarding editable ALV report using Classes

    I need to create an ALV report and make few fields editable
    and i need to update the changes  to the corresponding database tables
    for that please suggest me some idea or provide me sample code for that
    urgent

    Hi ramesh,
    Please check this example program. I think it will help for some extent.
    [code]&----
    *& Report  ZSUMA_INTERACTIVEREPORT                                     *
    report zsuma_interactivereport.
    tables: vbak.
    data :gr_alvgrid type ref to cl_gui_alv_grid,
          gr_cc_name type scrfname value 'CC_ALV',
          gr_ccontainer type ref to cl_gui_custom_container,
          gr_fieldcat type lvc_t_fcat,
          gr_layout type lvc_s_layo,
          gr_sort type lvc_t_sort,
          gr_get_cell type lvc_t_cell,
          gr_set_cell type lvc_t_cell,
          gr_hyper type lvc_t_hype,
          gr_drop_down type lvc_t_drop,
          is_variant type disvariant,
          line_number type lvc_s_roid-row_id,
          line(5) type c ,
          cell_value type lvc_value.
    data: begin of it_vbak occurs 0,
          vbeln type vbak-vbeln,
          erdat like vbak-erdat,
          erzet like vbak-erzet,
          netwr like vbak-netwr,
          waerk like vbak-waerk,
    *Below field is useful for making the entire row with different colors.
    it must be a char of 4.and layout-info_fname should populate with
    *this field.
          rowcolor(4) type c,
    *Below field is useful for making the INDIVIDUAL CELL with different
    *colors.for this we have to include structure of type lvc_t_scol.
    *layout-ctab_fname should be populate with this field.
          cellcolor type lvc_t_scol,
    *below field is added for for providing the hyperlinks to perticular
    *field. at the time of field catalog , it_fcatalog-web_field should be
    *populate with this field.
          vbeln_hyper type int4,
    *For displaying one cell as button.we have to declare one styles
    *internal table .it has to be populate.at layout structure this table
    *name has to be populate at layout-stylename.
         cellstyle type lvc_t_styl,
          end of it_vbak.
    *&   SELECTION SCREEN
    selection-screen begin of block b1 with frame title text-001.
    select-options s_vbeln for vbak-vbeln.
    selection-screen end of block b1.
    start-of-selection.
    select vbeln
           erdat
           erzet
           netwr
           waerk
           from vbak
           into corresponding fields of table it_vbak
           where vbeln in s_vbeln.
    data: wa_cellcolor type lvc_s_scol,
          wa_style type lvc_s_styl.
    loop at it_vbak.
    FOR ROW COLORING
    if sy-tabix = 1.
    it_vbak-rowcolor = 'C511'.
    FOR PUTTING THE HYPERLINKS ON VBELN FIELD
    it_vbak-vbeln_hyper = '1'.
    modify it_vbak.
    endif.
    FOR CELL COLORING
    if sy-tabix = 2.
    wa_cellcolor-fname = 'ERZET'.
    wa_cellcolor-color-col = '6'.
    wa_cellcolor-color-int = '1'.
    wa_cellcolor-color-inv = '1'.
    append wa_cellcolor to it_vbak-cellcolor.
    modify it_vbak index 2.
    endif.
    FOR DISPLAYING THE CELL AS A BUTTON
    clear it_vbak-cellstyle.
    at last.
    read table it_vbak index sy-tabix.
    wa_style-fieldname = 'NETWR'.
    wa_style-style = cl_gui_alv_grid=>mc_style_button.
    append wa_style to it_vbak-cellstyle .
    modify it_vbak .
    endat.
    endloop.
    if not it_vbak[] is initial.
      call screen 100.
    endif.
    *CLASS DEFINITION FOR HANDLING THE EVENTS IN ALV GRID
    class gr_event_handler definition.
    public section.
    methods:handle_hotspot_click
                  for event hotspot_click of cl_gui_alv_grid
                   importing e_row_id e_column_id es_row_no.
    endclass.
    *CLASS IMPLEMENTATIONFOR HANDLING THE EVENTS IN ALV GRID
    class gr_event_handler implementation.
    method handle_hotspot_click.
    perform handle_hotspot_click using e_row_id e_column_id es_row_no.
    endmethod.
    endclass.
    *&      Form  BUILDING_FIELDCATALOG
          text
         <--P_GR_FIELDCAT  text
    form building_fieldcatalog  changing p_gr_fieldcat type lvc_t_fcat.
    data s_fieldcat type lvc_s_fcat.
    s_fieldcat-fieldname = 'VBELN'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '1'.
    s_fieldcat-coltext   = 'DOCCUMENT NO.'.
    s_fieldcat-key   = ' '.
    s_fieldcat-emphasize = 'C511'.
    s_fieldcat-web_field = 'VBELN_HYPER'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'ERDAT'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '2'.
    s_fieldcat-coltext   = 'REC CREATE DATE.'.
    s_fieldcat-emphasize = 'C311'.
    s_fieldcat-hotspot = 'X'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'ERZET'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '3'.
    s_fieldcat-coltext   = 'TIME ENTRY.'.
    *S_FIELDCAT-EMPHASIZE = 'C311'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'NETWR'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '4'.
    s_fieldcat-emphasize = 'C311'.
    s_fieldcat-coltext   = 'NET WEIGHT.'.
    s_fieldcat-do_sum   = 'X'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'WAERK'.
    s_fieldcat-outputlen = '5'.
    s_fieldcat-col_pos   = '5'.
    s_fieldcat-emphasize = 'C511'.
    s_fieldcat-coltext   = 'CURR.'.
    FOR PUTTING THE DROP DOWN BOX.
    s_fieldcat-drdn_hndl = '1'.
    s_fieldcat-edit = 'X'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    endform.                    " BUILDING_FIELDCATALOG
    *&      Form  CREATE_CCONTAINER_INSTANCE
          text
    -->  p1        text
    <--  p2        text
    form create_ccontainer_instance .
    create object gr_ccontainer
    exporting
    container_name              = gr_cc_name
    exceptions
    cntl_error                  = 1
    cntl_system_error           = 2
    create_error                = 3
    lifetime_error              = 4
    lifetime_dynpro_dynpro_link = 5
    others                      = 6
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    endform.                    " CREATE_CCONTAINER_INSTANCE
    *&      Form  CREATE_ALVGRID_INSTANCE
          text
    -->  p1        text
    <--  p2        text
    form create_alvgrid_instance .
    create object gr_alvgrid
      exporting
        i_parent          = gr_ccontainer
      exceptions
        error_cntl_create = 1
        error_cntl_init   = 2
        error_cntl_link   = 3
        error_dp_create   = 4
        others            = 5
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform.                    " CREATE_ALVGRID_INSTANCE
    *&      Form  DISPLAYING_ALVGRID
          text
    -->  p1        text
    <--  p2        text
    form displaying_alvgrid .
    call method gr_alvgrid->set_table_for_first_display
      exporting
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
        is_variant                    = is_variant
        i_save                        = 'A'
       I_DEFAULT                     = 'X'
        is_layout                     = gr_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
        it_hyperlink                  = gr_hyper
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
      changing
        it_outtab                     = it_vbak[]
        it_fieldcatalog               = gr_fieldcat
       it_sort                       = gr_sort
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 3
       others                        = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    *CALL METHOD GR_ALVGRID->GET_FRONTEND_LAYOUT
    IMPORTING
       ES_LAYOUT = GR_LAYOUT
    *GR_LAYOUT-GRID_TITLE = 'HAI ALV'.
    *CALL METHOD GR_ALVGRID->SET_FRONTEND_LAYOUT
    EXPORTING
       IS_LAYOUT = GR_LAYOUT
    endform.                    " DISPLAYING_ALVGRID
    *&      Form  REFRESH_DISPLAY_TABLE
          text
    -->  p1        text
    <--  p2        text
    form refresh_display_table .
    call method gr_alvgrid->refresh_table_display
    EXPORTING
       IS_STABLE      =
       I_SOFT_REFRESH =
      exceptions
        finished       = 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.                    " REFRESH_DISPLAY_TABLE
    *&      Form  SETTING_LAYOUT
          text
         <--P_GR_LAYOUT  text
    form setting_layout  changing p_gr_layout type lvc_s_layo.
    p_gr_layout-grid_title = 'ALV GRID USING ABAP OBJECTS'.
    p_gr_layout-zebra = 'X'.
    p_gr_layout-no_toolbar = ''.
    p_gr_layout-sel_mode = 'D'.
    p_gr_layout-info_fname = 'ROWCOLOR'.
    p_gr_layout-ctab_fname = 'CELLCOLOR'.
    p_gr_layout-stylefname = 'CELLSTYLE'.
    endform.                    " SETTING_LAYOUT
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    set pf-status 'MENU'.
    if gr_alvgrid is initial.
    *CREATING THE CONTAINER INSTANCE BY SENDING THE CONTAINER NAME( IT HAS
    *TO COINSIDE WITH COSTUM CONTROL NAME OF TRANSACTION SCREEN
    perform create_ccontainer_instance.
    perform create_alvgrid_instance.
    *VARIANT POPULATION.
    perform setting_variants changing is_variant.
    *BELOW FORM IS USEFUL TO FILL THE HYPER LINK TABLE AND WE PASS THAT
    *TABLE TO 'IT_HYPERLINK' PARAMETER IN FIRST DISPLAY METHOD.
    perform setting_hyperlinks_field changing gr_hyper.
    *TO MAKE THE COLOUMN AS DROP DOWN.
    perform setting_dropdown_column changing gr_drop_down.
    perform building_fieldcatalog changing gr_fieldcat.
    perform setting_layout changing gr_layout.
    perform setting_sorting changing gr_sort.
    perform setting_cells changing gr_set_cell.
    perform displaying_alvgrid.
    *PERFORM GETTING_CELL_DETAILS CHANGING GR_GET_CELL. " IT IS NOT WORKING
                                                 FOR ME AND I HAVE DOUBT .
    perform creating_event_object.
    *PERFORM REFRESH_DISPLAY_TABLE.
    endif.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module user_command_0100 input.
    case sy-ucomm.
      when 'BACK'.
      leave to screen 000.
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  SETTING_SORTING
          text
         <--P_GR_SORT  text
    form setting_sorting  changing p_gr_sort type lvc_t_sort.
    data: lr_sort type lvc_s_sort.
    lr_sort-spos = '1'.
    lr_sort-fieldname = 'VBELN'.
    lr_sort-up = 'X'.
    append lr_sort to p_gr_sort.
    lr_sort-spos = '2'.
    lr_sort-fieldname = 'ERDAT'.
    lr_sort-up = 'X'.
    append lr_sort to p_gr_sort.
    endform.                    " SETTING_SORTING
    *&      Form  GETTING_CELL_DETAILS
          text
         <--P_GR_GET_CELL  text
    form getting_cell_details  changing p_gr_get_cell.
    call method gr_alvgrid->get_selected_cells
      importing
        et_cell = p_gr_get_cell
    *CELL_VALUE = P_GR_GET_CELL-VALUE.
    endform.                    " GETTING_CELL_DETAILS
    *&      Form  SETTING_CELLS
          text
         <--P_GR_SET_CELL  text
    form setting_cells  changing p_gr_set_cell type lvc_t_cell.
    data:s_gr_set_cell type lvc_s_cell.
    s_gr_set_cell-col_id-fieldname = 'NETWR'.
    s_gr_set_cell-row_id-index = '3'.
    append s_gr_set_cell to p_gr_set_cell.
    call method gr_alvgrid->set_selected_cells
      exporting
        it_cells = p_gr_set_cell.
    endform.                    " SETTING_CELLS
    *&      Form  SETTING_HYPERLINKS_FIELD
          text
         <--P_GR_HYPER  text
    form setting_hyperlinks_field  changing p_gr_hyper type lvc_t_hype.
    data: is_hype type lvc_s_hype.
    is_hype-handle = '1'.
    is_hype-href = 'HTTP://WWW.GOOGLE.CO.IN'.
    append is_hype to p_gr_hyper.
    is_hype-handle = '2'.
    is_hype-href = 'HTTP://SDN.SAP.COM'.
    append is_hype to p_gr_hyper.
    endform.                    " SETTING_HYPERLINKS_FIELD
    *&      Form  SETTING_DROPDOWN_COLUMN
          text
         <--P_GR_DROP_DOWN  text
    form setting_dropdown_column  changing p_gr_drop_down type lvc_t_drop.
    data: wa_drop type lvc_s_drop.
    wa_drop-handle = '1'.
    wa_drop-value = '$'.
    append wa_drop to p_gr_drop_down.
    wa_drop-handle = '1'.
    wa_drop-value = 'Rs'.
    append wa_drop to p_gr_drop_down.
    wa_drop-handle = '1'.
    wa_drop-value = 'CUR'.
    append wa_drop to p_gr_drop_down.
    call method gr_alvgrid->set_drop_down_table
      exporting
        it_drop_down       = p_gr_drop_down
       IT_DROP_DOWN_ALIAS =
    endform.                    " SETTING_DROPDOWN_COLUMN
    *&      Form  SETTING_VARIANTS
          text
         <--P_IS_VARIANT  text
    form setting_variants  changing p_is_variant type disvariant.
    p_is_variant-report = sy-repid.
    endform.                    " SETTING_VARIANTS
    *&      Form  HANDLE_HOTSPOT_CLICK
          text
         -->P_E_ROW  text
         -->P_E_COLUMN  text
         -->P_E_ROW_NO  text
    form handle_hotspot_click  using    p_e_row_id type lvc_s_row
                                        p_e_column_id type lvc_s_col
                                        p_es_row_no type lvc_s_roid.
    read table it_vbak index p_es_row_no-row_id.
    if sy-subrc = 0 and p_e_column_id-fieldname = 'ERDAT'.
    line = p_es_row_no-row_id.
    line_number = p_es_row_no-row_id.
    leave to screen 200.
    endif.
    endform.                    " HANDLE_HOTSPOT_CLICK
    *&      Form  CREATING_EVENT_OBJECT
          text
    -->  p1        text
    <--  p2        text
    form creating_event_object .
    data event_handle type ref to gr_event_handler.
    create object event_handle.
    set handler event_handle->handle_hotspot_click for gr_alvgrid.
    endform.                    " CREATING_EVENT_OBJECT
    *&      Module  STATUS_0200  OUTPUT
          text
    module status_0200 output.
      set pf-status 'BB'.
    SET TITLEBAR 'xxx'.
    *LINE = LINE_NUMBER.
    endmodule.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    module user_command_0200 input.
    if sy-ucomm = 'BACK'.
    leave to screen 100.
    endif.
    endmodule.                 " USER_COMMAND_0200  INPUT[/code]
    Reward points if helpful
    Thanks,
    Suma.

  • Doubt in report of FI

    Hi every one i have a small doubt in FI report that is i have to give the following output as per the user requirement i had added all the everything in this program i had given u the entire code the only problem is if make comment for the code of city and postal code the remaining everything is working properly and if i remove comment at CITY and POSTAL CODE there is some error can u find out that and help me please
    * Ist-Einzelpostenanzeige EC-PCA                                      *
    * - direkte Aufruf                                                    *
    * - Report Writer                                                     *
    * - Recherche                                                         *
    * 45b MIC: default values for poper and ryear depfr. fiscyear variant *
    * 46a MIC Warning if too few selection parameters                     *
    * 46a MIC: use up to 'whr_size' single values in select statement     *
    * 46a MIC: move'Initialization of Rep-Rep-Interface' to Initialization*
    * 46a MIC: check only new auth-object                                 *
    * 46c MIC: add RMVCT and get more fields from RRI                     *
    REPORT z_rcopca02_1 NO STANDARD PAGE HEADING MESSAGE-ID km
                    LINE-COUNT (2) LINE-SIZE 81.
    * Typen ***************************************************************
    *type-pools: kkblo.
    TYPE-POOLS: slis, ecarc.
    * DDIC-Tabellen *******************************************************
    TABLES: glpca,                         "Einzelposten / Ist
            glu1,                          "Übergabestruktur FI-SL-Anzeige
            t000,
            tka01,
            sscrfields,
            lfa1,
            kna1,
            bseg,
            with_item.
    * Variablen und int. Tabellen *****************************************
    DATA: afield        TYPE slis_fieldcat_alv,
          sp_group      TYPE slis_sp_group_alv,
          t_listheader  TYPE slis_t_listheader WITH HEADER LINE,
          t_layout      TYPE slis_layout_alv,
          t_fieldcat    TYPE slis_t_fieldcat_alv,
          t_spec_groups TYPE slis_t_sp_group_alv,
          event         TYPE slis_alv_event,
          t_events      TYPE slis_t_event,
          g_variant     LIKE disvariant,
          gx_variant    LIKE disvariant,
          g_exit(1)     TYPE c,
          g_save(1)     TYPE c,
          g_repid       LIKE sy-repid,
          msgtyp        LIKE sy-msgty,
          lt_dynpread   LIKE dynpread OCCURS 1 WITH HEADER LINE,
          ls_rpcak      LIKE rpcak,              "note 0310592
          packsize      TYPE i VALUE 1000,
          text1(60)     TYPE c,
          text2(60)     TYPE c,
          oldkokrs      LIKE glpca-kokrs,
          oldracct      LIKE glpca-racct.
    DATA: whr_size    TYPE i VALUE 50,"Maximum of single values per  MIC 46a
                       "charact. in the where-clause of the select-statement
          lines         TYPE i, "number of lines of range table      MIC 46a
          cnt_rldnr     TYPE i, "Zähler Anzahl selektierter Ledger
          cnt_kokrs     TYPE i, "Zähler Anzahl selektierter KoReKreise
          cnt_poper     TYPE i, "Zähler Anzahl selektierter Perioden
          cnt_ryear     TYPE i, "Zähler Anzahl selektierter GeschJahre
          cnt_rvers     TYPE i, "Zähler Anzahl selektierter Versionen
          cnt_bukrs     TYPE i, "Zähler Anzahl selektierter BuKreise
          empge         LIKE dkobr-empge,
          ksl_curr      LIKE tka01-pcacur,
          hsl_curr      LIKE t001-waers,
          a_rec         LIKE rstirec.
    DATA: BEGIN OF dim_data.
            INCLUDE STRUCTURE rgcdi.       "data for dimensions
    DATA: END OF dim_data.
    DATA: BEGIN OF tab_fields OCCURS 80,
            name LIKE dntab-fieldname,     "fields in table i_glpca
          END OF tab_fields.
    DATA: BEGIN OF i_glpca OCCURS 0.
            INCLUDE STRUCTURE rpca2.
    DATA:   racct_ktext LIKE rpcak-ktext,
            psppp LIKE prps-posid,
            name1 LIKE lfa1-name1,
            adrnr like lfa1-adrnr,
            stras like lfa1-stras,
            c_name1 like kna1-name1,
            v_rate like with_item-qsatz,
            qsshb like bseg-qsshb,
            qbshb like bseg-qbshb,
          END OF i_glpca.
    DATA: rw_subrc   LIKE sy-subrc,      "Flag: Report-Writer-Schnittstelle
          re_subrc   LIKE sy-subrc,        "Flag: Recherche-Schnittstelle
          subrc      LIKE sy-subrc.
    DATA: set_id    LIKE sethier-setid,    "Set-ID        "RDI_SETS_4.0
          set_class LIKE sethier-setclass, "Setklasse     "RDI_SETS_4.0
          set_sname LIKE sethier-shortname."Setname (24)  "RDI_SETS_4.0
    DATA: authorised(1),
          s_message(1),
          auth_dbcount LIKE sy-tabix,
    *     Hex-Konstanten für Minimum/Maximum-Werte
          BEGIN OF hex00,
            x1(12) TYPE c,
            x2(12) TYPE c,
          END OF hex00,
          BEGIN OF hexff,
            x1(12) TYPE c,
            x2(12) TYPE c,
          END OF hexff.
    RANGES rclnt FOR glpca-rclnt.
    FIELD-SYMBOLS: <glpca> LIKE LINE OF i_glpca,
                   <glpca_arc> TYPE ecarc_glpca_curr.
    * Selektionsoptionen *************************************************
    SELECT-OPTIONS:
      rldnr    FOR glpca-rldnr   DEFAULT '8A' NO-DISPLAY,
      rassc    FOR glpca-rassc                NO-DISPLAY,
    * rrcty    for glpca-rrcty   default 0,
      rrcty    FOR glpca-rrcty,
      rvers    FOR glpca-rvers   DEFAULT '000',
      kokrs    FOR glpca-kokrs   MEMORY ID cac,
      bukrs    FOR glpca-rbukrs  MEMORY ID buk,
    * poper    for glpca-poper   default sy-datlo+4(2),
    * ryear    for glpca-ryear   default sy-datlo,
      poper    FOR glpca-poper,
      ryear    FOR glpca-ryear,
      prctr    FOR glpca-rprctr  MATCHCODE OBJECT prct,
      pprctr   FOR glpca-sprctr  MATCHCODE OBJECT prct,
    * RACCT    FOR GLPCA-RACCT   MATCHCODE OBJECT KART,      "RD_P30K128304
      racct    FOR glpca-racct,            "RD_P30K128304
      drcrk    FOR glpca-drcrk,
      activ    FOR glpca-activ,
      rhoart   FOR glpca-rhoart,
      rfarea   FOR glpca-rfarea,
      stagr    FOR glpca-stagr,
      rtcur    FOR glpca-rtcur,
      runit    FOR glpca-runit,
      versa    FOR glpca-versa  NO-DISPLAY,
      eprctr   FOR glpca-eprctr NO-DISPLAY,
      afabe    FOR glpca-afabe  NO-DISPLAY,
      rmvct    FOR glpca-rmvct  NO-DISPLAY,
      hrkft    FOR glpca-hrkft  NO-DISPLAY,  "note 550972
      sbukrs   FOR glpca-sbukrs NO-DISPLAY,  "note 550972
      shoart   FOR glpca-shoart NO-DISPLAY,  "note 550972
      sfarea   FOR glpca-sfarea NO-DISPLAY,  "note 550972
      docct    FOR glpca-docct,
      docnr    FOR glpca-docnr,
      refdocct FOR glpca-refdocct,
      refdocnr FOR glpca-refdocnr,
      werks    FOR glpca-werks,
      repmatnr FOR glpca-rep_matnr MATCHCODE OBJECT pca_shlp_rep_matnr,
      rscope   FOR glpca-rscope.
    PARAMETERS: no_rrint NO-DISPLAY DEFAULT ' '." skip       "MICP40K066037
    " report-report-interface
    * display variant                                       ">>MICP40K039857
    SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE text-e01.
    PARAMETERS: p_vari LIKE disvariant-variant.
    SELECTION-SCREEN COMMENT 47(40) varname FOR FIELD p_vari.
    SELECTION-SCREEN END OF BLOCK 0.
    PARAMETERS log_grp(4) TYPE c NO-DISPLAY DEFAULT 'zKE5Z'.
    "<<MICP40K039857
    RANGES: v_racct  FOR glpca-racct,
            v_prctr  FOR glpca-rprctr,
            v_pprctr FOR glpca-sprctr.
    * Tabelle mit Werten aus den Berichts-Set vom Report-Writer           *
    DATA  BEGIN OF val_tab OCCURS 50.
            INCLUDE STRUCTURE rgciv.
    DATA  END OF val_tab.
    ***************************************************        MICP30K166368
    * feldkatalog und interface für bb-schnittstelle rw        MICP30K166368
    ***************************************************        MICP30K166368
    "MICP30K166368
    DATA  BEGIN OF bbs_fieldtab OCCURS 20. "MICP30K166368
            INCLUDE STRUCTURE rstifields.  "MICP30K166368
    DATA  END OF bbs_fieldtab.             "MICP30K166368
    * archiv
    TYPE-POOLS: rsds.
    TYPES:      BEGIN OF ty_archive_objects,
                   object       LIKE arch_obj-object,
                END   OF ty_archive_objects,
                ty_t_archive_objects TYPE ty_archive_objects OCCURS 2.
    CONSTANTS:  lc_set          TYPE  c           VALUE 'X',
                lc_report       TYPE  progname    VALUE 'ZKE5Z',
                lc_reporttype   TYPE  reporttype  VALUE 'TR'.
    TABLES:     admi_files.
    SELECT-OPTIONS lr_files FOR admi_files-archiv_key NO-DISPLAY.
    PARAMETER:  read_db       TYPE c            DEFAULT 'X' NO-DISPLAY,
                read_ar       TYPE c                        NO-DISPLAY,
                arc_obj       LIKE arch_obj-object          NO-DISPLAY,
                read_as       TYPE c            DEFAULT 'X' NO-DISPLAY.
    DATA  :     lt_arch_obj     TYPE ty_t_archive_objects WITH HEADER LINE,
                ls_selections   TYPE rsds_frange,
                lt_selections   TYPE rsds_frange_t,
                ls_selopt TYPE rsdsselopt,
                lt_glpca_archiv TYPE ecarc_t_glpca_curr.
    *********************************************************>>MICP40K039857
    * INITIALIZATION
    INITIALIZATION.
    * Diverse Initialisierungen
      PERFORM init_vars.
      g_repid = sy-repid.
    * Set default values for record type
      rrcty-sign = 'I'.
      rrcty-option = 'EQ'.
      rrcty-low    = '0'.
      APPEND rrcty.
      rrcty-low = '2'.
      APPEND rrcty.
    * Set default values for period and year (if kokrs or bukrs is known)
      GET PARAMETER ID 'BUK' FIELD bukrs-low.
      GET PARAMETER ID 'CAC' FIELD kokrs-low.
      IF     kokrs-low IS INITIAL       "get contr. area from company code
         AND NOT bukrs-low IS INITIAL.
        CALL FUNCTION 'KOKRS_GET_FROM_BUKRS'
          EXPORTING
            i_bukrs        = bukrs-low
          IMPORTING
            e_kokrs        = kokrs-low
          EXCEPTIONS
            no_kokrs_found = 1
            OTHERS         = 2.
        IF sy-subrc <> 0.
          CLEAR kokrs-low.
        ENDIF.
      ENDIF.
      IF NOT kokrs-low IS INITIAL.
        CALL FUNCTION 'K_KOKRS_READ'       "get fiscal year variant
             EXPORTING
                  kokrs           = kokrs-low
              IMPORTING
                  e_tka01         = tka01
            EXCEPTIONS
                  not_found       = 1
                  not_found_gjahr = 2
                  OTHERS          = 3.
        IF sy-subrc = 0.
          CALL FUNCTION 'G_PERIOD_GET'
            EXPORTING
              date                           = sy-datlo
              variant                        = tka01-lmona
            IMPORTING
              period                         = poper-low
              year                           = ryear-low
            EXCEPTIONS
              ledger_not_assigned_to_company = 1
              period_not_defined             = 2
              variant_not_defined            = 3
              OTHERS                         = 4.
          IF sy-subrc = 0.
            poper-sign = 'I'.
            poper-option = 'EQ'.
            APPEND poper.
            ryear-sign = 'I'.
            ryear-option = 'EQ'.
            APPEND ryear.
          ENDIF.
        ENDIF.
      ENDIF.
    * Settings for display variants
      g_save = 'A'.  "Schalter Varianten benutz./allg. speichern
      CLEAR g_variant.
      g_variant-report = g_repid.
      g_variant-log_group = log_grp.
      g_variant-username = sy-uname.
    * Get default variant
      gx_variant = g_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = g_save
        CHANGING
          cs_variant = gx_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        p_vari = gx_variant-variant.
      ENDIF.
    * Set variant
      IF p_vari IS INITIAL.
        p_vari = '1SAP'.
        MOVE p_vari TO gx_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
          EXPORTING
            i_save     = g_save
          CHANGING
            cs_variant = gx_variant
          EXCEPTIONS
            not_found  = 1.
        IF sy-subrc NE 0.
          CLEAR p_vari.
          CLEAR gx_variant-variant.
        ENDIF.
      ENDIF.
      varname = gx_variant-text.
      "<<MICP40K039857
    * archiv
      CALL FUNCTION 'KARL_DATA_INPUT_INIT'
        EXPORTING
          i_report     = lc_report
          i_reporttype = lc_reporttype
        IMPORTING
          e_xusedb     = read_db
          e_xusear     = read_ar
          e_archobj    = arc_obj
          e_infosys    = read_as
        TABLES
          t_arch_sel   = lr_files.
      DATA: lt_excluding LIKE sy-ucomm OCCURS 0 WITH HEADER LINE.
      CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
        EXPORTING
          p_status  = 'SELSCREEN'
          p_program = 'RCOPCA02'
        TABLES
          p_exclude = lt_excluding.
    * Initialisieren der Bericht/Bericht-Schnittstellen                   *
      DATA: ld_no_rrint TYPE boole_d.      "note 490484 begin
      IMPORT rri = ld_no_rrint FROM MEMORY ID 'RCOPCA02_NO_RRI'.
      IF ld_no_rrint = 'X'.
        FREE MEMORY ID 'RCOPCA02_NO_RRI'.
      ELSE.                                "note 490484 end
        CALL FUNCTION 'G_REPORT_INTERFACE_INIT'   "Report-Writer?
            EXPORTING                      "MICP30K166368
                 table = 'GLPCT'           "MICP30K166368
             IMPORTING
                 subrc = rw_subrc          "MICP30K166368
            TABLES                         "MICP30K166368
                 it_fieldr = bbs_fieldtab. "MICP30K166368
        CALL FUNCTION 'RSTI_APPL_STACK_POP'"oder Recherche?
             IMPORTING
                  i_rec                      = a_rec
             EXCEPTIONS
                  appl_stack_not_initialized = 1.
        re_subrc = sy-subrc.
        IF re_subrc = 0.
    *    check Receiver is this report
          IF NOT ( ( a_rec-rtool = 'RT' AND a_rec-ronam = 'Z_RCOPCA02_1' )
                   OR ( a_rec-rtool = 'TR' AND a_rec-ronam = 'ZKE5Z' ) ) .
            re_subrc = 2.
          ENDIF.
        ENDIF.
      ENDIF.
    * AT SELCTION-SCREEN on value request**********************************
    *at selection-screen on value-request for racct-low.          "RD "4.6a
    *                                                             "RD "4.6a
    * call function 'K_RACCT_VALUE_REQUEST'                       "RD "4.6a
    *      importing                                              "RD "4.6a
    *           e_racct      = racct-low.                         "RD "4.6a
    *                                                             "RD "4.6a
    *                                                             "RD "4.6a
    *at selection-screen on value-request for racct-high.         "RD "4.6a
    *                                                             "RD "4.6a
    * call function 'K_RACCT_VALUE_REQUEST'                       "RD "4.6a
    *      importing                                              "RD "4.6a
    *           e_racct      = racct-high.                        "RD "4.6a
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.         "MICP40K039857
      PERFORM f4_for_variant.              "MICP40K039857
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR poper-low.         "RD "4.6a
    * begin of insertion note 522715
      CALL FUNCTION 'K_KOKRS_READ'
        EXPORTING
          kokrs           = kokrs-low
        EXCEPTIONS
          not_found       = 1
          not_found_gjahr = 2
          OTHERS          = 3.
      IF sy-subrc = 0.
    * end of insertion note 522715
        CALL FUNCTION 'ECPCA_RPMAX_VALUE_REQUEST'               "RD "4.6a
             EXPORTING                                          "RD "4.6a
                  i_kokrs     = kokrs-low                       "RD "4.6a
                  i_ryear     = ryear-low                       "RD "4.6a
             IMPORTING                                          "RD "4.6a
                  e_rpmax     = poper-low                       "RD "4.6a
    * begin of insertion note 522715
             EXCEPTIONS
                  table_empty = 1.
      ENDIF.
    * end of insertion note 522715
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR poper-high.        "RD "4.6a
    * begin of insertion note 522715
      CALL FUNCTION 'K_KOKRS_READ'
        EXPORTING
          kokrs           = kokrs-low
        EXCEPTIONS
          not_found       = 1
          not_found_gjahr = 2
          OTHERS          = 3.
      IF sy-subrc = 0.
    * end of insertion note 522715
        CALL FUNCTION 'ECPCA_RPMAX_VALUE_REQUEST'               "RD "4.6a
             EXPORTING                                          "RD "4.6a
                  i_kokrs     = kokrs-low                       "RD "4.6a
                  i_ryear     = ryear-low                       "RD "4.6a
             IMPORTING                                          "RD "4.6a
                  e_rpmax     = poper-high                      "RD "4.6a
    * begin of insertion note 522715
             EXCEPTIONS
                  table_empty = 1.
      ENDIF.
    * end of insertion note 522715
    * AT SELCTION-SCREEN ***************************************************
    AT SELECTION-SCREEN.
      PERFORM pai_of_selection_screen.
    * begin of insertion note 522715
      IF NOT kokrs-low IS INITIAL.
        CALL FUNCTION 'K_KOKRS_READ'
          EXPORTING
            kokrs           = kokrs-low
          EXCEPTIONS
            not_found       = 1
            not_found_gjahr = 2
            OTHERS          = 3.
        IF sy-subrc <> 0.
          MESSAGE e101(ki) WITH kokrs-low.
        ENDIF.
      ENDIF.
    * end of insertion note 522715
    * archiv
      IF sy-ucomm = 'FC01' OR sy-ucomm = 'UCDS'
        OR sy-ucomm = 'ONLI' AND read_ar = 'X'
        AND read_as IS INITIAL AND lr_files[] IS INITIAL.
        IF lt_arch_obj[] IS INITIAL.
          lt_arch_obj-object = 'PCA_OBJECT'. APPEND lt_arch_obj.
          lt_arch_obj-object = 'EC_PCA_ITM'. APPEND lt_arch_obj.
        ENDIF.
        CALL FUNCTION 'KARL_DATA_INPUT_SELECT'
          EXPORTING
            i_db_and_arc       = lc_set
            i_infosys_possible = lc_set
            i_object_fixed     = 'V'
            i_documentation    = 'KARL_DATA_INPUT_SEL_KE5YZ'
            i_report           = lc_report
            i_reporttype       = lc_reporttype
          TABLES
            t_objects          = lt_arch_obj
            t_arch_sel         = lr_files
          CHANGING
            c_xusedb           = read_db
            c_xusear           = read_ar
            c_archobj          = arc_obj
            c_infosys          = read_as.
      ENDIF.
    * START-OF-SELECTION **************************************************
    START-OF-SELECTION.
    *   Default-Werte löschen, falls Aufruf über Recherche
    *   oder Report-Writer erfolgt ist
      IF no_rrint IS INITIAL AND ld_no_rrint IS INITIAL.        "note 490484
        IF rw_subrc EQ 0 OR re_subrc EQ 0.
          REFRESH: rldnr, rrcty, rvers,  kokrs, bukrs, poper,  ryear,
                   racct, prctr, pprctr, drcrk, activ, rhoart, rfarea,
                   versa, afabe, eprctr,
                   v_racct, v_prctr, v_pprctr.
          CLEAR:   rldnr, rrcty, rvers,  kokrs, bukrs, poper,  ryear,
                   racct, prctr, pprctr, drcrk, activ, rhoart, rfarea,
                   versa, afabe, eprctr,
                   v_racct, v_prctr, v_pprctr.
          IF NOT read_as IS INITIAL.                           "note 625581
            CLEAR: lr_files, lr_files[].                       "note 625581
          ENDIF.                                               "note 625581
        ENDIF.
    * Parameter einlesen über Report-Writer-Schnittstelle                 *
        IF rw_subrc EQ 0.
          PERFORM rw_get_parameters.
    * oder Parameter einlesen über Recherche-Schnittstelle                *
        ELSEIF re_subrc EQ 0.
          PERFORM re_get_parameters.
        ENDIF.
      ENDIF.
      IF read_db = 'X'.                     " read from DB (archiv)
    * Bewegungsdaten einlesen und puffern...................................
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            text = 'Einzelposten selektieren'(p10).
    * Use dirty trick to mislead DB-optimizer
        CALL FUNCTION 'DB_DO_NOT_USE_CLIENT_INDEX'
          EXPORTING
            value    = sy-mandt
          TABLES
            mandttab = rclnt.
        SELECT (tab_fields) FROM glpca
           CLIENT SPECIFIED
           PACKAGE SIZE packsize
           APPENDING CORRESPONDING FIELDS OF TABLE i_glpca
           WHERE rldnr     IN rldnr
             AND rrcty     IN rrcty
             AND rvers     IN rvers
             AND kokrs     IN kokrs
             AND rbukrs    IN bukrs
             AND ryear     IN ryear
             AND rassc     IN rassc
             AND hrkft     IN hrkft   "note 550972
             AND sbukrs    IN sbukrs  "note 550972
             AND shoart    IN shoart  "note 550972
             AND sfarea    IN sfarea  "note 550972
             AND racct     IN racct
             AND rprctr    IN prctr
             AND sprctr    IN pprctr
             AND poper     IN poper
             AND drcrk     IN drcrk
             AND activ     IN activ
             AND rhoart    IN rhoart
             AND rfarea    IN rfarea
             AND versa     IN versa
             AND eprctr    IN eprctr
             AND afabe     IN afabe
             AND rmvct     IN rmvct
             AND docct     IN docct
             AND docnr     IN docnr
             AND stagr     IN stagr
             AND rtcur     IN rtcur
             AND runit     IN runit
             AND refdocct  IN refdocct
             AND refdocnr  IN refdocnr
             AND werks     IN werks
             AND rep_matnr IN repmatnr       "RDIP40K020663
             AND rscope    IN rscope         "RDIP40K020663
          AND rclnt     IN rclnt.       "dirty trick to mislead DB-optimizer
          IF sy-dbcnt > 1.
            text1 = sy-dbcnt.
            CONDENSE text1.
            CONCATENATE text1 text-m01 INTO text2 SEPARATED BY space.
            CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
              EXPORTING
                text = text2.          " ... Datensätze gelesen
          ENDIF.
        ENDSELECT.
    * Entfernt nicht zugehörige Einträge....................................
        LOOP AT i_glpca WHERE ( NOT rprctr IN v_prctr  )
                           or ( not SPRCTR in v_pprctr )
                           OR ( NOT racct  IN v_racct  ).
          DELETE i_glpca.
        ENDLOOP.
      ENDIF.
    *archiv
      IF read_ar = 'X' AND NOT
        ( read_as IS INITIAL AND lr_files[] IS INITIAL ).
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            text = 'Lesen im Archiv'(p12).
        DEFINE fill_lt_selections.
          if not &2[] is initial.
            clear ls_selections.
            move &1 to ls_selections-fieldname.
            loop at &2.
              clear ls_selopt.
              move-corresponding &2 to ls_selopt.
              append ls_selopt to ls_selections-selopt_t.
            endloop.
            append ls_selections to lt_selections.
          endif.
        END-OF-DEFINITION.
        fill_lt_selections 'RLDNR'  rldnr.
        fill_lt_selections 'RRCTY'  rrcty.
        fill_lt_selections 'RVERS'  rvers.
        fill_lt_selections 'KOKRS'  kokrs.
        fill_lt_selections 'RBUKRS' bukrs.
        fill_lt_selections 'POPER'  poper.
        fill_lt_selections 'RYEAR'  ryear.
        fill_lt_selections 'RPRCTR' prctr.
        fill_lt_selections 'SPRCTR' pprctr.
        fill_lt_selections 'RACCT'  racct.
        fill_lt_selections 'DRCRK'  drcrk.
        fill_lt_selections 'ACTIV'  activ.
        fill_lt_selections 'RHOART' rhoart.
        fill_lt_selections 'RFAREA' rfarea.    "note 401961
        fill_lt_selections 'STAGR'  stagr.
        fill_lt_selections 'RTCUR'  rtcur.
        fill_lt_selections 'RUNIT'  runit.
        fill_lt_selections 'VERSA'  versa.
        fill_lt_selections 'EPRCTR' eprctr.
        fill_lt_selections 'AFABE'  afabe.
        fill_lt_selections 'RMVCT'  rmvct.
        fill_lt_selections 'DOCCT'  docct.
        fill_lt_selections 'DOCNR'  docnr.
        fill_lt_selections 'REFDOCCT' refdocct.
        fill_lt_selections 'REFDOCNR' refdocnr.
        fill_lt_selections 'WERKS'  werks.
        fill_lt_selections 'REP_MATNR' repmatnr.
        fill_lt_selections 'RSCOPE' rscope.
        fill_lt_selections 'HRKFT'  hrkft.   "note 550972
        fill_lt_selections 'SBUKRS' sbukrs.  "note 550972
        fill_lt_selections 'SHOART' shoart.  "note 550972
        fill_lt_selections 'SFAREA' sfarea.  "note 550972
        CALL FUNCTION 'EC_PCA_SELECT_FROM_ARCHIVE'
          EXPORTING
            i_selections            = lt_selections[]
            i_files_sequential_read = lr_files[]
          IMPORTING
            e_glpca                 = lt_glpca_archiv[]
          EXCEPTIONS
            no_infostruc_found      = 1.
        IF sy-subrc = 1.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CLEAR i_glpca.
        LOOP AT lt_glpca_archiv ASSIGNING <glpca_arc>
                        WHERE ( rprctr IN v_prctr  )
                          and ( sprctr IN v_pprctr )
                          AND ( racct  IN v_racct  ).
          MOVE-CORRESPONDING <glpca_arc> TO i_glpca.
          APPEND i_glpca.
        ENDLOOP.
    * delete duplicate records                                   note 639647
        IF NOT read_db IS INITIAL AND NOT lt_glpca_archiv[] IS INITIAL.
          SORT i_glpca.
          DELETE ADJACENT DUPLICATES FROM i_glpca.
        ENDIF.
      ENDIF.
      IF i_glpca[] IS INITIAL.         "Info,nichts gefunden
        MESSAGE s000.
        EXIT.
      ENDIF.
    * get texts for accounts ...............................................
      SORT i_glpca BY kokrs racct.
      LOOP AT i_glpca ASSIGNING <glpca>.
        IF <glpca>-kokrs <> oldkokrs OR <glpca>-racct <> oldracct. "AT NEW
          CLEAR ls_rpcak.
          oldkokrs = <glpca>-kokrs.
          oldracct = <glpca>-racct.
          CALL FUNCTION 'K_RACCT_SINGLE_CHECK'         "note 0310592
               EXPORTING
                    i_kokrs    = <glpca>-kokrs
                    i_racct    = <glpca>-racct
                    i_spras    = sy-langu
                    i_textflag = 'X'
               IMPORTING
                    e_rpcak    = ls_rpcak
               EXCEPTIONS
                    not_valid  = 1
                    OTHERS     = 2.
          IF sy-subrc NE 0.
            CLEAR ls_rpcak.
          ENDIF.
        ENDIF.                             "ENDAT
        <glpca>-racct_ktext = ls_rpcak-ktext.
    * Fetching vendor name from vendor number
    *break-point.
         SELECT SINGLE * FROM LFA1
             WHERE LIFNR = <glpca>-LIFNR AND
             SPRAS = SY-LANGU.
         IF SY-SUBRC eq 0.
            <glpca>-name1 = lfa1-name1.
            <glpca>-adrnr = lfa1-adrnr.
            <glpca>-stras = lfa1-stras.
         ENDIF.
    * Fetching customer name from customer number
         SELECT SINGLE * FROM kna1
             WHERE KUNNR = <glpca>-KUNNR.
         IF SY-SUBRC eq 0.
            <glpca>-c_name1 = kna1-name1.
         ENDIF.
         SELECT SINGLE * FROM bseg
                WHERE BUKRS EQ <glpca>-rbukrs AND
                      BELNR EQ <glpca>-refdocnr AND
                      GJAHR EQ <glpca>-ryear AND
                      KTOSL EQ 'WIT' AND
                      BUZEI EQ <glpca>-refdocln.
         IF SY-SUBRC eq 0.
           SELECT SINGLE * FROM WITH_ITEM
                  WHERE BUKRS EQ <glpca>-rbukrs AND
                        BELNR EQ <glpca>-refdocnr AND
                        GJAHR EQ <glpca>-ryear." AND
    *                    BUZEI EQ <glpca>-refdocln AND
    *                    WITHT EQ BSEG-QSSKZ.
           IF SY-SUBRC eq 0.
              <glpca>-v_rate = with_item-qsatz.
              <glpca>-qsshb = with_item-WT_QSSHB.
              <glpca>-qbshb = with_item-WT_QBSHB.
           ENDIF.
         ENDIF
      ENDLOOP.
    * Liste mit Einzelposten geeignet sortieren.............................
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          text = 'Einzelposten sortieren'(p30).
    *  if show_ref is initial.
    *    sort i_glpca by rldnr ryear rbukrs rrcty rvers
    *                    docct docnr docln.
    *  else.
      SORT i_glpca BY rldnr kokrs ryear rbukrs rrcty rvers poper
                      refdocct refdocnr refdocln.
    *  endif.
    * Berechtigungsprüfung und gemerkte Belege aufbereiten .................
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          text = 'Berechtigungsprüfungen'(p40).
      CLEAR: cnt_rldnr, cnt_kokrs, cnt_ryear, cnt_rvers, cnt_bukrs.
      LOOP AT i_glpca ASSIGNING <glpca>.
    *   Berechtigungscheck
        PERFORM check_repo_authority CHANGING authorised.
        IF authorised IS INITIAL.
          DELETE i_glpca.
          s_message = 'X'.
    *     zählen der Sätze ohne Berechtigung
          auth_dbcount = auth_dbcount + 1.
        ELSE. "Weitere Bearbeitung nur für berechtigte Belege...
    *     Zusätzlich merken der Anzahl der Ausprägungen
    *     bestimmter Dimensionen
          ON CHANGE OF <glpca>-rldnr.
            ADD 1 TO cnt_rldnr.
          ENDON.
          ON CHANGE OF <glpca>-kokrs.
            ADD 1 TO cnt_kokrs.
            CALL FUNCTION 'G_CURRENCY_FROM_CT_GET'
              EXPORTING
                ct       = '90'
                kokrs    = <glpca>-kokrs
                rldnr    = <glpca>-rldnr
              IMPORTING
                currency = ksl_curr.
          ENDON.
          ON CHANGE OF <glpca>-poper.
            ADD 1 TO cnt_poper.
          ENDON.
          ON CHANGE OF <glpca>-ryear.
            ADD 1 TO cnt_ryear.
          ENDON.
          ON CHANGE OF <glpca>-rvers.
            ADD 1 TO cnt_rvers.
          ENDON.
          ON CHANGE OF <glpca>-rbukrs.
            ADD 1 TO cnt_bukrs.
            CALL FUNCTION 'G_CURRENCY_FROM_CT_GET'
              EXPORTING
                bukrs    = <glpca>-rbukrs
                ct       = '10'
              IMPORTING
                currency = hsl_curr.
          ENDON.
    *     externe Immobilienbezeichnung                     "ww/kb
    *     on change of i_glpca-imkey.
          IF ( NOT <glpca>-imkey IS INITIAL ).
            CALL FUNCTION 'REMD_IMKEY_TO_EMPGE'
                 EXPORTING
                      i_imkey    = <glpca>-imkey
                      i_dabrz    = <glpca>-dabrz
    *                 I_length   = 20
                 IMPORTING
                      e_empge    = <glpca>-empge
                      e_konty    = <glpca>-konty
                 EXCEPTIONS
                      not_found  = 1.
            IF sy-subrc NE 0.
              CLEAR <glpca>-empge.
              CLEAR <glpca>-konty.
            ENDIF.
    *       CONCATENATE I_GLPCA-KONTY I_GLPCA-EMPGE INTO I_GLPCA-IMBEZ.
          ENDIF.
    *     endon.
    *     on change of i_glpca-dabrz.
    *        call function 'REMD_IMKEY_TO_EMPGE'
    *             exporting
    *                  i_imkey    = i_glpca-imkey
    *                  i_dabrz    = i_glpca-dabrz
    **                 i_length   = 20
    *             importing
    *                  e_empge    = i_glpca-empge
    *                  e_konty    = i_glpca-konty.
    **       CONCATENATE I_GLPCA-KONTY I_GLPCA-EMPGE INTO I_GLPCA-IMBEZ.
    *      endon.
    *     Konvertierungsproblem mit PSP-Nummer bereinigen
          IF NOT <glpca>-ps_psp_pnr IS INITIAL.
            IF <glpca>-ps_psp_pnr EQ space.
              CLEAR <glpca>-ps_psp_pnr.
            ELSE.
              WRITE <glpca>-ps_psp_pnr TO <glpca>-psppp.
              CALL FUNCTION 'CONVERSION_EXIT_ABPSN_INPUT'
                EXPORTING
                  input  = <glpca>-psppp
                IMPORTING
                  output = <glpca>-psppp.
            ENDIF.
          ENDIF.
    *     Währungen in Hilfsfeldern speichern
          IF <glpca>-hsl_curr IS INITIAL.
            <glpca>-hsl_curr = hsl_curr.
          ENDIF.
          IF <glpca>-ksl_curr IS INITIAL.
            <glpca>-ksl_curr = ksl_curr.
          ENDIF.
    *     modify i_glpca.
        ENDIF.
      ENDLOOP.
    * Nachricht, wenn nicht alle Einzelposten angezeigt werden.
      IF NOT s_message IS INITIAL.
        MESSAGE s407(km) WITH auth_dbcount.
      ENDIF.
    * EP ausgeben...........................................................
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          text = 'Einzelposten ausgeben'(p50).
      t_layout-detail_initial_lines = 'X'.
      t_layout-detail_popup         = 'X'.
      t_layout-f2code               = 'PIC1'.                "MICP40K039857
      t_layout-get_selinfos         = 'X'.
      t_layout-group_change_edit    = 'X'.                   "note 576149
      PERFORM fill_listheader.
      PERFORM fieldcat_fill.
      PERFORM spec_groups_fill.
      PERFORM events_fill.                 "MICP40K039857
      ">>MICP40K039857
    *  call function 'K_KKB_LIST_DISPLAY'
    *       exporting
    *            i_callback_program       = 'Z_RCOPCA02_1
    *            i_callback_user_command  = 'USR_CMD'
    *            i_callback_top_of_page   = 'TOP_OF_PAGE'
    **           I_CALLBACK_END_OF_PAGE   =
    **           I_CALLBACK_END_OF_LIST   =
    *            i_callback_pf_status_set = 'SET_PF_STATUS'
    **           I_CALLBACK_LAYOUT_SAVE   =
    **           I_CALLBACK_FIELDCAT_SAVE =
    *            i_tabname                = 'I_GLPCA'
    *            is_layout                = t_layout
    *            it_fieldcat              = t_fieldcat
    **           I_FCTYPE                 = 'R'
    **           IT_EXCLUDING             =
    *            it_special_groups        = t_spec_groups
    **           IT_SORT                  =
    **           IS_SEL_HIDE              =
    **           I_SCREEN_START_COLUMN    = 0
    **           I_SCREEN_START_LINE      = 0
    **           I_SCREEN_END_COLUMN      = 0
    **           I_SCREEN_END_LINE        = 0
    *       tables
    *            t_outtab                 = i_glpca
    *       exceptions
    *            others                   = 1.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    *  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
    *         I_INTERFACE_CHECK        = ' '
               i_callback_program       = 'Z_RCOPCA02_1'
               i_callback_pf_status_set = 'SET_PF_STATUS'
               i_callback_user_command  = 'USR_CMD'
               i_structure_name         = 'I_GLPCA'
               is_layout                = t_layout
               it_fieldcat              = t_fieldcat
    *         IT_EXCLUDING             =
               it_special_groups        = t_spec_groups
    *         IT_SORT                  =
    *         IT_FILTER                =
    *         IS_SEL_HIDE              =
               i_default                = 'X'
               i_save                   = g_save
               is_variant               = g_variant
               it_events                = t_events
    *         IT_EVENT_EXIT            =
    *         IS_PRINT                 =
    *         I_SCREEN_START_COLUMN    = 0
    *         I_SCREEN_START_LINE      = 0
    *         I_SCREEN_END_COLUMN      = 0
    *         I_SCREEN_END_LINE        = 0
    *    IMPORTING
    *         E_EXIT_CAUSED_BY_CALLER  =
    *         ES_EXIT_CAUSED_BY_USER   =
          TABLES
               t_outtab                 = i_glpca
        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.
      "<<MICP40K039857
      CLEAR i_glpca.
    *&      Form  CHECK_REPO_AUTHORITY
    *  Check only new auth-object K_PCA                                    *
    *  -->  p1        text
    *  <--  p2        text
    FORM check_repo_authority CHANGING authorized LIKE authorised.
    * fill structure for userexit in K_PCA_RESP_AUTHORITY_CHECK
      DATA: auth LIKE pca_i_auth.          "46a MIC check K_PCA and G_GLTP
      auth-bukrs = <glpca>-rbukrs.
      auth-rldnr = <glpca>-rldnr.
      auth-rvers = <glpca>-rvers.
      auth-rrcty = <glpca>-rrcty.
      CLEAR authorized.
    * check PrCtr/account/activity
      CALL FUNCTION 'K_PCA_RESP_AUTHORITY_CHECK'
        EXPORTING
          i_kokrs             = <glpca>-kokrs
          i_prctr             = <glpca>-rprctr
          i_kstar             = <glpca>-racct
          i_vorgn             = 'REPP'
          i_actvt             = '28'
          i_auth              = auth
          i_no_dialog_message = 'X'
        EXCEPTIONS
          no_authority        = 1
          data_missing        = 2
          OTHERS              = 3.
      IF sy-subrc = 0.                                          "ok
    * check ledger/version/record type
        CALL FUNCTION 'PCA_G_GLTP_AUTH_CHECK'
          EXPORTING
            rldnr            = <glpca>-rldnr
            rvers            = <glpca>-rvers
            rrcty            = <glpca>-rrcty
          EXCEPTIONS
            no_authorisation = 1
            OTHERS           = 2.
        IF sy-subrc = 0.                   "ok, User is authorized
          authorized = 'X'.
        ENDIF.
      ENDIF.
    ENDFORM.                               " CHECK_REPO_AUTHORITY
    *&      Form  INIT_VARS
    *       Initialisieren diverser Hilfsvariablen und -tabellen           *
    FORM init_vars.
      DATA BEGIN OF nametab OCCURS 80. "Tabelle mit Feldern aus der RPCA2
              INCLUDE STRUCTURE dntab.
      DATA END OF nametab.
      SELECT SINGLE * FROM t000
                      CLIENT SPECIFIED
                      WHERE mandt = sy-mandt.
      REFRESH nametab.
      CALL FUNCTION 'NAMETAB_GET'
        EXPORTING
          only    = 'T'
          tabname = 'RPCA2'
        TABLES
          nametab = nametab.
    * Übernehmen der Feldnamen, die auch in der GLPCA
    * vorkommen.
      LOOP AT nametab WHERE fieldname NE 'KSL_CURR'
                        AND fieldname NE 'HSL_CURR'
                        AND fieldname NE 'EMPGE'               "ww/kb
                        AND fieldname NE 'KONTY'.              "ww/kb
        MOVE nametab-fieldname TO tab_fields-name.
        APPEND tab_fields.
      ENDLOOP.
    * fill Fields of receiver for BBS                          "MIC46C
      CALL FUNCTION 'RSTI_REPORT_FIELDS_FIND'
        EXPORTING
          e_repid   = 'Z_RCOPCA02_1'
          e_type    = 'R'
        TABLES
          it_fields = bbs_fieldtab.
    * correct fieldnames
      READ TABLE bbs_fieldtab WITH KEY rfield = 'PRCTR'.
      IF sy-subrc = 0.
        bbs_fieldtab-rfield = 'RPRCTR'.
        MODIFY bbs_fieldtab INDEX sy-tabix.
      ENDIF.
      READ TABLE bbs_fieldtab WITH KEY rfield = 'PPRCTR'.
      IF sy-subrc = 0.
        bbs_fieldtab-rfield = 'SPRCTR'.
        MODIFY bbs_fieldtab INDEX sy-tabix.
      ENDIF.
      READ TABLE bbs_fieldtab WITH KEY rfield = 'BUKRS'.
      IF sy-subrc = 0.
        bbs_fieldtab-rfield = 'RBUKRS'.
        MODIFY bbs_fieldtab INDEX sy-tabix.
      ENDIF.
    * Unicode
      CLASS cl_abap_char_utilities DEFINITION LOAD.
      CLEAR hex00 WITH cl_abap_char_utilities=>minchar.
      CLEAR hexff WITH cl_abap_char_utilities=>maxchar.
    ENDFORM.                               " INIT_VARS
    *       FORM FILL_LISTHEADER                                          *
    *       List-Header in Abhängigkeit der selektierten Daten            *
    FORM fill_listheader.
      READ TABLE i_glpca INDEX 1.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      t_listheader-typ  = 'S'.
      t_listheader-key  = 'Ledger              '(h01).
      IF cnt_rldnr <= 1.
        t_listheader-info = i_glpca-rldnr.
      ELSE.
        t_listheader-info = '*'.
      ENDIF.
      APPEND t_listheader.
      t_listheader-typ  = 'S'.
      t_listheader-key  = 'Kostenrechnungskreis'(h02).
      IF  cnt_kokrs <= 1.
        t_listheader-info = i_glpca-kokrs.
      ELSE.
        t_listheader-info = '*'.
      ENDIF.
      APPEND t_listheader.
      t_listheader-typ  = 'S'.
      t_listheader-key  = 'Buchungskreis       '(h03).
      IF cnt_bukrs <= 1.
        t_listheader-info = i_glpca-rbukrs.
      ELSE.
        t_listheader-info = '*'.
      ENDIF.
      APPEND t_listheader.
      t_listheader-typ  = 'S'.
      t_listheader-key  = 'Buchungsperiode     '(h04).
      IF cnt_poper <= 1.
        t_listheader-info = i_glpca-poper.
      ELSE.
        t_listheader-info = '*'.
      ENDIF.
      APPEND t_listheader.
      IF cnt_ryear <= 1.
        t_listheader-typ  = 'S'.
        t_listheader-key  = 'Geschäftsjahr       '(h05).
        t_listheader-info = i_glpca-ryear.
        APPEND t_listheader.
      ENDIF.
      t_listheader-typ  = 'S'.
      t_listheader-key  = 'Version             '(h06).
      IF cnt_rvers <= 1.
        t_listheader-info = i_glpca-rvers.
      ELSE.
        t_listheader-info = '*'.
      ENDIF.
      APPEND t_listheader.
    ENDFORM.                    "fill_listheader
    *&      Form  FIELDCAT_FILL
    *&      Aufbau des Feldkataloges für den K_KKB_LIST_DISPLAY,           *
    *&      bzw REUSE_ALV_LIST_DISPLAY,                                    *
    *&      weitere Infos enthält die FktBaustein-Doku                     *
    FORM fieldcat_fill.
      DATA: i TYPE i VALUE 0.
      REFRESH t_fieldcat.
    * Ledger
    *  if cnt_rldnr > 1.
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RLDNR'.
      afield-no_sum      = 'X'.
      afield-no_out      = 'X'.
    *   afield-key         = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-sp_group    = '1'.
      APPEND afield TO t_fieldcat.
    *  endif.
    * Satzart
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RRCTY'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '1'.
      APPEND afield TO t_fieldcat.
    * Version
    *  if cnt_rvers > 1.
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RVERS'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '1'.
      APPEND afield TO t_fieldcat.
    *  endif.
    * Periode
    *  if cnt_poper > 1.
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'POPER'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '1'.
      APPEND afield TO t_fieldcat.
    *  endif.
    * Geschäftsjahr
    *  if cnt_ryear > 1.
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RYEAR'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '1'.
      APPEND afield TO t_fieldcat.
    *  endif.
    * Referenzbelegtyp
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'REFDOCCT'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-sp_group    = '2'.
      afield-seltext_s   = 'Typ'(t01).
      afield-seltext_m   = 'Belegtyp'(t02).
      afield-seltext_l   = 'Ref.Belegtyp'(t03).
      afield-outputlen   = 3. "Platz für die Sterne der Zwischensummen
    *  if not show_ref is initial.
      afield-key = 'X'.
    *  else.
    *    afield-no_out = 'X'.
    *  endif.
      APPEND afield TO t_fieldcat.
    * Referenzbelegnummer
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'REFDOCNR'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-sp_group    = '2'.
      afield-seltext_s  = 'Refbeleg'(t04).
      afield-seltext_m  = 'Refbelegnr'(t05).
      afield-seltext_l  = 'Ref.Belegnummer'(t06).
    *  if not show_ref is initial.
      afield-key = 'X'.
    *  else.
    *    afield-no_out = 'X'.
    *  endif.
      APPEND afield TO t_fieldcat.
    * Referenzbelegzeile
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'REFDOCLN'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-sp_group    = '2'.
      afield-seltext_s   = 'Zeile'(t07).
      afield-seltext_m   = 'Belegzeile'(t08).
      afield-seltext_l   = 'Ref.Belegzeile'(t09).
    *  if not show_ref is initial.
      afield-key = 'X'.
    *  else.
    *    afield-no_out = 'X'.
    *  endif.
      APPEND afield TO t_fieldcat.
    * Belegtyp PCA
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'DOCCT'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-sp_group    = '1'.
      afield-outputlen   = 3. "Platz für die Sterne der Zwischensummen
    *  if show_ref is initial.
      afield-key = 'X'.
    *  else.
      afield-no_out = 'X'.
    *  endif.
      APPEND afield TO t_fieldcat.
    * Belegnummer PCA
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'DOCNR'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-sp_group    = '1'.
    *  if show_ref is initial.
      afield-key = 'X'.
    *  else.
      afield-no_out = 'X'.
    *  endif.
      APPEND afield TO t_fieldcat.
    * Belegzeile PCA
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'DOCLN'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-sp_group    = '1'.
    *  if show_ref is initial.
      afield-key = 'X'.
    *  else.
      afield-no_out = 'X'.
    *  endif.
      APPEND afield TO t_fieldcat.
    * Kostenrechnungskreis
    *  if cnt_kokrs > 1.
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'KOKRS'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-no_out      = 'X'.
      afield-sp_group    = '7'.
      APPEND afield TO t_fieldcat.
    *  endif.
    * Buchungskreis
    *  if cnt_bukrs > 1.
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RBUKRS'.
      afield-ref_tabname = 'GLPCA'.
      afield-key_sel     = 'X'.
      afield-no_sum      = 'X'.
      afield-no_out      = 'X'.
      afield-seltext_s  = 'BuKrs'(b01).
      afield-seltext_m  = 'BuKrs'(b02).
      afield-seltext_l  = 'Empfänger-BuKrs'(b03).
      afield-sp_group    = '8'.
      APPEND afield TO t_fieldcat.
    *  endif.
    * Profit Center
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RPRCTR'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-sp_group    = '7'.
      APPEND afield TO t_fieldcat.
    * Eliminierungs-Profit-Center
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'EPRCTR'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '7'.
      APPEND afield TO t_fieldcat.
    * Sender-Profit-Center
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'SPRCTR'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-sp_group    = '7'.
      APPEND afield TO t_fieldcat.
    * Konto
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RACCT'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-sp_group    = '7'.
      APPEND afield TO t_fieldcat.
      ADD 1 TO i.
    * Kontentext
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RACCT_KTEXT'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'RPCAK'.
      afield-ref_fieldname = 'KTEXT'.
      afield-seltext_s   = 'Kont-txt.'(m11).
      afield-seltext_m   = 'Kontentext'(m12).
      afield-seltext_l   = 'Kontentext'(m13).
      afield-sp_group    = '7'.
      APPEND afield TO t_fieldcat.
      ADD 1 TO i.
    * Statistische Kennzahl
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'STAGR'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '12'.
      APPEND afield TO t_fieldcat.
    * Soll/Haben-Kennzeichen
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'DRCRK'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '1'.
      APPEND afield TO t_fieldcat.
    * Wert in Profit-Center-Währung
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'KSL'.
      afield-do_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
    *  AFIELD-SELTEXT_S   = 'PrCtr-Hauswhr.'(P01).
    *  AFIELD-SELTEXT_M   = 'PrCtr-Hauswährung'(P02).
    *  AFIELD-SELTEXT_L   = 'Profit-Center-Hauswährung'(P03).
      afield-cfieldname  = 'KSL_CURR'.
      afield-sp_group    = '3'.
      APPEND afield TO t_fieldcat.
    * Währungsschlüssel KSL
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos       = i.
      afield-fieldname     = 'KSL_CURR'.
      afield-ref_tabname   = 'TKA01'.
      afield-ref_fieldname = 'PCACUR'.
      afield-no_sum        = 'X'.
      afield-no_out        = 'X'.
      afield-seltext_s     = 'PrCtrHW'(t10).
      afield-seltext_m     = 'Währungsschl. PrCtrHW'(t11).
      afield-seltext_l     = 'Währungsschl. PrCtrHW'(t12).
      afield-sp_group      = '3'.
      APPEND afield TO t_fieldcat.
    * Betrag in Hauswährung
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'HSL'.
      afield-do_sum      = 'X'.
      afield-no_out      = 'X '.
      afield-ref_tabname = 'GLPCA'.
      afield-cfieldname  = 'HSL_CURR'.
      afield-sp_group    = '4'.
      APPEND afield TO t_fieldcat.
    * Währungsschlüssel Hauswährung
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos       = i.
      afield-fieldname     = 'HSL_CURR'.
      afield-ref_tabname   = 'T001'.
      afield-ref_fieldname = 'WAERS'.
      afield-no_sum        = 'X'.
      afield-no_out        = 'X '.
      afield-seltext_s     = 'BukrW.'(t13).
      afield-seltext_m     = 'Währungsschl. BukrW'(t14).
      afield-seltext_l     = 'Währungsschl. BukrW'(t15).
      afield-sp_group      = '4'.
      APPEND afield TO t_fieldcat.
    * Betrag in Transaktionswährung
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'TSL'.
      afield-no_out      = 'X '.
      afield-ref_tabname = 'GLPCA'.
      afield-cfieldname  = 'RTCUR'.
      afield-sp_group    = '5'.
      APPEND afield TO t_fieldcat.
    * Währungsschlüssel Transaktionswährung
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos       = i.
      afield-fieldname     = 'RTCUR'.
      afield-ref_tabname   = 'GLPCA'.
      afield-ref_fieldname = 'RTCUR'.
      afield-no_sum        = 'X'.
      afield-no_out        = 'X '.
      afield-seltext_s     = 'TW  '(t16).
      afield-seltext_m     = 'Währungsschl. TW'(t17).
      afield-seltext_l     = 'Währungsschl. TW'(t18).
      afield-sp_group      = '5'.
      APPEND afield TO t_fieldcat.
    * Menge
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'MSL'.
      afield-qfieldname  = 'RUNIT'.
      afield-no_out      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-sp_group      = '6'.
      APPEND afield TO t_fieldcat.
    * Mengeneinheit
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RUNIT'.
      afield-no_sum      = 'X'.
      afield-no_out      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-sp_group      = '6'.
      APPEND afield TO t_fieldcat.
    * Herkunftsobjektart
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RHOART'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group      = '7'.
      APPEND afield TO t_fieldcat.
    * Funktionsbereich
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RFAREA'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group      = '7'.
      APPEND afield TO t_fieldcat.
    * Objektklasse
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'RSCOPE'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group      = '1'.
      APPEND afield TO t_fieldcat.
    * G/L-Vorgang
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'ACTIV'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-seltext_s     = 'Vorg.'(t31).
      afield-seltext_m     = 'Vorgang'(t32).
      afield-seltext_l     = 'Betriebswirt. Vorgang'(t33).
      afield-sp_group      = '1'.
      APPEND afield TO t_fieldcat.
    * Geschäftsbereich
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'GSBER'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group      = '8'.
      APPEND afield TO t_fieldcat.
    * Kostenstelle
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'KOSTL'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '9'.
      APPEND afield TO t_fieldcat.
    * CO-Auftrag
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'AUFNR'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-sp_group    = '9'.
      APPEND afield TO t_fieldcat.
    * Projekt
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'PSPPP'.
      afield-no_sum      = 'X'.
      afield-no_out      = 'X'.
      afield-sp_group    = '9'.
      afield-ref_tabname   = 'PRPS'.
      afield-ref_fieldname = 'POSID'.
      APPEND afield TO t_fieldcat.
    * Debitor
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'KUNNR'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-seltext_s   = 'Debitor'(d01).
      afield-seltext_m   = text-d01.
      afield-seltext_l   = text-d01.
      afield-sp_group    = '8'.
      APPEND afield TO t_fieldcat.
    * Customer Name
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'C_NAME1'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'KNA1'.
      afield-no_out      = 'X'.
      afield-seltext_s   = 'Customer Name'.
      afield-seltext_m   = 'Cust Name'.
      afield-seltext_l   = 'C Name'.
      afield-sp_group    = '8'.
      APPEND afield TO t_fieldcat.
    * Kreditor
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'LIFNR'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'GLPCA'.
      afield-no_out      = 'X'.
      afield-seltext_s   = 'Kreditor'(k01).
      afield-seltext_m   = text-k01.
      afield-seltext_l   = text-k01.
      afield-sp_group    = '8'.
      APPEND afield TO t_fieldcat.
    * Vendor name
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'NAME1'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'LFA1'.
      afield-no_out      = 'X'.
      afield-seltext_s   = 'Vendor Name'(v01).
      afield-seltext_m   = text-v01.
      afield-seltext_l   = text-v01.
      afield-sp_group    = '8'.
      APPEND afield TO t_fieldcat.
    * Withholding tax rate
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'V_RATE'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = 'WITH_ITEM'.
      afield-no_out      = 'X'.
      afield-seltext_s   = 'Withholding tax rate'.
      afield-seltext_m   = 'With. tax rate'.
      afield-seltext_l   = 'W. Tax rate'.
      afield-sp_group    = '8'.
      APPEND afield TO t_fieldcat.
    * Withholding Tax Base Amount
      ADD 1 TO i.
      CLEAR afield.
      afield-col_pos     = i.
      afield-fieldname   = 'QSSHB'.
      afield-no_sum      = 'X'.
      afield-ref_tabname = '

    Hi pavan.
    something is definitely wrong with your code: You have an internal table for display with fields from rpca 2 and additional some more fields. I do not see a field ORT01 for CITY or PSTLZ for POSTAL CODE, at least to in table GLPCA from where the data are extracted.
    You must fill PSTLZ and ORT01 (if it is for the supplier):
         SELECT SINGLE * FROM LFA1
             WHERE LIFNR = <glpca>-LIFNR AND
             SPRAS = SY-LANGU.
         IF SY-SUBRC eq 0.
            <glpca>-name1 = lfa1-name1.
            <glpca>-adrnr = lfa1-adrnr.
            <glpca>-stras = lfa1-stras.
    **** add here: ***
      select single ort01 pstlz
        into corresponding fields of <glpca>
        from adrc
        where adrnr = <glpca>-adrnr.
         ENDIF.
    Make sure that fields ORT01 and PSTLZ are defined for internal table i_glpca.
    Regards,
    Clemens

  • Query Regarding Early Watch Report

    Hi All,
    I have certain queries regarding the Early Watch Report.
    Our platform in Oracle 10g and OS is HP-UX.Please sombody help me with the following.
    1.What is Early Watch report and why we use it?
    2.How to configure Early watch report from Solution Manager for DEV and QUA and PRO server?
    3.If we dont configure will SAP take it from the system by logging in to client 066(correct me if I am wrong).
    I have read SAP notes 20722,917558,12103,371023 but cant really make out how to configure it for our servers via Solution Manager.
    PS:Helpful suggestions will be obliged and rewarded.
    Regards,
    Ashutosh

    Hi Ashutosh,
    Please check below answers for your queries:
    1.What is Early Watch report and why we use it?
    The SAP EarlyWatch Alert is a diagnosis service, for the solution monitoring of SAP and non-SAP systems in the SAP Solution ManagerThis process identifies potential problems early, avoids bottlenecks and monitors the performance of your systems. SAP EarlyWatch Alert monitors your most important business processes and systems.
    2.How to configure Early watch report from Solution Manager for DEV and QUA and PRO server?
    Prerequisites to configure the Early Watch Report:
    You have:
    ·        set up RFC connections between your satellite systems and the SAP Solution Manager system, and an RFC connection between the SAP Solution Manager and the SAP Service Marketplace.
    ·        checked the availability of the required tools for the SAP service session (ST-A, ST-PI add-on), with the report RTCCTOOL.
    ·        assigned the Solution Monitoring roles to the users.
    ·        set up the Automatic Session Manager (ASM) in the Service Data Control Center (transaction: SDCCN) for all SAP satellite systems and the central SAP Solution Manager of your solution (SAP note 91488).
    ·        set up your systems in a solution landscape in the SAP Solution Manager.
    Configuration steps:
    1.      You configure the SAP EarlyWatch Alert scheduling in the SAP Solution Manager.
    You have:
    ¡        scheduled the service sessions for your solution, in the SAP Solution Manager Solution Directory
    Procedure:
           1.      Choose the transaction SOLUTION_MANAGER.
           2.      Choose the Solution Landscape tab in the Operations Setup area.
           3.      Choose the Solution Settings link.
    You go to the Solution Directory.
    Alternatively, you can also select a solution from the Overview of active solutions and go to the Solution Directory.
           4.      Select your solution.
           5.      You can also enter contact person data in the Contact Person tab.
          Proceed as follows:
                                                      i.       Choose Add Contact Person.
                                                    ii.       Enter the required data.
                                                   iii.       Save your entries.
    §         The contact data appears in the Solution Monitoring sessions, e.g. in Set-Up Business Process Monitoringsapurl_link_0001_0004_0005.
           6.      Specify the settings for your solution, in the Solution Settings tab:
            Ex:  Day of SAP EarlyWatch Alert data download
    At the end save your entries.
    3.If we dont configure will SAP take it from the system by logging in to client 066?
    Yes, SAP uses this client when running the Early Watch Check.
    Hope it clears your doubt.
    Thanks
    Kishore

  • Doubt on Reports

    Hi gurus,
    I have one query with me,Please help me out this.
    I developed a report, In that I wrote so many select queries all are working fine.And also I wrote some error messages if the data is not selected.
    Here my doubt is if the data is not selected, The message what I was wrote,that is displayed,But that is diplayed in next scree.I want that message in the selection screen it self.
         Means ,If I am in selection-screen , If the data is not selected for my inputs, The error message will be displayed in the same selection screen it self.
          Please can any one suggest me regarding this.
      Thanks in Advance
    Thanks and Regards
    Siri....

    Hi Siri,
    try like this...
    DATA: t_sflight TYPE TABLE OF sflight.
    PARAMETERS: p_carr TYPE sflight-carrid.
    AT SELECTION-SCREEN.
      IF p_carr IS INITIAL.
        MESSAGE e050(zmsg).
      ENDIF.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO TABLE t_sflight
      WHERE carrid = p_carr.
      IF sy-subrc EQ 0.
        MESSAGE i060(zmsg).
      ENDIF.
    Regards
    Adil

  • Regarding purchase order report in bw

    Hi guys,
                   I have a requirement for report in bw. I am getting data form datasources from po header and item level. In the report i have to show Purchase order quantity,
    Goods recived quantity, MRP and goods reciept value. Can u tell me what all the infoobjects i have to take for these fields in BW. Its urgent. I will definitley award points.Also tell me the fields from R/3 and from which tables they are coming from.
    Regards,
    Niranjan
    [email protected]

    Hi Niranjan,
                   check this link u will know all fields in bw and r/3..if u have any concerns get back to me.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ed/62073c44564d59e10000000a114084/frameset.htm(header level)
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ed/62073c44564d59e10000000a114084/frameset.htm  ( Item level)
    Regards anil.

  • Regarding standard aging reports

    Hi Experts/Gurus
        I need the standard reports for customer aging report and vendor aging report.
    Need immediate replies.
    Your answers can be rewarded with good points.
    Regards,
    kumar

    REPORT  zfi_customer_ageing
            NO STANDARD PAGE HEADING
            LINE-COUNT 58
           line-size 168
            MESSAGE-ID zh_msg.
           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: kna1,           " Customer 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 Customer Open Items Data
    DATA: BEGIN OF int_bsid OCCURS 0,
            kunnr   LIKE bsid-kunnr,         " Customer Number
            name1   LIKE kna1-name1,         " Customer Name
            shkzg   LIKE bsid-shkzg,         " Dr/Cr Indicator
            belnr   LIKE bsid-belnr,         " Document Number
            xblnr   LIKE bsid-xblnr,         " Ref Doc No
            blart   LIKE bsid-blart,         " Document Type
            zfbdt   LIKE bsid-zfbdt,         " Base Line Date
            zbd1t   LIKE bsid-zbd1t,         " Due date1
            zbd2t   LIKE bsid-zbd2t,         " Due Date2
            zbd3t   LIKE bsid-zbd3t,         " Due Date3
            waers   LIKE bsid-waers,         " Currency
            dmbtr   LIKE bsid-dmbtr,         " Amount in Local Curr
          END OF int_bsid.
    Internal Table for Amounts Sum Up Data
    DATA: BEGIN OF int_final OCCURS 0,
            kunnr   LIKE bsid-kunnr,         " Customer Number
            name1   LIKE kna1-name1,         " Customer Name
            total1  LIKE bsid-dmbtr,         " Amount in Local Curr
            total2  LIKE bsid-dmbtr,         " Amount in Local Curr
            total3  LIKE bsid-dmbtr,         " Amount in Local Curr
            total4  LIKE bsid-dmbtr,         " Amount in Local Curr
            total5  LIKE bsid-dmbtr,         " Amount in Local Curr
            total6  LIKE bsid-dmbtr,         " Amount in Local Curr
            total   LIKE bsid-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 bsid-dmbtr,   " Amount Totals
           v_gtotal2     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal3     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal4     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal5     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal6     LIKE bsid-dmbtr,   " Amount Totals
           v_gtotal      LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal1   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal2   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal3   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal4   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal5   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal6   LIKE bsid-dmbtr,   " Amount Totals
           v_subtotal    LIKE bsid-dmbtr,   " Amount Totals
           v_date        LIKE bsid-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 bsid-zfbdt,      " Date Range 1
            r_date2 FOR bsid-zfbdt,      " Date Range 2
            r_date3 FOR bsid-zfbdt,      " Date Range 3
            r_date4 FOR bsid-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_kunnr FOR kna1-kunnr. "Customer 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 Customer Code
      CLEAR kna1-kunnr.
      SELECT kunnr UP TO 1 ROWS
          INTO kna1-kunnr
          FROM kna1
          WHERE kunnr IN s_kunnr AND
                spras = sy-langu.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH 'Invalid Customer 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 Customer Open Items data from bsid
      SELECT l~kunnr
             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_bsid
       FROM knb1 AS l INNER JOIN kna1 AS l1
                    ON lkunnr  = l1kunnr
           INNER JOIN   bsid AS b
             ON lkunnr  = bkunnr AND
                lbukrs  = bbukrs
             WHERE l~kunnr  IN s_kunnr 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_bsid WHERE
                  ( blart  NE 'RE' AND blart  NE 'KR' ) OR
                    shkzg  NE 'H'.
      SORT int_bsid BY kunnr.
    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 Customer 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)  'Customer#'(015) CENTERED,
             13 sy-vline ,14(35) 'Customer 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_bsid.
        CLEAR v_date.
        IF int_bsid-zbd3t <> ' '.
          v_date = int_bsid-zfbdt + int_bsid-zbd3t.
        ELSE.
          IF int_bsid-zbd2t <> ' '.
            v_date = int_bsid-zfbdt + int_bsid-zbd2t.
          ELSE.
            v_date = int_bsid-zfbdt + int_bsid-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsid-zbd1t = ' '.
          v_date = int_bsid-zfbdt.
        ENDIF.
        IF v_date IN r_date1.
          int_final-total1 =   int_final-total1 +  int_bsid-dmbtr.
        ELSEIF v_date IN r_date2.
          int_final-total2 =   int_final-total2 +  int_bsid-dmbtr.
        ELSEIF v_date IN r_date3.
          int_final-total3 =   int_final-total3 +  int_bsid-dmbtr.
        ELSEIF v_date IN r_date4.
          int_final-total4 =   int_final-total4 +  int_bsid-dmbtr.
        ELSEif v_date > r_date4-high.
          int_final-total5 =   int_final-total5 +  int_bsid-dmbtr.
        ELSEif v_date < p_allgst.
          int_final-total6 =   int_final-total6 +  int_bsid-dmbtr.
        ENDIF.
        AT END OF kunnr.
          v_flag = 1.
        ENDAT.
        IF v_flag = 1.
          int_final-kunnr = int_bsid-kunnr.
          int_final-name1 = int_bsid-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-kunnr 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_bsid-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsid-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsid-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsid-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsid-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsid-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsid-waers,
                      168 sy-vline.
          ELSE.
            WRITE :    50 int_final-total1 CURRENCY int_bsid-waers,
                       66 sy-vline,
                       67 int_final-total2 CURRENCY int_bsid-waers,
                       83 sy-vline,
                       84 int_final-total3 CURRENCY int_bsid-waers,
                      100 sy-vline,
                      101 int_final-total4 CURRENCY int_bsid-waers,
                      117 sy-vline,
                      118 int_final-total5 CURRENCY int_bsid-waers,
                      134 sy-vline,
                      135 int_final-total6 CURRENCY int_bsid-waers,
                      151 sy-vline,
                      152 int_final-total CURRENCY int_bsid-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_bsid-waers,
                  66 sy-vline, 67 v_gtotal2 CURRENCY int_bsid-waers,
                  83 sy-vline, 84 v_gtotal3 CURRENCY int_bsid-waers,
                 100 sy-vline,101 v_gtotal4 CURRENCY int_bsid-waers,
                 117 sy-vline,118 v_gtotal5 CURRENCY int_bsid-waers,
                 134 sy-vline,135 v_gtotal6 CURRENCY int_bsid-waers,
                 151 sy-vline,152 v_gtotal CURRENCY int_bsid-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_bsid BY belnr zfbdt.
      LOOP AT int_bsid WHERE kunnr EQ int_final-kunnr.
        v_rem = v_cnt MOD 2.
        CLEAR v_date.
        IF int_bsid-zbd3t <> ' '.
          v_date = int_bsid-zfbdt + int_bsid-zbd3t.
        ELSE.
          IF int_bsid-zbd2t <> ' '.
            v_date = int_bsid-zfbdt + int_bsid-zbd2t.
          ELSE.
            v_date = int_bsid-zfbdt + int_bsid-zbd1t.
          ENDIF.
        ENDIF.
        IF int_bsid-zbd1t = ' '.
          v_date = int_bsid-zfbdt.
        ENDIF.
        IF v_rem NE 0.
          format color 2 intensified.
          WRITE :/1 sy-vline, 2 int_bsid-belnr,
                 12 sy-vline,13 int_bsid-kunnr,
                 23 sy-vline,24 int_bsid-name1,
                 59 sy-vline,60 int_bsid-xblnr,
                 76 sy-vline,77 int_bsid-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_bsid-dmbtr CURRENCY int_bsid-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsid-dmbtr.
            WRITE : 88 int_bsid-dmbtr  CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsid-dmbtr.
            WRITE : 105 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsid-dmbtr.
            WRITE : 122 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsid-dmbtr.
            WRITE : 139 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsid-dmbtr.
            WRITE : 156 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsid-dmbtr.
            WRITE : 173 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ENDIF.
          format color off.
        ELSE.
          WRITE :/1 sy-vline, 2 int_bsid-belnr,
                 12 sy-vline,13 int_bsid-kunnr,
                 23 sy-vline,24 int_bsid-name1,
                 59 sy-vline,60 int_bsid-xblnr,
                 76 sy-vline,77 int_bsid-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_bsid-dmbtr CURRENCY int_bsid-waers,
                  206 sy-vline.
          IF v_date IN r_date1.
            v_subtotal1 =   v_subtotal1 +  int_bsid-dmbtr.
            WRITE : 88 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date2.
            v_subtotal2 =   v_subtotal2 +  int_bsid-dmbtr.
            WRITE : 105 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date3.
            v_subtotal3 =   v_subtotal3 +  int_bsid-dmbtr.
            WRITE : 122 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEIF v_date IN r_date4.
            v_subtotal4 =   v_subtotal4 +  int_bsid-dmbtr.
            WRITE : 139 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date > r_date4-high.
            v_subtotal5 =   v_subtotal5 +  int_bsid-dmbtr.
            WRITE : 156 int_bsid-dmbtr CURRENCY int_bsid-waers.
          ELSEif v_date < p_allgst.
            v_subtotal6 =   v_subtotal6 +  int_bsid-dmbtr.
            WRITE : 173 int_bsid-dmbtr CURRENCY int_bsid-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_bsid-waers ,
                 87 sy-vline,
                 88 v_subtotal1 CURRENCY int_bsid-waers,
                104 sy-vline,
                105 v_subtotal2 CURRENCY int_bsid-waers,
                121 sy-vline,
                122 v_subtotal3 CURRENCY int_bsid-waers,
                138 sy-vline,
                139 v_subtotal4 CURRENCY int_bsid-waers,
                155 sy-vline,
                156 v_subtotal5 CURRENCY int_bsid-waers,
                172 sy-vline,
                173 v_subtotal6 CURRENCY int_bsid-waers,
                189 sy-vline,
                190 v_subtotal CURRENCY int_bsid-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 Customer 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) 'Customer#'(015) CENTERED,
               23 sy-vline, 24(35) 'Customer 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
    REPORT  zfi_vendor_ageing
            NO STANDARD PAGE HEADING
            LINE-COUNT 58
           line-size 168
            MESSAGE-ID zh_msg.
    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)
    M O D I F I C A T I O N    L O G
    Date       | Change Number | Initials      | Description
    30-Aug-2004 | DTSK900****   | Anji Reddy    | Initial
           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.

  • Urgent: Regarding Stock Ageing report

    hi,
    i want to have stock ageing report in which i want to have the deatils :-
    This is the material which is present in the palnt from dis <b>date</b> and further details of it consumption. plzz tell the <b>tcode</b> for it.
    plzz help me out as it is most urgent to me..
    regards,
    ric.s
    Message was edited by:
            ric .s

    Hi
    The report MC.9 shows Last movement date/Last receipt date / Last issue date.
    In period to analyze give appropriate date range
    Or
    check  MSEG & MARD table to get details about material documents with date
    Vishal...

  • Doubts in reports

    HI All,
         This is Pavani...Iam goin to attend interview this week...I hav no R/3 system
    installed in my PC...This is my first interview....Iam very nervy.
    I need ur help regarding tables n fields involved in the following reports.
    1.     Report to list by customer, the out standing payment amount due, the invoice date will be used to Determine for the invoice open date, the program will give company sales group and report totals.
    2.      Report in Material Master that outputs Material Valuated Stock, grouped by Material type and Plant. The output shows Material No., Storage Location, Unit of Measure and description in addition to group totals.
    3.     Vendor Performance Report that lists Vendor Name, Materials Supplied, Planned & Actual Delivery Times, Payments Terms and Prices.
    4.     reports in SD module such as sales order report, which covers all organization levels, delivery status, invoice status, shipping details and partner function details.
    5.     report on late shipment for the past four quarters, for the selected customers for specific sales organizations.
    6.     Interactive report for sales order’s their statuses along with their availability date and available quantity for the past quarters
    I really need ur help....ponts will be rewarded....
    Thanks in advance,
    Pavani.

    Hi Pavani,
    You situation is understandable.  But this is a Mini Project altogether
    1.  Accounts Receivables - BSID (FI Line Items), BSAD (FI Line Items), KNA1 (Customer Master), VBRK (Billing Header), Billing Doc No is the link between VBRK and BSID.
    2.  Stock Report - MARD (Plant, Storage Locationwise Current Stock), MARA (Material Master For Material Type), MAKT (Material Description)
    3.  Vendor Performance - EKKO (PO Header), EKPO (PO Item), EKET (Schedule Lines), MKPF (Material Document Header to Read GRNs), MSEG (Material Document Item), LFA1 (Vendor Master), T052* Tables (Payment Terms).
    4.  SD Reports - VBAK (Sale Document Header), VBAP (Sale Document Item), VBEP (Sale Document Schedule Lines), VBUK (Sale Order Status), VBUP (Sale Order Item Status), VBFA (Sales Document Flow), VBPA (Sales Partners), LIKP (Delivery Header), LIPS (Delivery Items), VTTK (Shipment Header), VTTP (Shipment Item), VBRK (Billing Header), VBRP (Billing Item), KONV (Condition Structure), J_1IEXCHDR (Excise Invoice Header), J_1IEXCDTL (Excise Invoice Item).
    5.  Late shipment details can be obtained with the help of above tables.
    6.  Availability Check is always futuristic.  Getting details for past period, as per my knowledge is impossible.
    I could give only table names.  For your requirement, the field list from each table will be pretty big.  Other friends of this forums might help you.
    Also from these tables you cannot generate report with simple queries.  You have to do lot of calculations and comparisons to generate reports.  You have to consider reversals, cancellations, exceptional situations in order to generate correct reports.
    Hope information is useful to you.
    Regards,
    Hema
    Message was edited by:
            Hema Nagarajan
    As Mr.Vijay said it is better not to put fake experience.  I have interviewed many candidates for a positions in our company.  I was able to identify very easily that the person has put fake experience.  Moreover when you project yourself as experienced candidate no one will ask you about reports.  You'll be asked questions on Performance Tuning, Enhancements, Interfacing kind of stuff.  You have to prepare well and be bit careful.  Theoretical knowledge will not work.
    Sorry I've dampened your spirit.
    Good Luck,
    Hema

  • SOME DOUBTS IN REPORTING

    HI ALL,
    IN RRI, WHAT IS THE MAXIMUM NO. OF QURIES WE CAN DRILL THROUGH FROM ONE QUERY?
    WILL IT BE POSSIBLE TO DISPLAY MORE THAN ONE QUERY IN ONE EXCEL SHEET?
    HOW TO FIND WHETHER THE TRANSACTION DATA HAS MASTER DATA?
    WHAT ARE TEXT VARIABLES, WHEN R THEY USED?
    REGARDS...

    Ganesh,
          There is no max no of RRI specified but you can have many as per the requirement.
    Yes it is possible to show more that one query result in a single sheet but it can be done only in a workbook. You can save as workbook and insert queries one below the other by taking care that the query result do not overlap.
    To find out whether the transaction data has master data or not....you can check in the Io definition if the with master data option is checked or not also if the master data object has any infosource.
    text variables are used in reporting. When the user enters the text it can be displayed as column heading for example...
    Hope this helps you......

Maybe you are looking for

  • Using shortcuts in Item Help Text

    Hello everyone, I have a problem using shortcuts in Help Text sections of items. It says in the help "Item help supports shortcuts using "SHORTCUT_NAME" syntax." but it seems not. In the shortcuts sections of the shared components, it doesn't says th

  • I used Migration Assistant and now it says the itunes is not up to date/will not let me open or update itunes. What do I do?

    How do I go about downloading or reloading Itunes onto my computer, without loosing all of my uploaded music?  I have attempted to reupload itunes and it will not successfully complete the download/does not give me an option to update itunes when i t

  • Ipod on my tv

    I have an Ipod classic 80gb about a year ago I bought an A/V composite cable and it worked great until a month or so ago now I can only get audio and not video I don't want to by another one since it's 50 bucks and I ain't got dime to my name what a

  • Printing Long Text of Production Order

    Dear all, Can we print the long text of Production Order using Co04N transaction? Please suggest. regards, Kumar

  • [SOLVED] xbindkeys fails to start

    $ xbindkeys xbindkeys: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory As you can see I'm having a bit of trouble launching xbindkeys. I can't find any post dealing with this on the forums