Update routine help

Hi Frieds
My requirement is
1 have 6 internal tables taken.Lets say x-soldto x-shipto y-soldto y-shipto and z-soltdo z-shipto
As per the design the logic is
ase xbusline-/bic/MRKPARTNR.
      when 'SO'.  "Sold-to
        move DATA_PACK1-sold_to to xcustomer.
      when 'SH'.  "Ship-to
        move DATA_PACK1-ship_to to xcustomer.
      when others.  "Default is the sold-to
    endcase.
The problem is when the condition is SO
   i need to use the data in x-soldtoy-soldto z-solto
when condition is SH
   i need to use the data in x-shipto y-shipto z-shipto
How can i dynamically change that internal table name .
In the data packege loop i need to loop throough
loop at ( Internal table should change based on condition we are checking above )where
          where fiscper    eq data_pack1-xfiscper
          and material     eq DATA_PACK1-material
          and sold_to      eq xcustomer.
Please let me know how should i proceed.
Regards
vijay

Hi Vijay,
Your problem is a little bit difficult to understand... but I believe it's easy to solve.
Why don't you just use an IF or CASE before your loop? That way you can write three different loops for each case (or two, because you only use sold-to, and ship-to otherwise.
Maybe I'm not understanding the problem...
Hope it helps,
David.

