Fetch GLPCA-SPRCTR instead of csks-PRCTR - Urgent

Hi All,
i have a report which dispalys a column profit center (CSKS-PRCTR).
My functional wants to replace this field (CSKS-PRCTR) with GLPCA-SPRCTR.
I tried with various option but not successful. Any help would be highly appreciated.
Thanks,
Senthil
Message was edited by:
        senthil kumar

Hi,
The problem is that i am getting multiple records, the input given is  controlling area, company code, date, plant, account number and functional area.
I am pasting my code here
start-of-selection.
  perform get_data.
  perform update_profit_center.                           "+D01K962014
  perform produce_output.
*&      Form  GET_DATA
form get_data.
  clear: t_month, t_days, t_year, t_date_from, t_date_to, t_line.
Month of Period to Analyze
  t_month = p_perio2+1(2).
Year of Period to Analyze
  t_year = p_gjahr2.
Get number of days of Period to Analyze
  call function 'NUMBER_OF_DAYS_PER_MONTH_GET'
       exporting
            par_month = t_month
            par_year  = t_year
       importing
            par_days  = t_days.
Put dates together for select from AFRU
  concatenate p_gjahr1 p_perio1+1(2) '01' into t_date_from.
  concatenate t_year t_month t_days into t_date_to.
Select Process Orders only for Dates specified
  select aufnr into table itab_aufnr
    from afru
   where budat ge t_date_from
     and budat le t_date_to
     and werks in s_werks.
Sort and delete duplicates from Orders table
  sort itab_aufnr.
  delete adjacent duplicates from itab_aufnr.
  describe table itab_aufnr lines t_line.
  if t_line gt 0.
Now select all other data with regard to Orders in Orders table
  select carbpl aauart awerks aaufnr bmatnr clmnga csptag "vornr
                                                 c~erdat  "+D01K962077
                                                  fmaktx jktext
          into table itab
   from ( ( ( ( ( ( (
                  aufk as a inner join afpo as b on baufnr = aaufnr )
                          inner join s022 as c on caufnr = baufnr and
                                                  cmatnr = bmatnr and
                                                  cwerks = bpwerk )
                          inner join makt as f on fmatnr = bmatnr )
                          inner join tkkap as g on gkokrs = akokrs )
                          inner join tkv09 as h on hkokrs = akokrs )
                          inner join crhd as i on iarbpl = carbpl )
                          inner join crtx as j on iobjty = jobjty and
                                                  iobjid = jobjid )
           for all entries in itab_aufnr
           where a~aufnr eq itab_aufnr-aufnr
             and a~auart in s_auart
             and a~werks in s_werks
             and c~arbpl in s_arbpl
             and g~kokrs in s_kokrs
             and g~versa in s_versa
             and h~awvrs in s_awvrs.
    sort itab by aufnr matnr.
    delete adjacent duplicates from itab comparing aufnr matnr.
    loop at itab.
      concatenate 'OR' itab-aufnr into lr_objnr-low.
      lr_objnr-sign = 'I'.
      lr_objnr-option = 'EQ'.
      append lr_objnr.
    endloop.
    sort lr_objnr.
    delete adjacent duplicates from lr_objnr.
    call function 'KKR_COOBJECT_VALUES_READ'
         exporting
              i_kokrs              = s_kokrs-low
        I_OBJNR              =
              i_gjahr_von          = p_gjahr1
              i_gjahr_bis          = p_gjahr2
              i_perio_von          = p_perio1
              i_perio_bis          = p_perio2
              i_nur_belast         = ' '
        I_KATYP              =
        I_NUR_P_I            =
        I_NUR_P_I_S          =
              i_kontrollkosten     = ' '
              i_read_owaer         = ' '
              i_pvers              = '000'
              i_ivers              = '000'
              i_svers              = s_awvrs-low
              i_avers              = s_versa-low
              i_bewsicht           = '0'
        I_CONV_UNITS         = 'X'
   IMPORTING
        E_KENNZAHLEN         =
         tables
              rng_objnr            = lr_objnr
        RNG_WRTTP            =
        RNG_BEKNZ            =
              t_kennzahlen         = lt_keyfigures
        T_KKBC               =
        T_KKROBJ             =
        T_KKBOB              =
         exceptions
              no_kokrs_set         = 1
              no_input_data        = 2
              different_input_data = 3
        OTHERS               = 4
  endif.
endform.                    " GET_DATA
*&      Form  update_profit_center
      update profit center for each line item in itab
form update_profit_center.
  data: lv_objid like crhd-objid,
        lv_kokrs like crco-kokrs,
        lv_kostl like crco-kostl,
        lv_prctr like csks-prctr.
  field-symbols: <fs_itab> like line of itab.
update profit center into itab - alv output table
  loop at itab assigning <fs_itab>.
    clear lv_objid.
  read resource/work center id of resource/work center of a plant
  -CRHD
    select objid into lv_objid
      from crhd
     where objty = 'A'              and   " A - work center
    use order creation date instead of period to analyse"+D01K962077
          begda <= <fs_itab>-sptag and                  "+D01K962077
          endda >= <fs_itab>-sptag and                  "-D01K962077
           begda <= <fs_itab>-erdat and                   "+D01K962077
           endda >= <fs_itab>-erdat and                   "+D01K962077
           arbpl =  <fs_itab>-arbpl and   " resource/work center
           werks =  <fs_itab>-werks.      " plant
      exit.
    endselect.
    clear: lv_kokrs,lv_kostl.
    if not lv_objid is initial.
    read cost center using work center id and date to analyse field to
    validate from and to valid periods- CRCO
      select kokrs kostl
        into (lv_kokrs,lv_kostl)
        from crco
       where objty =  'A'             and
             objid =  lv_objid        and
    use order creation date instead of period to analyse"+D01K962077
            endda >= <fs_itab>-sptag and                "-D01K962077
            begda <= <fs_itab>-sptag.                   "-D01K962077
             endda >= <fs_itab>-erdat and                 "+D01K962077
             begda <= <fs_itab>-erdat.                    "+D01K962077
        exit.
      endselect.
      if sy-subrc eq 0.
        clear lv_prctr.
      read profit center of cost center that belongs to a date to
      analyse period - from CSKS
<b>*** This quesry needs to be replaced with GLPCA table</b>
        select <b>prctr into lv_prctr</b>
          from csks
         where kokrs = lv_kokrs and          " Controlling Area
               kostl = lv_kostl and          " Cost Center
    use order creation date instead of period to analyse"+D01K962077
              datbi >= <fs_itab>-sptag and              "-D01K962077
              datab <= <fs_itab>-sptag.                 "-D01K962077
               datbi >= <fs_itab>-erdat and               "+D01K962077
               datab <= <fs_itab>-erdat.                  "+D01K962077
          exit.
        endselect.
        if sy-subrc eq 0.
        update profit center to itab
          <fs_itab>-prctr = lv_prctr.        " Profit Center
        endif.
      endif.
    endif.
  endloop.
