Logic Required

Hi All,
Pl find the requirement below.
We have a inventory report in that we were showing the stock as on date and the value of that stock.
This inventory data ( Stock Only) will come from AFS( SAP System) as well as Non-SAP System.To calculate the stock value we are capturing the Moving avarage value from MBEW Table ( Data Source : 0MAT_PLANT_ATTR).It's kf so i have added KF in the 0MAT_PLANT and directly i was inserting this in Query level and doing caluclation.
Issue : In MBEW Table level moving average price will be maintained at material level and it will contain only the latest price.Means If moving price changes several times in MBEW table it will contain latest one and it will be updated the same in BI also.When i am calculating the inventory for back months it will take the new price and stock value will come .This should not happen.
Ex :
Material                Month         Stock           Moving avarage  Price        Value
A                           jUL'10             10             120 /-                            10*120
B                          SEP'10              10              150                              10*150
As per the above example if i run report in Jul'10        value will come as 1200   after two months i will go back and check the value of stock for Jul'2010 will be 1500.But actually it was 1200.
Solution : As informed by FS-Consultants there is one more table MBEWH contains historic information moving avarage prise based on period and month.But when i have chaked there is no standard extractorbased on MBEWH and how can i include in the reporting(How to impliment the logic).
Regards
Ramakanth.

Hi All,
Pl find the requirement below.
We have a inventory report in that we were showing the stock as on date and the value of that stock.
This inventory data ( Stock Only) will come from AFS( SAP System) as well as Non-SAP System.To calculate the stock value we are capturing the Moving avarage value from MBEW Table ( Data Source : 0MAT_PLANT_ATTR).It's kf so i have added KF in the 0MAT_PLANT and directly i was inserting this in Query level and doing caluclation.
Issue : In MBEW Table level moving average price will be maintained at material level and it will contain only the latest price.Means If moving price changes several times in MBEW table it will contain latest one and it will be updated the same in BI also.When i am calculating the inventory for back months it will take the new price and stock value will come .This should not happen.
Ex :
Material                Month         Stock           Moving avarage  Price        Value
A                           jUL'10             10             120 /-                            10*120
B                          SEP'10              10              150                              10*150
As per the above example if i run report in Jul'10        value will come as 1200   after two months i will go back and check the value of stock for Jul'2010 will be 1500.But actually it was 1200.
Solution : As informed by FS-Consultants there is one more table MBEWH contains historic information moving avarage prise based on period and month.But when i have chaked there is no standard extractorbased on MBEWH and how can i include in the reporting(How to impliment the logic).
Regards
Ramakanth.

