Sorting in Classical report

Hi friends,
I am working with a Stasndard FI Report   RFKOPR00,Right now In this report,data is not getting diplayed profitcenter wise.hence user wants me add profit center in selection-screen and sort the output, it is a simple classical report,by priftcenter by proving a Sort button in application tool bar.
Could you please let me know, How I can provide this option,and the proccedure.
Kindly, provide me sample code if available.
Follwoing is the code that Prints output data.
loop at it_item into wa_item.
format color col_normal.
write:/ sy-vline.
write : 2 wa_item-lifnr,
        12 wa_item-name1,
        30 wa_item-prctr,
        41 wa_item-bukrs,
        50 wa_item-belnr,
        60 wa_item-buzei,
        70 wa_item-netdt,
        80 wa_item-zfbdt,
        90 wa_item-budat,
        100 wa_item-bldat,
        110 wa_item-bschl,
        115 wa_item-zlsch,
        120 wa_item-WAERS,
        150 wa_item-wrshb.
WRITE : 170 SY-VLINE.
format color off.
endloop.
Regards,
Xavier.P.

Hi,
There is an enhancement point in the subroutine : FORM raster_ausgabe_alv_grid
Just sort the output table before the ALV list display in the standard program,
SORT <tablename> by <profitcenter>
For addition of new field on selection screen its not possible as there is no enhancement point to add your custom code..
Hope you need to copy the report into a Z report and make changes
Regards
Shiva