endform.                    " update_profit_center
Senthil.
Message was edited by:
        senthil kumar
Message was edited by:
        senthil kumar

Similar Messages

  • Dynamic Accordion, fetching node name instead of value. Is it possible?

    Here is the xml.
    <?xml-stylesheet type="text/xsl" href="myweb.xsl"?>
    <client product="ppd" date="4/26/11 3:17 AM">
    <system>
           <osname>Linux
              </osname>
           <hostname>abhishek
              </hostname>
           <release>2.6.18-128.el5
              </release>
           <version>Red Hat Enterprise Linux Server release 5.3 (Tikanga)
              </version>
           <machine>ia64
              </machine>
           <bitmode>64
              </bitmode>
           <filesystem>
              <file mount='Mounted' home='Filesystem' total='1K-blocks' free='Available' used='Used' percentage='Use%' />
              <file mount='/' home='/dev/sda3' total='60300484' free='38305668' used='18882312' percentage='34%' />
              <file mount='/boot/efi' home='/dev/sda1' total='1046516' free='1037912' used='8604' percentage='1%' />
              <file mount='/dev/shm' home='tmpfs' total='4120800' free='4120800' used='0' percentage='0%' />
           </filesystem>
    </system>
    </client>
    my spry region. Using {systemData::osname} I can point to "Linux" but instead I would like to get osname itself. So basically I want to make a tree like structure using accordion where data within tree comes from this xml's node names.
    <div spry:region="systemData">
    <div id="Accordion1" class="Accordion" tabindex="0">
    <div spry:repeat="systemData" class="AccordionPanel">
    <div class="AccordionPanelTab">{systemData::osname}</div>
    <div class="AccordionPanelContent">
    {systemData::hostname}
    </div>
    </div>
    </div>
    <script type="text/javascript">
    var a1 = new Spry.Widget.Accordion("Accordion1");
    </script>
    </div>
    last but not least here is my spry dataset
    var systemData=new Spry.Data.XMLDataSet("include/xml/clientabhishek.xml","client/system");

    hehe. Sorry for not being so clear. I wanted to know whether there is a way I can get osname(node name) instead of Linux (node value) from my dataset. Like using {osname} I can get value of osname but I was wondering if osname itself can be fetched someway. Is there a way? Thanks for passing by

  • How to do Query optimization?It takes more time to fetch the record from db. Very urgent, I need your assistance

    Hi all
                                     I want to fetch just twenty thousands records from table. My query take more time to fetch  twenty thousands records.  I post my working query, Could you correct the query for me. thanks in advance.
    Query                    
    select
    b.Concatenated_account Account,
    b.Account_description description,
    SUM(case when(Bl.ACTUAL_FLAG='B') then
    ((NVL(Bl.PERIOD_NET_DR, 0)- NVL(Bl.PERIOD_NET_CR, 0)) + (NVL(Bl.PROJECT_TO_DATE_DR, 0)- NVL(Bl.PROJECT_TO_DATE_CR, 0)))end) "Budget_2011"
    from
    gl_balances Bl,
    gl_code_combinations GCC,
    psb_ws_line_balances_i b ,
    gl_budget_versions bv,
    gl_budgets_v gv
    where
    b.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID and bl.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID and
    bl.budget_version_id =bv.BUDGET_VERSION_ID and gv.budget_version_id= bv.budget_version_id
    and gv.latest_opened_year in (select latest_opened_year-3 from gl_budgets_v where latest_opened_year=:BUDGET_YEAR )
    group by b.Concatenated_account ,b.Account_description

    Hi,
    If this question is related to SQL then please post in SQL forum.
    Otherwise provide more information how this sql is being used and do you want to tune the SQL or the way it fetches the information from DB and display in OAF.
    Regards,
    Sandeep M.

  • Download Maintenance Orders instead of Production Order in SAP IM-3.2

    Hi All,
    I am trying to fetch Maintenance orders instead of production order in syclo agentry IM-3.2
    In the receipts screen their is a button GetProdOrder which fetches the Production order,instead of fetching the Production Order i want to change it to fetch the Maintenance Orders.
    please suggest me steps for the above change.
    Thanks ,
    Deepak.M
    Tags edited by: Michael Appleby

    Deepak,
    I don't think this will be easily accomplished.  The BAPI is written specifically for production orders.  I believe it would require changes to the BAPI itself, or changing the java to point to a different BAPI.
    Jason Latko - Senior Product Developer at SAP

  • Can u send an URGENT text message on the Droid Charge???

    I been trying to figure out how to send an urgent text message. I've had the phone since lst November and seems all I can do is send regualr text messages. How can u send an urgent text message so that it grabs the recipients attention to respond as soon as possible. Like for example, that person ur sending the message to is in a situation where they cant recieve phone calls, so u gotta text them instead and its an urgent matter, so ur wanna to send an urgent text message that grabd their attention immediately.  So does anyone know how u go about sending an urgent text message? Please get back to me. Thanks -Brian

    don't know aside from calling someone.  if they are unable to receive phone calls, then they are probably unable to receive texts.  you could sending them an e-mail - perhaps they have a data signal?

  • Problem with applet.getUserName() to fetch currently logged userid

    Hi,
    I am using applet.getPropertyValue("IllumLoginName") to fetch the currently logged in user. But in some places there is already an MII function used applet.getUserName() to fetch current logged in UserID. But the problem is when a user logs in the MII with a UserID : USERA and does some operation and logsoff and he logs in as a new user with ID : USERB, but MII fetches the USERA instead of USERB. After some investigations we found that it is because we are using getUserName() function of applet which is fetching the previously logged in userid.
    Please let me know what is the differece between these 2 functions.
    Browser : IE7+
    MII Version : 11.5
    Java version: 1.5.0_06
    Thanks in Advance,
    Raj.

    As you have found the .getUserName is only good for the initial user, so you must use the .getPropertyValue approach.
    The applets only 'log themselves in' once, so the getPropertyValue is the true check for the UME session user.
    You could also use this approach in an irpt page and request it with javascript as well:
    <input type="hidden" id="WhoDat" value="{IllumLoginName}">
    Regards,
    Jeremy

  • How to fetch rows from multiple tables

    I have a page with items from 3 tables. I need to populate these items with values from the database. The page does not allow me to use multiple automated fetches. So instead I decided to use a pl/sql page process that runs a cursor to get my field values and the uses apex_util.set_session_state to set the field item values. IS there any isues with doing this? Is there a better way?

    These tables are not really related so I gues I will stick with the pl/sql to populate and then page process to insert/update/delete. Here is the code I'm using.
    Chris
    DECLARE
    CURSOR get_info IS
    select A.FK_STU_BASE, A.FK_CONTACT, A.FK_RELATION, A.PRIORITY, A.CAN_PICK_UP_STUDENT,
    A.GETS_STX, A.GETS_STG, A.GETS_STA, A.GETS_DIS, A.GETS_THX, A.GETS_MED,
    A.GETS_MAIL, A.NOTES as STUDENT_NOTES, A.USER_FLD1, A.USER_FLD2, A.USER_FLD3,
    A.USER_FLD4, A.USER_FLD5, A.LAST_UPDATE_DATE, A.LAST_UPDATE_USER,
    B.PK_ID as CONTACT_PK_ID, B.FIRST_NAME, B.LAST_NAME, B.MIDDLE_INIT, B.PREFIX,
    B.SUFFIX, B.FK_LANGUAGE, B.PHONE, B.PHONE_UNLISTED, B.PHONE_EXTENSION,
    B.PHONE_DESCRIPTION, B.EMERGENCY_PHONE, B.EMERGENCY_UNLISTED, B.EMERGENCY_EXTENSION,
    B.EMERGENCY_DESCRIPTION, B.CELL_PHONE, B.CELL_UNLISTED, B.CELL_EXTENSION,
    B.CELL_DESCRIPTION, B.CELL2_PHONE, B.CELL2_UNLISTED, B.CELL2_EXTENSION,
    B.CELL2_DESCRIPTION, B.WORK1_PHONE, B.WORK1_UNLISTED, B.WORK1_EXTENSION,
    B.WORK1_DESCRIPTION, B.WORK2_PHONE, B.WORK2_UNLISTED, B.WORK2_EXTENSION,
    B.WORK2_DESCRIPTION, B.FAX_PHONE, B.FAX_DESCRIPTION, B.EMAIL1, B.EMAIL2,
    B.NOTES as CONTACT_NOTES, B.FK_LODGING, B.FK_EDUCATION_LEVEL,
    C.PK_ID as LODGING_PK_ID, C.FK_ZIP, C.FK_DISTRICT, C.HOUSE_NO, C.LETTER,
    C.DIRECTION, C.STREET, C.STREET2, C.PLUS4, C.APT, C.FK_GRIDCODE,
    C.FK_MUNICIPALITY, C.OPTIONAL_INFO1, C.OPTIONAL_INFO2, C.OPTIONAL_INFO3,
    C.FK_DWELLING, C.OPTIONAL_ZIPCODE
    from contact_link A,
    contact B,
    lodging C
    where A.PK_ID = :P470_CONTACT_LINK_PK_ID and
    B.PK_ID (+) = A.FK_CONTACT and
    C.PK_ID (+) = B.FK_LODGING;
    BEGIN
    FOR x in get_info LOOP
    -- Set Contact Link Items
    APEX_UTIL.SET_SESSION_STATE('P470_FK_STU_BASE',X.FK_STU_BASE);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_CONTACT',X.FK_CONTACT);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_RELATION',X.FK_RELATION);
    APEX_UTIL.SET_SESSION_STATE('P470_PRIORITY',X.PRIORITY);
    APEX_UTIL.SET_SESSION_STATE('P470_CAN_PICK_UP_STUDENT',X.CAN_PICK_UP_STUDENT);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STX',X.GETS_STX);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STG',X.GETS_STG);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STA',X.GETS_STA);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_DIS',X.GETS_DIS);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_THX',X.GETS_THX);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_MED',X.GETS_MED);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_MAIL',X.GETS_MAIL);
    APEX_UTIL.SET_SESSION_STATE('P470_STUDENT_NOTES',X.STUDENT_NOTES);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD1',X.USER_FLD1);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD2',X.USER_FLD2);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD3',X.USER_FLD3);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD4',X.USER_FLD4);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD5',X.USER_FLD5);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_UPDATE_DATE',X.LAST_UPDATE_DATE);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_UPDATE_USER',X.LAST_UPDATE_USER);
    --Set Contact Items
    APEX_UTIL.SET_SESSION_STATE('P470_CONTACT_PK_ID',X.CONTACT_PK_iD);
    APEX_UTIL.SET_SESSION_STATE('P470_FIRST_NAME',X.FIRST_NAME);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_NAME',X.LAST_NAME);
    APEX_UTIL.SET_SESSION_STATE('P470_MIDDLE_INIT',X.MIDDLE_INIT);
    APEX_UTIL.SET_SESSION_STATE('P470_PREFIX',X.PREFIX);
    APEX_UTIL.SET_SESSION_STATE('P470_SUFFIX',X.SUFFIX);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_LANGUAGE',X.FK_LANGUAGE);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE',X.PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_UNLISTED',X.PHONE_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_EXTENSION',X.PHONE_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_DESCRIPTION',X.PHONE_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_PHONE',X.EMERGENCY_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_UNLISTED',X.EMERGENCY_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_EXTENSION',X.EMERGENCY_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_DESCRIPTION',X.EMERGENCY_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_PHONE',X.CELL_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_UNLISTED',X.CELL_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_EXTENSION',X.CELL_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_DESCRIPTION',X.CELL_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_PHONE',X.CELL2_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_UNLISTED',X.CELL2_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_EXTENSION',X.CELL2_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_DESCRIPTION',X.CELL2_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_PHONE',X.WORK1_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_UNLISTED',X.WORK1_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_EXTENSION',X.WORK1_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_DESCRIPTION',X.WORK1_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_PHONE',X.WORK2_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_UNLISTED',X.WORK2_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_EXTENSION',X.WORK2_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_DESCRIPTION',X.WORK2_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_FAX_PHONE',X.FAX_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_FAX_DESCRIPTION',X.FAX_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMAIL1',X.EMAIL1);
    APEX_UTIL.SET_SESSION_STATE('P470_EMAIL2',X.EMAIL2);
    APEX_UTIL.SET_SESSION_STATE('P470_CONTACT_NOTES',X.CONTACT_NOTES);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_LODGING',X.FK_LODGING);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_EDUCATION_LEVEL',X.FK_EDUCATION_LEVEL);
    --Set Lodging Items
    APEX_UTIL.SET_SESSION_STATE('P470_LODGING_PK_ID',X.LODGING_PK_ID);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_ZIP',X.FK_ZIP);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_DISTRICT',X.FK_DISTRICT);
    APEX_UTIL.SET_SESSION_STATE('P470_HOUSE_NO',X.HOUSE_NO);
    APEX_UTIL.SET_SESSION_STATE('P470_LETTER',X.LETTER);
    APEX_UTIL.SET_SESSION_STATE('P470_DIRECTION',X.DIRECTION);
    APEX_UTIL.SET_SESSION_STATE('P470_STREET',X.STREET);
    APEX_UTIL.SET_SESSION_STATE('P470_STREET2',X.STREET2);
    APEX_UTIL.SET_SESSION_STATE('P470_PLUS4',X.PLUS4);
    APEX_UTIL.SET_SESSION_STATE('P470_APT',X.APT);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_GRIDCODE',X.FK_GRIDCODE);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_MUNICIPALITY',X.FK_MUNICIPALITY);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO1',X.OPTIONAL_INFO1);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO2',X.OPTIONAL_INFO2);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO3',X.OPTIONAL_INFO3);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_DWELLING',X.FK_DWELLING);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_ZIPCODE',X.OPTIONAL_ZIPCODE);
    END LOOP;
    END;

  • Urgent help please ! Get data after executing query

    Hi all
    I have stored some data's with labVIEW to mysql by writing query using db tools execute query.vi.
    For fetching those data's also wrote a query(select* from....)using the same tool . 
    the query got executed . What tool i have to use to retrieve the data from mysql to a labview array.( the fetch recordset data.vi tool is not fetching.)
    Thanks
    Attachments:
    db.JPG ‏11 KB

    First, make sure your query string is correct, no typos, the table and fields exist.  If all of this is correct, try using Fetch Next Recordset instead of Fetch Recordset.  I've had to do that with some databases.  For some reason, the record pointer doesn't advance with the query.  Or maybe the record pointer is pointing to empty space and the query places the record found as the next record instead of the current record.
    - tbob
    Inventor of the WORM Global

  • 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

  • ABAP Dump while Changing the Layout fields in Report output - RCOPCA02

    Hi,
    I Copied the Standard Program RCOPCA02 to ZRCOPCA02. I added two new fields(AUART, AUGRU) in the report output. It is executing correctly with default layout, While Changing the layout for displaying new fields it is dumping.
    I am not understanding, What should i do...
    Here is the Code.
    report ZRCOPCA02 no standard page heading message-id km
                    line-count (2) line-size 81.
    type-pools: slis, ecarc.
    DDIC-Tabellen *******************************************************
    tables: glpca,                         "Einzelposten / Ist
            glu1,                          "Übergabestruktur FI-SL-Anzeige
            t000,
            tka01,
            sscrfields,
            vbak.
    Variablen und int. Tabellen *****************************************
    data: l_vbeln like vbak-vbeln,
    l_auart like vbak-auart,
    l_augru like vbak-augru.
    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,
    v_auart like vbak-auart,
    v_augru like vbak-augru,
          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:  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 'KE5Z'.
    "<<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 'KE5Z',
                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 = 'RCOPCA02' )
                   or ( a_rec-rtool = 'TR' and a_rec-ronam = 'KE5Z' ) ) .
            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.
        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_glpcaO
            into 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  to i_glpca.
          append i_glpca.
        endloop.
      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 -racct_ktext = ls_rpcak-ktext.
      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 .
      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 -rbukrs
                ct       = '10'
              importing
                currency = hsl_curr.
          endon.
        externe Immobilienbezeichnung                     "ww/kb
        on change of i_glpca-imkey.
          if ( not -dabrz
                    I_length   = 20
                 importing
                      e_empge    = -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 -psppp.
            endif.
          endif.
        Währungen in Hilfsfeldern speichern
          if -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       = 'RCOPCA02'
               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.
    loop at i_glpca.
    select single vbeln auart augru
    into (l_vbeln, l_auart, l_augru)
    from vbak where vbeln = i_glpca-aubel.
    if sy-subrc = 0.
    move l_auart to i_glpca-v_auart.
    move l_augru to i_glpca-v_augru.
    modify i_glpca.
    endif.
    endloop.
      call function 'REUSE_ALV_GRID_DISPLAY'
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         exporting
            I_INTERFACE_CHECK        = ' '
               i_callback_program       = 'ZRCOPCA02'
               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 = -rrcty.
      clear authorized.
    check PrCtr/account/activity
      call function 'K_PCA_RESP_AUTHORITY_CHECK'
        exporting
          i_kokrs             = -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            = -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   = 'RCOPCA02'
          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

    Hi Prabhu,
    You are right, problem is with Field Catalog...
    When I use  FM 'REUSE_ALV_GRID_DISPLAY'  it is dumping...
    When i tried with FM 'REUSE_ALV_LIST_DISPLAY'  it is working perfectly....
    how can i use FM 'REUSE_ALV_GRID_DISPLAY' without dumping????
    do i need to pass any thing in FM????
    Here is the dump:
    Runtime Errors         MESSAGE_TYPE_X                                
           Occurred on     12/21/2006 at 01:03:24                                                                               
    The current application triggered a termination with a short dump.   
                                                             What happened?                                                       
    The current application program detected a situation which really    
    should not occur. Therefore, a termination with a short dump was     
    triggered on purpose by the key word MESSAGE (type X).               
                                                         Error analysis                                                       
    Short text of error message:                                                                               
    Technical information about the message:                             
    Message classe...... "0K "                                           
    Number.............. 000 
    User, transaction...                                                                               
    Language key........ "E"                                                    
    Transaction......... "SE38 "                                                
    Program............. "SAPLSLVC "                                            
    Screen.............. "SAPLSLVC_FULLSCREEN 0500"                             
    Screen line......... 3                                                                               
    Information on where termination occurred                                                                               
    The termination occurred in the ABAP program "SAPLSLVC " in "LINE_OUT_NEW_2".
    The main program was "ZRCOPCA02 ".                                          
    The termination occurred in line 918 of the source code of the (Include)    
    program "LSLVCF01 "                                                        
    of the source code of program "LSLVCF01 " (when calling the editor 9180).   
                                                             Source code extract                                                                               
    008880         gs_roid-row_id = rs_row-index * -1.                          
    008890       endif.                                                         
    008900       gs_roid-sub_row_id = rs_row-rowtype+7(10).                     
    008910       gs_poid-row_id = gs_roid-row_id.                               
    008920       gs_poid-sub_row_id = gs_roid-sub_row_id.                       
    008930       gs_poid-rowtype    = rs_row-rowtype.                           
    008940       gs_poid-index      = rs_row-index.                             
    008950       insert gs_poid into table rt_poid.  
    008960     endif.                                                               
    008970     append gs_roid to rt_roid.                                           
    008980                                                                          
    008990     loop at rt_fieldcat assigning <ls_fieldcat> where tech ne 'X' and    
    009000                                                       no_out ne 'X'.     
    009010                                                                          
    009020       if gflg_invisible = 'X'.                                           
    009030         if <ls_fieldcat>-do_sum is initial.                              
    009040           clear gflg_invisible.                                          
    009050           continue.                                                      
    009060         else.                                                            
    009070           clear g_col_counter.                                           
    009080           clear gflg_invisible.                                          
    009090         endif.                                                           
    009100       endif.                                                             
    009110                                                                          
    009120       clear gs_lvc_data.                                                 
    009130       clear g_style.                                                     
    009140                                                                          
    009150       assign component                                                   
    009160              <ls_fieldcat>-fieldname of structure rt_data to <g_field>.  
    009170       if sy-subrc ne 0.                                                  
         >         message x000(0k).                                                
    009190       endif.                                                             
    009200                                                                          
    009210       g_col_counter = g_col_counter + 1.                                 
    009220                                                                          
    009230       gs_lvc_data-row_pos = r_row_counter.                               
    009240       gs_lvc_data-col_pos = g_col_counter.                               
    009250       gs_lvc_data-row_id  = gs_roid-row_id.                              
    009260       gs_lvc_data-sub_row_id = gs_roid-sub_row_id.                       
    009270                                                                          
    009280   *   Endtotal and average                                               
    009290       if rs_row-rowtype(1) ca 'T' and <ls_fieldcat>-do_sum = 'C'.        
    009300   *     save the actual grouplevel information                    
    009310         gs_grouplevels = rs_grouplevels.                          
    009320         clear g_lines.                                            
    009330                                                                   
    009340   *     get number of lines of the collect table                  
    009350         describe table rt_data lines g_lines.                     
    009360   *     if there is only one line or the field has no references so
    009370   *     that only the first line has to be considered                                                                               
    Thanks,
    fractal
    null

  • IPhone Battery Drain, 7.1.2, I Have A FIX!

    Hello everyone!  My name is Gabriel Chen and my iPhone has been having trouble with battery draining, and overheating.  I'm here to tell you how to fix it.  This is completely different from the rest of the posts because I've discovered something interesting and new. 
    Background (I'm a little long-winded, sorry. Just skip down to "What-to-Do" if you are pretty sure you've had the same problems as me):
      I got my iPhone 5s when it first came out.  It's battery life was amazing, then the fire nation attacked.  Jokes aside, the battery became worthless about a month ago after I updated to 7.1.2.  I thought the issue was 7.1.2, but now that I fixed it, I don't think it is.  I took my phone into the apple store about a week ago because I was off to college and needed to fix this problem before I left.  They ran diagnostics and found kbd and backboard errors.  They immediately replaced it. I was happy because I had a brand new phone, but the battery issues came back, and this time even worse.  My phone was burning up, even hotter and it even froze sometimes.  I then took it to a store near my college–which was difficult because I have no car here–where they did a reset because that's what they always do.  I sat there and played with the phone to make sure the problem wasn't there.  Turns out it was still there.  I love apple genius bar employees, but not all of them are very knowledgeable about the products and how they work.  I don't blame them because: updates can always cause new problems, it's probably above their pay-grade to memorize what every single error code means, and they don't necessarily have knowledge that lets them troubleshoot any problems that involve hidden processes that their apple-issued easy-button diagnostic test doesn't tell them about.
      I then approached another employee who helped me immensely.  He knew something was wrong, which was awesome because most employees do tend to blow you off, so he decided he'd try to help me fix it.  He had a lot more knowledge about the phone.  This time he found kbd errors again so he replaced it.  After that process, he disappeared into the back of the employee's only part of the store.  I tried playing around with the phone, and it was clear that the problem persisted.  I then went and got help again.  This time, the new person who was helping me went to the back, and I waited around for about an hour and a half not knowing what was going on.  The whole time, I was wondering where the first guy who helped me disappeared to.  For the sake of convenience, the first person who helped me in this paragraph will be Ian, and the second will be Will.  Will eventually came back out, this time bringing Ian along with him.  Turns out Ian had been doing research for me in the back for the last 1.5 hours and found that the problem probably had to do with iCloud.  My phone was draining and overheating due to its attempt to download some sort of data with no success.  So each time it failed, it would retry over and over again.  This explains the overheating and battery drainage.  We deleted some stuff from iCloud and it got a lot better. 
      The next day though, the problem came back.  I was so frustrated so I've been trouble shooting for the past 5 hours.  Eventually, after 4 hours, I tried using different iTunes accounts.  There was no battery drain when I used these.  When I used my original account, there were still problems.  So I tried turning off iCloud on my account.  Still, I had no luck with it.  I eventually tried something else which finally fixed it! My phone now no longer has problems with battery drain and overheating.
    What-to-Do
    1. Go to Settings —> iCloud —> Delete Account
      Don’t worry, as long as you click “keep the stuff” or whatever it says, you won’t lose stuff
    2. See if your batter still drains by leaving it on and watching the battery.  Touch it and see if it’s heating up.  If your battery is draining 1% every 2 minutes, it definitely is still having problems.  It’s your own choice, but even if it does drain, I would follow the next step anyways.  If it doesn’t drain, the issue definitely had to do with iCloud.  Now, log in once again.
    3. Make sure all of the iCloud data that you care about is stored some where other than iCloud.  For example, make sure your Pages files are on your computer.
    4. Go to Settings —> iCloud —> Storage & Backup —> Manage Storage.  Then delete the stuff under Documents and Data.  I REPEAT, DO NOT DELETE WITHOUT FIRST MAKING SURE THE DATA IS ON YOUR COMPUTER IN SOME SHAPE OR FORM 
      Why?  What is probably happening is that there is probably data that is trying to get onto your phone.  This data is failing to do so which is causing an infinite loop of effort and failure which drains your battery and makes your phone work really hard.  Apple should code a fail-safe into this to stop the loop, but they haven’t yet.
    5. You’re done with this part!  For some of you, like me, your phone will stop draining.  If so, you’re done!  For some of you, it will start draining again!  Here’s the part that took me 5 hours to figure out, mostly because I was just frustrated and venting.
    6. If you’re still draining, go to Settings —> iTunes and App Store, and turn off SHOW ALL Music and Videos.  What this feature does is it will display the purchased items that have not been downloaded, but are on your iTunes account, specifically Music and Videos, within the the corresponding apps.  I understand that you probably like this feature and that you’re probably unhappy that I’m telling you to turn it off.  This is a glitch or bug that Apple will probably come to fix if it comes to their attention eventually, so don’t worry.  When they do fix it, you can turn these back on.
      Why? For some reason, the battery drain was being caused either: by the phone failing to fetch data from your iTunes account, pertaining to purchased items such as songs and videos; or by the phone repeatedly fetching the data, instead of just holding it in place.
    So, this fixed my phone completely.  Please rate me up if that’s even possible.  If you’re an Apple dude, I’d love to receive rewards if this was actually useful to you guys (haha, sorry I’m just a little proud of my accomplishment.)  If it doesn’t work, try to trouble shoot and figure it out.  If you would like clarification, feel free to comment or whatever it’s called. If this doesn't fix it, maybe try getting it replaced in an apple store because that might be the issue.

    Thought it had worked but soon found out it had not.
    after further days of trying finally, solved it for me Yesterday.
    turned off notifications when locked, and bingo, wow.
    i have not turned off iCloud but location services are also off.
    best thing to do I found was keep checking your usage, settings, general, usage, and flip down to bottom, if the standby and usage are similar there is a problem, if there is a big difference then all is ok. Just keep turning things off and on until the difference is very apparent.
    something on my phone was keeping the phone alive even when turned off, and I think this was the phone repeatedly trying to update continually.
    to me this is definitely down to the iOS, my wife has exactly same phone and iOS but hers doesn't have any problem and the battery lasts for days.
    the guy at the Genius Bar told me to restore the phone via iTunes, not iCloud. This is because iCloud remembers the exact info from your phone and simply reinstates it when you restore, and this includes the iOS too.
    when I get home from holidays that's what I'll do, or wait for iOS 8 in few weeks. But I'm so pleased I finally made it work, I was beginning to think ditch the phone and buy Samsung.
    anyway anyone out there please try my final solution and let me know if it works for you?

  • How to use the select option to get the multiple bom explosion

    hi friends,
              i have completed the bom exp using parameters to get one material
    input,but i need to adopt select option to give from and to materials
    i ll gives from and to materials with description and bom deails
    i here gave the coding also, pl give me a suggestion how to adpot the select
    optoins instead of parameters ,very urgent
    REPORT PP_BOM_EXPLOSION.
    tables :mara,marc,stpo.
    TYPE-POOLS : SLIS.
    *parameters: p_werks like t001w-werks obligatory.
    SELECT-OPTIONS : p_matnr FOR mara-matnr obligatory.
    **select-options : p_matnr for mara-matnr obligatory.
    PARAMETERS : P_WERKS LIKE T001W-WERKS OBLIGATORY,
            P_MATNR LIKE MARA-MATNR OBLIGATORY.
    *parameters: p_werks like marc-werks obligatory,
    *p_matnr like marc-matnr obligatory.
    constants c_x value 'X'.
    data: begin of it_comp occurs 0,
    matnr like mara-matnr,
    maktl like makt-maktx,
    idnrk like stpox-idnrk,
    ojtxp like stpox-ojtxp,
    menge like stpox-menge,
    meins like stpox-meins,
    matkl like stpox-matmk,
    end of it_comp.
    data : topmat like cstmat.
    data: w_topmat like cstmat.
    DATA : IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : WA_FIELDCAT_LN LIKE LINE OF IT_FIELDCAT.
    DATA : IT_EVENTCAT  TYPE SLIS_T_EVENT.
    DATA : WA_EVENTCAT_LN  LIKE LINE OF IT_EVENTCAT.
    DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA: S_COL_POS TYPE I.
    start-of-selection.
    perform explode_assembly.
    PERFORM BUILD_FIELDCATALOG.
    PERFORM DATA_DISPLAY.
    *end-of-selection.
    *perform write_report.
    *top-of-page.
    *perform print_header.
    *form print_header.
    *write: /(18) 'Component'(h00),
    *(40) 'Description'(h01),
    *'Mat.Group'(h02),
    *(18) 'Quantity'(h03).
    *uline.
    *endform.
    *form write_report.
    *write: / w_topmat-matnr under text-h00 color col_heading,
    *w_topmat-maktx under text-h01 color col_heading.
    *loop at it_comp.
    *write: /
    *it_comp-idnrk under text-h00,
    *it_comp-ojtxp under text-h01,
    *it_comp-matkl under text-h02,
    *it_comp-menge unit it_comp-meins under text-h03,
    *it_comp-meins.
    *endloop.
    *uline.
    *endform.
    form explode_assembly.
    data: it_stb like stpox occurs 0 with header line,
    it_stb2 like stpox occurs 0 with header line,
    it_stb3 like stpox occurs 0 with header line,
    w_msg(255) type c.
    SELECT MATNR FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
                               WHERE MATNR IN P_MATNR.
    Explode highest level:
    *LOOP AT IT_MARA.
    call function 'CS_BOM_EXPL_MAT_V2'
    exporting
    auskz = c_x
    capid = 'PP01'
    cuols = c_x
    datuv = sy-datum
    knfba = c_x
    ksbvo = c_x
    mbwls = c_x
    mdmps = c_x
    BGIXO = c_x
    MKMAT = c_x
    MMAPS = c_x
    FBSTP = c_x
    FTREL = c_x
    mtnrv = P_MATNR
    werks = p_werks
    importing
    topmat = w_topmat
    tables
    stb = it_stb
    exceptions
    alt_not_found = 1
    call_invalid = 2
    material_not_found = 3
    missing_authorization = 4
    no_bom_found = 5
    no_plant_data = 6
    no_suitable_bom_found = 7
    conversion_error = 8
    others = 9.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    into w_msg.
    *write: / w_msg.
    exit.
    endif.
    Don't process documents
    delete it_stb where idnrk is initial.
    Don't process valid from furure:
    delete it_stb where datuv >= sy-datum.
    Explode phantom assemblies up to last level
    *do.
    it_stb2[] = it_stb[].
    *delete it_stb2 where dumps is initial.
    *if it_stb2[] is initial.
    *exit.
    *endif.
    *delete it_stb where not dumps is initial.
    delete it_stb where VPRSV <> 'S' OR MMSTA = '61'.
    loop at it_stb2.
    call function 'CS_BOM_EXPL_MAT_V2'
    exporting
    capid = 'PP01'
    auskz = c_x
    cuols = c_x
    datuv = sy-datum
    knfba = c_x
    ksbvo = c_x
    mbwls = c_x
    mdmps = c_x
    FBSTP = c_x
    FTREL = c_x
    mtnrv = it_stb2-idnrk
    werks = p_werks
    tables
    stb = it_stb3
    exceptions
    alt_not_found = 1
    call_invalid = 2
    material_not_found = 3
    missing_authorization = 4
    no_bom_found = 5
    no_plant_data = 6
    no_suitable_bom_found = 7
    conversion_error = 8
    others = 9.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    into w_msg.
    *write: / w_msg.
    else.
    delete it_stb3 where idnrk is initial.
    delete it_Stb3 where sobsl = 50.
    loop at it_stb3 .
    multiply it_stb3-menge by it_stb2-menge.
    modify it_stb3 transporting menge.
    endloop.
    append lines of it_stb3 to it_stb.
    endif.
    *ENDLOOP.
    endloop.
    *enddo.
    Build table of components collecting the same components from
    all levels
    loop at it_stb.
    it_comp-matkl = it_stb-matmk.
    it_comp-idnrk = it_stb-idnrk.
    it_comp-ojtxp = it_stb-ojtxp.
    it_comp-menge = it_stb-menge.
      CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
        EXPORTING
        INPUT                = IT_STB-MEINS
        LANGUAGE             = SY-LANGU
        IMPORTING
      LONG_TEXT            =
       OUTPUT               = IT_STB-MEINS
      SHORT_TEXT           =
    EXCEPTIONS
       UNIT_NOT_FOUND       = 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.
    it_comp-meins = it_stb-meins.
    collect it_comp.
    clear it_comp.
    endloop.
    *READ TABLE IT_COMP INDEX 1.
    *IF SY-SUBRC = 0.
    IT_COMP-MATNR = w_topmat-matnr.
    IT_COMP-MAKTL = w_topmat-maktx.
    INSERT IT_COMP index 1.
    *ENDIF.
    ENDFORM.
    FORM TO APPEND DATA INTO ALV FORM
    FORM BUILD_FIELDCATALOG.
    PERFORM BUILD_FIELDCAT USING 'MATKL' 'Component'.
    PERFORM BUILD_FIELDCAT USING 'MATKL' 'Component'.
    *loop at it_comp.
       PERFORM BUILD_FIELDCAT USING 'MATNR' 'Material'.
      PERFORM BUILD_FIELDCAT USING 'MAKTL' 'Material Description'.
      PERFORM BUILD_FIELDCAT USING 'IDNRK' 'Component'.
      PERFORM BUILD_FIELDCAT USING 'OJTXP' 'Description'.
      PERFORM BUILD_FIELDCAT USING 'MATKL' 'Material Group'.
      PERFORM BUILD_FIELDCAT USING 'MENGE'  'Quantity'.
      PERFORM BUILD_FIELDCAT USING 'MEINS' 'Unit Of MEASUREMENT'.
    *endloop.
    ENDFORM.
    FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
    FORM BUILD_FIELDCAT USING L_FIELDNAME LIKE DD03L-FIELDNAME S_TEXT LIKE DD03P-SCRTEXT_M.
      CLEAR WA_FIELDCAT_LN.
      ADD 1 TO S_COL_POS.
      WA_FIELDCAT_LN-REF_TABNAME  = 'IT_COMP'.
      WA_FIELDCAT_LN-FIELDNAME    = L_FIELDNAME.
      WA_FIELDCAT_LN-SELTEXT_M    = S_TEXT.
      WA_FIELDCAT_LN-COL_POS      = S_COL_POS.
      WA_FIELDCAT_LN-QFIELDNAME   = SPACE.
      WA_FIELDCAT_LN-HOTSPOT      = SPACE.
      WA_FIELDCAT_LN-JUST         = 'R'.
      APPEND WA_FIELDCAT_LN TO IT_FIELDCAT.
    ENDFORM.
    FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
    FORM DATA_DISPLAY.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = TEXT-001
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = IT_FIELDCAT
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = IT_COMP
       EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.
    Thanks in advance
                                                                                    Regards
    senthilkumar D

    tables :mara,marc,stpo.
    parameters: p_werks like t001w-werks obligatory.
    *p_matnr like mara-matnr obligatory.
    *select-options : p_matnr for mara-matnr obligatory.
    select-options : P_matnr for mara-matnr.
    *parameters: p_werks like marc-werks obligatory,
    *p_matnr like marc-matnr obligatory.
    constants c_x value 'X'.
    data: begin of it_comp occurs 0,
    idnrk like stpox-idnrk,
    ojtxp like stpox-ojtxp,
    menge like stpox-menge,
    meins like stpox-meins,
    matkl like stpox-matmk,
    end of it_comp.
    data: w_topmat like cstmat.
    data : begin of itab occurs 0,
            matnr like mara-matnr,
            end of itab.
    *data : itab type table of mara with header line.
    start-of-selection.
    perform explode_assembly.
    end-of-selection.
    perform write_report.
    top-of-page.
    perform print_header.
    form print_header.
    write: /(18) 'Component'(h00),
    (40) 'Description'(h01),
    'Mat.Group'(h02),
    (18) 'Quantity'(h03).
    uline.
    endform.
    form write_report.
    write: / w_topmat-matnr under text-h00 color col_heading,
    w_topmat-maktx under text-h01 color col_heading.
    loop at it_comp.
    write: /
    it_comp-idnrk under text-h00,
    it_comp-ojtxp under text-h01,
    it_comp-matkl under text-h02,
    it_comp-menge unit it_comp-meins under text-h03,
    it_comp-meins.
    endloop.
    uline.
    endform.
    form explode_assembly.
    data: it_stb like stpox occurs 0 with header line,
    it_stb2 like stpox occurs 0 with header line,
    it_stb3 like stpox occurs 0 with header line,
    w_msg(255) type c.
    select matnr from mara into table itab where matnr  between p_matnr-low and p_matnr-high.
    loop at p_matnr.
      itab-matnr = p_matnr-low.
       append itab.
       itab-matnr = p_matnr-high.
       append itab.
       clear itab.
       endloop.
    Explode highest level:
    loop at itab.
    call function 'CS_BOM_EXPL_MAT_V2'
    exporting
    auskz = c_x
    capid = 'PP01'
    cuols = c_x
    datuv = sy-datum
    knfba = c_x
    ksbvo = c_x
    mbwls = c_x
    mdmps = c_x
    BGIXO = c_x
    MKMAT = c_x
    MMAPS = c_x
    FBSTP = c_x
    FTREL = c_x
    mtnrv = itab-matnr
    werks = p_werks
    importing
    topmat = w_topmat
    tables
    stb = it_stb
    exceptions
    alt_not_found = 1
    call_invalid = 2
    material_not_found = 3
    missing_authorization = 4
    no_bom_found = 5
    no_plant_data = 6
    no_suitable_bom_found = 7
    conversion_error = 8
    others = 9.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    into w_msg.
    write: / w_msg.
    exit.
    *else.
    endif.
    loop at it_stb.
    it_comp-matkl = it_stb-matmk.
    it_comp-idnrk = it_stb-idnrk.
    it_comp-ojtxp = it_stb-ojtxp.
    it_comp-menge = it_stb-menge.
    it_comp-meins = it_stb-meins.
    collect it_comp.
    clear it_comp.
    endloop.
    endloop.
    endform.
    i got the low and high from selectoption and then move it into itab.
    then i pass itab-matnr into fm. using loop.
    but i got only one output
    but ineet to got from and to output.
    give me a solution
    Regards
    ds

  • Intermittent Bug - htmldb_Get clobbers DOM body element - Apex4

    Hello,
    We recently started the process of upgrading to Apex4 and have had an issue with a call to htmldb_Get clobbering the DOM such that the body tag is emptied and thus nothing is rendered in the browser. But before jumping in too deep let me say this problem has been extremely hard to debug because 1) it is intermittent 2) it only happens in Firefox (3.5.X - 3.6.X) on Windows Vista and 3) turning on some debugging tools (like Fiddler) make the problem go away all together.
    How to reproduce:
    Go here:
    http://qa.surveyorhealth.com/meds/f?p=102:1:0
    On this page you will find a link to page 2
    On page2 you will find a link to page 1
    With enough patience, if you click on the two links (jumping back and forth between the pages) you will eventually reach a blank page. I've had to do it upward of 10 minutes before. Please note this does not only happen on MY Vista machine, but three other machines in separate locations, so I'm sure it's not just my browser. Once you get the blank screen if you view source you will see that indeed there is content between the body tags. And, if you have firebug installed, if you view the firebug console you will see that two ajax calls were successfully made (these are calls to htmldb_Get) and if you look at the DOM firebug will report that there is no content in the body tags.
    If you view source you will see two on demand application processes are called. One gets an application item's value and the other is used to set an application item's value (this code I believe was lifted from Carl here in the forums). They are defined like thus:
    returnItem:
    begin
    htp.prn(v(v('RETURNITEM')));
    end;
    returnNothing
    begin
    htp.prn(1);
    end;
    There is a third application process defined at "on load before header". It simply does this:
    :AI_PAGE_REQUESTED := 'YES';
    There are no other application items, application processes, page processes, page items or pages defined in this application. The javascript that calls htmldb_Get can all be seen if you do a view source on either page, they have the same javascript on them.
    This is the most stripped down app I could make that exhibits the problem. It does seem that the stripped down version results in a blank page less often than our actual application. So, in case you run out of patience clicking on those links, let me also give you a link to our application that does it more often, but still intermittent.
    http://qa.surveyorhealth.com/meds/f?p=500:4003:0::NO::::
    Once you visit that link about half way down the page you'll see a few links, one of them will say "Heath Ledger". Click on that link.
    You will now see some accordion type tabs. What you want to do is click the one that says "Example - Celebrity Drug Cocktail" then once that page loads click back to "Side Effects Risk Map". If you jump between these two tabs enough times you'll hit the blank page. Of course the page and application have many more processes, html and javascript in it but it shares the three application processes discussed above with the simplified application.
    Again this only shows up on Vista Firefox 3.5.X-3.6.X so please don't waste your time trying to replicate on a different environment. Also this code never has this problem in our environment that runs on Apex 3.2.0.00.27
    Let me know if you think there is any other information I could provide that would help in debugging. I could also email/ftp an export of the simplified application if it would help.

    Hi Patrick,
    Thanks for the feedback. I replaced page number 0 with $v('pFlowStepId') in both functions but that hasn't fixed the issue. I was missing an application item which was why you were seeing that error about RETURNITEM not in application 102. I've added the item and now the ajax queries are returning correctly (which actually seems to cause the blank page to show up more frequently).
    As for window.location = window.location. I can explain what it does, but for simplicity I just removed it and replaced it with an alert to show that it is not the root of the problem.
    Generally what I'm trying to do is force a page refresh if a user has used the back button. How do I know if they used the back button? If the back button is used then the page is not re-fetched from apex, instead it is pulled out of the browser's cache. I check for this situation by having every page run a pre header processes that sets AI_PAGE_REQUESTED := 'YES'. So the first thing the javascript does on the page is check what the value of that item is. If it is 'YES' then we know the page is being processed with a new request to apex and we're getting the latest content. If it is 'NO' then we know that the page has been pulled from the browser cache and we force the browser to refresh with window.location = window.location. You'll also see in the javascript code if AI_PAGE_REQUESTED != 'YES' then we set its value to NO (again using ajax). In summary it's just a way to force page refreshes when a page was not loaded with a fresh call to apex. And like I said, it worked fine in apex 3.X and works fine in 4.X outside of Firefox 3.6-3.8 in vista... I'm open to alternative implementations if it gets me away from these blank screens.
    I've included a screen shot of the blank screen and the results of the two ajax calls:
    http://qa.surveyorhealth.com/i/screens/blank-screen.gif
    Thanks again for your help Patrick.
    Edited by: Shawn Kessler on Sep 8, 2010 10:21 AM

  • FLAT FILE Datasource SERIOUS Problem

    Hi
    I want to read a header information in csv file to fill the FLAT FILE DATASOURCE structure.
    I cannot read it by default as I have to IGNORE THE HEADER ROW otherwise it wont come up correctly along with otherdetail  data that is below header row during extraction of CSV file.
    How can i do that or How can I CALL A Function module or any other to fetch that header row ?
    PLEASE HELP URGENTLY.
    Thanks

    you cannot read the header row only. But you can do a start routine within the transfer rules. There you can do whatever you like.
    Perhaps you might have some troubles getting your data that far. Your header row must comply to the rules defined in your datasource like size or data type. So you might need to change some definitions of your datasource.

  • [ORACLE 9] OPEN FOR statement USING bind variable

    Hi,
    I have a loop that only fetches 1 record instead of 7:
    DECLARE
    lv_into varchar2(40);
    lv_qry  varchar2(400);
    type curtest_ref is ref cursor;
    curtest          curtest_ref;
    lv_compteur number(4) := 1;
    lv_client_loc   varchar2(100);
    BEGIN
    dbms_output.put_line( 'Début' );
    lv_qry := 'select client_loc from tmp_jbm where client_id = :A ';
    open curtest for lv_qry using lv_compteur;                
    loop
                    fetch curtest into lv_client_loc ;
                    exit when curtest%notfound;
                    dbms_output.put_line( 'ligne: '       || to_char( lv_compteur )
                                       || ' Client Loc: ' || lv_client_loc );
                    lv_compteur := lv_compteur + 1;
                    exit when lv_compteur > 6;
         end loop;
    EXCEPTION
        when others then
                 dbms_output.put_line( 'Erreur exception: ' || sqlerrm );
    END;
    [/END CODE]
    It looks like the cursor only fetches 1 record and then stops.
    Many thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The code is doing what you have asked it to do.
    Incrementing lv_compteur := lv_compteur + 1; inside the FOR LOOP will not refresh your CURSOR as the CURSOR OPEN statement is outside the loop.
    You could change your lv_qry variable to something like this:
    lv_compteur_min number(4) := 1;
    lv_compteur_max number(4) := 6;
    lv_qry := 'select client_loc from tmp_jbm where client_id BETWEEN :A AND :B';and OPEN the cursor by passing two variables
    open curtest for lv_qry using lv_compteur_min, lv_compteur_max ;

Maybe you are looking for

  • Mac Pro - Yosemite - iMessage won't connect

    My mac pro is updated to Yosemite and everything is working but iMessage. Facetime, mail, everything is fully functional and I'm getting an error message saying "Could not sign in to iMessage. An error occurred during activations. Try again" Here's t

  • Design forms for multiple users

    Dear sir I am developing new application for my company.I don't know how to desing the the tables for multiple users and how to give rights to users to access certain forms.This application will use in two differnet languages. how to switch one langu

  • Multiple PHPBB forums

    I will be leasing a dedicated Windows Server 2008 server in a datacenter and I intend to host multiple websites with their own forums. I'm currently running on a Windows Server 2003 utilizing Snitz forum software and the Access DB. The Access DB is p

  • Very Very Urgent --Su01***

    Hi BW Gurus I got a requirement like ,I need to give(or add)access to new business areas 2414 and 2415 for already existing user to view the reports..How I should add this access to the Role in SU01 or PFCG transaction .Appreciated if also let me kno

  • Amount for budget in funds management

    Hi In case of internal order, we give create internal order first then we give budget amount in KO22. Similarly, where we have to give budget amount in case of funds management. I have given fund, commitment item and fund center in FB60. But budget c