T-code to pull the year to date balance in SAP

Hello All,
This is Aswin Seshadri. can some one help me in getting a T-code which can pull the YTD balance for a given set of company codes?
The reason, I am preparing a macro for the work I do in my company to update the YTD balance.
Best Regards
Aswin S

Hello Gaurav,
Thank you!
But, I am not able to mention the series of company codes here. I have 300 plus company codes with me. I need to pull the year to date balance for all.
Please help.
Regards
Aswin

Similar Messages

  • Please help , I have iPhone 4S and have updated to iso6, don't know if that has anything to do with the problem but I can't set the year on date and time to the correct year, it automatically goes to 2578 ? Plz help

    Subject:
    Please help , I have iPhone 4S and have updated to iso6, don't know if that has anything to do with the problem but I can't set the year on date and time to the correct year, it automatically goes to 2578 ? Plz help

    Settings>General>International.
    Set the calendar to "Gregorian". You have it set to Buddhist.

  • How to Find the Year to Date ?

    Dear Experts
    How to find the Year to date in BI 7.0 i.e(1st April of Current year  to Tilldate) is there any Standard Variable is there ,Please let me know .as we are needed in our project.
    Thanks in Advance
    Satish

    Hi,
    I hope Stadard variables(Cumilated upto current fiscal year-0FYTCFP) will be avalable for this kind of requirement. Try to create a restricted key fig by make use of the standard variables...
    This is just my assumption.
    Message was edited by:
            Kameswari Ponnuri

  • Modify code to pull the time dependent master data

    I fully under stand the suggestion below for the requirement to add the time dependent attribute comp code
    thanks fo rthe help but please tell me if there is a way i can modify the abap code and make the user enter the value for the date on which he want to pull th emaster data for company code or keydate to and from and pull the master data, so how will i proceede should i create the variable on 0doc_date and how to modify the code. please help . i have opened another question with same desc as above to assign points
    thanks
    soniya
    The literal within <..> is supposed to be replaced by the actual field name (as I didn't know the fields). In this case, I am changing your code for costcenter/company-code.
    data : wa like /bi0/qcostcenter.
    select single * from /bi0/qcostcenter into wa
    where costcenter = comm_structure-costcenter
    and objvers = 'A'
    and datefrom le comm_structure-<keydatefield>
    and dateto ge comm_structure-<keydatefield>.
    if sy-subrc = 0.
    result = wa-comp_code.
    endif.
    abort = 0.
    You can use this code for update rule of company_code. You have to replace '<keydatefield>' with a field name that contains the date on which the company is to be derived. If there is a date in your comm_structure (eg aedat) which you can use, you can specify that field in place of this literal (instead of comm_structure-<keydatefld> use comm_structure-aedat). If you have no such field, and you wish to use current date for getting the company code from time-dependent master data, you can use sy-datum (ie replace comm_strucutre-<keydatefld> with sy-datum).
    And it should work.
    The 'master data attribute' option is one of the options when you create update rule (one of the radio button options).

    That the code is doing anyway.
    If your txn data in the cube doesn't have a date, how does it know it is Feb data, or, it is March data?
    If it has a date or month field, you should modify and use this code to update the company based on that date instead of system date.
    Other than that minor variation, it is already doing what you look for.

  • Mail.app using Day of the Year for date stamps.  Whaaaat?

    Here's a new one, for me anyway:
    It seems all of my emails in the mail.app have suddenly been stamped with dates that use the day of the year, rather than day of the month, i.e:
    37 February, 2011, instead of 6 February, 2011.
    This date format appears in both the Viewer Window and Message Headers, and is seen in both sent/received dates, on all saved/new messages (all the way back to a few from 2001) and in both of the mail.app accounts I use: one straight-up gmail, the other a worldshare.net address, also using the Gmail server.
    This behavior is not present when reading through webmail, nor is it a problem on my iPod Touch.
    Any thoughts?
    Thanks.

    It was all in Language and Text pref pane. I was pulling day of year, rather than day of month.
    Big ups to ibook_Steve over at MacNN!

  • Transaction code to list the warehouse master data objects

    Hello all,
    Is there any transaction code that lists all the warehouse master data objects/ reports. If there is any transaction code or document related to it pl. post it.
    Thanks,
    maxx

    Hi Greetings
    Transaction : SAP1
    Logistics Execution --> Warehouse Management --> Master Data
    You can find Number if WM master data reports.
    Gobinathan G

  • ABAP Code for Backup the entire table data in the application server

    Hello Friends,
    I have to create the table data Backup and Store the entire table data in the application server and also be able to restore the data back if needed.
    this should be dynamic program for any table based on the table name given on the application server.. I have developed a program for this but its having problems with the Quantity, amount. Its not writing it correctly at the application level.
    ANy Suggestions on this.
    Below is the program for this.
    Thanks,
    Ster.
    * Report  YWMM_TABLE_DUMP                                             *
    REPORT ywmm_table_dump .
    TABLES :
            dd03l.
    * Type spool declaration
    TYPE-POOLS:
            abap, slis.
    DATA: i_table_data1  TYPE REF TO data.
    DATA : it_dd03l LIKE dd03l OCCURS 0 WITH HEADER LINE.
    *DATA : gt_fieldcat TYPE lvc_s_fcat.
    DATA : i_fcat      TYPE STANDARD TABLE OF lvc_s_fcat,
           l_dr_line         TYPE   REF TO data,
           l_v_as4vers       TYPE as4vers.
    FIELD-SYMBOLS: <f_table_data1>     TYPE STANDARD TABLE,
                   <f_wa_table_data1>  TYPE ANY.
    SELECTION-SCREEN: BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
    PARAMETERS: rb_copy RADIOBUTTON GROUP map DEFAULT 'X',
                rb_rest RADIOBUTTON GROUP map.
    SELECTION-SCREEN: END   OF BLOCK bl1.
    SELECTION-SCREEN: BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
    PARAMETERS: p_table  TYPE tabname OBLIGATORY,
                p_plfld TYPE dd03l-fieldname.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: p_bkfile TYPE localfile OBLIGATORY.
    SELECTION-SCREEN: END   OF BLOCK bl2.
    PERFORM get_data.
    IF rb_copy = 'X'.
      PERFORM backup.
    ELSEIF rb_rest = 'X'.
      PERFORM database_update.
    ENDIF.
    *&      Form  get_data
    FORM get_data.
      CLEAR   i_fcat.
      REFRESH i_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name = p_table  " Table Name
           CHANGING
                ct_fieldcat      = i_fcat
           EXCEPTIONS
                OTHERS           = 1.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = i_fcat
      IMPORTING
        ep_table        = i_table_data1.
      IF sy-subrc = 0.
        ASSIGN i_table_data1->* TO <f_table_data1>.
      ELSE.
        WRITE: 'Error creating internal table'.
      ENDIF.
      IF rb_copy = 'X'.
        SELECT  * FROM (p_table) INTO CORRESPONDING FIELDS OF
                  TABLE <f_table_data1> UP TO 20 ROWS.
      ELSEIF rb_rest = 'X'.
        CREATE DATA l_dr_line LIKE LINE OF <f_table_data1>.
        ASSIGN l_dr_line->* TO <f_wa_table_data1>.
    *Get Data from Application Server
    * Opening the dataset P_BKFILE given in the selection screen
        TRANSLATE p_bkfile TO LOWER CASE.
        OPEN DATASET p_bkfile FOR INPUT IN TEXT MODE." ENCODING DEFAULT.
        IF sy-subrc NE 0.
    *    MESSAGE:
        ELSE.
          DO.
    * Reading the file from application server
            READ DATASET p_bkfile INTO <f_wa_table_data1>.
            IF sy-subrc = 0.
              APPEND <f_wa_table_data1> TO <f_table_data1>.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
    * Closing the dataset
          CLOSE DATASET p_bkfile.
        ENDIF.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  backup
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM backup.
      TRANSLATE p_bkfile TO LOWER CASE.
      OPEN DATASET p_bkfile FOR OUTPUT IN TEXT MODE.
      IF sy-subrc NE 0.
        WRITE: text-017.
        STOP.
      ELSE.
        LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
          TRANSFER <f_wa_table_data1> TO p_bkfile.
        ENDLOOP.
      ENDIF.
      CLOSE DATASET p_bkfile.
    ENDFORM.                    " backup
    *&      Form  database_update
    FORM database_update.
      DATA : i_mara_u TYPE STANDARD TABLE OF mara WITH HEADER LINE,
             i_ekpo_u TYPE STANDARD TABLE OF ekpo WITH HEADER LINE,
             i_eban_u TYPE STANDARD TABLE OF eban WITH HEADER LINE,
             i_resb_u TYPE STANDARD TABLE OF resb WITH HEADER LINE,
             i_plpo_u TYPE STANDARD TABLE OF plpo WITH HEADER LINE,
             i_stpo_u TYPE STANDARD TABLE OF stpo WITH HEADER LINE,
             i_vbap_u TYPE STANDARD TABLE OF vbap WITH HEADER LINE,
             i_vbrp_u TYPE STANDARD TABLE OF vbrp WITH HEADER LINE,
             i_lips_u TYPE STANDARD TABLE OF lips WITH HEADER LINE,
             i_afvc_u TYPE STANDARD TABLE OF afvc WITH HEADER LINE,
             i_asmd_u TYPE STANDARD TABLE OF asmd WITH HEADER LINE,
    *           i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
             i_qmel_u TYPE STANDARD TABLE OF qmel WITH HEADER LINE,
             i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
             i_esll_u TYPE STANDARD TABLE OF esll WITH HEADER LINE,
             i_t165_u  TYPE STANDARD TABLE OF t165 WITH HEADER LINE,
             i_t165e_u TYPE STANDARD TABLE OF t165e WITH HEADER LINE,
             i_twpko_u TYPE STANDARD TABLE OF twpko WITH HEADER LINE,
             i_tpext_u TYPE STANDARD TABLE OF tpext WITH HEADER LINE,
             i_ce4mxpa_u TYPE STANDARD TABLE OF ce4mxpa WITH HEADER LINE,
             i_ce4mxpa_acct_u TYPE STANDARD TABLE OF ce4mxpa_acct WITH
                                                             HEADER LINE,
             i_zaim_u  TYPE STANDARD TABLE OF zaim WITH HEADER LINE,
             i_s012_d TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
             i_s012_i TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
             i_dummy  TYPE STANDARD TABLE OF mara.
      CASE p_table.
        WHEN 'MARA'.
    *     Non-Key
          PERFORM move_to_table USING   <f_table_data1>
                                CHANGING i_mara_u[]
                                         i_mara_u.
          PERFORM update_table USING i_mara_u[].
      ENDCASE.
    ENDFORM.                    " database_update
    *&      Form  move_to_mara
    FORM move_to_table USING    p_tab_from TYPE STANDARD TABLE
                       CHANGING p_tab_to   TYPE STANDARD TABLE
                                p_w_table.
      DATA:  l_wa_fcat TYPE lvc_s_fcat.
      FIELD-SYMBOLS: <f_field_from> TYPE ANY,
                     <f_field_to>   TYPE ANY.
      LOOP AT p_tab_from ASSIGNING <f_wa_table_data1>.
        LOOP AT i_fcat INTO l_wa_fcat.
          ASSIGN COMPONENT l_wa_fcat-fieldname
         OF STRUCTURE <f_wa_table_data1> TO <f_field_from>.
          ASSIGN COMPONENT l_wa_fcat-fieldname
         OF STRUCTURE p_w_table TO <f_field_to>.
          <f_field_to> = <f_field_from>.
        ENDLOOP.
        APPEND p_w_table TO p_tab_to.
      ENDLOOP.
    ENDFORM.                    " move_to_mara
    *&      Form  update_table
    FORM update_table  USING p_table_update TYPE STANDARD TABLE.
      SELECT SINGLE *
        FROM dd03l
       WHERE fieldname = p_plfld
         AND tabname   = p_table
         AND keyflag   <> 'X'
         AND as4local = 'A'
         AND   as4vers = l_v_as4vers
         AND   ( comptype = 'E' OR comptype = space ).
      IF sy-subrc = 0.
    *   Do update
        IF NOT p_table_update IS INITIAL.
          UPDATE (p_table) FROM TABLE p_table_update.
          IF sy-subrc = 0.
            COMMIT WORK.
          ELSE.
            ROLLBACK WORK.
            WRITE: text-003.
            STOP.
          ENDIF.
        ENDIF.
      ELSE.
    *delete and insert.
        IF NOT p_table_update IS INITIAL.
    *      DELETE (p_table).
          IF sy-subrc = 0.
            INSERT (p_table) FROM TABLE p_table_update.
            IF sy-subrc = 0.
              COMMIT WORK.
            ELSE.
              ROLLBACK WORK.
              WRITE: text-018.
              STOP.
            ENDIF.
          ELSE.
            ROLLBACK WORK.
            WRITE: text-018.
            STOP.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " update_table
    Edited by: Julius Bussche on Jul 18, 2008 1:43 PM
    Please use a meaningfull subject title!

    ARS,
    I am struggling a bit to get this.
    there is a syntax error,
    Field "FIELDS_INT-TYPE" is unknown. It is neither in one of thespecified tables nor defined by a "DATA" statement.     
    Again you have asked to move to a diffrent table. What is that table and how to build it.
        LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
          LOOP AT i_fcat INTO l_fcat.
            IF l_fcat-inttype EQ 'P'.
              ASSIGN COMPONENT l_fcat-fieldname
                  OF STRUCTURE <f_wa_table_data1> TO <f_field>
                  TYPE     fields_int-type
                  DECIMALS fields_int-decimals.
            ELSE.
              ASSIGN COMPONENT l_fcat-fieldname
                  OF STRUCTURE <f_wa_table_data1> TO <f_field>
                  TYPE     fields_int-type.
            ENDIF.
            " Move <f_field> to a new table and use this table for download
          ENDLOOP.
          TRANSFER <f_wa_table_data1> TO p_bkfile.
        ENDLOOP.
    Ster

  • OM - Report S_AHR_61016509 Vacant Positions doesn't pull the Org Unit data

    Hello,
    When I run the report - S_AHR_61016509 Vacant Positions, it pulls all the vacant positions. But it does not pull the information on which Org Unit the vacant position belongs to.
    The end user would like to know which org unit the vacant position belongs to in the org structure, so if there is a new hire in that org unit, we can reuse the same position.
    Please guide.
    Thanks in advance.
    Madhu

    Hi,
    On the output, click on print preview button (ShiftF6). On the next screen, click on change layout button (CtrlF8). Select the 4 hidden fields and transfer them to the left pane and click on copy.
    You can then transport the output as excel too.
    Iu2019d recommend you to save the layout by going to Settings>Layout>Saving. You would then get an option on the report selection screen to specify the layout and you could save your variant accordingly.
    Hope this helps.
    Donnie

  • How to pull the Latest Time/Date of the update?

    Hi BW gurus,
    Hope everyone is fine.
    I have a doubt to meet my user requirement.
    I have a developed the infocubes and Infoset(combining only two master data infoprovider infoobjects) and created few reports on them.
    Now the requirement is
    "Client is asking for the latest date on which the data target is updated".
    Say if we run the infopackage on a particular day say "Dec 1st 2006"
    For example one cube is a full update, always by dropping the previously loaded data and one cube is updated with the delta update.
    For all the reports , if we run the query, the report should give the information stating that the latest update was made on "UPDATED DATE=Dec 1st 2006".
    how to achieve this?
    Please somebody help me out.
    Please tell me the step by step that I need to follow to achieve this.
    Any kind of help is appreciated.
    I am still in DEV.
    Thanks in advance,
    Regards
    Sam Mathew

    Hello
    This can be achieved
    First add an infoobject to your Data targets for Update date
    Second , include the update date infoobject in your infosource
    Map the infoobject with the field sys-datum which is current system date
    So whenever you execute an infopackage, the sys-datum field will pick up the current date at which it is executed.
    This is what you want in BW as latest update date of data target
    Regards
    Ganesh N

  • How to transport the CO and DATA file to SAP system

    Hello Experts ,
                          I want to know the procedure to import a transport request into an isolated SAP system ( which is not in the transport route ) using the CO and DATA files .
    I know that user should have adminstrator role to do this but i dont know how to do this .
    Regards
    Vivek

    Simply copy the source cofile and datafile from the source system to the target system and then import.
    Data file is located at /usr/sap/trans/<sid>/data with format R<transport_number>.<sid> and cofile is located at /usr/sap/trans/<sid>/cofile with format K<transport_number>.<sid>
    Copy them to the same location on the target system and then go to STMS -> Extras -> Add -> insert the name of the transport in format <sid>K<transport_number>, this will add the transport to the import queue then just simply import the transport.
    Regards
    Juan

  • I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. years each month.

    I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. year each month. I need to create a spreedsheet using the the Acutlas from the year-to-date and from last year-to-date, but need to report each month.

    Hi Tony,
    Answering your question would be easier given a screen shot of the source table and one of what you want the summary table to look like.
    Is the data you want for each month in a single cell o the source table, or does the summary table need to collect February's data (for example) from several cells and do some math with those numbers before presenting them on the summary table?
    Regards,
    Barry

  • Month-to-Date and Year-to-Date values in Query

    Hello experts,
    One of our BI reports has the following requirement: the user should be asked for the report date. After the user inputs the date, the report shows the key figures in three different "flavors": one is the values for that date, the second one is the cumulate values from the first day of the month of the report date to the report date itself, and the third is the cumulate values from the first day of the year of the report date to the report date itself.
      I created my report date variable based on 0CALDAY. Then I searched for SAP-exit variables that would help me achieve this, but could not really find any, except for 0P_ABO10, 0P_ABO11, 0P_ABO12 variables, all of them have as description "Start of Key Date Year". I tried creating a few selections in which the dates taken were defined as a range from each of these variables to the report date variable (for the year-to-date values), but I got the error "Variable 0P_ABO10 could not be substituted". I also got this error for the other two variables. And I could not find any SAP-exit variables like "Start of Key Date Month", in order to do the Month-to-Date part. My next try was to use the field "Key Date" with a variable in it, instead my own report date variable based on 0CALDAY, but it gave me the same errors.
    I searched the forums and found a few threads that looked useful, like
    First and Last day of month and
    1st day of month / 1st day of week variables
    However, they require some ABAP coding, and I do not know where to place the code (actually, I do not know where to work with ABAP code), and I also believe that I would have to do some changes to it.
    Any suggestions?

    Hi Pedro,
    You have to create customer exit in T_Code: CMOD
    1. Create a Z project
    2. Select RSR00001 as enhancement type.
    3. Go into include ZXRSRU01
    4. create a code like
    Here A is your variable based on 0calmonth with type customer exit and B is variable for 0calday.
    Try to write logic for your case taking this as example.
    WHEN 'A'.
        IF I_Step = 2.
          Loop at I_T_VAR_RANGE into L_T_VAR_RANGE where VNAM = 'B'.
            Concatenate L_T_VAR_RANGE-LOW(4) '001' into D1.
            Concatenate L_T_VAR_RANGE-LOW(4) '012' into D2.
            Clear L_S_Range.
            L_S_Range-low = D1.
            L_S_RANGE-high = D2.
            L_S_RANGE-sign = 'I'.
            L_S_RANGE-opt = 'BT'.
            Append L_S_Range to E_T_Range.
          ENDLOOP.
        ENDIF.
    If you want exact code I can help you in that.
    Thanks,
    Kams

  • Year-to-date summarization

    Hi,
    I have to get the Year-to-date amount on an ALV output for a GL account. Is there any FM to do it?... Currently Iam just getting the output for the period that I put in selection screen.
    Thank you,
    SB.

    Hi
    You have to use the filed symbols for this purpose.
    see the sample code
    report zfgldr0010
           line-size 122
           line-count 60
           no standard page heading
           message-id zndc.
    Database Tables
    tables: bsis,      " Accounting: Secondary Index for G/L Accounts
            ska1,      " GL Account Master
            t001,      " Company Codes
            csks,      " Cost Centers Master
            setnode,   " Cost Center Group Hierarchy
            setleaf.   " Cost Center Group Hierarchy
    Declaration of Internal Tables
    Internal Table to fetch the Opex Budget & Capex Actual Data
    data: begin of it_bud_tab occurs 0,
            lednr   like cosp-lednr,          " Ledger No
            objnr   like cosp-objnr,          " Object No
            gjahr   like cosp-gjahr,          " Fiscal Year
            wrttp   like cosp-wrttp,          " Actuals
            versn   like cosp-versn,          " Version
            twaer   like cosp-twaer,          " Currency
            perbl   like cosp-perbl,          " Period Block
            kstar   like cosp-kstar,          " Cost Element/GL A/C No
            wog001  like cosp-wog001,         " Total Value
            wog002  like cosp-wog002,         " Total Value
            wog003  like cosp-wog001,         " Total Value
            wog004  like cosp-wog002,         " Total Value
            wog005  like cosp-wog001,         " Total Value
            wog006  like cosp-wog002,         " Total Value
            wog007  like cosp-wog001,         " Total Value
            wog008  like cosp-wog002,         " Total Value
            wog009  like cosp-wog001,         " Total Value
            wog010  like cosp-wog002,         " Total Value
            wog011  like cosp-wog001,         " Total Value
            wog012  like cosp-wog002,         " Total Value
          end of it_bud_tab.
    Internal Table to fetch the Settlement Costs(Opex-Actual)
    data: begin of it_set_tab occurs 0,
            kokrs   like coep-kokrs,          " Controlling Area
            belnr   like coep-belnr,          " Acc Document
            buzei   like coep-buzei,          " Line Item
            perio   like coep-perio,          " Period Block
            wkgbtr  like coep-wkgbtr,         " Value in CO Curr
            lednr   like coep-lednr,          " Ledger No
            objnr   like coep-objnr,          " Object No
            gjahr   like coep-gjahr,          " Fiscal Year
            wrttp   like coep-wrttp,          " Actuals
            versn   like coep-versn,          " Version
            kstar   like coep-kstar,          " Cost Element
            beknz   like coep-beknz,          " Dr/Cr Indicator
            parob1  like coep-parob1,         " Partner Object
          end of it_set_tab.
    Internal Table to fetch the COBRB data(Settlement rules)
    data: begin of cobrb_tab occurs 0,
            objnr   like cobrb-objnr,         " Object No
            rec_objnr1 like cobrb-rec_objnr1, " Ref Object No
            bureg   like cobrb-bureg,         " Dostribution Rule
            lfdnr   like cobrb-lfdnr,         " Sequence No
            perbz   like cobrb-perbz,         " Settlement Rule
            konty   like cobrb-konty,         " Acct Assign Category
            bukrs   like bsis-bukrs,          " Company Code
            kostl   like bsis-kostl,          " Cost Center
          end of cobrb_tab.
    Internal Table to Settlement Actual Costs for Cost center & GL
    data: begin of set_act_tab occurs 0,
            kostl   like csks-kostl,          " Cost Center
            hkont   like bsis-hkont,          " GL Account No
            amt_atd like bsis-dmbtr,          " YTD Actual
          end of set_act_tab.
    Internal Table to Settlement Actual Costs for Cost center
    data: begin of set1_act_tab occurs 0,
            kostl   like csks-kostl,          " Cost Center
            hkont   like bsis-hkont,          " GL Account No
            amt_atd like bsis-dmbtr,          " YTD Actual
          end of set1_act_tab.
    Internal Table to Capex Budget Figures
    data: begin of cap_tab occurs 0,
            belnr   like coej-belnr,          " Accounting Doc No
            buzei   like coej-buzei,          " Line Item No
            objnr   like coej-objnr,          " Object No
            wrttp   like bpej-wrttp,          " Value Type
            gjahr   like coej-gjahr,          " Fiscal Year
            wtjhr   like bpej-wtjhr,          " budget Value
          end of cap_tab.
    Internal Table to Segragate the Budget Figures(Full Year and YTD)
    data: begin of cap1_tab occurs 0,
            gjahr   like coej-gjahr,          " Fiscal Year
            kostl(10) type n,                 " Cost Center
            hkont(10) type n,                 " GL Account No
            amt_fy  like coej-wkf001,         " Full Year Amount
            amt_ytd like coej-wkf001,         " Ytd Amount
          end of cap1_tab.
    Internal Table to Sum up the Budget Figures(Full Year and YTD)
    data: begin of cap2_tab occurs 0,
            gjahr   like coej-gjahr,          " Fiscal Year
            kostl(10) type n,                 " Cost Center
            amt_fy  like coej-wkf001,         " Full Year Amount
            amt_ytd like coej-wkf001,         " Ytd Amount
          end of cap2_tab.
    Internal Table to Segragate the CAPEX YTD data(GL Wise)
    data: begin of cap_ytd_tab occurs 0,
            gjahr   like coej-gjahr,          " Fiscal Year
            kostl(10) type n,                 " Cost Center
            kstar   like coej-kstar,          " Cost Element
            amt_ytd like coej-wkf001,         " Ytd Amount
          end of cap_ytd_tab.
    Internal Table to Segragate the CAPEX YTD data(CC Wise)
    data: begin of cap1_ytd_tab occurs 0,
            gjahr   like coej-gjahr,          " Fiscal Year
            kostl(10) type n,                 " Cost Center
            amt_ytd like coej-wkf001,         " Ytd Amount
          end of cap1_ytd_tab.
    Internal Table to Segragate the Budget Figures(Full Year and YTD)
    data: begin of it_ytd_tab occurs 0,
            gjahr   like cosp-gjahr,          " Fiscal Year
            kostl   like bsis-kostl,          " Cost Center
            kstar   like cosp-kstar,          " Cost Element
            amt_fy  like cosp-wkf001,         " Full Year Amount
            amt_ytd like coej-wkf001,         " Ytd Amount
          end of it_ytd_tab.
    Internal Table to Segragate the Budget Figures(Full Year and YTD)
    data: begin of it_ytd1_tab occurs 0,
            gjahr   like cosp-gjahr,          " Fiscal Year
            kostl   like bsis-kostl,          " Cost Center
            amt_fy  like cosp-wkf001,         " Full Year Amount
            amt_ytd like coej-wkf001,         " Ytd Amount
          end of it_ytd1_tab.
    Internal Table to fetch the Actual YTD Figures
    data: begin of it_act_tab occurs 0,
            bukrs   like bsis-bukrs,          " Company Code
            hkont   like bsis-hkont,          " GL Account No
            gjahr   like bsis-gjahr,          " Fiscal Year
            belnr   like bsis-belnr,          " Accounting Doc No
            budat   like bsis-budat,          " Posting Date
            waers   like bsis-waers,          " Currency
            kostl   like bsis-kostl,          " Cost Center
            shkzg   like bsis-shkzg,          " Dr/Cr Indicator
            dmbtr   like bsis-dmbtr,          " Doc Amount
          end of it_act_tab.
    Internal Table to fetch the Actual YTD Figures( GL-SUM)
    data: begin of act1_tab occurs 0,
            bukrs   like bsis-bukrs,          " Company Code
            kostl   like bsis-kostl,          " Cost Center
            hkont   like bsis-hkont,          " GL Account No
            gjahr   like bsis-gjahr,          " Fiscal Year
            dmbtr   like bsis-dmbtr,          " Doc Amount
          end of act1_tab.
    Internal Table to fetch the Actual YTD Figures( CC-SUM)
    data: begin of act2_tab occurs 0,
            bukrs   like bsis-bukrs,          " Company Code
            kostl   like bsis-kostl,          " Cost Center
            gjahr   like bsis-gjahr,          " Fiscal Year
            dmbtr   like bsis-dmbtr,          " Doc Amount
          end of act2_tab.
    Internal Table to fetch the WBS Data
    data: begin of wbs_tab occurs 0,
            pspnr   like prps-pspnr,          " WBS Element
            posid   like prps-posid,          " WBS Structure Element
            objnr   like prps-objnr,          " Object No
            psphi   like prps-psphi,          " Project ID
            pbukr   like prps-pbukr,          " Company Code
            pkokr   like prps-pkokr,          " Controlling Area
            fkstl   like prps-fkstl,          " Cost center
          end of wbs_tab.
    Internal Table to get Capex Actual from Networks
    data: begin of net_tab occurs 0,
            aufnr   like afko-aufnr,          " Order No
            ftrmi   like afko-ftrmi,          " Release Date
            pronr   like afko-pronr,          " Project No
            aufpl   like afvc-aufpl,          " Routing No
            aplzl   like afvc-aplzl,          " Counter No
            objnr   like afvc-objnr,          " Object No
            projn   like afvc-projn,          " WBS Element
          end of net_tab.
    Internal Table to get Capex Actual from Orders
    data: begin of ord_tab occurs 0,
            aufnr   like aufk-aufnr,          " Order No
            aedat   like aufk-aedat,          " Order Date
            kostl   like aufk-kostl,          " Cost center
            objnr   like aufk-objnr,          " Object No
            pspel   like aufk-pspel,          " WBS Element
          end of ord_tab.
    Internal Table to fetch the Capex Actual Data
    data: it_cap_tab like kv02s occurs 0 with header line.
    Internal Table to store the output of function-G_SET_TREE_IMPORT.
    data : ccenter_group_tab like sethier occurs 0 with header line.
    Internal Table to store the output of function-G_SET_TREE_IMPORT.
    data : cost_center_tab like setvalues occurs 0 with header line.
    Declaration of Variables
    data: v_f_oper_amnt like bsis-wrbtr,    " Operations   F Year Budget
          v_f_depr_amnt like bsis-wrbtr,    " Depreciation F Year Budget
          v_f_main_amnt like bsis-wrbtr,    " Maintenance  F Year Budget
          v_f_capx_amnt like bsis-wrbtr,    " Capex F Year Budget
          v_b_oper_amnt like bsis-wrbtr,    " Operations   Budget YTD
          v_b_depr_amnt like bsis-wrbtr,    " Depreciation Budget YTD
          v_b_main_amnt like bsis-wrbtr,    " Maintenance  Budget YTD
          v_b_capx_amnt like bsis-wrbtr,    " Capex Budget YTD
          v_a_oper_amnt like bsis-wrbtr,    " Operations   Actual YTD
          v_a_depr_amnt like bsis-wrbtr,    " Depreciation Actual YTD
          v_a_main_amnt like bsis-wrbtr,    " Maintenance  Actual YTD
          v_a_capx_amnt like bsis-wrbtr,    " Capex Actual YTD
          v_v_oper_amnt type i,             " Operations   Variance
          v_v_depr_amnt type i,             " Depreciation Variance
          v_v_main_amnt type i,             " Maintenance  Variance
          v_v_capx_amnt type i,             " Capex Variance
          v_t_f_amnt    type i,             " Total F Year Budget
          v_t_b_amnt    type i,             " Total Budget YTD
          v_t_a_amnt    type i,             " Total Actual YTD
          v_t_v_amnt    type i,             " Total Variance
          v_gt_f_amnt   type i,             " GTotal F Year Budget
          v_gt_b_amnt   type i,             " GTotal Budget YTD
          v_gt_a_amnt   type i,             " GTotal Actual YTD
          v_gt_v_amnt   type i,             " GTotal Variance
          v_per_oper    type i,             " % YTD Operations
          v_per_depr    type i,             " % YTD Depreciation
          v_per_main    type i,             " % YTD Maintenance
          v_per_capx    type i,             " % YTD Capex
          v_per_tot     type i,             " % YTD Total
          v_per_gtot    type i,             " % YTD G Total
          v_kstar(4)    type n,             " Cost element
          v_yr(2)       type c,             " Year
          v_year(4)     type c,             " Year
          v_lines       type i,             " Number
          v_str(10)     type c,             " String
          v_gl(4)       type n,             " GL element
          v_gl1(10)     type n,             " GL Account Code
          v_mon(2)      type n,             " Month
          v_month(2)    type n,             " Month
          v_day(2)      type n,             " Day
          v_date  like sy-datum,            " Start Date in Year
          v_setid like sethier-setid, " To store Identification of a set
          v_subrc like sy-subrc,      " Return code
          v_settid like rgsbs-setnr.  " Identification of a set
    data: v_f_oper_amnt1 type i,    " Operations   F Year Budget
          v_f_depr_amnt1 type i,    " Depreciation F Year Budget
          v_f_main_amnt1 type i,    " Maintenance  F Year Budget
          v_f_capx_amnt1 type i,    " Capex F Year Budget
          v_b_oper_amnt1 type i,    " Operations   Budget YTD
          v_b_depr_amnt1 type i,    " Depreciation Budget YTD
          v_b_main_amnt1 type i,    " Maintenance  Budget YTD
          v_b_capx_amnt1 type i,    " Capex Budget YTD
          v_a_oper_amnt1 type i,    " Operations   Actual YTD
          v_a_depr_amnt1 type i,    " Depreciation Actual YTD
          v_a_main_amnt1 type i,    " Maintenance  Actual YTD
          v_a_capx_amnt1 type i.    " Capex Actual YTD
    Declaration of Constants
    constants : c_i         type c value 'I',         " Sign
                c_x         type c value 'X',         " Sign
                c_d         type c value 'D',         " Type
                c_h         type c value 'H',         " Credit Ind
                c_s         type c value 'S',         " Type
                c_o         type c value 'O',         " Type
                c_a         type c value 'A',         " Type
                c_01(2)     type n value '01',        " Month
                c_opt1(2)   type c value 'EQ',        " Option
                c_opt2(2)   type c value 'BT',        " Option
                c_dot(3)    type c value '...',       " Dots
                c_or(2)     type c value 'OR',        " Type
                c_ks(2)     type c value 'KS',        " Type
                c_mon(2)    type n value '01',        " Month
                c_ndc    like setnode-setname value 'NDC', " CC Group
                c_glno   like coej-versn value '000',  " For GL No
                c_versn1 like coej-versn value '100',  " Value
                c_kokrs  like coej-kokrs value '1000', " Controlling Area
                c_wrttp  like coej-wrttp value '01',   " Value Type
                c_wrttp1 like coej-wrttp value '41',   " Value Type
                c_wrttp2 like coej-wrttp value '04',   " Value Type
                c_versn  like coej-versn value '000',  " Version
                c_kbud   like bpej-vorga value 'KBUD', " Activity
                c_kbfr   like bpej-vorga value 'KBFR', " Activity
                c_kbn0   like bpej-vorga value 'KBN0', " Activity
                c_it_bud_tab_wog0(15)   value 'IT_BUD_TAB-WOG0',
                c_prart  like prps-prart value 'CA',   " Project Type
                c_psin   like afvc-steus value 'PSIN', " Control Key
                c_lednr  like cosp-lednr value '00',   " Ledger
                c_lednr1 like bpej-lednr value '0002', " Ledger
                c_class1 like setnode-setclass value '0101', " Class
                c_class2 like setnode-subclass value '1000', " Subclass
                c_thous     type i value '1000',        " Number
                c_settab like rgsbs-table value 'CCSS', " Table for set
                c_cctfld like t800s-feld value 'KOSTL'. " Field name
    Declaration of Ranges
    ranges: rn_kostl  for csks-kostl.       " Cost Centers
    Selection Screen
    selection-screen begin of block b1 with frame title text-001.
    parameters     : p_bukrs like t001-bukrs
                                default '1000'," Company Code
                     p_gjahr like bsis-gjahr
                        default sy-datum+0(4), " Fiscal Year
                     p_date  like bsis-budat obligatory.   " Date
    selection-screen end of block b1.
    selection-screen begin of block b2 with frame title text-021.
    parameters    : p_cgrup like setnode-setname.  " Cost Center Group
    select-options: s_kostl for csks-kostl.        " Cost Center
    selection-screen end of block b2.
    selection-screen begin of block b3 with frame title text-029.
    select-options :
      s_opers for ska1-saknr obligatory,  " Operns & Support GL A/C
      s_deprc for ska1-saknr obligatory,  " Depreciation GL A/C
      s_mmain for ska1-saknr obligatory,  " Major Maintenance GL A/C
      s_capex for ska1-saknr obligatory.  " Capital Expenditure GL A/C
    selection-screen end of block b3.
    Initialization
    initialization.
    At selection-screen
    at selection-screen.
    Validate the Selection Screen fields
      perform validate_screen.
    Value request for Cost Center Group.
    at selection-screen on value-request for p_cgrup .
    Get the F4 Help for Cost center Group
      perform set_auswaehlen(sapfk00b) using c_settab c_cctfld
                                       changing p_cgrup v_subrc
                                                v_settid.
    Start-of-Selection
    start-of-selection.
    Clear all the Variables in the Program
      perform clear_var.
    Get the Cost Centers from Cost Center Group.
      perform get_cc_values.
    Get the Budget data from database Table COSP
      perform get_budget_data.
    Get the Settlement Costs data from database Tables COBRB,COSP
      perform get_cobrb_data.
    Get the Actual YTD data from database Table BSIS
      perform get_act_ytd_data.
    Get the WBS Element Data
      perform get_wbs_data.
    Get the Networks and Activities for the WBS
      perform get_net_ord_data.
    Get the WBS Budget data from database Tables BPEJ
      perform get_cap_budget_data.
    Get the WBS Actual YTD data for WBS
      perform get_cap_act_ytd_data.
    Top-of-page
    top-of-page.
    Write the Report and Column Headings
      perform top_of_page.
    End-of-Selection
    end-of-selection.
    D-splay the Output Report.
      perform display_report.
    Form-Routines
    *&      Form  validate_screen
    Validation of selection Screen fields
    form validate_screen.
    Validation of Company Code
      clear t001.
      if not p_bukrs is initial.
        select single bukrs
          into t001-bukrs
          from t001
          where bukrs eq p_bukrs.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Company Code'(033).
        endif.
      endif.
    Validation of GL Account Code( P & L Operations )
      clear ska1.
      if not s_opers[] is initial.
        select saknr up to 1 rows
          into ska1-saknr
          from ska1
          where saknr in s_opers
            and ktopl = c_kokrs
            and xbilk = ' '.
        endselect.
        if sy-subrc <> 0.
          message e999 with
          'Incorrect GL Account for Operations and Support Cost'(034).
        endif.
      endif.
    Validation of GL Account Code( P & L  Depreciation)
      clear ska1.
      if not s_deprc[] is initial.
        select saknr up to 1 rows
          into ska1-saknr
          from ska1
          where saknr in s_deprc
            and ktopl = c_kokrs
            and xbilk = ' '.
        endselect.
        if sy-subrc <> 0.
          message e999 with
          'Incorrect GL Account for Depreciation'(035).
        endif.
      endif.
    Validation of GL Account Code( P & L  Maintenance)
      clear ska1.
      if not s_mmain[] is initial.
        select saknr up to 1 rows
          into ska1-saknr
          from ska1
          where saknr in s_mmain
            and ktopl = c_kokrs
            and xbilk = ' '.
        endselect.
        if sy-subrc <> 0.
          message e999 with
          'Incorrect GL Account for Major Maintenance'(036).
        endif.
      endif.
    Validation of GL Account Code (Balance Sheet-Capex)
      clear ska1.
      if not s_capex[] is initial.
        select saknr up to 1 rows
          into ska1-saknr
          from ska1
          where saknr in s_capex
            and ktopl = c_kokrs
            and xbilk = c_x.
        endselect.
        if sy-subrc <> 0.
          message e999 with
          'Incorrect GL Account for Capital Expenditures'(037).
        endif.
      endif.
    Validation of Cost Center Group
      if not p_cgrup is initial .
        clear setleaf-setname.
        select setname up to 1 rows
          from setleaf
          into setleaf-setname
          where setname eq p_cgrup and
                setclass = c_class1  and
                subclass = c_class2.
        endselect.
        if sy-subrc <> 0.
          clear setnode-setname.
          select setname up to 1 rows
            from setnode
            into setnode-setname
            where setname eq  p_cgrup and
                  setclass = c_class1   and
                  subclass = c_class2.
          endselect.
          if sy-subrc <> 0.
            message e999 with
            'Enter Correct Cost Center Group'(038).
          endif.
        endif.
      endif.
    Validation of Cost Center
      clear csks.
      if not s_kostl[] is initial.
        select kostl up to 1 rows
          into csks-kostl
          from csks
          where kostl in s_kostl
            and kokrs = c_kokrs.
        endselect.
        if sy-subrc <> 0.
          message e999 with
          'Enter Correct Cost Center Code'(039).
        endif.
      endif.
    Enter either Cost Center Group or Values
      if not p_cgrup is initial and not s_kostl[] is initial.
        message e999 with
          'Enter either Cost Center Group or Values'(040).
      endif.
    Validation of Date
      if p_date+0(4) ne p_gjahr.
        message e999(zndc) with
           'Please Enter the date in same Fiscal Year'(020).
      endif.
    To enter only last day of the month
      clear: v_month, v_day, v_year.
      v_month = p_date+4(2).
      v_day   = p_date+6(2).
      v_year  = p_date+0(4).
      if ( v_month = '01' or v_month = '03' or v_month = '05' or
           v_month = '07' or v_month = '08' or v_month = '10' or
           v_month = '12' ).
        if v_day ne '31'.
          message e999(zndc) with
          'Enter Last date of the Month'(022).
        endif.
      elseif ( v_month = '04' or v_month = '06' or v_month = '09' or
               v_month = '11' ).
        if v_day ne '30'.
          message e999(zndc) with
          'Enter Last date of the Month'(022).
        endif.
      elseif v_month = '02'.
        if v_year eq '2004' or v_year eq '2008'.
          if v_day ne '29'.
            message e999(zndc) with
            'Enter Last date of the Month'(022).
          endif.
        else.
          if v_day ne '28'.
            message e999(zndc) with
            'Enter Last date of the Month'(022).
          endif.
        endif.
      endif.
    endform.                    " validate_screen
    *&      Form  get_cc_values
    Get the Cost Centers from Cost Center Group
    form get_cc_values.
    Populate the Cost Centers from Cost Center Group
      if s_kostl[] is initial.
        if p_cgrup is initial.
          p_cgrup = c_ndc.
        else.
          p_cgrup = p_cgrup.
        endif.
    Concatenating Setnode table setclass,subclass fields and
    Cost Center Group
        concatenate c_class1 c_class2 p_cgrup
                       into v_setid.
    Calling function module to get SET_HIERARCHY & SET_VALUES
        perform frm_g_set_tree_import tables ccenter_group_tab[]
                                             cost_center_tab[]
                                      using  v_setid.
        loop at cost_center_tab.
          rn_kostl-low = cost_center_tab-from.
          rn_kostl-high = cost_center_tab-to.
          rn_kostl-sign =   c_i.
          if rn_kostl-low = rn_kostl-high.
            rn_kostl-option = c_opt1.
          else.
            rn_kostl-option = c_opt2.
          endif.
          append rn_kostl.
        endloop.
        clear v_setid.
       endif.
      else.
        rn_kostl[] = s_kostl[].
      endif.
    endform.              "get_cc_values
    *&       FORM  FRM_G_SET_TREE_IMPORT
    Subroutine to call the function G_SET_TREE_IMPORT.
    form frm_g_set_tree_import
                         tables ccenter_group_tab structure sethier
                                cost_center_tab   structure setvalues
                         using  p_v_setid.
      call function 'G_SET_TREE_IMPORT'
        exporting
      CLIENT                          = SY-MANDT
      FIELDNAME                       = ' '
      LANGU                           = SY-LANGU
      NO_DESCRIPTIONS                 = ' '
      NO_RW_INFO                      = ' '
          setid                           = p_v_setid
      TABNAME                         = ' '
      NO_VARIABLE_REPLACEMENT         = ' '
      ROOT_HEADER_ONLY                = ' '
      NO_TABLE_BUFFERING              = ' '
      MAX_HIER_LEVEL                  = 99
      DATE_FROM                       =
      DATE_TO                         =
    IMPORTING
      SET_NOT_TRANSPARENT             =
       tables
         set_hierarchy                   = ccenter_group_tab
         set_values                      = cost_center_tab
    EXCEPTIONS
      SET_NOT_FOUND                   = 1
      ILLEGAL_FIELD_REPLACEMENT       = 2
      ILLEGAL_TABLE_REPLACEMENT       = 3
      OTHERS                          = 4
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    "frm_g_set_tree_import
    *&      Form  clear_var
    Clear all the Variables in the program
    form clear_var.
    Clear/Initialize all the Variables
      clear: v_f_oper_amnt1, v_f_depr_amnt1, v_f_main_amnt1,
             v_f_capx_amnt1, v_b_oper_amnt1, v_b_depr_amnt1,
             v_b_main_amnt1, v_b_capx_amnt1, v_a_oper_amnt1,
             v_a_depr_amnt1, v_a_main_amnt1, v_a_capx_amnt1,
             v_f_oper_amnt, v_f_depr_amnt, v_f_main_amnt,
             v_f_capx_amnt, v_b_oper_amnt, v_b_depr_amnt,
             v_b_main_amnt, v_b_capx_amnt, v_a_oper_amnt,
             v_a_depr_amnt, v_a_main_amnt, v_a_capx_amnt,
             v_v_oper_amnt, v_v_depr_amnt, v_v_main_amnt,
             v_v_capx_amnt, v_t_f_amnt, v_t_b_amnt,
             v_t_a_amnt, v_t_v_amnt, v_gt_f_amnt,
             v_gt_b_amnt,v_gt_a_amnt,v_gt_v_amnt,
             v_per_oper, v_per_depr, v_per_main,
             v_per_capx, v_per_tot,  v_per_gtot.
    endform.               "clear_var
    *&      Form  get_budget_data
    Get the Budget Data from Database Table COSP
    form get_budget_data.
    Form Local data
      data: l_period(2) type n,
            l_name(35)  type c,
            l_monat     type i .
      l_monat = p_date+4(2).
    Field Symbols
      field-symbols <fs>.
      clear it_bud_tab.
      refresh it_bud_tab.
      select lednr             " Ledger No
             objnr             " Object No
             gjahr             " Fiscal Year
             wrttp             " Actuals
             versn             " Version
             twaer             " Currency
             perbl             " Period Block
             kstar             " Cost Element/GL A/C No
             wog001            " Total Value
             wog002            " Total Value
             wog003            " Total Value
             wog004            " Total Value
             wog005            " Total Value
             wog006            " Total Value
             wog007            " Total Value
             wog008            " Total Value
             wog009            " Total Value
             wog010            " Total Value
             wog011            " Total Value
             wog012            " Total Value
        into table it_bud_tab
        from cosp
        where lednr = c_lednr  and
              gjahr = p_gjahr  and
              wrttp = c_wrttp  and
              versn = c_versn  and
              beknz in (c_d,c_s).
      if sy-subrc = 0.
    Segragate the Budget Figures(Full Year and YTD)
        loop at it_bud_tab.
          if it_bud_tab-objnr+0(2) eq c_ks.
            move-corresponding it_bud_tab to it_ytd_tab.
            it_ytd_tab-kostl = it_bud_tab-objnr+6(10).
            it_ytd_tab-amt_fy = it_bud_tab-wog001  + it_bud_tab-wog002  +
                                it_bud_tab-wog003  + it_bud_tab-wog004  +
                                it_bud_tab-wog005  + it_bud_tab-wog006  +
                                it_bud_tab-wog007  + it_bud_tab-wog008  +
                                it_bud_tab-wog009  + it_bud_tab-wog010  +
                                it_bud_tab-wog011  + it_bud_tab-wog012.
    Get the YTD Budget using Field Symbols
            do l_monat times.
              l_period = sy-index.
              concatenate c_it_bud_tab_wog0 l_period
                           into l_name.
              assign (l_name) to <fs>.
              it_ytd_tab-amt_ytd = it_ytd_tab-amt_ytd +
                                          <fs>.
            enddo.
            collect it_ytd_tab.
            clear   it_ytd_tab.
          endif.
        endloop.
        sort it_ytd_tab by gjahr kostl kstar.
    Cost Center wise Sum Up of Costs
        loop at it_ytd_tab.
          at end of kostl.
            sum.
            move-corresponding it_ytd_tab to it_ytd1_tab.
            append it_ytd1_tab.
          endat.
          clear it_ytd1_tab.
        endloop.
        sort it_ytd1_tab by gjahr kostl.
    Segragate the Budget Figures into different Accounts/Cost elements
        loop at it_ytd_tab.
          if it_ytd_tab-kostl in rn_kostl.
    Budget Full Year and YTD (Operations & Support Cost)
            if not s_opers[] is initial.
              if it_ytd_tab-kstar in s_opers.
                v_f_oper_amnt = v_f_oper_amnt + it_ytd_tab-amt_fy.
                v_b_oper_amnt = v_b_oper_amnt + it_ytd_tab-amt_ytd.
              endif.
            endif.
    Budget Full Year and YTD (Depreciation)
            if not s_deprc[] is initial.
              if it_ytd_tab-kstar in s_deprc.
                v_f_depr_amnt = v_f_depr_amnt + it_ytd_tab-amt_fy.
                v_b_depr_amnt = v_b_depr_amnt + it_ytd_tab-amt_ytd.
              endif.
            endif.
    Budget Full Year and YTD (Major Maintainance)
            if not s_mmain[] is initial.
              if it_ytd_tab-kstar in s_mmain.
                v_f_main_amnt = v_f_main_amnt + it_ytd_tab-amt_fy.
                v_b_main_amnt = v_b_main_amnt + it_ytd_tab-amt_ytd.
              endif.
            endif.
          endif.
        endloop.
    Convert the Amount fields to nearest Thousand
        v_f_oper_amnt1 =  v_f_oper_amnt / c_thous .
        v_f_depr_amnt1 =  v_f_depr_amnt / c_thous .
        v_f_main_amnt1 =  v_f_main_amnt / c_thous .
        v_b_oper_amnt1 =  v_b_oper_amnt / c_thous .
        v_b_depr_amnt1 =  v_b_depr_amnt / c_thous .
        v_b_main_amnt1 =  v_b_main_amnt / c_thous .
      endif.
    endform.                "get_budget_data
    *&      Form  get_cobrb_data
    Get the Settlement Data from Database Table COBRB
    form get_cobrb_data.
      clear cobrb_tab.
      refresh cobrb_tab.
      select objnr            " Object No
             rec_objnr1       " Ref Object No
             bureg            " Dostribution Rule
             lfdnr            " Sequence No
             perbz            " Settlement Rule
             konty            " Acct Assign Category
             bukrs            " Company Code
             kostl            " Cost Center
         into table cobrb_tab
         from cobrb
         where kostl in rn_kostl.
      sort cobrb_tab by objnr rec_objnr1.
      delete adjacent duplicates from cobrb_tab comparing objnr.
    Get the Settlement Costs from COEP Table
      clear it_set_tab.
      refresh it_set_tab.
      if not cobrb_tab[] is initial.
        select kokrs            " Controlling Area
               belnr            " Acc Document
               buzei            " Line Item
               perio            " Period Block
               wkgbtr           " Value in CO Curr
               lednr            " Ledger No
               objnr            " Object No
               gjahr            " Fiscal Year
               wrttp            " Actuals
               versn            " Version
               kstar            " Cost Element
               beknz            " Dr/Cr Indicator
               parob1           " Partner Object
           into table it_set_tab
           from coep
           for all entries in cobrb_tab
           where lednr = c_lednr  and
                 wrttp = c_wrttp2 and
                 versn = c_versn  and
                 gjahr = p_gjahr  and
                 objnr = cobrb_tab-objnr and
                 parob1 = cobrb_tab-rec_objnr1 and
                 beknz in (c_o, c_a).
      endif.
    Settlement Actual Costs
      loop at cobrb_tab.
        if cobrb_tab-objnr+0(2) eq c_or.
          loop at it_set_tab where objnr  = cobrb_tab-objnr
                                   and parob1 = cobrb_tab-rec_objnr1.
            set_act_tab-kostl = cobrb_tab-kostl.
            set_act_tab-hkont = it_set_tab-kstar.
    Get the Actual Settlement Costs YTD Amount
            if it_set_tab-perio between c_mon and v_month.
              set_act_tab-amt_atd = set_act_tab-amt_atd +
                                    abs( it_set_tab-wkgbtr ).
            endif.
            collect set_act_tab.
            clear   set_act_tab.
          endloop.
        endif.
      endloop.
      sort set_act_tab by kostl hkont.
    Sum Up the Settlement Costs-CC wise
      loop at set_act_tab.
        at end of kostl.
          read table set_act_tab index sy-tabix.
          sum.
          move-corresponding set_act_tab to set1_act_tab.
          append set1_act_tab.
        endat.
        clear set1_act_tab.
      endloop.
      sort set1_act_tab by kostl.
      delete set1_act_tab where amt_atd = 0.
    endform.              "get_cobrb_data
    *&      Form  get_act_ytd_data
    Get the Actual YTD Data from Database Table BSIS
    form get_act_ytd_data.
      clear it_act_tab.
      refresh it_act_tab.
      select
            bukrs            " Company Code
            hkont            " GL Account No
            gjahr            " Fiscal Year
            belnr            " Accounting Doc No
            budat            " Posting Date
            waers            " Currency
            kostl            " Cost Center
            shkzg            " Dr/Cr Indicator
            dmbtr            " Doc Amount
         into table it_act_tab
         from bsis
         where bukrs eq p_bukrs  and
               gjahr eq p_gjahr  and
               budat le p_date   and
               kostl in rn_kostl.
      if sy-subrc = 0.
        sort it_act_tab by bukrs hkont.
        loop at it_act_tab.
          if it_act_tab-shkzg = c_h.
            it_act_tab-dmbtr = it_act_tab-dmbtr * -1.
          endif.
          move-corresponding it_act_tab to act1_tab.
          collect act1_tab.
          clear act1_tab.
        endloop.
        sort act1_tab by bukrs kostl hkont.
      endif.
    Cost Center wise Sum Up of Costs
      loop at act1_tab.
        at end of kostl.
          sum.
          move-corresponding act1_tab to act2_tab.
          append act2_tab.
        endat.
        clear act2_tab.
      endloop.
      sort act2_tab by gjahr kostl.
    Seperate the different Actual YTD Expenditures
      loop at act1_tab.
    Actual YTD (Operations & Support Cost)
        if not s_opers[] is initial.
          if act1_tab-hkont in s_opers.
            v_a_oper_amnt = v_a_oper_amnt + act1_tab-dmbtr.
          endif.
        endif.
    Actual YTD (Depreciation)
        if not s_deprc[] is initial.
          if act1_tab-hkont in s_deprc.
            v_a_depr_amnt = v_a_depr_amnt + act1_tab-dmbtr.
          endif.
        endif.
    Actual YTD (Major Maintainance)
        if not s_mmain[] is initial.
          if act1_tab-hkont in s_mmain.
            v_a_main_amnt = v_a_main_amnt + act1_tab-dmbtr.
          endif.
        endif.
      endloop.
    Opex Settlement Actual Costs
      loop at set_act_tab.
    Actual YTD (Operations & Support Cost)
        if not s_opers[] is initial.
          if set_act_tab-hkont in s_opers.
            v_a_oper_amnt = v_a_oper_amnt + set_act_tab-amt_atd.
          endif.
        endif.
    Actual YTD (Depreciation)
        if not s_deprc[] is initial.
          if set_act_tab-hkont in s_deprc.
            v_a_depr_amnt = v_a_depr_amnt + set_act_tab-amt_atd.
          endif.
        endif.
    Actual YTD (Major Maintainance)
        if not s_mmain[] is initial.
          if set_act_tab-hkont in s_mmain.
            v_a_main_amnt = v_a_main_amnt + set_act_tab-amt_atd.
          endif.
        endif.
      endloop.
    Convert Amount Fields to nearest thousands
      v_a_oper_amnt1 =  v_a_oper_amnt / c_thous .
      v_a_depr_amnt1 =  v_a_depr_amnt / c_thous .
      v_a_main_amnt1 =  v_a_main_amnt / c_thous .
    endform.                    " get_act_ytd_data
    *&      Form  get_wbs_data
    Get the WBS Element Data
    form get_wbs_data.
      clear wbs_tab.
      refresh wbs_tab.
      select pspnr             " WBS Element
             posid             " WBS Structure Element
             objnr             " Object No
             psphi             " Project ID
             pbukr             " Company Code
             pkokr             " Controlling Area
             fkstl             " Cost Center
         into table wbs_tab
         from prps
         where pbukr = p_bukrs  and
               pkokr = c_kokrs  and
               fkstl in rn_kostl and
               prart = c_prart.
    Consider only the Same Year WBS Elements Data
      loop at wbs_tab.
        v_yr   = wbs_tab-posid+5(2).
        if v_yr <> p_gjahr+2(2) .
          delete wbs_tab index sy-tabix.
        endif.
        clear: v_yr, v_gl.
      endloop.
      sort wbs_tab by pspnr posid.
    endform.              "get_wbs_data
    *&      Form  get_net_ord_data
    Get the Network, Orders Data for the WBS
    form get_net_ord_data.
    Get the Network data
      clear: net_tab, ord_tab.
      refresh: net_tab, ord_tab.
      if not wbs_tab[] is initial.
        select a~aufnr             " Order No
               a~ftrmi             " Release Date
               a~pronr             " Project No
               b~aufpl             " Routing No
               b~aplzl             " Counter No
               b~objnr             " Object No
               b~projn             " WBS Element
           into table net_tab
           from afko as a join afvc as b
           on aaufpl eq baufpl
           for all entries in wbs_tab
        

  • Year to date variable

    Hello experts,
    I have installed the variable : Current Year From Start, Range to Current date(Sap Exit) with tech name 0I_IPMD7. How do i know which time infoObject it is applicable to?
    i want to use this in the year to date sales calculation. But cannot see this available in any of the time infoobjects in the present 0sd_c03 cube!!
    please guide..
    regards,

    Hi Aby,
    Please look at RSZGLOBV table. You'll see that this variable is based on 0IPM_BEGDATE characteristic.
    You can also look in SE37 at the FM RSVAREXIT_0I_IPMD7 to figure out what the code is doing.
    Best regards,
    Eugene

  • Extract year from date and exclude Null

    I have a calculated column that will pull the year out of a date column:
    =TEXT([Date Impact Identified],"yyyy")
    This formula works fine but if the column is blank then it returns the value as 1899. I have tried several variations of ISBLANK or ="" but nothing has worked so far. I think I am putting the formula in the wrong order. Can anyone help?
    Thanks.

    Hello,
    In order to save you weeding through other threads, here's what should work in your scenario:
    =IF(ISBLANK([Date
    Impact Identified]),"",TEXT([Date
    Impact Identified],"yyyy"))
    cheers, teylyn

Maybe you are looking for