Similar Messages

  • Logic required  for Sort in ALV

    Hi All,
    I am dowloding the ALV report layout in excel sheet thorough mailing functionality.
    I want to implenemnt the dynamic sort. Here I am writing this.but i want the logic for below code.
          CALL FUNCTION 'LT_DBDATA_READ_FROM_LTDX'
            EXPORTING
      I_TOOL             = 'LT'
              IS_VARKEY          = W_VARKEY_EU
            TABLES
              T_DBFIELDCAT       = IT_DBFIELDCAT_EU
            T_DBSORTINFO       =  IT_DBSORTINFO
             T_DBFILTER         = IT_FILTER_LAYOUT
             T_DBLAYOUT         = IT_DB_LAYOUT.
    LIT_DBSORTINFO[] = IT_DBSORTINFO[].
        SORT LIT_DBSORTINFO[] BY KEY1.
        DELETE ADJACENT DUPLICATES FROM LIT_DBSORTINFO[] COMPARING KEY1.
        LOOP AT LIT_DBSORTINFO[].
          CLEAR: LW_SPOS,
                 LW_UP,
                 LW_DOWN,
                 LW_SUBTOT,
                 LW_COMP,
                 LW_EXPA,
                 LW_GROUP.
          CLEAR IT_DBSORTINFO[].
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'SPOS'.
          IF SY-SUBRC = 0.
            LW_SPOS = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'UP'.
          IF SY-SUBRC = 0.
            LW_UP = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'DOWN'.
          IF SY-SUBRC = 0.
            LW_DOWN = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'SUBTOT'.
          IF SY-SUBRC = 0.
            LW_SUBTOT = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'COMP'.
          IF SY-SUBRC = 0.
            LW_COMP = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'EXPA'.
          IF SY-SUBRC = 0.
            LW_EXPA = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'GROUP'.
          IF SY-SUBRC = 0.
            LW_GROUP = IT_DBSORTINFO-VALUE.
          ENDIF.
          LOOP AT IT_ALV_DATA FROM W_LOOP_FROM_EU TO W_LOOP_TO_EU.
            LW_TABIX = SY-TABIX.
            READ TABLE IT_FIELDCAT INTO LW_FIELDCAT WITH KEY
                               FIELDNAME = LIT_DBSORTINFO-KEY1.
            IF SY-SUBRC = 0.
              ASSIGN COMPONENT SY-TABIX OF
                         STRUCTURE IT_ALV_DATA TO <LFS>.
              IF SY-SUBRC = 0.
                CLEAR LW_CHAR.
                LW_CHAR = <LFS>.
                  IF LW_SPOS= 'SPOS'.
                  LOGIC Required
                    ENDIF.
                  ELSEIF LW_OPTION = 'DOWN'.
                 LOgic required
                    ENDIF.
                        ENDIF.
          ENDLOOP.
        ENDLOOP.
    regards,
    Ajay reddy

    Hai,
    Let
    1)general data
    2)all customers
    3)company code data
    4)sales organization data
    are the check box names,Then
    Just use the piece  of code below:
    <b>IF general data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF all_customers = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF company_code_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF sales_organization_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.</b>
    Now check whether more than one Check Boxes are selected or not
    <b>IF COUNT GT 1.
    "* Do the oprations  what ever you want here  
    ENDIF.</b>
    <b>Reward points if it helps you.</b>
    Regds,
    Rama chary.Pammi

  • ALV ...Logic required

    Hi every body,
       I have one requirement like an alv report will display
    output which contains a material number.
    <b>If i click On the material number it shud go to MM03...Accounting view
    Logic required for this.</b>I am a beginner ...Plz help me...
    Thanks in advance.
    Message was edited by: raja gurrala

    Hi,
    See the code sample,
    INCLUDE <icon>.
    * Predefine a local class for event handling to allow the
    * declaration of a reference variable before the class is defined.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA : o_alvgrid          TYPE REF TO cl_gui_alv_grid ,
           o_dockingcontainer TYPE REF TO cl_gui_docking_container ,
           o_eventreceiver    TYPE REF TO lcl_event_receiver,
           wa_layout TYPE lvc_s_layo ,
           wa_variant TYPE disvariant.
    CONSTANTS : c_a(1) TYPE c VALUE 'A' ,                     " All Layouts
                c_x(1) TYPE c VALUE 'X'.
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
    * Hot Spot Click
           handle_hotspot
             FOR EVENT hotspot_click OF cl_gui_alv_grid
                IMPORTING e_row_id
                          e_column_id
                          es_row_no,
    * Double Click
    handle_double_click
          FOR EVENT double_click OF cl_gui_alv_grid
              IMPORTING e_row
                        e_column
                        es_row_no,
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    * Implementation
    CLASS lcl_event_receiver IMPLEMENTATION.
    *&      Method handle_hotspot
    * This method is called when the user clicks on a hotspot to drill down.
    * The following types are exported from the ALV
    * LVC_S_ROW
    * LVC_S_COL
    * LVC_S_ROID
      METHOD handle_hotspot.
    * The hotspot processing coded in the form below.
        PERFORM f9900_handle_hotspot USING e_row_id
                                           e_column_id
                                           es_row_no.
      ENDMETHOD.                    "handle_hotspot
    *&      Method handle_double_click
      METHOD handle_double_click.
    * The double click processing should be coded in the form below.
        PERFORM f9901_handle_double_click USING e_row
                                                e_column
                                                es_row_no.
      ENDMETHOD.                    "HANDLE_DOUBLE_CLICK
    FORM f9900_handle_hotspot  USING    p_row_id
                                        p_column_id
                                        p_row_no.
    *Read internal table for proper value.
      READ TABLE  i_output
                  INDEX p_row_id
                  INTO wa_output.
    * Call the transaction MMBE
      SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
      CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
    ENDFORM.                    " f9900_handle_hotspot
    *&      Form  f9901_handle_double_click
    *       Double Click
    FORM f9901_handle_double_click  USING    p_row
                                             p_column
                                             p_row_no.
      READ TABLE i_output INDEX p_row INTO wa_output.
      CASE p_column.
        WHEN 'MATNR'.
          IF NOT wa_output-matnr IS INITIAL.
            SET PARAMETER ID 'MAT' FIELD wa_output-matnr.
            CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
          ENDIF.
      ENDCASE.
    ENDFORM.                    " f9901_handle_double_click
    U can use either hot spot or double click event.
    If u r using hotspot set the hotspot = 'X' in fieldcatalog.
    Hope this helps.
    OR another method without oops concept
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    data:lv_matnr    LIKE v_mmim_lc-matnr,   "Material
    read table i_output into w_output index rs_selfield-tabindex.
    lv_matnr = w_output-matnr.
    SET PARAMETER ID 'MAT' FIELD lv_matnr.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN .
    Clear:     lv_matnr.
    ENDFORM.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                =
    *   I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_repid
         i_callback_pf_status_set          = 'SET_PF_STATUS'
    <b>     i_callback_user_command           = 'USER_COMMAND'</b>
         i_background_id        = 'ALV_BACKGROUND'
        IS_LAYOUT               = I_LAYOUT
        it_fieldcat             = i_fieldcat "field catalog
       I_SAVE                   = 'A'
       IS_VARIANT               = G_VARIANT
        TABLES
            t_outtab                       = i_output "output table
       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.
    Kindly reward points if this helps u, revert back with queries.
    Message was edited by: Judith Jessie Selvi

  • Logic required to findout "Release To Date" of the Purchase order

    Hi
    We are developing a custom program to release purchase orders as per clients requirements. In that, in the output, we need to display the "Release To Date" of the purchase order. Consider the release codes are R1,R2& R3, and currently the PO is released by R1, then we need to show "Release To Date" as R1. Simillerly once R2 also released the PO, we need to show "R1 R2" in the Release To Date field. This you can see in the Release Tab of the PO.
    Now we need to adopt the same logic in our custom program also. Which table i can find the release to date details. The latest release code of the PO also good enough to build the logic to findout the "Release To Date"
    Any pointers would be of great help.
    Thanks
    Venkat.

    Hi Venkat,
    Check up these tables
    T16FC, T16FD, T16FG, V_T16FC
    Regards,
    Hareesha
    If it's help's reward the pts

  • Program logic required

    Hi all,
    I have requirement saying that transfer data from one program to another transaction selection screen.
    Requirement is.
    In a programi will l have final data in one internal table.
    This data i need to send it for another program selection screen as input.
    Please provide me the logic.
    Thanks in advance

    use the first program as an include for the second program
    then in the intilisation of the second program
    use the values of the internal table of 1st program.
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Programming Logic required for pulling the records for past month /week

    Hi All
    I need help in the SQL programming logic.
    Oracle Database Version: 10.2.0.3.0
    Requirement
    In a data warehouse environment, I need to programme for weekly and monthly automated batch jobs to insert the data from Data_tbl to Reporting_tbl for generating reports. Tables descriptions are given below.
    Table1 - Data_tbl (Source table –this table gets updated everyday).
    Record_dt     first_name     last_name
    Table2 - Reporting_tbl_(Target table)
    Cycle_dt     first_name     last_name
    1. Monthly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’
    Using the above condition in development, I am pulling the data from source table for the past month data. This will be repeated every month and it should be automated.
    i.e., if I run this report any time in dec 2008, it should pick records of dates from Nov 01st to Nov 30th 2008. if I run this report any time in Jan 2009, it should pick records of dates from Dec 01st to Dec 31st 2008.
    Date Values should be assigned for past month. Value of Cycle_dt in target table should be end date of past month like 30-nov-2008, 31-dec-2008.
    2. Weekly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’
    Here week start day is Monday and end day is Sunday.
    If I run the report between Dec 08th to Dec 14th , it should pull records of dates from Dec 01st to Dec 07th 2008.
    On Dec 15th, it should pick from Dec 08th to Dec 14th.
    Value of Cycle_dt in target table should be end date of past week like 07-Dec-2008, 14-Dec-2008.
    Please help me with the logics for both Monthly and Weekly reports.
    Thanks

    Hi,
    For the monthly report, instead of
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’say:
    Where   Record_dt >= TRUNC (ADD_MONTHS (SYSDATE, -1), 'MM')
    and     record_dt <  TRUNC (SYSDATE, 'MM')SYSDATE is the current DATE.
    TRUNC (SYSDATE, 'MM') is the beginning of the current month. (Notice the condition above is less than this date, not equal to it.)
    ADD_MONTHS (STSDATE, -1) is a date exactly one month ago, therefore it is in the previous month.
    For the weekly report, instead of:
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’say
    Where   Record_dt >= TRUNC (SYSDATE - 7, 'IW')
    and     record_dt <  TRUNC (SYSDATE, 'IW')TRUNC (dt, 'IW') is the beginning of the ISO week (Monday-Sunday) that contains dt. Again, notice the end condition is strictly less than the beginning of the current week.

  • Logic Required in HR ABAP Program

    Hi,
    First i have to check the Change Date on Infotype 0000 Actions infotype (P0000-AEDTM).  If the change date falls within the Period Selection date specified then i have to include the employee in the report.
    the included fields are:
    P0000-AEDTM,P0001-BUKRS,PERNR,ENAME,P0000-MASSN,P0000-MASSG,P0000-BEGDA,P0001-ORGEH,P0001-PLANS,P0001-STELLP0001-ABKRS,P0001-WERKS,P0001-BTRTL,Q0001-MSTBR,Q0001-ENAME(supervisor name)
    If the change date (P0000-AEDTM) does not fall within the Period Selection Date, i have to check the Change Date in Infotype 0001 Organization Assignment infotype (P0001-AEDTM). If the change date falls within the Period Selection date specified then i have to include the employee in the report. Include in report only that information which has been changed from the previous Infotype 0001 record, except for Change Date, Company Code, Personnel Number and Name, which must always be included in the report.
    For this requirement i have written the below code:
    LOOP AT p0000 WHERE aedtm >= pn-begda AND
                          aedtm <= pn-endda.
       wa_final-massn = p0000-massn.
        wa_final-pernr = p0000-pernr.
        wa_final-aedtm = p0000-aedtm.
        wa_final-massg = p0000-massg.
        wa_final-begda = p0000-begda.
        wa_final-begda = p0000-begda.
        rp-provide-from-last p0001 space  p0000-begda p0000-endda.
        wa_final-bukrs = p0001-bukrs.
        wa_final-kostl = p0001-kostl.
        wa_final-mstbr = p0001-mstbr.
        wa_final-ename = p0001-ename.
        APPEND wa_final TO it_final.
        CLEAR wa_final.
    ENDLOOP.
    if sy-subrc ne 0.
    LOOP AT p0001 WHERE aedtm >= pn-begda AND
                            aedtm <= pn-endda.
          lv_endda = p0001-begda - 1.
          READ TABLE p0001 WITH KEY pernr = p0001-pernr endda = lv_endda INTO w0001.
          IF sy-subrc = 0.
          if p0001-kostl ne w0001-kostl.
            wa_final-kostl = p0001-kostl.
          endif.
         if p0001-mstbr ne w0001-mstbr.
            wa_final-mstbr = p0001-mstbr.
         endif.
          wa_final-pernr = p0001-pernr.
          wa_final-aedtm = p0001-aedtm.
          wa_final-bukrs = p0001-bukrs.
          wa_final-ename = p0001-ename.
           APPEND wa_final TO it_final.
           CLEAR wa_final.
          Endif.
    Endif..
    is this code correct? or do i have to do any modifications?

    This is like retro payroll run see the payroll program.
    RPCUCALC00 and you will find the logic over there how it will run retroactive payroll
    Best Regards

  • Tables Proration/Spliting Logic required

    Hi Friends
    I have 3 internal tables:
    IT_0001:
    PERNR     BEGDA     ENDDA     WERKS     BTRTL     ABKRS     KOSTL     ORGEH
    10774     20080101     20081028     US11     14     CB          0
    10774     20081029     99991231     US11     14     CB     1125100     30084829
    IT_0008_1:
    PERNR     BEGDA     ENDDA     TRFGR     BAND1
    10774     20080101     20080803     1     1
    IT_0008:
    PERNR     BEGDA     ENDDA     TRFST     BAND
    10774     20080804     20081231     6     6
    WITH THE ABOVE TABLES COMBINATION,BY SPLITING THE TABLES BASED ON BEGDA,ENDDA
    MY FINAL TABLE HAS TO COME AS FOLLOWS:
    IT_FINAL:
    PERNR     BEGDA     ENDDA     WERKS     BTRTL     MOLGA     BAND     BONUSPRCNTAGE
    10774     20080101     20080803     US11     14     10     1     8
    10774     20080804     20081028     US11     14     10     6     8
    10774     20081029     20081231     US11     14     10     6     8
    Can any one please provide me the logic for this.
    Thanks for your cooperation.
    Regards,
    Sree

    Hi Gourav
    Thanks for your suggestion!
    Let me ask the same question in this way then:
    Please correct me the code where I am wrong:
    Logic for Proration calculation for Bonus Percentage when Band
          maintained in TRFGR field.
                SORT it_0001_1 BY pernr begda endda.
                SORT it_0008_1 BY pernr begda endda.
                LOOP AT it_0001_1 INTO wa_0001_1.
                  LOOP AT it_0008_1 INTO wa_0008_1 WHERE pernr = wa_0001_1-pernr.
    To check the end date is 12/31/9999, if yes then set it to bonus year end date
                    IF wa_0008_1-endda = c_year OR wa_0008_1-endda0(4) > gv_endyear0(4).
                      wa_0008_1-endda = c_aug_e.
                      MODIFY it_0008_1 FROM wa_0008_1 TRANSPORTING endda.
                    ELSEIF wa_0001_1-endda = c_year.
                      wa_0001_1-endda = gv_endyear.
                    ENDIF.
    ***Condition to split the records based on the records in PA0001 and Pa0008 tables data
                    IF wa_0001_1-begda >= wa_0008_1-begda AND wa_0001_1-endda = wa_0008_1-endda.
                      wa_final-pernr = wa_0001_1-pernr.
                      wa_final-begda = wa_0001_1-begda.
                      wa_final-endda = wa_0001_1-endda.
                      wa_final-werks = wa_0001_1-werks.
                      wa_final-btrtl = wa_0001_1-btrtl.
                      wa_final-kostl = wa_0001_1-kostl.
                      IF wa_0001_1-kostl IS NOT INITIAL.
                        APPEND wa_final TO it_final.
                      ELSE.
                        APPEND wa_final TO it_costcenter.
                      ENDIF.
                      EXIT.
                    ELSEIF wa_0001_1-begda >= wa_0008_1-begda AND wa_0001_1-endda > wa_0008_1-endda.
                      wa_final-pernr = wa_0001_1-pernr.
                      wa_final-begda = wa_0001_1-begda.
                      wa_final-endda = wa_0008_1-endda.
                      wa_final-werks = wa_0001_1-werks.
                      wa_final-btrtl = wa_0001_1-btrtl.
                      wa_final-kostl = wa_0001_1-kostl.
                      IF wa_final-begda < wa_final-endda.
                        IF wa_0001_1-kostl IS NOT INITIAL.
                          APPEND wa_final TO it_final.
                        ELSE.
                          APPEND wa_final TO it_costcenter.
                        ENDIF.
                        gv_date  = wa_0008_1-endda.
                        IF ( gv_date+4(4) EQ c_leap ).           " to check date is feb 28th
                          gv_mod = wa_0008_1-endda+0(4) MOD 4.
                          gv_mod1 = wa_0008_1-endda+0(4) MOD 4.
                          IF ( gv_mod EQ 0  OR gv_mod1 EQ 0 ).   " to check for leap year
                            wa_0008_1-endda+4(4) = c_leap1.
                            wa_final-pernr = wa_0001_1-pernr.
                            wa_final-begda = wa_0008_1-endda.
                            wa_final-endda = wa_0001_1-endda.
                            wa_final-werks = wa_0001_1-werks.
                            wa_final-btrtl = wa_0001_1-btrtl.
                            wa_final-kostl = wa_0001_1-kostl.
                            IF wa_0001_1-kostl IS NOT INITIAL.
                              APPEND wa_final TO it_final.
                            ELSE.
                              APPEND wa_final TO it_costcenter.
                            ENDIF.
                          ENDIF.
                        ENDIF.
                      ENDIF.
                      EXIT.
                    ELSEIF wa_0001_1-begda >= wa_0008_1-begda AND wa_0001_1-endda < wa_0008_1-endda.
                      wa_final-pernr = wa_0001_1-pernr.
                      wa_final-begda = wa_0001_1-begda.
                      wa_final-endda = wa_0001_1-endda.
                      wa_final-werks = wa_0001_1-werks.
                      wa_final-btrtl = wa_0001_1-btrtl.
                      wa_final-kostl = wa_0001_1-kostl.
                      IF wa_final-begda < wa_final-endda.
                        IF wa_0001_1-kostl IS NOT INITIAL.
                          APPEND wa_final TO it_final.
                        ELSE.
                          APPEND wa_final TO it_costcenter.
                        ENDIF.
                        gv_date  = wa_0008_1-endda.
                        IF ( gv_date+4(4) EQ c_leap ).             " to check date is feb 29th
                          gv_mod = wa_0008_1-endda+0(4) MOD 4.
                          gv_mod1 = wa_0008_1-endda+0(4) MOD 4.
                          IF ( gv_mod EQ 0  OR gv_mod1 EQ 0 ).     " to check for leap year
                            wa_0008_1-endda+4(4) = c_leap1.
                            wa_final-pernr = wa_0001_1-pernr.
                            wa_final-begda = wa_0008_1-endda.
                            wa_final-endda = wa_0001_1-endda.
                            wa_final-werks = wa_0001_1-werks.
                            wa_final-btrtl = wa_0001_1-btrtl.
                            wa_final-kostl = wa_0001_1-kostl.
                            IF wa_0001_1-kostl IS NOT INITIAL.
                              APPEND wa_final TO it_final.
                            ELSE.
                              APPEND wa_final TO it_costcenter.
                            ENDIF.
                          ENDIF.
                        ELSEIF wa_0001_1-begda >= wa_0008_1-begda AND wa_0001_1-endda >= wa_0008_1-endda.
                          wa_final-pernr = wa_0001_1-pernr.
                          wa_final-begda = wa_0001_1-endda + 1.
                          wa_final-endda = wa_0008_1-endda.
                          wa_final-werks = wa_0001_1-werks.
                          wa_final-btrtl = wa_0001_1-btrtl.
                          wa_final-kostl = wa_0001_1-kostl.
                          IF wa_0001_1-kostl IS NOT INITIAL.
                            APPEND wa_final TO it_final.
                          ELSE.
                            APPEND wa_final TO it_costcenter.
                          ENDIF.
                        ENDIF.
                      ENDIF.
                      EXIT.
                    ENDIF.
                    CLEAR: wa_0008_1,
                           gv_date.
                  ENDLOOP.
    ***** 23/07/2008
                  LOOP AT it_0008 INTO wa_0008 WHERE pernr = wa_0001_1-pernr.
    To check the end date is 12/31/9999, if yes then set it to bonus year end date
                    IF wa_0008-endda = c_year OR wa_0008-endda0(4) > c_end0(4).
                      wa_0008-endda = c_end.
                      MODIFY it_0008 FROM wa_0008 TRANSPORTING endda.
                    ELSEIF wa_0001_1-endda = c_year.
                      wa_0001_1-endda = c_end.
                    ENDIF.
    ***Condition to split the records based on the records in PA0001 and Pa0008 tables data
                    IF wa_0001_1-begda <= wa_0008-begda AND wa_0001_1-endda = wa_0008-endda.
                      wa_final-pernr = wa_0001_1-pernr.
                      wa_final-begda = wa_0008-begda. "CHANGED FROM 0001 TO 0008
                      wa_final-endda = wa_0008-endda. "CHANGED FROM 0001 TO 0008
                      wa_final-werks = wa_0001_1-werks.
                      wa_final-btrtl = wa_0001_1-btrtl.
                      wa_final-kostl = wa_0001_1-kostl.
                      IF wa_0001_1-kostl IS NOT INITIAL.
                        APPEND wa_final TO it_final.
                      ELSE.
                        APPEND wa_final TO it_costcenter.
                      ENDIF.
                      EXIT.
                    ELSEIF wa_0001_1-begda <= wa_0008-begda AND wa_0001_1-endda > wa_0008-endda.
                      wa_final-pernr = wa_0001_1-pernr.
                      wa_final-begda = wa_0008-begda. "look here
                      wa_final-endda = wa_0008-endda.
                      wa_final-werks = wa_0001_1-werks.
                      wa_final-btrtl = wa_0001_1-btrtl.
                      wa_final-kostl = wa_0001_1-kostl.
                      IF wa_final-begda < wa_final-endda.
                        IF wa_0001_1-kostl IS NOT INITIAL.
                          APPEND wa_final TO it_final.
                        ELSE.
                          APPEND wa_final TO it_costcenter.
                        ENDIF.
                      ENDIF.
                    ELSEIF wa_0001_1-begda <= wa_0008-begda AND wa_0001_1-endda < wa_0008-endda.
                      wa_final-pernr = wa_0001_1-pernr.
                      wa_final-begda = wa_0008-begda.
                      wa_final-endda = wa_0001_1-endda.
                      wa_final-werks = wa_0001_1-werks.
                      wa_final-btrtl = wa_0001_1-btrtl.
                      wa_final-kostl = wa_0001_1-kostl.
                      IF wa_final-begda < wa_final-endda.
                        IF wa_0001_1-kostl IS NOT INITIAL.
                          APPEND wa_final TO it_final.
                        ELSE.
                          APPEND wa_final TO it_costcenter.
                        ENDIF.
                      ENDIF.
                    ENDIF.
                  ENDLOOP.
    ****23/07/2007
                ENDLOOP.
    ***Updating the IT_0001_1 and IT_COSTCENTER tables with band information.
                IF it_final[] IS NOT INITIAL.
                  LOOP AT it_final INTO wa_final.
                    gv_tabix = sy-tabix.
                    LOOP AT it_0008_1 INTO wa_0008_1  WHERE pernr EQ wa_final-pernr
                                                      AND   begda LE wa_final-begda
                                                      AND   endda GE wa_final-endda.
                      READ TABLE it_cgroup INTO wa_cgroup WITH KEY werks = wa_final-werks
                                                                   btrtl = wa_final-btrtl.
                      IF sy-subrc EQ 0.
                        wa_final-band = wa_0008_1-trfgr.
                        wa_final-molga = wa_cgroup-molga.
                        MODIFY it_final FROM wa_final INDEX gv_tabix TRANSPORTING band molga.
                        CLEAR: wa_0008_1,
                               wa_final,
                               gv_tabix.
                      ENDIF.
                    ENDLOOP.
      ***TRFST CALCULATION.
                    LOOP AT it_0008 INTO wa_0008  WHERE pernr EQ wa_final-pernr
                                                  AND   begda LE wa_final-begda
                                                  AND   endda GE wa_final-endda.
                      READ TABLE it_cgroup INTO wa_cgroup WITH KEY werks = wa_final-werks
                                                                   btrtl = wa_final-btrtl.
                      IF sy-subrc EQ 0.
                        wa_final-band = wa_0008-trfst.
                        wa_final-molga = wa_cgroup-molga.
                        MODIFY it_final FROM wa_final INDEX gv_tabix TRANSPORTING band molga.
                        CLEAR: wa_0008,
                               wa_final,
                               gv_tabix.
                      ENDIF.
                    ENDLOOP.
                    CLEAR: wa_final.
                  ENDLOOP.
                ENDIF.
    Actually I have developed code but it's not giving the required results.
    That's why I asked for the solution .My intension in asking the solution is to get various types of approaches of the solution but not to waste the comunity time.
    Anyhow thanks!
    Regards,
    Sree

  • Reg logic required for selection-screen.

    Hi,
    i have one requirement
    on selection screen 2 radio button
    1 for service
    2 for account
    Parameter      FILE     LOCALFILE     Filename
    If the radiobutton ACCOUNT is selected the default name for file will be:
         ‘Rev_acc_com_&system_time_stamp&.dat’
    Elseif the radiobutton SERVICE is selected the default name for file will be:
         ‘Rev_srv_com_&system_time_stamp&.dat’
    some body can give the logic for this.

    take the following solution
    data: tstamp type TZNTSTMPS.
    data: filename type string.
    call function 'CONVERT_INTO_TIMESTAMP'
    exporting
       I_DATLO  = sy-datum
       I_TIMLO   = sy-uzeit
    importing
       E_TIMESTAMP = tstamp.
    if ACCOUNT is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    else if SERVICE is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    the filename variable will be containing ur required file name..
    reward points if useful....

  • Mapping logic required-UDF

    Hi,
    My sender structure is as follows
    <zaction>(1:1)
    --Trans
    <Zcode>(0:999)
    --Code
    --Id
    My target field is
    <code>(0:999)
    --ID
    My requirement is
    if code= CE,CB,CH,CJ,CI,CO then don't create target field ID.
    else
    if code=AF and Trans=01 then ID=axv0001
    or
    if code=AF and Trans=02 then ID=axv0002
    if none of the above conditions matches pass ID received from sender.
    I am confused at using context type UDF. As suppress result is completely supressing the target field. it's not looking into the rest of logic. Can you provide me an appropraite UDF for this logic please.
    TIA,
    Mahesh

    Hello,
    You can use this context type UDF:
    Arguments: inTrans
    inCode
    inID
    for(int a=0;a<inCode.length;a++){
         if(inCode[a].equals("CE")|inCode[a].equals("CB")|inCode[a].equals("CH")|inCode[a].equals("CJ")|inCode[a].equals("CI")|inCode[a].equals("CO")){
              result.addSuppress();
         else if(inCode[a].equals("AF")&inTrans[0].equals("01")){
              result.addValue("axv0001");
         else if(inCode[a].equals("AF")&inTrans[0].equals("02")){
              result.addValue("axv0002");
         else{
              result.addValue(inID[a]);
    Logic is like this:
    For code
    Trans -> removeContext -> \
    Code --> removeContext -> UDF -> code
    ID ----> removeContext -> /
    For ID
    Trans -> removeContext -> \
    Code --> removeContext -> UDF -> splitByValue:eachValue -> ID
    ID -----> removeContext -> /
    Hope this helps,
    Mark
    Edited by: Mark Dihiansan on Nov 9, 2011 3:47 AM

  • Input template worksheet logic requirement

    Hello,
    I need to accomplish the following requirement that I need some help with. Lets say the user selects Forecast_Vmay2012, the may 2012 value of a specific account ABC should sum Jan-Apr 2011 XYZ Account values. This needs to be flexible, in other dimension member Forecast_vmay2012 has current month property with value of 5. Just like that, Forecast_Vaug2012 has value of 8 etc. based on this, the worksheet logic needs to sum previous year's initial current month -1(in our initial example current month value is 5, so sum 1st 4). Any idea on how to accomplish it?
    Thanks.

    Hi Zack
    Based on the information provided and from my understanding. If you know that there a static calculations or in your example: Account ABC should SUM XYZ account values then you can use nested IF statements with the AND / OR operators.
    Please find below a link to an example using complex and nested IF statements.
    [http://www.experiglot.com/2006/12/11/how-to-use-nested-if-statements-in-excel-with-and-or-not/]
    Will using script logic not be able to meet your requirements ? or is there a large amount of calculations which need to occur?
    The downside to this approach will unfortunately be that your workbook will be large and depending on the amount of data, potentially slow in performance.
    Hope this helps
    Kind regards
    Daniel

  • Logic required to get the missed document nos in arport

    Hi Guys,
    Document numbers are flowing in to two ODS's. These doc numbers are available in 'X' and 'Y' ODS's.
    We are missing some doc nos in both the ODS's.
    For example: 101,102,103 doc nos are available in 'X" ODS also 101 1nd 102 also avaialable in'Y' ODS.
    But we are missing 103 in "Y' ODS.
    we want to display those doc nos in a report.
    We Created an infoset on these two ODS's.
    What kind of logic is required to display these missed doc nos in a BW Report
    Thanks,
    Nela

    I would suggest to use another DSO, specifically for this missing document numbers with Document Number and two Flags (FLAG1 and FLAG2). Both DSO1 and DSO2 will Source this 3rd DSO (In this DSO, Doc Number will be Unique - No Duplicates).
    In the transformation for DSO1, lookup DSO2, compare the Doc Numbers and fill FLAG1 as 'X' on each missing record.
    In the transformation for DSO2, lookup DSO1, compare the Doc Numbers and fill FLAG2 as 'X' on each missing record.
    Then you can generate two reports for missing Doc Numbers based on FLAG1 and FLAG2.
    This is just an example, you could do the same in other optimized ways.... discuss with your ABAPer....

  • Date logic required urgently

    hI all,
    i need logic for the following
    Basically, “15.06.2007” is the “Required delivery date for the plant”. This means that the stock should be there in the plant by “15.06.2007”.
    We need to change the formula for the delivery date.
    Formula: Delivery date = (15.06.2007 – LEAD TIME of the material)
    Say, for example the lead time for the product is 8 (this varies for different materials). Then the delivery date should be:
    Delivery date = (15.06.2007 – 8)
                                = 07.06.2007
    So we need to create a PO for this material on 07.06.2007
    Thanks
    sanjeev

    use this Fm
    RP_CALC_DATE_IN_INTERVAL
    pass i/p as date and  sign as minus .
    make use of this code .
    pass ur lead days 
    data: date like sy-datum,
          date1 like sy-datum.
    date = sy-datum.
    CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
      EXPORTING
        date            = date
        days            = 08 "take this as leadtime in days  
        months          = 00
       SIGNUM           = '-'   
        years           = 00
    IMPORTING
       CALC_DATE       = date1. " new date
    write:/ 'new date',  date1.
    regards,
    Vijay

  • Reg:Logic required

    Hi ,
    We are working on one development for this we are using exit:MV45AFZZ and written code on it.The logic we have written is when ever the field FPLT:FAKSP is blank at contarct level ,then it should trigger an intimation mail .First time it is triggering mail and even when we go go second and third time and make some change other than field FAKSK again it is triggering mail.How to stop further mails ,it should trigger only when we make change in field FAKSK only .Pls help.
    Regards,
    Sash .
    Use meaningful subject for your future questions
    Edited by: Vijay Babu Dudla on Feb 26, 2009 7:54 AM

    Hi ,
    The requirement is when ever the user removes a billing block at filed FPLT:FAKSP then it should trigger a mail .Logic we have taken is :Pass the VBAK:VBELN to FPLA:VBELN and pick the FPLNR then send it to FPLT and check FAKSP ,if it is space then trigger a mail .Pls suggest exit and required coding.
    Thnaking you in advance.
    With Regards,
    Sash.

  • Mapping logic required

    Hi All,
    A segment E1BLINE in the source IDOC can repeat multiple times(0..999) and at the target that many times the record needs to be generated.
    In the target record strucutre a field say ABC is mapped to a feild in XYZ in segment   E2ES (0..999) .But the test IDOC doesnt have these segment data ,suppose if segmnt E1BLINE repeats 2 times i am getting 2 records in target structure but the field ABC should have blank values in each record as  if there is no data in the source.I am unable to get the logic .
    Thanks in advance

    Hi Priyanka,
    my actual requirement is as follows
    for example:
    There are 2 segments  LINE Segment     E2ES Segment.   I need to generate target file records based on LINE SEgmentIn my input data I am getting 2 LINE SEGMENTS so I am generating 2 records in the output file. But some of the fields in target comes from E2ES Segment.
    LINE  segment 2 times so no of recordsets =2 .(which i am able to generate)
    E2ES  segment has 4 fields.     QUALI1 , FIELD1,QUALI2 , FIELD2
    If QUALI1 = 100 ,  FIELD1--> ABC
    If QUALI2 = 200 ,  FIELD2--> HBY
    If QUALI2 = 200 ,  FIELD2--> HBY
    If QUALI2 is used i can easily get 2 HBY fields at target .But how do i get two  ABC  fields

Maybe you are looking for

  • Internal hard drives won't appear in Disk Util

    I have a bizarre problem with my hard drives now. I'm on a 2.4GHz Core2Duo Macbook Pro 15" with 10.5.4. I've switched the hard drive a couple of times before with no issues whatsoever. Now, with the exception of the brand new one that won't hold an i

  • Safari does not display full URL

    Safari 6.0.5 will not display full URL until I click in the URL Location bar.  For example, the full URL of this page is: https://discussions.apple.com/community/mac_os/question-post!input.jspa?containe rType=14&container=2131&fromWidget=true&questio

  • Solaris 10 network installation for X2100

    I would like to ask that how can I install Solaris 10 over network for Sun Fire X2100 because I did not found the X2100 Server Operating System Installation Guide but I found the Sun Fire X2100 M2 Server Operating System Installation Guide instead.

  • IO Exceptions

    Helo, Is it possible to input an exception into both readValue methods to check for incorrect numbers? For example, if I were to enter five instead of 5, is there code that will allow a message box to be output? Below is the code within which are the

  • Horizontal scroller not appearing despite viewport being larger than scoller area

    I have a few datagrids which I have rotated 270 degrees so the header will be on the left side. I have contained these datagrids in a VGroup so they would be stacked on top of  each other. Everything looks as I want it, but the horizontal scroller wi