Dear Experts logic required

I want to fetch data from three tables EKKO, LFA1 and CDHDR. Actually I want to fetch release date from CDHDR.
I am giving release date in selection screen as in input but i am not able to fetch the data according to release date.
Can u please check my select and tell me where i should correct.
SELECT ebeln
       bsart
       aedat
       lifnr
       waers
       bedat
       rlwrt
       FROM ekko
       INTO CORRESPONDING FIELDS OF TABLE t_ekko
       WHERE
             bsart IN s_bsart
       AND   bedat IN s_bedat
       AND   lifnr IN s_lifnr.
SELECT lifnr
         name1
         from lfa1
         INTO TABLE t_lfa1
         FOR ALL ENTRIES IN t_ekko
         WHERE lifnr = t_ekko-lifnr.
LOOP AT t_ekko INTO w_ekko.
     w_ekko-g_ebeln = w_ekko-ebeln.
    n = sy-tabix.
  MODIFY t_ekko INDEX N from w_ekko TRANSPORTING g_ebeln.
   ENDLOOP.
SELECT objectclas
          objectid
          tcode
          udate
          FROM cdhdr
          INTO TABLE t_cdhdr
          FOR ALL ENTRIES IN t_ekko
          where objectclas = 'EINKBELEG'
          AND   objectid   = t_ekko-g_ebeln
          AND   tcode = 'ME29N'
          AND   udate in s_udate.
LOOP AT t_ekko INTO w_ekko.
   w_final-ebeln = w_ekko-ebeln.
   w_final-bsart = w_ekko-bsart.
   w_final-lifnr = w_ekko-lifnr.
   w_final-waers = w_ekko-waers.
   w_final-bedat = w_ekko-bedat.
   w_final-rlwrt = w_ekko-rlwrt.
READ TABLE t_lfa1 INTO w_lfa1 WITH KEY lifnr = w_ekko-lifnr.
   w_final-name1 = w_lfa1-name1.
READ TABLE t_cdhdr INTO w_cdhdr WITH KEY objectclas = 'EINKBELEG'.
                                              objectid = w_ekko-ebeln.
   w_final-udate = g_udate.
   APPEND w_final TO t_final.
ENDLOOP.

Hi,
The first thing I would like you to do is to step through your code to see which statement is causing you the issue.  ie: which select statement does not retrieve any date, or which read statement that does not find any data.  This would help if figuring our your issue.
thanks.
JB