Similar Messages

  • Need help in sorting a column in classic report

    Hi I am trying to create and classic report and I need to do sorting on the columns. Also I am using a select list to filter the records in the column. When I am not using the select list the sorting is working but when I am using the selcet list and select the sort option then it is showing error. Can anyone help...
    Thnaks,
    Rik

    Select lists prior to v4 will sort on the return value. In v4, it sorts on the display value (as you're probably expecting). There's nothing really for you to fix here except if it's really important, see if you can get upgraded to v4.

  • Classic Report Sort problem

    I have a classic report that retrieves data based on the value in an item. When the page first opens the report retrieves properly. However, the strange thing is when I try to sort the rows by pressing the column header, I receive "No Data Found".
    The report is just very basic. Selecting a few columns from a table where ID = :P3_ID.
    If I change the where clause to be WHERE ID like '%' || :P3_ID, when it initially retrieves, I receive the data for the value in P3_ID. However, when I sort the report by a column header, it retrieves everything. It is as if P3_ID has been set to NULL or a blank eventhough it displays the proper ID.
    Any ideas?
    Thanks,

    Hi Brian,
    see the following thread Interactive Reports: problem with textfield as parameter for an explanation
    Patrick
    *** New *** Oracle APEX Essentials *** http://essentials.oracleapex.info/
    My Blog, APEX Builder Plugin, ApexLib Framework: http://www.oracleapex.info/

  • How to implement Dynamic Sort to an SQL classic report?

    Hi,
    I'm trying to implement dynamic sort to my working sql classic report, when user selects order by column from select item(action as submit page), the report should be refreshed and display with the selected column sort order.
    But not able to do so.
    Report Query:
    Select a, b, c from sample order by :P1_ORDER_BY
    P1_ORDER_BY - Select Item:
    STATIC2: Column 1;a, Column 2;b, Column 3;c
    Running page, report doesnt sorts in any of the column priority.
    Kindly guide.
    Regards,
    Krishna

    Of course the select item is in use.
    It should submit the the page on select so you can retrieve the current value in you report select statement.
    look here:
    http://apex.oracle.com/pls/apex/f?p=21296:2:
    table:
    create table sample
      a varchar2(30)
    , b varchar2(30)
    , c varchar2(30)
    insert into sample values('a','z','k');
    insert into sample values('b','y','d');
    insert into sample values('c','x','a');
    insert into sample values('d','w','b');
    commit;
    Select List:
    P2_ORDER_BY
    STATIC:Order by A;A,Order by B;B,Order by C;C
    Report select:
    select
    a,b,c
    from sample
    order by
      decode(:P2_ORDER_BY,'A',a,null)
    , decode(:P2_ORDER_BY,'B',b,null)
    , decode(:P2_ORDER_BY,'C',c,null)Marc
    Edited by: telemat on Aug 24, 2012 1:50 PM

  • Classic report ORA-00933 SQL command not properly ended when enabling sort

    Hi,
    Oracle 11g r2, APEX 4.1.1.00.23.
    I have some reports of type SQL Query (PL/SQL function body returning SQL query), so the source is like the following :
    begin
      return points_ui.get_points_query(:P0_FILTER_TYPE);
    end;Without any sort option, the report is rendering successfully.
    But I got the following error when a try to enable the sort option for a column :
    ORA-00933: SQL command not properly endedI read about this error on Oracle forums, and I saw it was a bug in a previous release, but I thought it was fixed in 4.0.2...
    Any help would be much appreciated.
    Thanks.
    Yann.

    OK indeed I had to remove the order by clause from the query, I should have tested this...
    I thought there were some checks in the internal APEX process to "merge" the order by clauses, but it seems it is not the case...
    Thank you for your help.
    Yann.

  • How to Link column header only in classic Report in APEX 4.1

    Hello Everybody,
    Probably there is a simpler way to do this, but I am not sure. I want a link on column header in Report on a specific column. The link will take me to new region or a page.
    How to achieve this in APEX 4.1
    Theme : Blue 2
    Database 11g
    I see there is a column link opiton, but that creates link for every row in that column on a specific icon, I just want link on a title of the column in Classic Report.
    For Example,
    if there are two columns Name and Client ID, which has 10 records to display on a classic report. I wan the link on Client ID on header only not on the records.
    Can anybody provide some simple solution for this.
    Thanks,
    --CP
    Edited by: cpora007 on Jun 22, 2012 10:38 AM

    Hello,
    I didn't understand, what do you mean by default it is going to sort popup. I have a classic report based on SQL, which generates a report with static header, there is no sort or any other link on that.
    I added a link in column header name with an anchor. It works and takes to the new page.
    But it is not a proper solution. A solution based on Jquery dynamic action is preferable. Also the preferred option is that the link opens a hidden region of the same page at the same location of the report and the report gets hidden. after the procession on the form region and submitting the update/ insert process. the report region shows up with the change data.
    Moving on to new page is 2nd option, if the first do not work.
    In the JavaScript, put: apex.submit("GO_TO_MY_OTHER_PAGE");
    On the page, create a Branch to the Second page. Set the condition to Request=Expression 1. Set the request to "GO_TO_MY_OTHER_PAGE"
    On which page I need to create a branch?, Is it on the report page or the form page.
    Thanks a lot for the response. I appreciate your kind efforts in this regard.
    --CP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Oracle APEX Classic Report Break Formatting

    I created a classic report. Under report attributes I defined Break Formatting as "First, Second and Third Column".
    The data columns for this report are Domain, Discipline, TechnologyArea and Products.
    Domain is the parent. Discipline is a child of domain. TechnologyArea is the child of Discipline. Products are children of TechnologyAreas.
    Domain prints in the first column, Discipline in the second, TechnologyArea in the third and Product in the fourth. There are one to many products for any TechnologyArea - and one to many TechnologyAreas for any Discipline - and one to many Disciplines for any Domain. The report is sorted on Domain, Discipline, TechnolgyArea and Product. Therefore domain prints over and over and over. Discipline prints over and over until it changes. TechnologyArea prints several times before it changes. I don't like that.
    I want the report to print Domain and not print it again until it changes. I want it to do the save for Discipline and TechnologyArea.
    I set break formatting to "First, Second and Thrid Column". Now Domain prints once and does not print again until it changes. So far so good! Now Discipline prints once and does not print on subsequent rows until the discipline changes. So far so good! The TechnologyArea name prints on every row. That's not good.
    Given this pattern, if there were an option for First, Second, Third and Fourth columns I think that would give me the report I want - but there's not. Can anyone tell me how to stop TechnologyArea from repeating on every row?

    This look about right?
    notice the last two records in the with statement are duplicates.
    with test_data as(
        select 'MAMMAL' domain, 'DOG' discepline, 'BEAGLE' technologyArea, 'SQUEEKY TOY' product from dual union all
        select 'MAMMAL',  'DOG' ,   'RETRIEVER', 'SQUEEKY TOY' from dual union all
        select 'MAMMAL',  'CAT' ,   'LION',      'SQUEEKY TOY'  from dual union all
        select 'MAMMAL',  'CAT' ,   'CHEETAH',   'SQUEEKY TOY'  from dual union all
        select 'MAMMAL',  'DOG' ,   'DINGO',     'SQUEEKY TOY'  from dual union all
        select 'REPTILE', 'LIZARD', 'IGUANA',    'LARGE ROCK' from dual union all
        select 'REPTILE', 'LIZARD', 'GUILLA MONSTER', 'LARGE ROCK' from dual union all
        select 'REPTILE', 'SNAKE',  'CORAL',     'LARGE ROCK' from dual union all
        select 'REPTILE', 'SNAKE',  'PYTHON',    'LARGE ROCK' from dual union all
        select 'REPTILE', 'SNAKE',  'KING',      'LARGE ROCK' from dual union all
        select 'MAMMAL',  'DOG' ,   'BEAGLE',    'BONE' from dual union all
        select 'MAMMAL',  'DOG' ,   'RETRIEVER', 'BONE' from dual union all
        select 'MAMMAL',  'CAT' ,   'LION',      'BONE' from dual union all
        select 'MAMMAL',  'DOG' ,   'DINGO',     'BONE'  from dual union all
        select 'REPTILE', 'LIZARD', 'IGUANA',    'HEAT LAMP' from dual union all
        select 'REPTILE', 'LIZARD', 'GUILLA MONSTER', 'HEAT LAMP' from dual union all
        select 'REPTILE', 'SNAKE',  'CORAL',     'HEAT LAMP' from dual union all
        select 'REPTILE', 'SNAKE',  'PYTHON',    'HEAT LAMP' from dual union all
        select 'REPTILE', 'SNAKE',  'KING',      'HEAT LAMP' from dual union all
        select 'MAMMAL',  'CAT' ,   'CHEETAH',   'BONE' from dual union all
        select 'MAMMAL',  'CAT' ,   'CHEETAH',   'BONE' from dual
    select * from(
    select
        case when domain         != nvl(domain_lag,        ':START:') then domain         else null end as domain,
        case when discepline     != nvl(discepline_lag,    ':START:') then discepline     else null end as discepline,
        case when technologyarea != nvl(technologyarea_lag,':START:') then technologyarea else null end as technologyarea,
        case when product        != nvl(product_lag,       ':START:') then product        else null end as product
    from(
        select domain, discepline, technologyarea, product,
               lag(domain,1)         over(order by domain, discepline, technologyarea, product) domain_lag,
               lag(discepline,1)     over(order by domain, discepline, technologyarea, product) discepline_lag,
               lag(technologyarea,1) over(order by domain, discepline, technologyarea, product) technologyarea_lag,
               lag(product,1)        over(order by domain, discepline, technologyarea, product) product_lag
          from test_data
         order by domain, discepline, technologyarea, product)
    where coalesce(product, technologyarea, discepline, domain) is not null
    edit
    I did not understand the question properly before submitting this. Here it is anyway.
    Cheers,
    Tyson Jouglet
    Edited by: Tyson Jouglet on Jan 26, 2011 2:42 PM

  • Classic Report with a two-line row, the second one as a drop down?

    Hi,
    Using APEX 4.0 is it possible to make a classic report layout that has row items sorted in 2 rows? The first row for each SQL record set row looks like the classic report 'normal' row, while the second one contains just one single column value. This second row is supposed to be hidden and should be displayable by clicking a small '+' sign at the beginning of the row.
    I remember having seen this done, but I simply seem not to be able to formulate my query correctly to let Google display me the expected result. Although I am not sure if was APEX+jQuery or ExtJs. I hope though it is not ExtJS, since I do not plan to use that one.
    Thank you in advance.
    Tamas

    Is this for Verizon landline internet? If so, you should ask your question in the Verizon Residential forums. http://forums.verizon.com

  • Problem with download link for a BLOB Column in a "Classic report"

    I am having a problem where I cannot make a download link for a blob column function in a "classic" (non-interactive) report. I went through the tutorial on this topic and it was great help it working out the minor bugs, but I get a 404 error (apex_util.get_BLOB not found). For testing purposes I went ahead and created a an identical report on the same page that is an "Interactive report" and it works like a charm. Same query, same BLOB formatting Mask, pulling data from the same table. So, it really doesn't seem like an issue with the grants, since both reports should be executing as the same user.
    I know it sounds like the obvious answer is to just go with the interactive report and my problem is solved, but the rest of this site uses classic reports, and I don't need the sort features of an interactive report, and the slightly different style of the the report really stands out even if I turn off all the bells and whistles. I don't want to change the css to make them look identical, I just want a regular report to work.

    I eventually found another post: APEX_UTIL.GET_BLOB was not found on this server
    In this post there is the suggestion of putting "dbms_lob.getlength("var")" after the date field in your select. So I changed my query to have it at the end, and now my format mask (DOWNLOAD:table_name:ATTACHED_FILE:FILE_ID::FILE_MIME_TYPE:FILE_NAME:::attachment:Download) works like a charm, in a classic report.

  • How to convert Classical Report into PDF format..........

    Hi Experts,
    I have written a classical report with write statements and when i am downloading in excel the format is mismatching and now i want to convert into PDF format.
    How to convert into PDF format from Classical report ?
    Yusuf

    Hi yusuf,
    please find the below report,,
    please make two include programs before executing it,
    there codes are pasted below,
    INCLUDE zimpr_data_declaration.
    INCLUDE zimpr_performs_wrap.
    REPORT  zimpr_word_wrap NO STANDARD PAGE HEADING LINE-SIZE 115..
                INCLUDE for DATA DECLARATION                               *
    INCLUDE zimpr_data_declaration.
                INCLUDE for all performs.                                  *
    INCLUDE zimpr_performs_wrap.
    TOP-OF-PAGE--
    TOP-OF-PAGE.
      PERFORM f_top_page.                     "TOP OF THE REPORT PAGE,I.E. HEADER.
    START-OF-SELECTION.
      SET PF-STATUS 'SEL_SCREEN'.             "PF-STATUS OF THE SELECTION SCREEN.
      PERFORM f_data_retrieval.               "PERFORM FOR ALL SELECT STATEMENTS.
      PERFORM f_report_display.               "REPORT DISPLAY,WRITE STATEMENTS.
    --Define the actions to be performed for pf-status-----
    AT USER-COMMAND.
      wf_ok_code = sy-ucomm.
      wf_save_ok = wf_ok_code.
      CLEAR wf_ok_code.
      CASE wf_save_ok.
        WHEN 'PDF'.          "WHEN PDF ICON IS CLICKED,REPORT WILL CONVERT INTO PDF.
          loc_repid  = sy-repid.   "PROGRAM NAME
    --THIS FM SETS  THE PARAMETERS FOR LAYOUT OF PDF OUTPUT--
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              layout                 = loc_paart             "LANDSCAPE LAYOUT
              line_size              = loc_linsz                  "CHARACTER WIDTH OF REPORT
              no_dialog              = 'X'
              user                   = sy-uname              "USERNAME
            IMPORTING
              out_parameters         = loc_print_parms        "OUTPUT PARAMETERS WILL BE COLLECTED HERE.
              valid                  = loc_valid
            EXCEPTIONS
              archive_info_not_found = 1
              invalid_print_params   = 2
              invalid_archive_params = 3
              OTHERS                 = 4.
    --FOR GENERATING THE SPOOL NUMBER--
          NEW-PAGE PRINT ON NO DIALOG PARAMETERS loc_print_parms.                        " This allocates the spool no
          "to the screen without the dialog screen.
          PERFORM f_top_page.
          PERFORM f_report_display.
          NEW-PAGE PRINT OFF.                                                      "This marks the end of the screen for which the spool no was generated.
          wf_id = sy-spono.                                                      " This assign the spool no of the screen to the variable.
    --PERFORM FOR GETTING THE PDF OUTPUT--
          PERFORM f_pdf_display.
    --PERFORM FOR DOWLOADING FILE TO A LOCAL DISK--
          PERFORM f_download_local.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    include data declaration----
    *&  Include           ZIMPR_DATA_DECLARATION
    TYPE-POOLS : shlp.
    DATA : wf_ordert TYPE aufk-auart.                      "ORDER TYPE
    DATA : wf_order TYPE aufk-aufnr.                       "ORDER NUMBER
    DATA : wf_bdate TYPE afko-gstrp.                       "BASIC START DATE
    DATA : wf_status(4) TYPE c ."rihea-i_astatin.                 "STATUS
    DATA : wf_objnr TYPE jest-objnr VALUE 'OR%'.           "Object number
    DATA : wf_aufnr TYPE aufk-aufnr.
    DATA : wf_name TYPE thead-tdname.                      "NAME TO PASS IN FM READ_TEXT
    DATA : wf_date1(12) TYPE c.                            "DATE
    DATA : wf_i1(3) TYPE n,wc_i1(3) TYPE n VALUE '1'.      "COUNTERS FOR REPORT DISPLAY
    DATA : wf_i2(3) TYPE n,wc_i2(3) TYPE n VALUE '1'.
    DATA : wf_kopf TYPE tdid VALUE 'KOPF',wf_aufk TYPE tdobject VALUE 'AUFK'.
    DATA : wf_save_ok TYPE sy-ucomm ,wf_ok_code TYPE sy-ucomm.
    DATA: wf_id TYPE tsp01-rqident ,                         " For storing Spool request number
          wf_bytes TYPE i .                                  " For storing the bytes of data to be converted to PDF.
    DATA : wf_langu(2) TYPE c VALUE 'EN'.
    DATA: wf_pripar TYPE pri_params,                         " Structure for Passing Print Parameters
          wf_rcpar TYPE arc_params.                          " ImageLink structure
    DATA : wf_statu TYPE dfies-fieldname VALUE 'STATUS',
           wf_field TYPE help_info-dynprofld VALUE 'S_STATUS'.
    &--SELECTION SCREEN--
    SELECTION-SCREEN BEGIN OF BLOCK b_1 WITH FRAME TITLE text-000.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS:  s_ordert FOR wf_ordert .                  "ORDER TYPE
    SELECT-OPTIONS:  s_order FOR wf_order OBLIGATORY.          "ORDER NUMBER
    SELECT-OPTIONS:  s_bdate FOR wf_bdate.                      "BASIC START DATE
    SELECT-OPTIONS:  s_status FOR wf_status matchcode object zei_sys .  "SYSTEM STATUS
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN END OF BLOCK b_1.
    *--INTERNAL TABLES--
    TYPES : BEGIN OF ty_aufk,
          aufnr TYPE aufk-aufnr,              "OREDR NUMBER
          auart TYPE aufk-auart,              "ORDER TYPE
          objnr TYPE aufk-objnr,              "OBJECT NUMBER
          ktext type aufk-ktext,              "SHORT TEXT
          gstrp TYPE afko-gstrp,              "BASIC START DATE
          END OF ty_aufk.
    TYPES : BEGIN OF ty_tj02t,
          objnr TYPE aufk-objnr,              "OBJECT NUMBER
          txt04 TYPE tj02t-txt04,             "STATUS
          istat TYPE tj02t-istat,             "Object status
          spras TYPE tj02t-spras,             "LANGUAGE KEY
          END OF ty_tj02t.
    TYPES : BEGIN OF ty_temp,
          objnr TYPE aufk-objnr,
          status(300) TYPE c,
           END OF ty_temp.
    TYPES : BEGIN OF ty_wrap,
           line(54) TYPE c,                     "LONG TEXT
           END OF ty_wrap.
    TYPES : BEGIN OF ty_wrap2,
           line(25) TYPE c,                     "STATUS
           END OF ty_wrap2.
    TYPES : BEGIN OF ty_f4,
            txt04 TYPE tj02t-txt04,
            txt30 TYPE tj02t-txt30,
            END OF ty_f4.
    types :  begin of ty_sta,
            istat type tj02t-istat,
            objnr type jest-objnr,
            end of ty_sta.
    data : int_sta type table of ty_sta with header line.
    DATA : int_f4 TYPE TABLE OF ty_f4 WITH HEADER LINE.
    DATA: int_pdf TYPE TABLE OF tline WITH HEADER LINE.            "TABLE FOR PDF CONVERSION
    DATA: int_wrap TYPE TABLE OF ty_wrap WITH HEADER LINE.         "TABLE FOR LONGTEXT
    DATA: int_wrap2 TYPE TABLE OF ty_wrap2 WITH HEADER LINE.       "TABLE FOR STATUS
    DATA: int_temp TYPE TABLE OF ty_temp WITH HEADER LINE.         "Table for concatenation of system status.
    DATA: int_aufk TYPE TABLE OF ty_aufk WITH HEADER LINE.
    DATA: int_tj02t TYPE TABLE OF ty_tj02t WITH HEADER LINE.
    DATA: int_tline TYPE STANDARD TABLE OF tline WITH HEADER LINE. "TABLE FOR READ_TEXT.
    DATA : int_fld TYPE TABLE OF dfies ,wa_fld LIKE LINE OF int_fld.                     " Field Type for FM for F4 help
    DATA :int_return   TYPE TABLE OF ddshretval WITH HEADER LINE .
    DATA:
      loc_print_parms LIKE pri_params,          "PRINT PARAMETERS
      loc_valid(1)      TYPE c,
      loc_file type SDOK_CHTRD,
      loc_bytecount     TYPE i,                 "NUMBER OF BYTES TRANSFERRED
      loc_length        TYPE i,                 "LINE-LENGTH
      loc_rqident       LIKE tsp01-rqident,     "SPOOL NUMBER
      loc_rq2name(12)   TYPE c.
    DATA: loc_filename LIKE rlgrap-filename.     "FILENAME
    DATA:loc_repid LIKE sy-repid,                    " Report to execute
         loc_linsz LIKE sy-linsz VALUE 115,          " Line size
         loc_paart LIKE sy-paart VALUE 'X_65_132'.   " Paper Format
    Include           ZIMPR_PERFORMS_WRAP----
    *&  Include           ZIMPR_PERFORMS_WRAP
    *&      Form  f_top_page
         top-of the page
    -->  p1        text
    <--  p2        text
    FORM f_top_page .
    *--HEADER--
      FORMAT COLOR 1 .
      WRITE : text-010.
      FORMAT COLOR 1 OFF.
      WRITE : / text-011,sy-datum NO-GAP.
      WRITE : / text-012,sy-uzeit NO-GAP,90 text-013,101 sy-uname.
      ULINE .
      FORMAT COLOR 1 INTENSIFIED OFF .
      WRITE : 1 sy-vline,                "HEADINGS
      2 text-014 NO-GAP,
      7 sy-vline,
      8 text-015 NO-GAP,
      20 sy-vline,
      21 text-016 NO-GAP,
      76 sy-vline,
      77 text-017 NO-GAP,
      88 sy-vline,
       89 text-018  NO-GAP,
      115 sy-vline.
      WRITE : /1 sy-vline,
        2 text-019 NO-GAP,7 sy-vline,
        20 sy-vline,76 sy-vline,77 text-020 NO-GAP,88 sy-vline,115 sy-vline.
      ULINE.
      FORMAT COLOR 1 OFF.
    ENDFORM.                    " f_top_page
    *&      Form  f_data_retrieval
         select statements
    -->  p1        text
    <--  p2        text
    FORM f_data_retrieval .
    SELECTING ORDER TYPE,ORDER NO.,OBJECT NO. AND BASIC START DATE
      SELECT  p~aufnr
               p~auart
               p~objnr
               p~ktext
               r~gstrp
               FROM  ( aufk AS p INNER JOIN afko AS r ON raufnr = paufnr )
               INTO TABLE int_aufk
               WHERE p~aufnr IN s_order AND
                     p~auart IN s_ordert AND
                     r~gstrp IN  s_bdate AND
                     p~objnr LIKE wf_objnr.
      IF sy-subrc <> 0.
        MESSAGE s101(zipm).                "no values found for selection criteria.
        STOP.
      ENDIF.
      SORT int_aufk BY aufnr.
      DELETE ADJACENT DUPLICATES FROM int_aufk.
      SELECT q~istat
           p~objnr
           FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
           INTO TABLE int_sta
           FOR ALL ENTRIES IN int_aufk
           WHERE p~objnr = int_aufk-objnr
                 AND q~txt04 IN s_status and
                 q~spras = wf_langu and
                 p~inact = ''.
      IF sy-subrc <> 0.
        MESSAGE s101(zipm).                "no values found for selection criteria.
        STOP.
      ENDIF.
      SORT int_sta BY objnr.
      DELETE ADJACENT DUPLICATES FROM int_sta.
    *--SELECTING OBJECT NO.,STATUS AND LANGUAGE--
      IF int_sta[] IS NOT INITIAL.
        SELECT p~objnr
               q~txt04
               q~istat
               q~spras
               FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
               INTO TABLE int_tj02t
               FOR ALL ENTRIES IN int_sta
               WHERE p~inact = '' AND
                     p~objnr = int_sta-objnr AND
                     q~spras = wf_langu AND
                    q~txt04 IN s_status AND
                     p~objnr LIKE wf_objnr.
        IF sy-subrc <> 0.
          MESSAGE s101(zipm).               "no values found for selection criteria.
          STOP.
        ENDIF.
      ENDIF.
    ENDFORM.                    " f_data_retrieval
    *&      Form  f_report_display
          report display
    -->  p1        text
    <--  p2        text
    FORM f_report_display .
      LOOP AT int_tj02t.              "concatenating the status into a internal table
        AT NEW objnr.
          CLEAR int_temp-status.
        ENDAT.
        CONCATENATE int_temp-status int_tj02t-txt04 INTO int_temp-status SEPARATED BY space.
        AT END OF objnr.
          int_temp-objnr = int_tj02t-objnr.       "key field.
          APPEND int_temp.
          CLEAR int_temp.
        ENDAT.
        CLEAR int_tj02t.
      ENDLOOP.
      LOOP AT int_aufk.
        CONCATENATE sy-mandt int_aufk-aufnr INTO wf_name .    "concatenating client number and order number
    *--THIS FM CAPTURES THE LONG TEXT AND STORES IT IN INTERNAL TABLE--
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            id                      = wf_kopf         "TEXT ID
            language                = sy-langu       "LANGUAGE
            name                    = wf_name        "TEXT NAME
            object                  = wf_aufk         "TEXT OBJECT
          TABLES
            lines                   = int_tline      "LINES OF LONG TEXT.
          EXCEPTIONS
            id                      = 1
            language                = 2
            name                    = 3
            not_found               = 4
            object                  = 5
            reference_check         = 6
            wrong_access_to_archive = 7
            OTHERS                  = 8.
        IF sy-subrc <> 0.
          int_tline-tdline = int_aufk-ktext.
          APPEND int_tline.
          CLEAR :int_tline.
        ENDIF.
        LOOP AT int_tline.
    *--THIS FM WRAPS THE LONG TEXT INTO 54 CHARACTERS EACH--
          CALL FUNCTION 'RKD_WORD_WRAP'
            EXPORTING
              textline            = int_tline-tdline          "LONG TEXT LINE
              outputlen           = 54                        "OUTPUT LENGTH
            TABLES
              out_lines           = int_wrap                  "INTERNAL TABLE
            EXCEPTIONS
              outputlen_too_large = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            CLEAR :int_tline.
          ENDIF.
        ENDLOOP.
    *-- THIS FM WRAPS THE STATUS INTO 25 CHARACTERS EACH--
        READ TABLE int_temp WITH KEY objnr = int_aufk-objnr.
        CALL FUNCTION 'RKD_WORD_WRAP'
          EXPORTING
            textline            = int_temp-status
            outputlen           = 25
          TABLES
            out_lines           = int_wrap2
          EXCEPTIONS
            outputlen_too_large = 1
            OTHERS              = 2.
        IF sy-subrc <> 0.
         CONTINUE.
        ENDIF.
        IF NOT int_wrap2[] IS INITIAL.
          ULINE AT (115).
        ENDIF.
        DESCRIBE TABLE int_wrap LINES wf_i2.         "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP
        DESCRIBE TABLE int_wrap2 LINES wf_i1.        "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP2
        WHILE ( wc_i1 LE wf_i1 OR wc_i2 LE wf_i2 ).
          IF ( wc_i2 LE wf_i2 ).
            READ TABLE int_wrap INDEX wc_i2 .        "READING THE INTERNAL TABLE INT_WRAP WITH INDEX
            wc_i2 = wc_i2 + 1.
          ENDIF.
          IF ( wc_i1 LE wf_i1 ).
            READ TABLE int_wrap2 INDEX wc_i1 .       "READING THE INTERNAL TABLE INT_WRAP2 WITH INDEX
            wc_i1 = wc_i1 + 1.
          ENDIF.
    *--THIS FM CONVERTS THE DATE FROM SYSTEM FORMAT TO OUTPUT FORMAT--
          CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
            EXPORTING
              input  = int_aufk-gstrp
            IMPORTING
              output = wf_date1.
          IF NOT int_wrap2[] IS INITIAL .
    *--REPORT DISPLAY--
            WRITE : /1 sy-vline, 2 int_aufk-auart COLOR = 4 INTENSIFIED OFF NO-GAP ,
                    7 sy-vline ,8 int_aufk-aufnr COLOR = 4 INTENSIFIED OFF NO-GAP,
                    20 sy-vline,21 int_wrap-line,
                    76 sy-vline ,77  wf_date1 ,
                    88 sy-vline ,89 int_wrap2-line,
                    115 sy-vline.
    *--CLEARING THE VARIABLES--
            wf_date1 = ''.
            CLEAR: int_aufk,int_temp,int_wrap2-line,int_wrap-line.
          ENDIF.
        ENDWHILE.
        wc_i1 = 1.
        wc_i2 = 1.
        CLEAR :int_wrap,int_wrap2.
        REFRESH : int_wrap,int_wrap2,int_tline.
      ENDLOOP.
      ULINE AT (115).
    ENDFORM.                    " f_report_display
    *&      Form  F_PDF_DISPLAY
         pdf conversion
    -->  p1        text
    <--  p2        text
    FORM f_pdf_display .
    *--THIS FM CONVERTS THE SPOOL REQUEST INTO PDF REPORT--
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = wf_id                 "SPOOL NUMBER
          no_dialog                = space
          pdf_destination          = 'X'
        IMPORTING
          pdf_bytecount            = loc_bytecount        "NUMBER OF BYTES TRANSFERRED
        TABLES
          pdf                      = int_pdf                                  "TABLE FOR PDF REPORT
        EXCEPTIONS
          err_no_abap_spooljob     = 1
          err_no_spooljob          = 2
          err_no_permission        = 3
          err_conv_not_possible    = 4
          err_bad_destdevice       = 5
          user_cancelled           = 6
          err_spoolerror           = 7
          err_temseerror           = 8
          err_btcjob_open_failed   = 9
          err_btcjob_submit_failed = 10
          err_btcjob_close_failed  = 11
          OTHERS                   = 12.
    ENDFORM.                    " F_PDF_DISPLAY
    *&      Form  f_download_local
         download to local system
    -->  p1        text
    <--  p2        text
    FORM f_download_local .
    ---------------------THIS FM DOWNLOADS THE PDF REPORT INTO LOCAL MACHINE
    data  loc_ret TYPE iwerrormsg.
      CALL FUNCTION 'IW_C_GET_SAPWORKDIR'
       IMPORTING
         SAPWORKDIR       = loc_file
        ERROR_MSG        =  loc_ret
      loc_filename = loc_file.
      if loc_ret is initial.
      concatenate loc_filename '\work order header long text_  ' sy-timlo '.pdf' into loc_filename.
      endif.
      CALL FUNCTION 'DOWNLOAD'
        EXPORTING
          bin_filesize = loc_bytecount      "NO. OF BYTES
          filename     = loc_filename       "DEFAULT FILE NAME
          filetype     = 'BIN'
        IMPORTING
          act_filename = loc_filename
        TABLES
          data_tab     = int_pdf.
    ENDFORM.                    " f_download_local
    if you have any doubts,,
    please revert
    Regards,
    Talwinder

  • How to get theoutput of classical report in table format

    hi all,
                   i am new to this forum.i want the help from experts over here.for example if we create the program in classical report for employee details.how to get the output in tabular column format.pls reply to me.
          Thanks in advance

    HI all,
    I am new here. Currently I am trying to create a program which is able to compare and validate key fields from different tables.
    my code looks like this:
    *~Internal Tables
    DATA:
      LT/RAB/KPI_CONF TYPE STANDARD TABLE OF /RAB/KPI_CONF,
      LT/RAB/KPI_MAPP TYPE STANDARD TABLE OF /RABL/KPI_MAPP,
      LT/RABL/KPI_HEAD TYPE STANDARD TABLE OF /RABL/KPI_HEAD.
    DATA:
      /RAB/KPI_CONF_NEW TYPE SORTED TABLE OF /RAB/KPI_CONF WITH UNIQUE KEY XX100011 XX100004 XX100022 XX100010,
      /RAB/KPI_MAPP_NEW TYPE SORTED TABLE OF /RAB/KPI_MAPP WITH UNIQUE KEY XX100009 XX000197 XX100007 XX100014,
      /RAB/KPI_HEAD_NEW TYPE SORTED TABLE OF /RAB/KPI_HEAD WITH UNIQUE KEY XX100004.
    DATA: GWA_/RAB/KPI_CONF TYPE /RAB/KPI_CONF,
          GWA_/RAB/KPI_MAPP TYPE /RAB/KPI_MAPP,
          GWA_/RAB/KPI_HEAD TYPE /RAB/KPI_HEAD.
    *Fill the internal table with database values
    PERFORM get_existing_records.
    FORM GET_EXISTING_RECORDS.
      SELECT *
        FROM /RABL/KPI_CONF
        INTO TABLE LT/RAB/KPI_CONF.
      SELECT *
          FROM /RAB/KPI_MAPP
          INTO TABLE LT/RAB/KPI_MAPP.
      SELECT *
          FROM /RAB/KPI_HEAD
          INTO TABLE LT/RAB/KPI_HEAD.
      LOOP AT LT/RAB/KPI_CONF INTO GWA_/RAB/KPI_CONF.
        READ TABLE LT/RAB/KPI_HEAD INTO GWA_/RAB/KPI_HEAD with key XX100004 = GWA_/RAB/KPI_CONF-XX100004.
        IF SY-SUBRC <> 0.
          WRITE:  'No header id found in formula'.
        ENDIF.
        LOOP AT LT/RAB/KPI_HEAD INTO GWA_/RAB/KPI_HEAD.
          READ TABLE LT/RAB/KPI_MAPP INTO GWA_/RAB/KPI_MAPP with key XX100009 = GWA_/RAB/KPI_HEAD-XX100012.
          IF SY-SUBRC <> 0.
            WRITE: ' no selection ID found in table'.
            endif.
        ENDLOOP.
            ENDLOOP.
    ENDFORM.
    I would like to have a output report in which the results from my above statement are displayed.
    Any advise is welcome
    Thanks.
    Rabie

  • Bug in Classic Report based on Function?

    As a simple example, suppose I want a classic report in which I can change the sort field by selecting from the item P1_SORTFIELD. In Apex 4.2 I was able to implement the report using the PL/SQL function
    return 'select ENAME, SAL from EMP order by ' || :P1_SORTFIELD;
    I cannot do this in Apex 5 on my apex.oracle.com workspace. I either get an "SQL command not property ended" runtime error if I use generic column names, or "not all variables bound" parse error if I don't.
    My real application uses generic column names, so I am most interested in a solution to that.  For example, I tried creating a report having the source
    return 'select ENAME from EMP order by ENAME';
    If I run it using generic column names I still get the "SQL Command not properly ended" runtime error.
    Is this a bug??
    Ed Sciore

    Ed Sciore wrote:
    As a simple example, suppose I want a classic report in which I can change the sort field by selecting from the item P1_SORTFIELD. In Apex 4.2 I was able to implement the report using the PL/SQL function
    return 'select ENAME, SAL from EMP order by ' || :P1_SORTFIELD;
    I cannot do this in Apex 5 on my apex.oracle.com workspace. I either get an "SQL command not property ended" runtime error if I use generic column names, or "not all variables bound" parse error if I don't.
    My real application uses generic column names, so I am most interested in a solution to that.  For example, I tried creating a report having the source
    return 'select ENAME from EMP order by ENAME';
    If I run it using generic column names I still get the "SQL Command not properly ended" runtime error.
    I cannot reproduce the same error messages in my workspace on apex.oracle.com.
    The basic problem here is that the function body will not return a syntactically correct SQL query if the session state value of P1_SORTFIELD is not a valid sort expression for the query. This will always be the case when the region source is validated in the App Builder, and also if P1_SORTFIELD is null at runtime. The solution is to ensure that the function body always returns a valid query irrespective of the value of P1_SORTFIELD:
    return 'select ENAME, SAL from EMP' || nullif(' order by ' || :p1_sortfield, ' order by ');
    Here is another weird thing. I looked at my Apex 4.2 application that got transferred over to Apex 5. The region that does the dynamic sorting still works. But now I just created a new region on that page that has the same source, and as far as I can tell, exactly the same properties. And this region gives me the runtime error. The URL is apex.oracle.com/pls/apex/f?p=80034:33 if that helps.
    Given that I can't reproduce your results based on the information provided, I think we'd need access to the app in your workspace in debug mode to investigate this fully.

  • Regarding Classical Reporting

    Hi all,
    I want to know how to write the code in calssical reporting to get field headngs.
    In ALV means we use Field catalog merge FM, But in classical it is differnt.
    I want one example program to get field catalog in classical Reporting out put,
    My out put looks like XL sheet. I want to know how to get that grids in Classical reporting.
    Regards,
    sarath

    Hi
    Using Sy-Vline, and Sy-Uline we can design the Field catalog like Excel like output in the Classical reporting
    see the sample code and the output
    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
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • LAYOUT option in classical report

    HI all,
    Is it possible to provide SORT options, LAYOUT options (CHANGE layout, SAVE layout) in classical report as similar to those options in ALV? If so, how to display those icons at the top of the report as similar to ALV?
    Regards,
    Shanthi

    Hi Shanthi
    It can be done but will take more time.
    For example.
    just check this.
    data: tcode(10) type c.
    START-OF-SELECTION.
    FORMAT COLOR COL_HEADING.
    ULINE.
    WRITE:/ '***********************The following are the transaction'.
    WRITE:'codes in BPS ************************'.
    FORMAT COLOR COL_HEADING OFF.
    ULINE.
    SKIP .
    FORMAT COLOR COL_HEADING.
    ULINE.
    WRITE:/ 'Please select the report/program by double clicking on the'.
    WRITE:'line'.
    ULINE.
    FORMAT COLOR COL_HEADING OFF.
    SKIP.
    FORMAT COLOR COL_POSITIVE.
    ULINE.
    tcode = 'ZCUS1'.
    WRITE:/ '1.Version Utility program - ZCUS1 .', 75 tcode.
    HIDE tcode.
    ULINE.

  • Drill Down  In classical report

    Hi
    i had done a classical report ,but now user wants in in drill down ,
    My output now is
    Planned Downtime
    IDLE MACHINE TIME (DUE TO) 25.50 47.60 %
    PREVENTATIVE MAINTENANCE 88.50 0.32 %
    HOLIDAYS 288 1.05 %
    Unplanned Downtime 0.00 0.00 %
    SHIFT START-UP 0.00 0.00 %
    PRODUCT TO PRODUCT CLEANING 0.00 0.00 %
    BATCH TO BATCH CLEANING 0.00 0.00 %
    Now he want a plus sign at planned and unplanned down time
    when click on that pplus sign i should get details of that
    similarly same for unplanned and rest  and also Minus ..
    Most importantly iam using sy-vline uline all in normal list to display.
    Is it possible in classical report ..if yes then pls help me
    out in this if possible with code.
    Regards
    Answers will be rewarded points.

    Hi,
    see this example.
    REPORT ZRJNTRIAL_TREE LINE-COUNT 65
    LINE-SIZE 80
                                                   NO STANDARD PAGE
    HEADING.
    DATA: BEGIN OF ITEMS OCCURS 100,
             ID(10),
             PARENT_ID(10),
             TEXT(20),
             SYMBOL,
          END OF ITEMS,
          TABIX_STACK LIKE SY-TABIX OCCURS 10 WITH HEADER LINE,
          ITEMS_SHOW LIKE ITEMS OCCURS 100 WITH HEADER LINE.
    INCLUDE <SYMBOL>.
    append sample items (mixed order)
    PERFORM APPEND_ITEM USING:
        '1'  ''        'Food',
        '2'  ''        'Drinks',
        '12' '9'       'Jack Daniels',
        '17' '11'      'Bosch',
        '3'  ''        'Tools',
        '4'  '1'       'Meat',
        '16' '11'      'Metabo',
        '5'  '1'       'Chocolate',
        '6'  '2'       'Alcoholic',
        '8'  '4'       'Pork',
        '10' '5'       'Milka',
        '11' '3'       'Drills',
        '13' '9'       'Jim Beam',
        '7'  '4'       'Beef',
        '14' '2'       'Non-alcoholic',
        '35' '31'      'Teran',
        '9'  '6'       'Whiskey',
        '15' '14'      'Coca-cola',
        '18' '6'       'Wine',
        '28' '18'      'Croatia',
        '33' '28'      'Slavonia',
        '34' '28'      'Istria',
        '29' '18'      'Hungary',
        '30' '29'      'Tokaj',
        '19' '33'      'Enjingi',
        '20' '33'      'Zdjelarevic',
        '22' '19'      'Riesling',
        '23' '19'      'Chardonnay',
        '24' '20'      'Riesling',
        '32' '31'      'Malvazija',
        '25' '20'      'Merlot',
        '31' '34'      'Tomasevic'.
    show initial list (items with level 0 - parentless items)
    LOOP AT ITEMS WHERE PARENT_ID = ''.
      MOVE-CORRESPONDING ITEMS TO ITEMS_SHOW.
      ITEMS_SHOW-SYMBOL = '+'.
      APPEND ITEMS_SHOW.
    ENDLOOP.
    PERFORM PRINT_TREE TABLES ITEMS_SHOW.
    at line-selection - when the node is opened/closed or item double-clk
    AT LINE-SELECTION.
      READ TABLE ITEMS WITH KEY PARENT_ID = ITEMS_SHOW-ID. "see 'hide'
      IF SY-SUBRC = 0. "item has children - expand or collapse
        SY-LSIND = 0.
        PERFORM EXPAND_COLLAPSE USING ITEMS_SHOW-ID.
        PERFORM PRINT_TREE TABLES ITEMS_SHOW.
      ELSE.            "item has NO children - perform some action
        READ TABLE ITEMS WITH KEY ID = ITEMS_SHOW-ID.
        WRITE: 'Action performed on item "' NO-GAP, ITEMS-TEXT NO-GAP,
               '", id.', ITEMS-ID.
      ENDIF.
    form print_tree
    FORM PRINT_TREE TABLES ITEMS STRUCTURE ITEMS.
      DATA: V_TABIX LIKE SY-TABIX,
            START_TABIX LIKE SY-TABIX,
            V_LEVEL LIKE SY-TFILL,
            V_OFFSET TYPE I,
            V_ID LIKE ITEMS-ID,
            V_PARENT_ID LIKE ITEMS-PARENT_ID,
            V_PARENT_ID_FOR_VLINE LIKE ITEMS-PARENT_ID,
            V_PREV_LEVEL TYPE I,
            V_ITEMS_COUNT LIKE SY-TFILL,
            V_VLINES_STRING(200).
      CHECK NOT ITEMS[] IS INITIAL.
      SORT ITEMS BY PARENT_ID ID.
      READ TABLE ITEMS INDEX 1.
      V_PARENT_ID = ITEMS-PARENT_ID.
      START_TABIX = 1.
      REFRESH TABIX_STACK.
      DO.
        LOOP AT ITEMS FROM START_TABIX.
          V_TABIX = START_TABIX = SY-TABIX."remember current index
          V_ID = ITEMS-ID.
          V_PARENT_ID_FOR_VLINE = ITEMS-PARENT_ID.
        decrease level and exit loop if parent not the same as previous
          IF ITEMS-PARENT_ID NE V_PARENT_ID.
            PERFORM READ_FROM_STACK CHANGING START_TABIX. "level = NoOfRecs
            READ TABLE ITEMS INDEX START_TABIX.
            V_PARENT_ID = ITEMS-PARENT_ID.
            ADD 1 TO START_TABIX.   "next loop starts from parent index + 1
           clear vline
            IF V_LEVEL > 1.
              V_OFFSET = 2 + ( V_LEVEL - 2 ) * 3.
              IF V_LEVEL = 1. V_OFFSET = 1. ENDIF.
              V_VLINES_STRING+V_OFFSET = ' '.
            ENDIF.
            EXIT.
          ENDIF.
          V_PARENT_ID = ITEMS-PARENT_ID.
        write item
          FORMAT COLOR OFF.
          DESCRIBE TABLE TABIX_STACK LINES V_LEVEL."level is no of StackRecs
          WRITE: / V_VLINES_STRING.
          V_OFFSET = V_LEVEL * 3.
          IF V_LEVEL NE 0.
            IF V_PREV_LEVEL < V_LEVEL.
              WRITE: AT V_OFFSET '|', / ''.
              WRITE: / V_VLINES_STRING.
            ENDIF.
            V_OFFSET = V_LEVEL * 3.
            WRITE AT V_OFFSET '|--'.
          ENDIF.
          V_OFFSET = V_OFFSET + 3.
          CASE ITEMS-SYMBOL.
            WHEN '+'.
              WRITE AT V_OFFSET SYM_PLUS_FOLDER AS SYMBOL
                    COLOR 4 INTENSIFIED HOTSPOT.
            WHEN '-'.
              WRITE AT V_OFFSET SYM_MINUS_FOLDER AS SYMBOL
                    COLOR 4 INTENSIFIED HOTSPOT.
            WHEN OTHERS. FORMAT COLOR 5.
          ENDCASE.
          WRITE: ITEMS-TEXT.
          V_PREV_LEVEL = V_LEVEL.
          HIDE: ITEMS-ID.
          ADD 1 TO V_ITEMS_COUNT.
          READ TABLE ITEMS WITH KEY PARENT_ID = ITEMS-ID.
        increase level and exit loop if item has children
          IF SY-SUBRC = 0.
            START_TABIX = SY-TABIX.
            APPEND V_TABIX TO TABIX_STACK. "level is no of recs in stack
            V_PARENT_ID = ITEMS-PARENT_ID.
           set vline
            V_TABIX = V_TABIX + 1.
            READ TABLE ITEMS INDEX V_TABIX.
            V_OFFSET = 2 + ( V_LEVEL - 1 ) * 3.
            IF V_LEVEL > 0.
              IF ITEMS-PARENT_ID = V_PARENT_ID_FOR_VLINE AND SY-SUBRC = 0.
                V_VLINES_STRING+V_OFFSET = '|'.
              ELSE.
                V_VLINES_STRING+V_OFFSET = ' '.
              ENDIF.
            ENDIF.
            EXIT.
          ENDIF.
        at last - decrease level
          AT LAST.
           clear vline
            IF V_LEVEL > 1.
              V_OFFSET = 2 + ( V_LEVEL - 2 ) * 3.
              IF V_LEVEL = 1. V_OFFSET = 1. ENDIF.
              V_VLINES_STRING+V_OFFSET = ' '.
            ENDIF.
            " next loop starts from parent index, not parent index + 1
            " because of different parents level will decrease anyway
            PERFORM READ_FROM_STACK CHANGING START_TABIX.
            APPEND START_TABIX TO TABIX_STACK. "must return index to stack
          ENDAT.
        ENDLOOP.
        DESCRIBE TABLE ITEMS.
        IF START_TABIX > SY-TFILL OR V_ITEMS_COUNT >= SY-TFILL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
    form expand_collapse
    FORM EXPAND_COLLAPSE USING VALUE(V_ID).
      DATA: V_NO_MORE_ORPHANS,
            ITEMS_TEMP LIKE ITEMS OCCURS 100 WITH HEADER LINE.
      DELETE ITEMS_SHOW WHERE PARENT_ID = V_ID. "try to collapse
      IF SY-SUBRC = 0.                     "succesfull first collapse
        DO.            "cascade collapse - delete 'orphans' that are left
          REFRESH ITEMS_TEMP.
          MOVE ITEMS_SHOW[] TO ITEMS_TEMP[].
          SORT ITEMS_TEMP BY ID.
          V_NO_MORE_ORPHANS = 'X'.
          LOOP AT ITEMS_SHOW WHERE PARENT_ID NE ''.
            READ TABLE ITEMS_TEMP WITH KEY ID = ITEMS_SHOW-PARENT_ID
                                   BINARY SEARCH TRANSPORTING NO FIELDS.
            IF SY-SUBRC NE 0.              "no parent - it's an orphan
              CLEAR V_NO_MORE_ORPHANS.
              DELETE ITEMS_SHOW.
            ENDIF.
          ENDLOOP.
          IF V_NO_MORE_ORPHANS = 'X'. EXIT. ENDIF.
        ENDDO.
        ITEMS_SHOW-SYMBOL = '+'.
        MODIFY ITEMS_SHOW TRANSPORTING SYMBOL WHERE ID = V_ID.
      ELSE.                                "unsuccessfull collapse - expand
        ITEMS_SHOW-SYMBOL = '-'.
        MODIFY ITEMS_SHOW TRANSPORTING SYMBOL WHERE ID = V_ID.
        LOOP AT ITEMS WHERE PARENT_ID = V_ID.      "show children
          APPEND ITEMS TO ITEMS_SHOW.
        ENDLOOP.
        LOOP AT ITEMS_SHOW WHERE PARENT_ID = V_ID. "check grandchildren
          READ TABLE ITEMS WITH KEY PARENT_ID = ITEMS_SHOW-ID.
          IF SY-SUBRC = 0.
            ITEMS_SHOW-SYMBOL = '+'.
          ELSE.
            ITEMS_SHOW-SYMBOL = ''.
          ENDIF.
          MODIFY ITEMS_SHOW.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    form append_item
    FORM APPEND_ITEM USING VALUE(ID) VALUE(PARENT_ID) VALUE(TEXT).
      ITEMS-ID = ID.
      ITEMS-PARENT_ID = PARENT_ID.
      ITEMS-TEXT = TEXT.
      APPEND ITEMS.
    ENDFORM.
    form read_from_stack
    FORM READ_FROM_STACK CHANGING TABIX LIKE SY-TABIX.
      DESCRIBE TABLE TABIX_STACK.
      CHECK SY-TFILL NE 0.
      READ TABLE TABIX_STACK INDEX SY-TFILL.
      TABIX = TABIX_STACK.
      DELETE TABIX_STACK INDEX SY-TFILL.
    ENDFORM.
    rgds,
    bharat.

Maybe you are looking for

  • Webex Connect Jabber

    Customer presently has Webex Meeting place in cloud  for all its users with IM and Presence capability and they are planning to implement a UC Solution Will it be required to convert Webex Client to Jabber since client needs only one interface on the

  • Unidentified plug-in that causes Safari to crash

    when i open safari i get the following error message: "The application Safari quit unexpectedly. The problem my have been caused by the ct_plugins plug-in." Could I get rid of the plug-in that is causing the problem by using Time Machine? If so, how

  • Using ftp in core java code to transferring a file to other sys

    My mail id:[email protected] hi to all I am actually using this code for transforing a file from my system to side system of mine.but the code is compiling and when runing this code i am getting an error: java.net.ConnectException: Connection ref

  • Individual Bass Control for Front/Rea

    Hey everyone! I was wondering if it is possible to control the bass and treble settings for each output on my soundcard individually, ie: the front and rear speakers. The reason I ask is because I have really nice speakers connected to the rear outpu

  • Blank fields in the table EKKO

    Hi, We have two strange records in the table EKKO. Only the following fields have data. MANDT, EBELN and MEMORY. All the other fields are blank. Could you please provide any insights as to how this record was saved? Regards Deepak