Start Routine logic problem !

Experts ,
in my start routine,
my Source-field-fieldname has value "ABC123"
and i need to assing this value in reverse order like "123ABC" to the Infoobject.
How do i get this output ?
thankss

Hi Honar ,
Please use this code to reverse the strings.I think you want it like
Input : "ABA123"
Output : "321CBA"
for this use below code
data : v_Input (20) type c .
data : v_Output(20) type c.
LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS> .
v_Input =   <SOURCE_FIELDS>-FIELDNAME .
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
string =v_Input
lang = 'E'
IMPORTING
RSTRING = v_Output
EXCEPTIONS
TOO_SMALL = 1
OTHERS = 2
<SOURCE_FIELDS>-FIELDNAME = v_Output .
ENDLOOP .
This will work .
If you have different requirement then please tell me .
Regards,
Jaya

Similar Messages

  • ABAP assistance - start routine logic in update rule

    I have used an existing update rule and have based my logic around the same.  The purpose of the rule is to look up customer master data and get a subset of customer numbers from the transaction records so that the values for customer number from the transactional data will not be updated if it does not match with existing master data customer numbers.
    The loads are full and we drop the data before we load.
    I have listed the logic below (the number at the front is to be considered as the line number) and a list of open questions that I have thereafter:
    Start routine logic:
    1  DATA: l_index LIKE sy-tabix.
    2  DATA: BEGIN OF ls_customer,
    3        customer TYPE /BI0/OICUSTOMER,
    4        objver TYPE RSOBJVERS,
    5     END OF ls_customer,
    6      lt_customer LIKE TABLE OF ls_customer.
    7  REFRESH: lt_customer.
    8  LOOP AT DATA_PACKAGE.
    all customers from data package
    9    ls_customer-custno = DATA_PACKAGE-custid.
    10  ls_customer-objver = 'A'
    11    APPEND ls_customer TO lt_customer.
    12   ENDLOOP.
    12  SORT lt_customer.
    13  DELETE ADJACENT DUPLICATES FROM lt_customer.
    14   IF NOT lt_customer[] IS INITIAL.
    15    SELECT /BI0/OICUSTOMER RSOBJVERS
    16      FROM /BI0/PCUSTOMER
    17      INTO CORRESPONDING FIELDS OF TABLE lt_customer
    18      FOR ALL ENTRIES IN lt_customer
    19      WHERE ls_customer-custno = DATA_PACKAGE-custid
    20      AND ls_customer-objver = 'A'
    21    SORT lt_customer BY customer ASCENDING                    
    22  ENDIF.
    Questions
    Line
    1 - what is the purpose of this line? What is it that is being declared
    2 - in some code I have seen this line with OCCURS 0 at the end what does this mean with and without the term?
    4 - I am using the Data Element name is this correct or should I use the field name?
    3 - 5 here I declare an internal structure/table is that correct?
    6 - here I declare a work area based on the internal table is that correct?
    7 - What would happen if I avoided using the REFRESH statement?
    8 - 12 - Is this syntactically correct, I am trying to get a set of data which is the customer numbers which match the master data customers and the master data record is án active version and than appendíng to the work area?
    13 - My understanding is this will reduce the number of records in the work area is this correct and needed?
    14 - 22 I am trying to identify my required set of data but feel I am repeating myself, could someone advise?
    Finally what logic would I actually need to write in the key figure object, could I use something like:
    Result = lt_customer.
    Thanks
    Edited by: Niten Shah on Jun 30, 2008 8:06 PM

    1. This line is not required
    2. OCCURS 0 is the OLD way of defining an internal table with that structure.  As it is, it just defines a flat structure.
    3. Data element is usually best
    3-5 Yes
    6. No.  Here you are declaring a table of the type of the flat structure.  Just as the ABAP says!
    7. Nothing.  But by putting this in, you ensure that you know the state of the table (empty) before you start looping through the data package
    8-12. You can tell if it is syntactically correct by pressing Ctrl-F2 when in the editor.  Looks ok.
    13. Ensures your list of customers contains no duplicated.  The code up to this point is building a list of all the unique customers in the data package.
    14-22. Goes to the database and brings back ONLY those customers which are found in the master data.  Looks ok.
    This is a start routine (that's why you've got a data package).  You don't use result.  You should update the datapackage.  But this you haven't done.  Double click on the table name /BIC/PCUSTOMER to get the correct field names.
    So you have to loop through the data package again, and check if the customer in the datapackage is lt_customer.  If it is, fine, otherwise you blank it and report an error, or set an error message or whatever.
    I wouldn't do it like this.  I'd do something like this:
    STATICS: st_customer TYPE HASHED TABLE OF TYPE /bi0/oicustomer
                                  WITH UNIQUE KEY TABLE_LINE.
    * st_customer retains its value between calls, so only populate if empty
    * In one run of the infopackage, this will mean you do only one read of
    * the master data, so very efficient.
    IF st_customer IS INITIAL.
      SELECT customer FROM /BI0/PCUSTOMER
                              INTO TABLE st_customer
                              WHERE objvers EQ 'A'. " Only active values
    ENDIF.
    * Go through data package
    LOOP AT DATA_PACKAGE.
    * Check whether the customer exists.
      READ TABLE st_customer TRANSPORTING NO FIELDS
                  WITH TABLE KEY table_line = DATA_PACKAGE-custid.
      CHECK sy-subrc IS NOT INITIAL.
    * If you get here, the customer isn't valid.  So I'm just setting it blank
      CLEAR DATA_PACKAGE-custid.
      MODIFY DATA_PACKAGE. " Updates the datapackage record
    ENDLOOP.
    Even this is not fully optimised, but it's not bad.
    I strongly suggest that you get yourself sent on the basic ABAP programming course if you're going to do a lot of this.  Otherwise, read the ABAP documentation in the help.sap.com, and, from the editor, get the cursor on each ABAP keyword and press F1 to read the ABAP help.
    matt

  • Start Routine Logic Updating Field in Target ODS

    Hi,
    I am creating a  Start Routine to Update Field (date) from one ODS to another based on the Key Structure: Document Number, Line Item Number.
    I am encountering a situation as follows:
    Source
    Doc Num 1 Line Item 10 Date 1/1/1
    Target
    Doc Num 1 Line Item 10 Date 1/1/1
    DocNum 1 Line Item 20
    DocNum 1 Line Item 30
    DocNum 1 Line Item 40
    The Routine I have now correctly updates line item 10 with the date 1/1/1.
    I am trying to modify the code to only update the target ods if all of the line items are in the source.  In this example Line Item 10 would not get updated since Line Items 20,30,40 are not in the Source ODS. 
    Has anyone encountered something like this.
    Thanks for any help.

    Hi,
    If you have all the line items in target for which you want to do updates  you can do this in transformation start routine.
    Try this first hand logic :
    1. Create a internal tables(say SOURCE_INTERNAL_TABLE and TARGET_INTERNAL_TABLE)
        with fields document number and another field integer say COUNTER
    2. Read active table of source for all the document numbers in source package.
    3. Update the SOURCE_INTERNAL_TABLE for all the document number with appropriate counts
        (All the records of same document number should be in same data package)
    4. Update the TARGET_INTERNAL_TABLE by reading the target ODS as done for source.
    5. LOOP  AT SOURCE_PACKAGE
         if COUNTER in SOURCE_INTERNAL_TABLE and TARGET_INTERNAL_TABLE is not same
         then delete the record from source package itself
       END LOOP
    6. Your next code
        (Please take care that you are not referring the deleted records otherwise it will through a dump)
    If you don't have all the line items in target then you need to bring them somewhere in BI (document number and item number only sufficient with both as a key fields) so as to refer them in your start routine.
    Please update me if anything is wrong or if any corrections in logic.
    Thanks and Regards,
    Prashant Vankudre.

  • Need Start routine logic

    Hi,
    Can anyone please let me know the code in start routine for the below.
    I want to delete the unwanted datapackage in start routine for the below condition.
    For  system PCR
    For purch.org Z300, only those purchase orders shall be loaded to further layers which have the text "FCM" in the field Incoterms2 (ZPURINC2), the other purchase orders of this purch org and this system can be deleted.
    thankyou........
    Regards...
    Balaji

    Hi,
    Delete Source_package where SYSTEM = 'PCR' and PURCH.ORG = 'Z300' and ZPURINC2 NE 'FCM'.
    Check the definition of source_package in the start routine screen and use the exact infoobjects while defining the Delete statement
    Regards
    Githen

  • Start Routine logic to delete records which do not satisfy a condition

    Hello,
    Iam trying to code a start routine to delete the records from the source_package if a certain set of conditions are not met.
    It is failing at the last statement.
    Pls help.
    Thanks
    Jagadish
    code is as follows..
    LOOP AT SOURCE_PACKAGE assigning <SOURCE_FIELDS>.
    IF not (
    ( <SOURCE_FIELDS>-/BIC/ZCLSD_DT BETWEEN <SOURCE_FIELDS>-/BIC/ZWEEKOF
    AND <SOURCE_FIELDS>-/BIC/ZNONWKOF )
      AND
      ( <SOURCE_FIELDS>-/BIC/ZCLSD_DT IS  INITIAL )
    DELETE SOURCE_PACKAGE FROM <SOURCE_FIELDS>.
    (is failing at the delete statement.)
    ENDIF.
    ENDLOOP.

    Thanks Pratap,
    I used an internal table to load the records and used a delete statement out side the LOOP.
    By using a Work Area assignment instead of the Source_fields, The delete statement is giving me an error saying "Conversion of Numeric Value to type Object is not valid".
    Here is the code I have modified...
       TYPES: BEGIN OF LINE,
                WO(6) type c,
              END OF LINE.
       DATA: WA TYPE LINE,
             ITAB TYPE TABLE OF LINE.
    LOOP AT SOURCE_PACKAGE assigning <SOURCE_FIELDS>.
    IF NOT (
    ( <SOURCE_FIELDS>-/BIC/ZCLSD_DT BETWEEN <SOURCE_FIELDS>-/BIC/ZWEEKOF
        AND <SOURCE_FIELDS>-/BIC/ZNONWKOF
      AND
      <SOURCE_FIELDS>-/BIC/ZAPRD_DT IS NOT initial )
    Append <SOURCE_FIELDS>-/BIC/ZWO_NBR to itab.
    ENDIF.
    ENDLOOP.
    loop at itab into WA.
    DELETE SOURCE_PACKAGE where /bic/ZWO_NBR = WA-wo.
    endloop.

  • Start routine logic

    All Open Items  +   (Status Closed  and BLINEDATE <= Last day of the current Month  and Clearing Date > Last Day of the current Month  )
    Need to implement above routine in the star routine,
    To find open item we have a char FI_DOCSTAT if this is u2018Ou2019 it is a open item
    And if this is u2018Cu2019 that is a closed item.
    I know how to get that last month
    Unable to find the logic for the same.
    If you have some time please try to give the logic.
    Thanks,
    Satish

    Hi,
    Take the system date and calculate the Last Date of the month(through FM) then filter out the records.
    Regards,
    Pradeep.
    Edited by: Pradeepkdas on Jan 27, 2012 1:27 PM

  • Start routine logic to delete sourcepackage if there are no entries in itab

    Hi there,
    I am trying to Delete entries from a source_package where
    source_package-material does not exist in itab_ds001(this internal table contain 3000 records, and has columns material, and Batch) and
    source_package-batch does not exist in itab_ds001(this internal table contain 3000 records, and has columns material, and Batch)
    I knew, it can be achieved with 2 loops,
    But the problem is, My full load deal with 4 million records
    --> 4 million times 3000 internal loops.,...takes lot of time to execute.
    so I am looking for some ABAP coding help from experts
    appreciate your time

    Hi, it is very easy.
    LOOP AT source_package assigning <source_fields>.
    READ TABLE itab_ds001 Transporting no fields
    With key material = <source_fields>-material.
    IF sy-subrc NE 0.
    DELETE source_package index sy-tabix.
    ENDIF.
    READ TABLE itab_ds001 Transporting no fields
    With key batch = <source_fields>-batch
    IF sy-subrc NE 0.
    DELETE source_package index sy-tabix.
    ENDIF.
    ENDLOOP.
    Hope it is helpful

  • How do you identify the Logical system in start routine of a transformation

    My scenario is this.  I have five r3 systems that I am extracting from.   In the start routine of the transformation from the r3 data source to my data store I  am going to delete data and I need to know the source system id.    How do I identify the logical system or source system id in the transformation.  Is there a system field that contains this information.    I do not want to hard code the source system id in the routine.

    hi
    have a lool at tables rsreqdone and rsbkrequest with a join you should be able to determine the source.
    regards
    Boujema
    How to give points: Mark your thread as a question while creating it. In the answers you get, you can assign the points by clicking on the stars to the left. You also get a point yourself for rewarding (one per thread).
    Edited by: Boujema Bouhazama on May 9, 2008 12:04 AM

  • What is the logic behind the start routine

    Dear One's,
    Kindly take a moment and explain the logic behind this start routine written in update rules of ODS.
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    $$ end of global - insert your declaration only before this line   -
    The follow definition is new in the BW3.x
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CST_T07_O006.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
               MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
               DATA_PACKAGE STRUCTURE DATA_PACKAGE
      USING    RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries.
    DATA: ITAB_/BIC/AT07_O00600 TYPE SORTED TABLE OF /BIC/AT07_O00600
          WITH HEADER LINE
          WITH UNIQUE DEFAULT KEY INITIAL SIZE 0,
          DATA_PACKAGE_NEW TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
          WITH HEADER LINE
          WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    sort the datapackage based on lead number and lead program definition
    SORT DATA_PACKAGE BY /BIC/TLDNR /BIC/TLDPRGFTE.
    from the resources ODS read all lead values based on the values those
    SELECT * FROM /BIC/AT07_O00600 INTO TABLE
             ITAB_/BIC/AT07_O00600
             FOR ALL ENTRIES IN DATA_PACKAGE
             WHERE /BIC/TLDNR = DATA_PACKAGE-/BIC/TLDNR.
    FIELD-SYMBOLS: <LS_DATA_PACKAGE> TYPE DATA_PACKAGE_STRUCTURE.
    FIELD-SYMBOLS: <LS_/BIC/AT07_O00600> TYPE /BIC/AT07_O00600.
    loop at internal table of ODS to check if there are lead program defin
    from the source which mean the values of lead program definition in OD
    values of lead program definition in datapackage.
       LOOP AT ITAB_/BIC/AT07_O00600 ASSIGNING <LS_/bic/at07_o00600>.
         READ TABLE DATA_PACKAGE
          TRANSPORTING NO FIELDS
          WITH KEY
          /BIC/TLDNR = <LS_/bic/at07_o00600>-/BIC/TLDNR
          /BIC/TLDPRGFTE = <LS_/bic/at07_o00600>-/BIC/TLDPRGFTE
          BINARY SEARCH.
          IF SY-SUBRC <> 0.
    new lines with zero values are inserted because there are no correspon
    DATA_PACKAGE_NEW-/BIC/TLDNR = <LS_/BIC/AT07_O00600>-/BIC/TLDNR.
    DATA_PACKAGE_NEW-/BIC/TLDPRGFTE = <LS_/BIC/AT07_O00600>-/BIC/TLDPRGFTE.
      DATA_PACKAGE_NEW-/BIC/TLDFTE = 0.
      APPEND DATA_PACKAGE_NEW.
         ENDIF.
      ENDLOOP.
    append the new records which are created for the leads in the datapack
      APPEND LINES OF DATA_PACKAGE_NEW TO DATA_PACKAGE.
    reset the sorting of the datapackage back to its original state
      SORT DATA_PACKAGE.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.
    Thanks in advance

    hi,
    it's retrieve data from table /BIC/AT07_O00600
    and add to data package, so your records will be more than from source
    hope this helps.

  • Problems in Start Routine of Transfermations (DTP)

    Hi Abap OO Gurus,
    I am migrating the 3.x data source to BI 7.0 ,here I am getting problems in DTP especially in the start routine . we are using the SP10, pls see the below code  . I have fixed some code still I am getting problems  at the below loop statement .
    PROGRAM trans_routine.
          CLASS routine DEFINITION
    CLASS lcl_transform DEFINITION.
      PUBLIC SECTION.
        TYPES:
          BEGIN OF tys_SC_1,
         InfoObject: 0MPOINT Measuring point.
            MPOINT           TYPE /BI0/OIMPOINT,
         InfoObject: 0MDOC Measurement Document.
            MDOC           TYPE /BI0/OIMDOC,
         InfoObject: 0MPOBJ Object Number of Measuring Point Object.
            MPOBJ           TYPE /BI0/OIMPOBJ,
         InfoObject: 0MPTYP Type of Measuring Point.
            MPTYP           TYPE /BI0/OIMPTYP,
         InfoObject: 0PSORT Position Number of Measuring Point in Object (
    *Sort Field).
            PSORT           TYPE /BI0/OIPSORT,
         InfoObject: 0ASSEMBLY Assembly.
            ASSEMBLY           TYPE /BI0/OIASSEMBLY,
         InfoObject: 0ATINN Internal Characteristic Number.
            ATINN           TYPE /BI0/OIATINN,
         InfoObject: 0MDATE Date of Measurement.
            MDATE           TYPE /BI0/OIMDATE,
         InfoObject: 0TIME Time.
            TIME           TYPE /BI0/OITIME,
         InfoObject: 0DESIRSI Target Value for Measuring Point in SI Unit.
            DESIRSI           TYPE /BI0/OIDESIRSI,
         InfoObject: 0TVIND Target Value for Measuring Point Is Defined.
            TVIND           TYPE /BI0/OITVIND,
         InfoObject: 0MRMINI Lower Measurement Area Limit Is Defined.
            MRMINI           TYPE /BI0/OIMRMINI,
         InfoObject: 0MRMINSI Lower Meas. Limit or Min. Total Counter Read
    *ing in SI Unit.
            MRMINSI           TYPE /BI0/OIMRMINSI,
         InfoObject: 0MRMAXI Upper Measurement Area Limit Is Defined.
            MRMAXI           TYPE /BI0/OIMRMAXI,
         InfoObject: 0SIUNIT SI unit.
            SIUNIT           TYPE /BI0/OISIUNIT,
         InfoObject: 0CJUMPSI Counter Overflow Reading in SI Unit.
            CJUMPSI           TYPE /BI0/OICJUMPSI,
         InfoObject: 0PYEARSI Annual Performance in SI Unit.
            PYEARSI           TYPE /BI0/OIPYEARSI,
         InfoObject: 0CREATED_BY Created By.
            CREATED_BY           TYPE /BI0/OICREATED_BY,
         InfoObject: 0READSI Measured Value/Total Counter Reading in SI Un
    *it.
            READSI           TYPE /BI0/OIREADSI,
         InfoObject: 0READEU Measured Value in Document Entry Unit.
            READEU           TYPE /BI0/OIREADEU,
         InfoObject: 0RECDU Unit of Measurement for Document Entry.
            RECDU           TYPE /BI0/OIRECDU,
         InfoObject: 0CNTRRSI Counter Reading in SI Unit.
            CNTRRSI           TYPE /BI0/OICNTRRSI,
         InfoObject: 0CDIFFSI Counter Reading Difference in SI Unit.
            CDIFFSI           TYPE /BI0/OICDIFFSI,
         InfoObject: 0CAT_TYPE Catalog.
            CAT_TYPE           TYPE /BI0/OICAT_TYPE,
         InfoObject: 0CAT_GROUP Code group.
            CAT_GROUP           TYPE /BI0/OICAT_GROUP,
         InfoObject: 0FI_STATUS Processing Status.
            FI_STATUS           TYPE /BI0/OIFI_STATUS,
         InfoObject: 0DIM_ID Dimension Key.
            DIM_ID           TYPE /BI0/OIDIM_ID,
         InfoObject: 0CNTIND Measuring Point is Counter.
            CNTIND           TYPE /BI0/OICNTIND,
         InfoObject: 0EQUIPMENT Equipment Number.
            EQUIPMENT           TYPE /BI0/OIEQUIPMENT,
         InfoObject: 0FUNCT_LOC Functional Location.
            FUNCT_LOC           TYPE /BI0/OIFUNCT_LOC,
         InfoObject: 0CAT_CODE Code.
            CAT_CODE           TYPE /BI0/OICAT_CODE,
         InfoObject: 0MRMAXSI Upper Meas. Limit or Max. Total Counter Read
    *ing in SI Unit.
            MRMAXSI           TYPE /BI0/OIMRMAXSI,
         InfoObject: 0DOCAF Measurement Document Included for Associated T
    *ask.
            DOCAF           TYPE /BI0/OIDOCAF,
         InfoObject: 0RECORDMODE BW Delta Process: Update Mode.
            RECORDMODE           TYPE RODMUPDMOD,
         Field: RECORD.
            RECORD           TYPE RSARECORD,
          END   OF tys_SC_1.
        TYPES:
          tyt_SC_1        TYPE STANDARD TABLE OF tys_SC_1
                            WITH NON-UNIQUE DEFAULT KEY.
        DATA:
          p_check_master_data_exist
                TYPE RSODSOCHECKONLY READ-ONLY,
    *-    Instance for getting request runtime attributs;
        Available information: Refer to methods of
        interface 'if_rsbk_request_admintab_view'
          p_r_request
                TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.
      PRIVATE SECTION.
        TYPE-POOLS: rsd, rstr.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: ...
    DATA:   ...
    *constants: c_tabname type rstlogotab value '/BI0/MEQUIPMENT'.
    $$ end of global - insert your declaration only before this line   -
        METHODS
          start_routine
            IMPORTING
              request                  type rsrequest
              datapackid               type rsdatapid
            EXPORTING
              monitor                  type rstr_ty_t_monitors
            CHANGING
              SOURCE_PACKAGE              type tyt_SC_1
            RAISING
              cx_rsrout_abort.
        METHODS
          inverse_start_routine
            IMPORTING
              i_th_fields_outbound         TYPE rstran_t_field_inv
              i_r_selset_outbound          TYPE REF TO cl_rsmds_set
              i_is_main_selection          TYPE rs_bool
              i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
              i_r_universe_inbound         TYPE REF TO cl_rsmds_universe
            CHANGING
              c_th_fields_inbound          TYPE rstran_t_field_inv
              c_r_selset_inbound           TYPE REF TO cl_rsmds_set
              c_exact                      TYPE rs_bool.
    ENDCLASS.                    "routine DEFINITION
    $$ begin of 2nd part global - insert your code only below this line  *
    ... "insert your code here
    data: lt_data type ref to data.
    data: ls_data type ref to data.
    field-symbols: <G_T_0EQUIPMENT> type standard table.
    field-symbols: <G_S_0EQUIPMENT> type any.
    field-symbols: <FUNCT_LOC> type any.
    field-symbols: <DATEFROM> type any.
    field-symbols: <DATETO> type any.
    constants: c_tabname type rstlogotab value '/BI0/MEQUIPMENT'.
    $$ end of 2nd part global - insert your code only before this line   *
          CLASS routine IMPLEMENTATION
    CLASS lcl_transform IMPLEMENTATION.
          Method start_routine
          Calculation of source package via start routine
      <-> source package
      METHOD start_routine.
    *=== Segments ===
        FIELD-SYMBOLS:
          <SOURCE_FIELDS>    TYPE tys_SC_1.
        DATA:
          MONITOR_REC     TYPE rstmonitor.
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries
    In this start routine missing functional location for
    an equipment is added to a Data Package record, if it is available
        create data lt_data type table of (c_tabname).
        assign lt_data->* to <G_T_0EQUIPMENT>.
        create data ls_data type (c_tabname).
        assign ls_data->* to <G_S_0EQUIPMENT>.
        assign component 'FUNCT_LOC' of structure <G_S_0EQUIPMENT> to
        <FUNCT_LOC>.
        assign component 'DATE_FROM' of structure <G_S_0EQUIPMENT> to
        <DATEFROM>.
        assign component 'DATE_TO' of structure <G_S_0EQUIPMENT> to
        <DATETO>.
        CALL FUNCTION 'RSAU_READ_MASTER_DATA'
          EXPORTING
            I_IOBJNM                = '0EQUIPMENT'
            I_FLG_WHOLE_TABLE       = 'X'
          IMPORTING
            E_TABLE                 = <G_T_0EQUIPMENT>
          EXCEPTIONS
            READ_ERROR              = 1
            NO_SUCH_ATTRIBUTE       = 2
            WRONG_IMPORT_PARAMETERS = 3
            CHAVL_NOT_FOUND         = 4
            OTHERS                  = 5.
        CASE SY-SUBRC.
          WHEN 0.
            LOOP AT <G_T_0EQUIPMENT> INTO <G_S_0EQUIPMENT>.
              IF <FUNCT_LOC> IS INITIAL.
                DELETE <G_T_0EQUIPMENT>.
              ENDIF.
    master data collected and condensed
            ENDLOOP.
            <b>LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
              IF ( SOURCE_PACKAGE-FUNCT_LOC IS INITIAL ) AND
              ( SOURCE_PACKAGE-EQUIPMENT IS NOT INITIAL ).
                READ TABLE <G_T_0EQUIPMENT> WITH KEY
                ('EQUIPMENT') = SOURCE_PACKAGE-EQUIPMENT INTO <G_S_0EQUIPMENT>
                IF SY-SUBRC = 0.
                  IF ( SOURCE_PACKAGE-MDATE >= <DATEFROM> )
                  AND ( SOURCE_PACKAGE-MDATE <= <DATETO> ).</b>* record for equipment exists and valid
                    SOURCE_PACKAGE-FUNCT_LOC = <FUNCT_LOC>.               MODIFY SOURCE_PACKAGE.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDLOOP.
          WHEN 4.
    master data is not (yet) loaded
          WHEN OTHERS.
    problem occured, output as warning
            MONITOR-MSGID = SY-MSGID.
            MONITOR-MSGTY = 'W'.
            MONITOR-MSGNO = SY-MSGNO.
            MONITOR-MSGV1 = SY-MSGV1.
            MONITOR-MSGV2 = SY-MSGV2.
            MONITOR-MSGV3 = SY-MSGV3.
            MONITOR-MSGV4 = SY-MSGV4.
            APPEND MONITOR.
        ENDCASE.
    if abort is not equal zero, the update process will be canceled
    DEL  :ABORT = 0.
    Please adjust the syntax manually.
        - Automatically replaced: COMM_STRUCTURE with SOURCE_FIELDS
        - Included the new Exception Handling (instead of ABORT)
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "start_routine
          Method inverse_start_routine
          This subroutine needs to be implemented only for direct access
          (for better performance) and for the Report/Report Interface
          (drill through).
          The inverse routine should transform a projection and
          a selection for the target to a projection and a selection
          for the source, respectively.
          If the implementation remains empty all fields are filled and
          all values are selected.
      METHOD inverse_start_routine.
    $$ begin of inverse routine - insert your code only below this line-
        ... "insert your code here
    $$ end of inverse routine - insert your code only before this line -
      ENDMETHOD.                    "inverse_start_routine
    ENDCLASS.                    "routine IMPLEMENTATION
    here I am getting the error like ""SOURCE_PACKAGE" is a table without a header line and therefore has no component called "FUNCT_LOC". I tried many ways to fix this problem.
    Could you some kind soul educate how to fix the problem .
    Thanks in advacne ,RP.

    Since the MONITOR is a table without header-line, u can no longer use it as a workarea for record entry. You can use MONITOR_REC defined in the data-section of this method to fill in the record and then append it to the table.
    MONITOR-MSGID = SY-MSGID.
    MONITOR-MSGTY = 'W'.
    MONITOR-MSGNO = SY-MSGNO.
    MONITOR-MSGV1 = SY-MSGV1.
    MONITOR-MSGV2 = SY-MSGV2.
    MONITOR-MSGV3 = SY-MSGV3.
    MONITOR-MSGV4 = SY-MSGV4.
    APPEND MONITOR.
    has to be replaced with
    clear MONITOR_REC.
    MONITOR_REC-MSGID = SY-MSGID.
    MONITOR_REC-MSGTY = 'W'.
    MONITOR_REC-MSGNO = SY-MSGNO.
    MONITOR_REC-MSGV1 = SY-MSGV1.
    MONITOR_REC-MSGV2 = SY-MSGV2.
    MONITOR_REC-MSGV3 = SY-MSGV3.
    MONITOR_REC-MSGV4 = SY-MSGV4.
    APPEND MONITOR_REC to MONITOR.

  • Problem in execution of start routine

    Hi gurus,
    I have written the following start routine in BW 3.5.
    I want this code to be executed when i move data from ODS1: ZCC_LOAN to ODS2: ZCORPLNS.
    The problem is that the start routine is not executed.
    I used breakpoints (break-point.) both above and below the loop (loop at DATA_PACKAGE.) and scheduled the infopackage to do a transfer, but data was scheduled without entering the debug screen.
    Do you think there might be wrong with the declarations of the DATA_PACKAGE? Any suggestions?
    Thank you for your help,
    Giorgos
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: /BIC/AZCORPLNS00.
    TABLES: /BIC/AZCC_LOAN00.
    DATA: lrate like /BIC/AZCORPLNS00-/BIC/ZBASERATE.
    DATA: lspread like /BIC/AZCORPLNS00-/BIC/ZREPRSPRD.
    DATA: lmonth like /BIC/AZCORPLNS00-fiscper3.
    DATA: basedays type i,
          year(4) type c,
          month(2) type c,
          lrmonth(2) type c,
          lmonthi type i,
          monthi type i,
          lyear(4) type c,
          lyeari type i,
          fileyearmonth(6) type c,
          lrdyearmonth(6) type c,
          yeari type i.
    $$ end of global - insert your declaration only before this line   -
    The follow definition is new in the BW3.x
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CS8ZCC_LOAN.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
               MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
               DATA_PACKAGE STRUCTURE DATA_PACKAGE
      USING    RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries
    loop at DATA_PACKAGE.
    fileyearmonth = DATA_PACKAGE-/BIC/ZFILEDATE(6).
    lrdyearmonth = DATA_PACKAGE-/BIC/ZLASTREPR(6).
        if fileyearmonth = lrdyearmonth.
          month = DATA_PACKAGE-/BIC/ZFILEDATE+4(2).
          monthi = month.
          year = DATA_PACKAGE-/BIC/ZFILEDATE(4).
          yeari = year.
          if month = '01'.
            lyeari = yeari - 1.
            lmonthi = 12.
          else.
            lyeari = yeari.
            lmonthi = monthi - 1.
          endif.
          lyear = lyeari.
          lmonth = lmonthi.
         clear lrate.
         clear lspread.
         select single /BIC/ZBASERATE /BIC/ZREPRSPRD
         from /BIC/AZCORPLNS00 into (lrate, lspread)
             where FISCPER3 = lmonth and FISCYEAR = lyear
             and /BIC/ZACCNUMB = DATA_PACKAGE-/BIC/ZACCNUMB.
          DATA_PACKAGE-/BIC/ZBASERATE = lrate.
          DATA_PACKAGE-/BIC/ZREPRSPRD = lspread.
          modify DATA_PACKAGE.
        endif.
      endloop.

    Hi Giorgos
    You need to use work area(l_s_datapak_line) of DATA_PACKAGE instead of DATA_PACKAGE.
    Following are the changes should be required in your code
    DATA: l_s_datapak_line TYPE DATA_PACKAGE_STRUCTURE.
    loop at DATA_PACKAGE into l_s_datapak_line.
    fileyearmonth = l_s_datapak_line-/BIC/ZFILEDATE(6).
    lrdyearmonth = l_s_datapak_line-/BIC/ZLASTREPR(6).
    if fileyearmonth = lrdyearmonth.
    month = l_s_datapak_line-/BIC/ZFILEDATE+4(2).
    monthi = month.
    year = l_s_datapak_line-/BIC/ZFILEDATE(4).
    yeari = year.
    if month = '01'.
    lyeari = yeari - 1.
    lmonthi = 12.
    else.
    lyeari = yeari.
    lmonthi = monthi - 1.
    endif.
    lyear = lyeari.
    lmonth = lmonthi.
    clear lrate.
    clear lspread.
    select single /BIC/ZBASERATE /BIC/ZREPRSPRD
    from /BIC/AZCORPLNS00 into (lrate, lspread)
    where FISCPER3 = lmonth and FISCYEAR = lyear
    and /BIC/ZACCNUMB = l_s_datapak_line-/BIC/ZACCNUMB.
    l_s_datapak_line-/BIC/ZBASERATE = lrate.
    l_s_datapak_line-/BIC/ZREPRSPRD = lspread.
    MODIFY DATA_PACKAGE FROM l_s_datapak_line.
    endif.
    endloop.

  • Start Routine to populate the Logical Source System

    Hi Friends please help me with the below
    1. <b>Requirement</b> : to Populate The system Date , Source System
    in BI for Each load request.
    <b>
    1 Solution:</b> I thought of writing the Start Routine for this but it is giving me error
    syntax Error: END METHOD MISSING?????
    2. Also I have requirement to populate 0sourcsys source system id, can any body help how to populate that.
    Thanks
    Poonam Roy
    <b>ABAP Code.</b>
    I have the End Method. what more to do.
      METHOD start_routine.
    *=== Segments ===
        FIELD-SYMBOLS:
          <SOURCE_FIELDS>    TYPE tys_SC_1.
        DATA:
          MONITOR_REC     TYPE rstmonitor.
    <b>
    $$ begin of routine - insert your code only below this line        -</b>
    ... "insert your code here
    <b>
    FORM STARTROUTINE
    USING G_S_MINFO TYPE RSSM_S_MINFO
    CHANGING DATAPAK type TRANSTRU
    ABORT LIKE SY-SUBRC.
    DATA: ZLOAD_DAT LIKE SY-DATUM
    ZZSOURSYS TYPE RSLOGSYS
    IF G_S_MINFO-DATAPAKID=1
    SOURCE_FIELDS-ZLOAD_DAT = SY-DATE.
    SOURCE_FIELDS-ZZSOURSYS = G_S_MINFO-LOGSYS.
    ENDIF.
    ABORT = 0.
    ENDFORM.
    ENDMETHOD.
    ENDCLASS</b>.
    *--  fill table "MONITOR" with values of structure "MONITOR_REC"
    *-   to make monitor entries
    ... "to cancel the update process
       raise exception type CX_RSROUT_ABORT.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.

    Hi,
    Check whether the formula is useful here than Routine. Because you can see the Sy-datum , source system( I Guess) fields as avaialable formula elements .
    With rgds,
    Anil Kumar Sharma .P

  • ABAP Code Problem in Start Routine to Fill the value from Look-up Table ???

    Hi all,
         I am trying to fill the values of DOC_NUMBER & PLANT from look-up table /BIC/AZSD_O0700 (Billing Item ODS) for each BILL_NUM in Start Routine for Update Rules of Billing Header ODS and modify the data_package.
    What is wrong with the below ABAP code, PLEASE ???
    data: it_data type standard table of data_package_structure
            with header line
            with non-unique default key initial size 0.
    types: begin of billing_item_type,
                 BILL_NUM          like /BIC/AZSD_O0700-BILL_NUM,
                 DOC_NUMBER   like /BIC/AZSD_O0700-DOC_NUMBER,
                 PLANT               like /BIC/AZSD_O0700-PLANT,
             end of billing_item_type.
    refresh it_data.
    clear it_data.
    it_data[] = DATA_PACKAGE[].
    refresh DATA_PACKAGE.
    clear DATA_PACKAGE.
    loop at it_data.
        select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
               from /BIC/AZSD_O0700
               where  BILL_NUM  = it_data-BILL_NUM
               and    FISCVARNT = it_data-fiscvarnt.
        endselect.
        if sy-subrc = 0.
           move-corresponding it_data to DATA_PACKAGE.
        endif.
      endloop.
      modify DATA_PACKAGE.
    Thanks,
    Venkat.

    Hi Venkat,
      Two things -One is the performance and the other ... there is no Append  within the loop.
      Try moving the select statement ousdie the loop to improve performance and move the modify statement into the loop ... change modify to append. Code below.
       Let me know if you need more help.
    Best regards,
    Kazmi
    data: it_data type standard table of data_package_structure
    with header line
    with non-unique default key initial size 0.
    types: begin of billing_item_type,
    BILL_NUM like /BIC/AZSD_O0700-BILL_NUM,
    DOC_NUMBER like /BIC/AZSD_O0700-DOC_NUMBER,
    PLANT like /BIC/AZSD_O0700-PLANT,
    end of billing_item_type.
    refresh it_data.
    clear it_data.
    it_data] = DATA_PACKAGE[.
    refresh DATA_PACKAGE.
    clear DATA_PACKAGE.
    loop at it_data.
    select DOC_NUMBER PLANT into (it_data-DOC_NUMBER, it_data-PLANT)
    from /BIC/AZSD_O0700
    where BILL_NUM = it_data-BILL_NUM
    and FISCVARNT = it_data-fiscvarnt.
    endselect.
    if sy-subrc = 0.
    move-corresponding it_data to DATA_PACKAGE.
    Append DATA_PACKAGE.
    endif.
    endloop.

  • Start Routine not working correctly.

    Hi gurus,
    I'm having a problem with a start routine in an update rule to one of my cubes. I debug it and it seems to work fine. However, it ends the simulation saying in the error message "No active update rules exist for this infosource." However, I think it's something to do with the logic I have in my start routine. Below is the start routine which I am trying to debug. I'm doing a lookup on an ODS and if no match is found on that ODS by Sales Order and Sales Order Item, I do another lookup on an object that has the same information that I'm looking to append to the transaction record. Any help would be greatly appreciated. I'm thinking the second loop against the internal table might not be working correctly as it seems to just sit on that table.
    Thanks in advance,
    John
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: ...
    DATA:   PENDING_QTY  LIKE /BIC/AZO_BKLG100-/BIC/ZQTYPEND1,
            ABSOLUTE_QTY LIKE /BIC/AZO_BKLG100-/BIC/ZQTYPEND1,
            TEN_PERCENT  LIKE /BIC/AZO_BKLG100-/BIC/ZQTYPEND1,
            TEN_PERCENT_VALUE TYPE P LENGTH 4 DECIMALS 2 VALUE '0.1'.
    DATA:   ZWEEK LIKE SCAL-WEEK.
    $$ end of global - insert your declaration only before this line   -
    The follow definition is new in the BW3.x
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CSZO_PMO1_ENHANCED.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
               MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
               DATA_PACKAGE STRUCTURE DATA_PACKAGE
      USING    RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries
    TABLES : /BIC/AZO_PMI100.    "Active PM Invoice ODS
    TABLES : /BIC/PZ_CTBWOBJ.    "CTBW Order Master
      DATA: T_DATA_PAK  LIKE DATA_PACKAGE OCCURS 0 WITH HEADER LINE,
            T_DATA_PAK1 LIKE DATA_PACKAGE OCCURS 0 WITH HEADER LINE,
            IV_INVQTY like /BIC/AZO_PMI100-INV_QTY,
            IV_INVVAL like /BIC/AZO_PMI100-NETVAL_INV,
            BEGIN OF IT_INVOICES OCCURS 0,
                  INV_SALES_ORD    LIKE /BIC/AZO_PMI100-/BIC/ZSORDDORD,
                  INV_SALES_ITEM   LIKE /BIC/AZO_PMI100-/BIC/ZSORDIORD,
                  INV_DOC_NUM      LIKE /BIC/AZO_PMI100-/BIC/ZBILLDINV,
                  INV_DOC_ITEM     LIKE /BIC/AZO_PMI100-/BIC/ZBILLIINV,
                  INV_QTY          LIKE /BIC/AZO_PMI100-INV_QTY,
                  NETVAL_INV       LIKE /BIC/AZO_PMI100-NETVAL_INV,
                  ZBRAND           LIKE /BIC/AZO_PMI100-/BIC/ZBRAND,
                  ZBRANDOWN        LIKE /BIC/AZO_PMI100-/BIC/ZBRANDOWN,
                  ZDESGNOWN        LIKE /BIC/AZO_PMI100-/BIC/ZDESGNOWN,
                  ZFLAGBKLG        LIKE /BIC/AZO_PMI100-/BIC/ZFLAGBKLG,
                  ZNOCOLORS        LIKE /BIC/AZO_PMI100-/BIC/ZNOCOLORS,
                  ZNOSPCLRS        LIKE /BIC/AZO_PMI100-/BIC/ZNOSPCLRS,
                  ZOPENFCTY        LIKE /BIC/AZO_PMI100-/BIC/ZOPENFCTY,
                  ZPACKSYST        LIKE /BIC/AZO_PMI100-/BIC/ZPACKSYST,
                  ZPPG             LIKE /BIC/AZO_PMI100-/BIC/ZPPG,
                  ZAPPLICAT        LIKE /BIC/AZO_PMI100-/BIC/ZAPPLICAT,
                  ZPAPERGDE        LIKE /BIC/AZO_PMI100-/BIC/ZPAPERGDE,
                  ZPRINTMTH        LIKE /BIC/AZO_PMI100-/BIC/ZPRINTMTH,
                  ZQUALITY         LIKE /BIC/AZO_PMI100-/BIC/ZQUALITY,
                  ZSHAPE           LIKE /BIC/AZO_PMI100-/BIC/ZSHAPE,
                  ZSIZE            LIKE /BIC/AZO_PMI100-/BIC/ZSIZE,
                  ZVARIANT         LIKE /BIC/AZO_PMI100-/BIC/ZVARIANT,
                  ZVOLUME          LIKE /BIC/AZO_PMI100-/BIC/ZVOLUME,
            END OF IT_INVOICES,
            BEGIN OF IT_CTBW OCCURS 0,
                  CTBW_SALES_ORD    LIKE /BIC/PZ_CTBWOBJ-/BIC/ZSORDDORD,
                  CTBW_SALES_ITEM   LIKE /BIC/PZ_CTBWOBJ-/BIC/ZSORDIORD,
                  CTBW_BRAND        LIKE /BIC/PZ_CTBWOBJ-/BIC/ZBRAND,
                  CTBW_BRANDOWN     LIKE /BIC/PZ_CTBWOBJ-/BIC/ZBRANDOWN,
                  CTBW_DESGNOWN     LIKE /BIC/PZ_CTBWOBJ-/BIC/ZDESGNOWN,
                  CTBW_NOCOLORS     LIKE /BIC/PZ_CTBWOBJ-/BIC/ZNOCOLORS,
                  CTBW_NOSPCLRS     LIKE /BIC/PZ_CTBWOBJ-/BIC/ZNOSPCLRS,
                  CTBW_C_APM_006    LIKE /BIC/PZ_CTBWOBJ-/BIC/C_APM_006,
                  CTBW_PACKSYST     LIKE /BIC/PZ_CTBWOBJ-/BIC/ZPACKSYST,
                  CTBW_PAPERGDE     LIKE /BIC/PZ_CTBWOBJ-/BIC/ZPAPERGDE,
                  CTBW_PPG          LIKE /BIC/PZ_CTBWOBJ-/BIC/ZPPG,
                  CTBW_PRINTMTH     LIKE /BIC/PZ_CTBWOBJ-/BIC/ZPRINTMTH,
                  CTBW_QUALITY      LIKE /BIC/PZ_CTBWOBJ-/BIC/ZQUALITY,
                  CTBW_SHAPE        LIKE /BIC/PZ_CTBWOBJ-/BIC/ZSHAPE,
                  CTBW_SIZE         LIKE /BIC/PZ_CTBWOBJ-/BIC/ZSIZE,
                  CTBW_VARIANT      LIKE /BIC/PZ_CTBWOBJ-/BIC/ZVARIANT,
                  CTBW_VOLUME       LIKE /BIC/PZ_CTBWOBJ-/BIC/ZVOLUME,
            END OF IT_CTBW.
    *These deletions are already included in the InfoPackage:
    *Keep only PackMat Finished Materials SOrders:
    *DELETE DATA_PACKAGE
      WHERE MATL_GROUP(5) NE 'PM-FM'.
    *Keep only open SOrders:
    *DELETE DATA_PACKAGE
       where /BIC/ZOSTATUS = 'C'.
    *Keep only MC and CF SOrders:
    *DELETE DATA_PACKAGE
       where DOC_TYPE NE 'ZOR6' AND DOC_TYPE NE 'ZOR9'.
    *Keep only non rejected SOrders:
    DELETE DATA_PACKAGE
        where REASON_REJ IS NOT INITIAL.
              Exclude list of statistical Item Categories (not billing
              relevant).
    DELETE DATA_PACKAGE WHERE
       ITEM_CATEG = 'ZPC1' or     
       ITEM_CATEG = 'ZPC2' or     
       ITEM_CATEG = 'ZPC3' or
       ITEM_CATEG = 'ZPC4' or
       ITEM_CATEG = 'ZTAF' or     
       ITEM_CATEG = 'ZTAE' or     
       ITEM_CATEG = 'ZTAG' or     
       ITEM_CATEG = 'ZTSV'.
      REFRESH: T_DATA_PAK,T_DATA_PAK1,
               IT_INVOICES, IT_CTBW.
      T_DATA_PAK[] = DATA_PACKAGE[].
      T_DATA_PAK1[] = DATA_PACKAGE[].
      DATA : COUNT1 LIKE SY-TABIX.
      DESCRIBE TABLE T_DATA_PAK1 LINES COUNT1.
      IF NOT COUNT1 IS INITIAL.
       Selection for Invoice Items    ***********
    SORT T_DATA_PAK1 BY /BIC/ZSORDDORD /BIC/ZSORDIORD.
       SELECT   /BIC/ZSORDDORD /BIC/ZSORDIORD /BIC/ZBILLDINV /BIC/ZBILLIINV
                INV_QTY        NETVAL_INV
                /BIC/ZBRAND    /BIC/ZBRANDOWN /BIC/ZDESGNOWN /BIC/ZFLAGBKLG
                /BIC/ZNOCOLORS /BIC/ZNOSPCLRS /BIC/ZOPENFCTY /BIC/ZPACKSYST
                /BIC/ZPPG      /BIC/ZAPPLICAT /BIC/ZPAPERGDE /BIC/ZPRINTMTH
                /BIC/ZQUALITY  /BIC/ZSHAPE    /BIC/ZSIZE     /BIC/ZVARIANT
                /BIC/ZVOLUME
           INTO  TABLE IT_INVOICES
           FROM /BIC/AZO_PMI100
           FOR ALL ENTRIES IN T_DATA_PAK1
           WHERE /BIC/ZSORDDORD   = T_DATA_PAK1-/BIC/ZSORDDORD AND
                 /BIC/ZSORDIORD  = T_DATA_PAK1-/BIC/ZSORDIORD AND
    051114: Exclude pro forma invoices from selection.
                    ( bill_type NE 'ZPF1' AND bill_type NE 'ZPF2' AND
                      bill_type NE 'ZPF3').
        SORT: IT_INVOICES BY INV_SALES_ORD   INV_SALES_ITEM.
        DELETE IT_INVOICES WHERE ZQUALITY IS INITIAL.
        REFRESH: T_DATA_PAK1.
      LOOP AT T_DATA_PAK.
         CLEAR: T_DATA_PAK1, IV_INVQTY, IV_INVVAL, IT_INVOICES, IT_CTBW.
         MOVE-CORRESPONDING T_DATA_PAK TO T_DATA_PAK1.
         loop at IT_INVOICES
              where INV_SALES_ORD  = T_DATA_PAK-/BIC/ZSORDDORD
                and INV_SALES_ITEM = T_DATA_PAK-/BIC/ZSORDIORD.
            IV_INVQTY = IV_INVQTY + IT_INVOICES-INV_QTY.
            IV_INVVAL = IV_INVVAL + IT_INVOICES-NETVAL_INV.
         endloop.
            Use req. del. date if not conf. del. date is available
            Changes being made to use conf. del. date instead of
            req. del. date.   This is not always filled in.
         IF T_DATA_PAK1-/BIC/ZDATESCHL IS INITIAL.
           MOVE T_DATA_PAK1-DSDEL_DATE to T_DATA_PAK1-/BIC/ZDATESCHL.
         ENDIF.
         move:
             IV_INVQTY                  to T_DATA_PAK1-INV_QTY,
             IV_INVVAL                  to T_DATA_PAK1-NETVAL_INV,
             IT_INVOICES-ZBRAND         to T_DATA_PAK1-/BIC/ZBRAND,
             IT_INVOICES-ZBRANDOWN      to T_DATA_PAK1-/BIC/ZBRANDOWN,
             IT_INVOICES-ZDESGNOWN      to T_DATA_PAK1-/BIC/ZDESGNOWN,
             IT_INVOICES-ZFLAGBKLG      to T_DATA_PAK1-/BIC/ZFLAGBKLG,
             IT_INVOICES-ZNOCOLORS      to T_DATA_PAK1-/BIC/ZNOCOLORS,
             IT_INVOICES-ZNOSPCLRS      to T_DATA_PAK1-/BIC/ZNOSPCLRS,
             IT_INVOICES-ZOPENFCTY      to T_DATA_PAK1-/BIC/ZOPENFCTY,
             IT_INVOICES-ZPACKSYST      to T_DATA_PAK1-/BIC/ZPACKSYST,
             IT_INVOICES-ZPPG           to T_DATA_PAK1-/BIC/ZPPG,
             IT_INVOICES-ZAPPLICAT      to T_DATA_PAK1-/BIC/ZAPPLICAT,
             IT_INVOICES-ZPAPERGDE      to T_DATA_PAK1-/BIC/ZPAPERGDE,
             IT_INVOICES-ZPRINTMTH      to T_DATA_PAK1-/BIC/ZPRINTMTH,
             IT_INVOICES-ZQUALITY       to T_DATA_PAK1-/BIC/ZQUALITY,
             IT_INVOICES-ZSHAPE         to T_DATA_PAK1-/BIC/ZSHAPE,
             IT_INVOICES-ZSIZE          to T_DATA_PAK1-/BIC/ZSIZE,
             IT_INVOICES-ZVARIANT       to T_DATA_PAK1-/BIC/ZVARIANT,
             IT_INVOICES-ZVOLUME        to T_DATA_PAK1-/BIC/ZVOLUME.
         if IT_INVOICES-ZFLAGBKLG is initial.
            SELECT /BIC/ZSORDDORD
                   /BIC/ZSORDIORD
                   /BIC/ZBRAND
                   /BIC/ZBRANDOWN
                   /BIC/ZDESGNOWN
                   /BIC/ZNOCOLORS
                   /BIC/ZNOSPCLRS
                   /BIC/C_APM_006
                   /BIC/ZPACKSYST
                   /BIC/ZPAPERGDE
                   /BIC/ZPPG
                   /BIC/ZPRINTMTH
                   /BIC/ZQUALITY
                   /BIC/ZSHAPE
                   /BIC/ZSIZE
                   /BIC/ZVARIANT
                   /BIC/ZVOLUME
           INTO  TABLE IT_CTBW
           FROM /BIC/PZ_CTBWOBJ
           FOR ALL ENTRIES IN T_DATA_PAK1
           WHERE /BIC/ZSORDDORD   = T_DATA_PAK1-/BIC/ZSORDDORD AND
                 /BIC/ZSORDIORD  =  T_DATA_PAK1-/BIC/ZSORDIORD AND
                 OBJVERS = 'A'.
        SORT: IT_CTBW BY CTBW_SALES_ORD   CTBW_SALES_ITEM.
        DELETE IT_CTBW WHERE CTBW_QUALITY IS INITIAL.
         REFRESH: T_DATA_PAK1.
         endif.
         loop at IT_CTBW
            where CTBW_SALES_ORD  = T_DATA_PAK-/BIC/ZSORDDORD
            and CTBW_SALES_ITEM = T_DATA_PAK-/BIC/ZSORDIORD.
         endloop.
           move:
             IT_CTBW-CTBW_BRAND         to T_DATA_PAK1-/BIC/ZBRAND,
             IT_CTBW-CTBW_BRANDOWN      to T_DATA_PAK1-/BIC/ZBRANDOWN,
             IT_CTBW-CTBW_DESGNOWN      to T_DATA_PAK1-/BIC/ZDESGNOWN,
             IT_CTBW-CTBW_NOCOLORS      to T_DATA_PAK1-/BIC/ZNOCOLORS,
             IT_CTBW-CTBW_NOSPCLRS      to T_DATA_PAK1-/BIC/ZNOSPCLRS,
             IT_CTBW-CTBW_PACKSYST      to T_DATA_PAK1-/BIC/ZPACKSYST,
             IT_CTBW-CTBW_PPG           to T_DATA_PAK1-/BIC/ZPPG,
             IT_CTBW-CTBW_PAPERGDE      to T_DATA_PAK1-/BIC/ZPAPERGDE,
             IT_CTBW-CTBW_PRINTMTH      to T_DATA_PAK1-/BIC/ZPRINTMTH,
             IT_CTBW-CTBW_QUALITY       to T_DATA_PAK1-/BIC/ZQUALITY,
             IT_CTBW-CTBW_SHAPE         to T_DATA_PAK1-/BIC/ZSHAPE,
             IT_CTBW-CTBW_SIZE          to T_DATA_PAK1-/BIC/ZSIZE,
             IT_CTBW-CTBW_VARIANT       to T_DATA_PAK1-/BIC/ZVARIANT,
             IT_CTBW-CTBW_VOLUME        to T_DATA_PAK1-/BIC/ZVOLUME.
           if T_DATA_PAK1-MATERIAL+0(1) eq 'A'.
              move T_DATA_PAK1-MATERIAL+1(4) to T_DATA_PAK1-/BIC/ZQUALITY.
              move T_DATA_PAK1-MATERIAL+5(3) to T_DATA_PAK1-/BIC/ZSIZE.
              move T_DATA_PAK1-MATERIAL+8(2) to T_DATA_PAK1-/BIC/ZVARIANT.
           endif.
          APPEND T_DATA_PAK1.
         ENDLOOP.
      ENDIF.
      IF SY-SUBRC EQ 0.
        DATA_PACKAGE[] = T_DATA_PAK1[].
        ABORT = 0.
      ENDIF.
      REFRESH: T_DATA_PAK, T_DATA_PAK1.
      REFRESH: IT_INVOICES, IT_CTBW.
      FREE: T_DATA_PAK,T_DATA_PAK1.
      FREE: IT_INVOICES, IT_CTBW.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.
    Edited by: John Lucky on Jan 25, 2008 10:58 PM

    Hi,
    Why is the hard coding of "breakpoint" done.
    Try removing it.
    Regards
    Merlin.

  • ABAP routine - Transfer rules Start routine

    hello everyone,
    i need some help in writin an ABAP code. Well the logic is say i have a table which sends data to BW. the data comes like :-
    Order        Q1           
    101           50      
    101           20    
    102          10
    101           60
    But i want to store only 1 value for each order , i.e summarize the value so in when the data package comes , i want to check all records for one order and add the qty value for each order and store it in the ODS.
    so ODS for above eg should look like
    Order  qty
    101    130
    102       10
    Thanks,
    Will assign points to all helpful answers.
    Laura.

    Hi:
    If you add Order as the only Key FIELD in ODS and set the Key-figure Q1 to Aggregation, it will solve your problem. You don;t need additional code.
    NOTE: If this is not the case, its not easy to write this in ABAP. because, you don't know whether all Orders (e.g., Order #101) will come in the same DATA PACKAGE. They might be split into two different DATA PACKAGES and your Start Routine will Execute ONLT ONE DATAPACKAGE at a time.
    Chamarthy
    Message was edited by:
            Chamarthy

Maybe you are looking for

  • Video out of sync with audio when using airphoil

    Hey I was wondering if it was possible for me to use airfoil with a movie. It's just that there is a time delay in the sound there for the video and sound go completely out of sync. Note: Airphoil is like using airtunes speakers.Airphoil is an app th

  • 9.0 Pro Acrobat.exe doesnt close

    Hi, we recently upgraded from CS2 to CS4 and have noticed that when opening PDF files in IE, the acrobat.exe doesn't close down.... So by the end of the day, the users have around 5 instances of acrobat.exe in their task manager. When they try and sh

  • Does this laptop support CS3 and CS4 ?

    I need to know if this laptop model, Asus x54hy-sx030d support CS3 and CS4 ? Here are the specifications of the model : CPU:  Intel® Core™ i3-2310M Processor (3M Cache, 2.10 GHz) Memory : 4GB DDR3, 1 x SO-DIMM VGA: AMD Radeon® HD 6470M 1GB VRAM HDD:

  • Query Operator "IS" is not working good for object type "String"

    Hi, I have a problem with advanced search. When the object type is String, and I want to search directly value (for exemple 'a') i have returned all value starts with 'a', even though I set Query Operator to "IS" When I use Query operator "setByUser"

  • USMT Copies Data but does not restore data.

    Can someone help me to shed some lite on a problem we are having?  I am running an OSD task in SCCM2012R2.  The Task Has the USMT option selected and enabled.  When I run the OSD task on workstation I can see it run, I can even go to the directory an