Similar Messages

  • Logic required for creation of PR and PO report

    Dear Experts,
           I want to create a report which gives the details of internal lead time for creation purchase requisition to purchase order. Well which tables I need to use for this . I know some tables like eban, ekko to join. Can you please give me the correct information. I only want those purchase orders which are created with purchase requisition. I need to calculate how many days taken from PR to PO.

    Dear,
    PR release date will be found in CDHDR table in CDHDR-UDATE. PO dates you can find as mentioned in replies.
    But the problem is the time taking for executing the report. It will more lenghty to read different tables and give you output (if you go for yearly range data). ABAP dump error.
    Better, just consult with ABAP team and they can give you a correct solution.
    Regards,
    Syed Hussain.

  • 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

  • Business Objects 4.0 (Custom functions) -- Expert advise required

    Good day All!!!
    I require a technical expert advise from this forum ASAP. I hope you have some time amidst
    your busy schedule and answer the required clarifications.
    Problem Description:
    I would like to write a custom function (e.g to convert local time zone to utc and from utc time zone to local) and import that function in the BO 4.0 universe so that universe has the ability to use this function.
    I understand BO 4.0 supports importing of the custom functions e.g data_quality_custom_functions.atl.
    Expert advise Required from you on below questions:
    Now my question is how to write a custom function and generate the required .atl files that can be imported in the universe?
    Does this require any specific tool/API's to generate these functions ?
    Can we use traditional languages like C/C++ to generate the custom functions or does it uses any script based languages?
    Is there any flexibility to accommodate complex algorithms in the custom based function?
    Are do we have to approach SAP to generate the .atl files by giving some interface document?
    It would be of great help at this stage if you could provide some insight into the mentioned areas as we are in a critical stage to finalize a design approach. If you have time to answer our queries and require additional details on why we have to go for custom functions then I will be glad to provide right level of details.
    Looking forward to your expert advise early....
    Thanks
    NAGSCAT

    Yes, it is. Please, look at chapter 8.5.2 in the Business Intelligence Platform Administrator Guide.

  • 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

  • Business mapping, experts advice required

    Dear Experts,
    I need your suggestion for business mapping.
    Our Client is Builder, who undertakes following types of projects:
    1. Contracting Project - He just takes order for construction of building & executes. He pays for expenses of material, labour  & raises regular bills to customer.
    This looks like Customer Project.
    2. Development Project - He him self acquires land, constructs building & sells/leases flats, offices.
    This looks like Investment project to me.
    Where should we settle theses two?
    Profitability Segment, Cost Center, AuC, G/L, etc....
    Please advice.
    Thanks in anticipation,
    SSanjay

    Hi,
    In fact wanted to add something in the previous reply:
    Case1: PSG.
    Case2: FXA For investments.
    For Customer: I would assume the real estate management would be the solution in support to PS.
    Follow the link for the detailed discussion:
    [Real Estate and PS|http://help.sap.com/saphelp_erp60_sp/helpdata/en/2c/277063456a11d189440000e829fbbd/content.htm]
    Also for settlement please follow the link below:
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/2c/276a49456a11d189440000e829fbbd/content.htm
    hope its useful.
    thanks..

  • Dear Expert

                      Dear Expert,
    Can someone pls tell me the procedure or steps  to upgrade from UCS 1.4 to 2.0.
    Much Thanks,
    Mukesh

    Hello Mukesh,
    Hope this helps.
    1.       Activate UCSM
    2.       Activate Server adapter (It will show as “Pending Next Reboot”)
    3.       Activate server CIMC (CIMC will reboot and come up)
    4.       Activate IOM (This will show as “Pending Next Reboot”)
    5.       Activate Fabric Interconnect one by one starting with Secondary.
    6.       After this secondary FI will reboot along with the IOM connected to that
    7.       Do the same on primary FI
    8.       Now all components except the server adapter will show as “Ready”
    9.       All the components are now upgraded except server BIOS
    10.    To upgrade server BIOS, create a service profile with BIOS policy with the right version
    11.    Associate the service profile with the servers
    12.    Server will reboot and come up with the upgraded BIOS and adapter will now show ready

  • 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.

  • Plz helpme experts logical database problem

    hi experts
    plz help
    i am working in a upgrade project
    and in one report i am using logical database eqi(check selection of DIEQI)
    in which
    in selection criteria
    in 4.6 it have a checkbox icon
    and
    in 6.0 it is written ad_icon
    i am not able to know what is this ad_icon
    due to this icon i am getting a cross icon in my output
    but i want a checkbox
    expert plz help and tell me how i am getting this cross icon and how i can get the checkbox icon
    THANX IN ADVANCE
    FYI :IN 6.0
    PARAMETERS  dy_adrfl NO-DISPLAY FOR TABLE diequi.
    SELECTION-SCREEN COMMENT 71(30) ad_icon FOR TABLE diequi.
    IN 4.6
    parameters  dy_adrfl for table diequi as checkbox modif id ad1.
    anit gautam

    HI,
    Can you show us the code of your SELECTION-SCREEN.
    Also code from the INITIALIZATION and
    AT SELECTION-SCREEN OUTPUT.
    Regards,
    Sesh

  • 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

  • Logic required for the requirement (urgent)

    HI experts,
    can anyone help me out regarding the following logic.
    The logic will check for both complete and partial goods receipts and invoice receipts. Based on the PO line item history it will calculate the totals into following categories:
    (1) Total PO Line Item value with both GR & IR
    (2) Total PO Line Item value with GR but no IR
    (3) Total PO Line Item value with IR but no GR
    For a single PO line, it is possible to have the Total Line Item Value divided into one or more of the above three categories at the same time. For example, if for a PO line item with 100 unit at $10.00 per unit, there is a GR for 50 Units and IR for only 30 units, the three columns above will be populated as:
    (1) Total PO Line Item value with both GR & IR – 30 x 10 = 300
    (2) Total PO Line Item value with GR but no IR – 20 x 10 = 200
    (3) Total PO Line Item value with IR but no GR – 0 x 10 = 0
    Similarly, if for a PO line item with 100 units and $10.00 per unit, there is a GR for 50 units and IR for 70 units, the three columns will be populated as:
    (1) Total PO Line Item value with both GR & IR – 50 x 10 = 500
    (2) Total PO Line Item value with GR but no IR – 0 x 10 = 0
    (3) Total PO Line Item value with IR but no GR – 20 x 10 = 200
    Regards,
    Nagaraj

    Maybe this example will help....
    report zrich_0002 .
    data: iekbe type table of ekbe with header line.
    data: xmbew type mbew.
    data: xekpo type ekpo.
    data: begin of ibuckets occurs 0,
          ebeln type ekpo-ebeln,
          ebelp type ekpo-ebelp,
          pgrir type p decimals 2,  " Total GR & IR
          pgr   type p decimals 2,  " Total GR
          pir   type p decimals 2,  " Total IR
          pgrni type p decimals 2,  "GR no IR
          pirng type p decimals 2,  "IR no GR
          end of ibuckets.
    parameters: p_ebeln type ekko-ebeln,
                p_ebelp type ekpo-ebelp.
    start-of-selection.
      clear iekbe.  refresh iekbe.
      select * into table iekbe from ekbe
                  where ebeln = p_ebeln
                    and ebelp = p_ebelp
                    and vgabe in ('1','2').
      loop at iekbe.
        clear ibuckets.
        ibuckets-ebeln = iekbe-ebeln.
        ibuckets-ebelp = iekbe-ebelp.
        select single * from ekpo into xekpo
                      where ebeln = iekbe-ebeln
                        and ebelp = iekbe-ebelp.
        select single * from mbew into xmbew
                       where matnr = xekpo-matnr.
        case iekbe-vgabe.
          when  '1'.
            ibuckets-pgrir = iekbe-menge * xmbew-stprs.
            ibuckets-pgr   = iekbe-menge * xmbew-stprs.
          when '2'.
            ibuckets-pgrir = iekbe-menge * xmbew-stprs.
            ibuckets-pir   = iekbe-menge * xmbew-stprs.
        endcase.
        collect ibuckets.
      endloop.
      loop at ibuckets.
        ibuckets-pgrni = ibuckets-pgr - ibuckets-pir.
        ibuckets-pirng = ibuckets-pir - ibuckets-pgr.
        if ibuckets-pgrni < 0.
          clear ibuckets-pgrni.
        endif.
        if ibuckets-pirng < 0.
          clear ibuckets-pirng.
        endif.
        modify ibuckets.
      endloop.
      loop at ibuckets.
        write:/    ibuckets-ebeln,
                   ibuckets-ebelp ,
                   ibuckets-pgrir,
                   ibuckets-pgr   ,
                   ibuckets-pir  ,
                   ibuckets-pgrni ,
                   ibuckets-pirng .
      endloop.
    Regards,
    Rich Heilman

  • 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

Maybe you are looking for