Similar Messages

  • Urgent help required to write the code in  update routine

    Hi all,
    i want to calculate open purchase order qty in update routine
    formula is
    open purchase order qty = scl qty - rec qty
    where schd line date is less then or equal to 90 days from the current date.
    I have written one code : but its giving error that comm_structure is not defined in abap dictionary,can any body help to write appropriate routine. this calculation i am making for MM, and data source and cube are 2lis_02_scl and cube is zc_pur01 ( made by coping the 0pur_c01), data source scl has all fields required in the foumula...here is my code
    DATA:  COMM_STRUCTURE LIKE  /BIC/CS2LIS_02_SCL.
    DATA: SCL_QTY LIKE COMM_STRUCTURE-/BIC/ZK_SCLQTY.
    DATA:      GR_QTY LIKE COMM_STRUCTURE -/BIC/ZK_GRQTY.
    DATA: SCL_DATE.
    SCL_DATE = SY-DATUM + 90.
    SELECT COMM_STRUCTURE -/BIC/ ZK_SCLQTY COMM_STRUCTURE -/BIC/ ZK_GRQTY FROM
    /BIC/CS2LIS_02_SCL INTO   SCL_QTY     GR_QTY  
    WHERE
    COMM_STRUCTURE -/0SCHED_DATE LE SCL_DATE.
    IF SYSUBRC  = 0
    RESULT = SCL_QTY - GR_QTY.
    ELSE = NOVALUE.
    ENDIF.
    Can any body help me soon its very urgent.
    thanks

    Hi Anupam,
    I am not a very good ABAP Programmer, but found some things to notify u inyour code..
    DATA: COMM_STRUCTURE LIKE /BIC/CS2LIS_02_SCL,
          SCL_QTY LIKE COMM_STRUCTURE-/BIC/ZK_SCLQTY,
          GR_QTY LIKE COMM_STRUCTURE -/BIC/ZK_GRQTY.
    DATA  SCL_DATE LIKE SY-DATUM.
    SCL_DATE = SY-DATUM + 90.
    SELECT COMM_STRUCTURE -/BIC/ ZK_SCLQTY COMM_STRUCTURE -/BIC/ ZK_GRQTY FROM
    /BIC/CS2LIS_02_SCL INTO SCL_QTY GR_QTY
    WHERE
    COMM_STRUCTURE -/0SCHED_DATE LE SCL_DATE.
    IF SYSUBRC = 0
    RESULT = SCL_QTY - GR_QTY.
    ELSE.
    What should be the return value if you dont have to    calculate the result."
    ENDIF.
    try it.. and see..
    regards,
    kishore.

  • Help with Update Routines

    Hello!
    I'm quite new to writing Update routines & need help regarding the same.
    I need to write some Update routines for Time Characteristics.
    Here is some info:
    (1) Period to analyze (Custom Char) is in Cal Month/Year (ex:01/2007)
          -- Map 01/2007 to Fiscal Pd/year (007/2006)
    (2) Map Fiscal Pd/year (007/2006) to Planning period (ZDOT_FISCPER -->New Char).
    Planning period (ZDOT_FISCPER) periods are as follows:
    July – Oct      Pd 1
    Nov – Mar      Pd 2
    April – June   Pd 3
    So, Fiscal Pd/year of 007/2006 will be Planning period 02/2006.
    Please advise on how to go about this. Any code for these updates will be of great help.
    Thanks!

    Roberto,
    Appreciate your response. I got a clarification done now, The PERIO is Cal Month/Year. So my Question (1) has an answer now )
    Coming to Question (2):
    Ranges for ZDOR_FISCPER(Planning Period) ranges to Fiscal Period.
    I'm thinking, from the result of (1) which is Fiscal year/period ((lets ignore the year(since it is mapped to Fiscal year(GJAHR) always)), can we do this:
    Fisc pd                  Planning Period
    001-004                               1
    005-009                               2
    010-012                               3
    You think this would work, any clue how to go about this?
    Thanks Again!

  • Update Routine & Start Routine in BI 7.0

    Hi Experts,
    We have recently upgraded from BI 7.0 , I am confused about where to write start routine & update routine in transformations of BI 7.0?
    Please mention any pointers?
    Thanks.
    Sharat.

    Hi
    When you open the start routine you will see a routines info which gives you help on this.
    A summary would be:
    Update routine in transformation.
    RESULT = source_field-material.
    Basically you can acess the value of the record by using source_field.
    Start routine.
    The data comes in the form of an internal table with name SOURCE_PACKAGE.
    You can access the values by looping into a work area.
    LOOP AT SOURCE_PACKAGE assigning <source_fields>.
    ENDLOOP.
    End routine(This is a new feature in BI 7.0 where you can modify data when transformations are complete and before data is updated to info-providers)
    The data comes in the form of an internal table with name RESULT_PACKAGE.
    You can access the values by looping into a work area.
    LOOP AT RESULT_PACKAGE assigning <result_fields>.
    ENDLOOP.
    Hope this helps you to understand the basics of the abap used in the transformations .
    Regards
    Samarpita

  • Update Routine to populate 0VENDOR from either of the 2 data source fields

    Hi,
    I have a requirement to write an update routine for 0VENDOR based on the below logic :
    Create routines to populated BW Info Object u201CVendoru201D (0VENDOR) based on the following logic:
    IF field u201CVendoru201D (ITM_VENDOR_ID) is populated from data source 0BBP_SC_TD_1, THEN populate 0VENDOR with that value
    ELSE IF u201CPreferred Vendoru201D (ITM_PROPVEN_ID) is populated from data source 0BBP_SC_TD_1, THEN populate 0VENDOR with that value
    ELSE IF neither u201CVendoru201D (ITM_VENDOR_ID) or u201CPreferred Vendoru201D (ITM_PROPVEN_ID) are populated from data source 0BBP_SC_TD_1, then 0VENDOR = NULL
    Can anyone help me in converting this logic into ABAP routine.
    Thanks,
    Suchitra

    Hi Suchitra,
    In the Transfer Rules ... You will be mapping each field then the mapping field click on the button with Triangle then you can see the which type you want.
    Then select the routine and select the datasource fields (don't forget to select the both fields VENDOR and PROPITM)...
    Then give a name to routine ...
    and in the code just change the COMM_STRUCTURE to TRANSFER_STRUCTURE.
    Then you can get this .... done..
    Regards,
    Ravi Kanth

  • New field to be filled by update routine

    Deltas are running, and added a new char to the cube and written update routine to fill the new char. How should i fill this new value for history. I don't want to reshedule the job from r/3. Will i be able to do from reconstruction (i doubt since our PSA Data is deleted every week). there is no ods between. What are options available.
    Kunal

    Hi Kunal,
       If data is available in BW then you can write some coding(routine) to fill the data for history data you have to loop back(CUBE to CUBE) to CUBE.
    Have a look:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f421c86c-0801-0010-e88c-a07ccdc69601
       Provide some more details. Which character, is available as attribute of any object...etc..
    Hope it Helps
    Srini

  • Update routine for 0proc_unit conversion

    Hi all,
    My infoobject 0OPR_ACTWRK uses 0PROC_UNIT for units. It holds data in days and in hours. When I load it to a cube, I want to convert all values to working hours.
    I figured out that I have to use an update routine in my update rules. A lot of forum threads about unit conversion mention the function module UNIT_CONVERSION_SIMPLE. Can I use this function for my problem? Or should I use a different function module?
    This will be my first ABAP code, so can anyone help me and tell me what I have to fill in exactle in the routine format below?
    $$ begin of routine - insert your code only below this line        -
    fill the internal table "MONITOR", to make monitor entries
    result value of the routine
      RESULT = .
    result value of the unit
      UNIT = .
    if the returncode is not equal zero, the result will not be updated
      RETURNCODE = 0.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    Thanks in advance!
    Regards, Pieter

    Dear Pieter,
    I am not infront of the system..
    the following surely will give error.. :).. so post back here.. so that me or someone else will reply you..
    So let us start witht he following coding in the 'Start routine'.
    LOOP AT DATA_PACKAGE.
    IF DATA_PACKAGE-UNIT= 'DAY'.
       DATA_PACKAGE-opr_pldwrk = DATA_PACKAGE-opr_pldwrk * 8.
    ELSE.
    Do nothing.
    ENDIF.
    MODIFY DATA_PACKAGE.
    ENDLOOP.
    Regards,
    Hari
    Message was edited by: Hari Kiran Y
    Message was edited by: Hari Kiran Y

  • Update Routine ABAP question

    Hi,
    I am updating data between two ODS objects using some update routines. I would like to write the following routine (in pseudo code):
    ++++++++++++++++++++++++++++++++++++++++++++++++++++
    Check if the characteristic i am updating is not null
    IF COMM_STRUCTURE-field1 = 'value1'     AND
             COMM_STRUCTURE-field2 = 'value2'.
    RESULT COMM_STRUCTURE-field3.
    ELSE.
    Don't update anything
    END IF
    +++++++++++++++++++++++++++++++++++++++++++++++++++
    My questions:
    1. How i tell the routine not to update anything (as specified in the pseudo code)?
    2. How i can check that the characteristic i woul like to update is not null?
    3. What is the preferred debug method in case i do not use the PSA?
    BR,
    Xibi

    Thanks Siggi for your prompt and helpful answer. There are however some fundamental things which are not fully clear to me (BTW, where i can find some good documentation on ABAP for BW??):
    > Hi,
    >
    > 1. How i tell the routine not to update anything (as
    > specified in the pseudo code)?
    >
    > set the returncode to a value <> 0.
    I wrote the following:
    returncode = 1.
    Consequently the updated failed. Maybe i am doing something wrong but my intention is not to have the whole thing fail, but rather skip the update for some records.
    > 2. How i can check that the characteristic i woul
    > like to update is not null?
    >
    > if not comm_structure-<fieldname> is initial.
    The problem is that the characteristic i am trying to update is not contained in the source ODS but only in the target one. Will "if not comm_structure-<fieldname> is initial" still work in this case?
    >
    > 3. What is the preferred debug method in case i do
    > not use the PSA?
    >
    > Without psa, you need to add a endless loop:
    > statics: st_flag type c value '0'.
    >
    > while st_flag = '0'.
    > break-point.
    > endwhile.
    >
    >
    > Hope this helps!
    >
    > regards
    >
    > Siggi

  • Update routine infinite loop

    Hello Experts,
    For loading ODS2 we are making a lookup on ODS1 for 0material based on
    purchaing document number, item line item.
    Is there any mistake in the start routine or update routine.
    Because the load goes in infinite loop. I think update routine should be changed.
    Any suggestions are appreciated
    Start routine:
    data: begin of itab occurs 0,
            pur_doc like /BIC/AZODS100-OI_EBELN,
            item like /BIC/AZODS100-OI_EBELP,
            material like /BIC/AZODS100-material,
          end of itab.
    clear itab.
    select OI_EBELN OI_EBELP MAT_PLANT from /BIC/AZODS100
             into table itab.
    Update routine for 0material
    loop at itab where pur_doc = COMM_STRUCTURE-OI_EBELN
                       and item = COMM_STRUCTURE-OI_EBELP.
           RESULT = itab-matplant.
    endloop.

    Hi,
    this takes a long time, because with each record of your data packaged it is doing the loop and scanning each row of the internal table. Use the following instead.
    Start routine:
    types: begin of t_itab,
    pur_doc like /BIC/AZODS100-OI_EBELN,
    item like /BIC/AZODS100-OI_EBELP,
    material like /BIC/AZODS100-material,
    end of t_itab.
    data: itab type hashed table of t_itab with unique key pur_doc item.
    select OI_EBELN OI_EBELP MAT_PLANT from /BIC/AZODS100
    into table itab order by oi_ebeln oi_ebelp mat_plant.
    I hope these fields are the key of the ods object.
    Update routine for 0material
    data: wa_itab type t_itab.
    read table itab into wa_itab with table key pur_doc = COMM_STRUCTURE-OI_EBELN
    item = COMM_STRUCTURE-OI_EBELP.
    if sy-subrc = 0.
    RESULT = wa_itab-matplant.
    else.
    clear result.
    endif.
    Hope this helps
    regards
    Siggi

  • Update Routine - ABAP code

    Hi,
    I am trying to write an update routine to calculate and populate fields in my ODS infoprovider.
    one of the key figure field in my update rules is 'No. of Days'. Based on the 'No. of Days' range, I want to send a key figure(Infoobject:Due amount) value to another infoobject(Bucket1, Bucket2, Bucket3 ect.)in my ODS infoprovider. For example, let's say,
    IF NO. OF DAYS = >0 AND <=30
       THEN TAKE THE DUE AMOUNT PUT IN BUCKET1
    ENDIF.
    ELSE IF
       NO. OF DAYS = >31 AND <=60
       THEN TAKE THE DUE AMOUNT PUT IN BUCKET2
    ENDIF.
    ELSE IF
       NO. OF DAYS = >61 AND <=90
       THEN TAKE THE DUE AMOUNT PUT IN BUCKET3
    ENDIF.
    I think, I know the data flow logic but I don't know how to code in ABAP language. If someone can give me some psuedo like ABAP code, I would appreciate your help with points.

    Hi Roa,
    I would do this in the start routine of the update rule.
    Here is a sample on how do this. You could use a case statement for this code also.
    Loop at Data_Packet.
    IF NO. OF DAYS = >0 AND <=30
    Data_Packet-BUCKET1 = DUE AMOUNT
    ELSEIF
    NO. OF DAYS = >31 AND <=60
    Data_Packet-BUCKET2 = DUE AMOUNT
    ENDIF.
    ELSEIF
    NO. OF DAYS = >61 AND <=90
    Data_Packet-BUCKET3 = DUE AMOUNT
    ENDIF.
    modify data_packet.
    endlloop.
    Cheers! Bill

  • Infostructure update routine : debug problem

    Hi All,
    We have created three update routines for three corresponding infostructures. But I am not able to debug this routine. I tried to put a hard breakpoint also, but it was of no use. The Infostructure logs the changes in the sales order.
    How can I get the list of objects that are accessible in these routines?
    How can I view the values of MCVBAP and MCVBAK(communication structures) that are used in the update routines?
    How can I debug such routines?
    From where does these structures, MCVBAK and MCVBAP, get value? Are these runtime values? How much time does it take normally take for the infostructure to be updated? or is it updated immediately when the sales Order is saved?
    Thanks,
    Jiten

    Hello,
    some hopefully helpful answers:
    - the MCVBAK / MCVBAP are structures, that are built from the orderdata in the function MCV_STATISTICS_ORDER. There are two exits EXIT_SAPLMCS1_001 (header Data) and EXIT_SAPLMCS1_002 (position data) where you could fill additional user fields in these structures. Additional fields you could define in the structures MCVBAKUSR or MCVABPUSR.
    - the time that it takes to get an infostructure updates depends on it's customizing of updating (transaction OM01). the possibilities are: no update, update in V1-posting, update in V2-posting, update in batch.
    - Helpful are folling transactions: MC30 ( shows the update logs, you have to set the parameter MCL = 'X' in your userdate, see OSS - Note 77427) , MCVR (simulation of update).
    Regards Wolfgang

  • Converting Tx Routines and Update Routines in to Tranformation in 2004's

    Hi,
    I have to get all the data from the existing BW 3.5 system in to the BI 7.0 system.
    While the conversion process if I choose to create the transformation instead and installing the update rules and tranfer rules and migrating those to the tranformations.
    Here I have three similiar questions:
    i. So, if I copy the transfer routines in to the Transformation, then do I have to change any ABAP Code?  Is there any syntax changes that have to be take care off.
    ii. If I copy the Update routines in to the Transformation, then do I have to change any ABAP Code?  Is there any syntax changes that have to be take care off.
    iii. If I copy the Start routines in to the Transformation, then do I have to change any ABAP Code?  Is there any syntax changes that have to be take care off.
    I appreciate your help.  Thanks!

    1) TRAN_STRUCTURE to SOURCE_FIELDS
    2) COMM_STRUCTURE to SOURCE_FIELDS
    3) DATA_PACKAGE to SOURCE_PACKAGE
    http://help.sap.com/saphelp_nw04s/helpdata/en/44/bd9b5be97c112ce10000000a11466f/content.htm

  • How to put break point in the update routine

    I am trying to create a break point in update routine. I can do that in the start routine but I would like to know how I can include a break point in update routine in Q.
    Thanks

    Go to Monitor Screen of the data load -> Details tab -> data processing -> right click on Data Packets -> select simulation -> select update rules and give no.of records you want to debug and then system will display the code where you can debug by giving break points.
    Hope it helps..

  • Canu2019t u201Ccommentu201D lines in Update Routine although in Change mode

    Hi,
    There is an update rule between a datasource (2LIS_02_SCL) and ODS1 that I need to modify. When I double click on it, instead of seeing the old update rule that I am used to, showing the list of the fields I get some graphics with the links between fields in one group to the other.
    The u201CRule groupu201D is set to u201CStandard Groupu201D.
    I double click on the link between the fields of interest and changed u201CRule Typeu201D to u201CRoutineu201D and changed it to the change mode for changes.
    I have an INCLUDE program from another project which performs the same tasks that I am trying to implement.
    At a location where it states u201Cu2026insert your code here u2026u201D, I am able to bring in the lines from the other routine which does the desired job.
    1.
    The problem at this moment is that I canu2019t get COMMENT on all the previous codes which were in there. I tried deleting, and that also fails. As a result, I am getting errors.
    Any help on this?
    2.
    Is that the right place to modify the routine?
    3.
    What is the difference between between between this approach of modifying update routines compare to the old one?
    Thanks

    Hi,
    thanks so far:
    I did exactly what you described. When I got to where to insert my code, I see that the system by default has METHODS, with declaration etc.
    I want to ignore all those and simple insert the following. Donu2019t I need to comment on all the existing information that I do not need:
    e.g. when I inserted the code below, and performed a u201Cchecku2019, it failed at a line (TYPE RSODSOCHECKONLY READ-ONLY,) which existed originally in the default code which read. I though I should be able to comment those out, but the system is not allowing me:
    Attributs
        DATA:
          p_check_master_data_exist
                TYPE RSODSOCHECKONLY READ-ONLY,
    *--my insert begins--
    INCLUDE MY_UPDTE_RULE.
    $$ end of global - insert your declaration only before this line   -
    FORM Calc_Data
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
      USING    COMM_STRUCTURE LIKE /BIC/CS2LIS_02_SCL
               RECORD_NO LIKE SY-TABIX
               RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING RESULT LIKE /BI0/V0PUR_C01T-GR_QTY
               RETURNCODE LIKE SY-SUBRC
               ABORT LIKE SY-SUBRC.
    $$ begin of routine - insert your code only below this line        -
    fill the internal table "MONITOR", to make monitor entries
    IF ( COMM_STRUCTURE-u2026u2026.
        perFORM ZZZZZZZ
           USING    COMM_STRUCTURE-u2026u2026
           u2026u2026
           u2026u2026
           CHANGING RESULT.
    if the returncode is not equal zero, the result will not be updated
        RETURNCODE = 0.
    else.
        RETURNCODE = 4.
    endif.
    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.
    *--end of my code--
    Thanks

  • Look up at master data in  update routine

    Hi all,
    I am loading from flat file in to an infocube. My transaction data comes in the format Subcategory, Area,Date, Sales qty,UOM. But my infocube should be filled with Category,Subcategory,Region,Area,Date,SalesQty,UOM. My business requirements want me to model Category, Subcategory,Region area as characteristics of dimension. ie I cannot model Category as navigational attribute of Subcategory and Region as navigational attribute of Area.
    But I can get the master data file for Subcategory in Sucategory, Category format and Area in Area, Region format. So when I load the transaction data I can make a table lookup on these master data table and fill the required fields.
    But the problem is I donot have much experince in ABAP routines.
    Can any one help me with a sample start/update routine on how to do this.
    Any help will be appreciated.
    Regards,
    Amith

    Amith,
    Actually, you may everything do in a start routine of the URs (including lookup itself).
    There is no need to declare internal table in a global part of routine and then read values in routines.
    The code may look the following. (Don't have the system on hand. So, some syntax may require some modification.)
    TABLES: <Your Master Data Table>.
    DATA: wa_temp TYPE DATA_PACKAGE_STRUCTURE OCCURS 0 WITH HEADER LINE,
         wa_md TYPE <Your Master Data Table>  OCCURS 0 WITH HEADER LINE.     
    SELECT * FROM <Your Master Data Table> INTO wa_md.
    SORT wa_md ASCENDING BY <Basic Char Key>.
    LOOP AT DATA_PACKAGE INTO wa_temp.
       READ TABLE wa_md WITH KEY <Basic Char Key> = wa_temp-<Basic Char Key>.
       wa_temp-<YourLookupIO> = wa_md-<YourLookupAttribute>.
       MODIFY DATA_PACKAGE FROM wa_temp.
    ENDLOOP.
    Best regards,
    Eugene

Maybe you are looking for

  • Apple Configurator - Updating to iOS 6.1.2 removed saved user data

    We are currently managing several classroom sets of iPads using Apple Configurator. When updating to iOS 6.1.2 on the Supervise tab, about two-thirds of one classroom (about 20 iPads) and another 4 out of 6 in a special education classroom lost all p

  • ITunes won't play music and won't display some of my album art.

    iTunes won't play music and won't display some of my album art. I'll click play but the song wont play and some of my album art doesnt appear anymore. When I go on iTunes music store non of the pictures will appear it will just be black where a pictu

  • Airport Shows Signal but doesn't work.

    My airport seems to be working completely fine. All the bars are up, signal looks ok. I try to get on a site. Nothing. As if there was no connection. I also checked my iStat Pro and It's only getting 0-1/kbs up and down. No more. What's up with this?

  • Multi person form filling

    I want to create a form where information is filled in by three department, each department can only access a certain part to fill or change. I have tried creating  a saveable document, with no luck

  • Network printer problems in OSX 10.7.5

    Has anyone had this happen to them since they upgraded to 10.7.5?   All of a sudden my canon wireless printer will not connect.  I have tried everything.  Deleted the qeues, tried to add it back but no printers were listed.  I've tried to add through