Need hints to bring BC400(ABAP) knowledge to BW update rules/routines.

Hi,
I have just completed the BC400 (ABAP) course at SAP but the instructor had no clue about BW.
From se80, he thought how to create packages, programs, functions modules, classes/Interfaces, etc. but whenever, I asked how these fit into the BW update rules and transfer rules, he said he knew nothing about BW.
For example, how do I bring in a program written in se80 into my update rule or transfer routine which updates and ODS or cube?
i.e. The main reasoning for learning this BC400(ABAP) is to be comfortable in writing update rule or transfer routine to update ODS/Cubes in BW but the instructor failed me in making the link between the ABAP class and BW.
Can you give me some guide on this?
Can I work in se80 as I was taught and bring codes from there to update a cube?
i.e. if I need to write an update routine to update a cube from an ODS, can this be done in se80 (on BW)
I will appreciate any guidelines to bring in my new found knowledge to the BW environment.
Thanks

Most Bw transformations are already includes inside programs or cmods or BTEs
By double cliking on start routines and end routines it already takes you into the ABAP enviroment
Have a look at the sappress book - user exits and BADIs in BW (it's not a brillaitn book by any means - it's just about passable and is short on detail - but it will get you a head start)

Similar Messages

  • ABAP objects for transfer/update rules - does this apply to include stateme

    I have a question about the new requirement for the code in the update/transfer rules to be written in ABAP Objects standards.  Does this still apply if in your update rules you using include programs?  Does this mean that when we upgrade we will have to follow the ABAP Objects standards (ie no header lines)?

    Routines will method based.
    In addition to what Chetan has sent, check this how to also.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Ravi Thothadri

  • Abap Code help in update rule

    Hi Gurus,
    I have  a requiement, that is if there are 5 line items with in a document and each one has diffeerent tax jurisdiction code, then we should be showing only one tax jurisdiction code for a document. Line items are not displayed in report. The condition to pick up tax jurisdiction code is the one which has least ending zeros among all the lime items with in a document.
    Supppose
    Doc1 Item Tax Jurisdiction code
    1800000002 1 CNQC00000000000
    1800000002 2 CNQC00000000000
    1800000002 3 CN0000000000000
    1800000002 4 CNQC00000000000
    1800000002 5 TXJOHNCLEBUR000
    So here the value of Tax Jurisdiction code is TXJOHNCLEBUR000 as it has least ending zeros compared to other values with in a document.
    Any help how to use the string function and acheive the desired result.
    Thanks,
    Raj.

    Hi Anand,
    Thanks for the reply. we don't expect any non-zeros after seeing first zero. Now i have added another z object which will contain only least zeros for a doc. What I am doing is now after loading the data into the cube from ods  i am doing loop back and updating the new z object. Below is the code I am trying to do
    TABLES: /BIC/AZFGLO10100.
    Defining an internal table as ods table****
    Types: BEGIN OF ITAB_01,
    doc_no LIKE /BIC/AZFGLO10100-AC_DOC_NO,
    item_no LIKE /BIC/AZFGLO10100-ITEM_NUM,
    taxjur LIKE /BIC/AZFGLO10100-TAXJURCODE,
    length like num,  ***** this will hold the length of the zeros
    END OF ITAB_01.
    loading the data from active ods table into defined internal table*****
    select AC_DOC_NO ITEM_NUM TAXJURCODE  from /BIC/AZFGLO10100 into table
      Itab_01 where AC_DOC_NO = /BIC/AZFGLO10100-AC_DOC_NO and
      item_num = /BIC/AZFGLO10100-ITEM_NUM.
    sort itab_01 doc_no item_no
    now I want to use code too populate the vlaue of length field in internal table (which shows how many zeros a tax jurisdiction code has for every corresponding line item)
    then in the update rule of z tax jurisdiction i will wirte a routine such that
    select taxjur into result from itab_01 where doc_no = COMM_STRUCTURE-doc_no and length = min(length).
    now I have one more doubt , the number of items in a document will be varying so how to takecare of this...
    If possible can you please provide me with the abap code that you have mentioned in earlier post.
    Any more help on this is really appreciated.
    Thanks,
    Raj

  • Need help in assigning date to a field in Update Rule.

    Dear all,
    I am stuck with a small problem but could´t find a solution. I need to fill a date field (Last Movement date)  in the update rules. Currently it is being filled correctly. I need to just enhance the code in ELSE part, that is if i don´t find a relevant date in a look up ODS, i need to assign a future date i.e 99991231.(31.12.9999). When i write the same thing in the ELSE, RESULT = 99991231, the date is not filled. it is showing blank.
    Any help would be appreciated.
    Regards,
    Srini

    Hi,
    If you are assigning the value directly, mark it in single quotes.
    For example: Result = '99991231'.
    This will work.
    Regards,
    Yogesh.

  • Update rule - Routine Char -ABAP issue

    Dear Experts,
    Infocube u2013 Update rule u2013Chars-
    MM_BEMOT(Indicator)  IS a FIELD which I am introducing in the update rule.
    I don't get any value from Data_package.
    MM_BEMOT_ITAB has 2 entries.(50,06). It is not updating 2 entries u2013
    It is updating the same entry 2 times 50.
    Infocube - I have to update like
    Order,Indicator,Type,Cost element,amount
    45167 06 01 12345 10.00
    45167 50 01 12345 10.00
    Startroutine - I am reading the data from DSO and moving those data into
    MM_BEMOT_ITAB . MM_BEMOT_ITAB has 2 entries now. I have to update 50,06 values into
    MM_BEMOT.
    READ TABLE MM_BEMOT_ITAB
    WITH KEY ORDER = COMM_STRUCTURE-ORDER
    COSTELMNT = COMM_STRUCTURE-COSTELMNT.
    result value of the routine
    LOOP AT MM_BEMOT_ITAB.
    IF SY-SUBRC = 0.
    RESULT = MM_BEMOT_ITAB-MM_BEMOT.
    endif.
    ENDLOOP.
    Advance thx
    ENDIF.

    You may have to put the following line in your update rule after changing the result.
    RETURNCODE = 0.
    Regards.
    Sanjay
    Message was edited by:
            Sanjay Sinha

  • Need to create a transformation based on Update Rules Logic

    Hi,
    I have an existing complex Update Rule. I need to manually create a Transformation based on this Update Rule logic. The Start Routine of the Update Rule comprises of:
    1) All data declarations in the Global Area
    2) The local coding area consists of various select statements from various r/3 tables used later for mapping. It also calculates and stores values in the Data Package final internal table for few infoobjects that are not present in the Source object but and are used to populated data in the target.
    3) then we have the various one to one individual Infoobject mappings/constants and many individual infoobject routines that pick result from the comm_structure
    I am not very clear as to where each of the above coding logic should be put in the transformation coding area...... I can see four main coding areas in the transformation....global area, 2nd Global Area, Method Start_Routine and Method Inverse_Start_Routine........... I think the global data declarations(point 1 above) should be put in the Global declaration area of the start routine. The local area of the update rule logic (point 2 above) that contains select statements should be put in 2nd Global part or should it be put in Method Start_routine????? Point 3 above for individual filed mappings will be done through Rule groups. Also can anyone let me know what is the methos inverse_start_routine used for?????
    Thanks.

    Hi,
    Point 1 you mentioned should be put under2nd Global declaration part of start routine.
    Point 2 should be put under Method Start_routine.
    Point 3 as you only mentioned can be done by individual field rule mappings.
    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)
    Not very clear though about Inverse routine. But definetly not being used for the case you mentioned.
    Hope it helps.

  • ABAP for removing records in update rule

    hello all,
    we have data loading to several infocubes based on sales order type (logical partition).  our entire business and reporting strategy for sales is based on order type.  we have 1 extractor loading these 5 cubes.  we want to code in the update rule to check for each cube a particular value, and if its not this value, remove the record.
    example would be loading order type cube zpt1 we want to check the records coming into this cube that the value for characteristic ziden = z1.  if not, remove the record and do not update the cube.  the other cubes are the same.  cube zpt2 checks if characteristic ziden = z2.  if not, remove all other records.
    can someone inform us how this coding would look like in the update rules?
    thanks so much

    I'm assuming you need code for BW 3.x, since you mentioned Update Rules. There are a couple of ways:
    DELETE
      data_package
    WHERE
      /bic/ziden NE 'Z2'.
    Or
    LOOP AT data_package.
      IF data_package-/bic/ziden NE 'Z2'.
        DELETE data_package.
      ENDIF.
    ENDLOOP.
    If you're on BI 7, then you can create a filter on the DTP to the target so that it only extracts the records needed from the source.
    Edited by: Dennis Scoville on Aug 19, 2009 1:59 PM

  • Abap knowledge for SD consultant

    Dear Friends,
                       Iam a SD consultant, I want to know upto what extent Abap knowledge is required by a SD consultant. Please tell me on what topics we need have knowledge to be compitetive in market. I believe companies are looking for candidates with knowledge on tables, debugging . ALE, Idoc's etc. Also can some body send me some useful material on solution manager & ALE, Idoc's. My email Id is [email protected]
    Thanks,
    Jay

    Dear Jay,
    You would need to have knowledge about tables, Tcodes, Reports (Selection Screen, Report Layout, Logic, Authorization etc), Knowledge in Debugging, IDOC's, ALE and EDI.
    Solution Manager:
    http://help.sap.com/saphelp_sm32/helpdata/en/a0/c3266e44c54d5e8300b5ffe54f756b/frameset.htm
    ALE and IDOC:
    ALE stands for Application Link Enabling and is used for distribution of data. IDOC is an Intermediate Document. It carries the application data from one server to another server.It uses the RFC(Remote Function call) .
    IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system. Instead of calling a program in the destination system directly, the data is first packed into an IDoc and then sent to the receiving system, where it is analyzed and properly processed. Therefore an IDoc data exchange is always an asynchronous process. The significant difference between simple RFC-calls and IDoc data exchange is the fact, that every action performed on IDocs are protocolled by R/3 and IDocs can be reprocessed if an error occurred in one of the message steps.
    While IDocs have to be understood as a data exchange protocol, EDI and ALE are typical use cases for IDocs. R/3 uses IDocs for both EDI and ALE to deliver data to the receiving system. ALE is basically the scheduling mechanism that defines when and between which partners and what kind of data will be exchanged on a regular or event triggered basis. Such a set-up is called an ALE-scenario.
    It is the the combination of Segements.
    Segment : All the required fields will get assigned in relavant segement.Like that we will have lot of segments.We will assign all the segments to IDOC type.In the required level(Parent & child level .Like tree nodes).
    Idocs Type is a Structure by lot of segments.
    IDOC is generared at the time of run time .
    It will have the data.
    There are basically two types of IDOCs.
    Basic IDOCs : Basic IDOC type defines the structure and format of the business document that is to be exchanged between two systems.
    Extended IDOCs : Extending the functionality by adding more segments to existing Basic IDOCs.
    http://www.allsaplinks.com/idoc_sample.html
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sappoint.com/abap.html
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDALEIO/BCMIDALEIO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDALEPRO/BCMIDALEPRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFAALEQS/CABFAALEQS.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVEDISC/CAEDISCAP_STC.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVEDI/CAEDI.pdf
    http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://expertanswercenter.techtarget.com/eac/knowledgebaseCategory/0,295197,sid63_tax296858_idx0_off50,00.html
    http://sap.ittoolbox.com/documents/popular-q-and-a/extending-a-basic-idoc-type-2358
    http://help.sap.com/saphelp_47x200/helpdata/en/dc/6b7eee43d711d1893e0000e8323c4f/frameset.htm
    Need info on automatic determination of tax code at PO
    Hope this will help.
    Regards,
    Naveen.

  • Re: ABAP knowledge in SAP BW

    Hi guys & girls,
    Am trying to try apply for jobs..but before, am in preparation stage and am stuck at ABAP. Since most of the offers are asking for ABAP knowledge..so being a BW'er i beg for ur advise on the following-
    1.) What topics should i be covering in ABAP which will be useful for       me in real time?
    2.) COuld somebody list out the topics please?
    3.) And to what extent and where do u use ABAP?
    Regards
    Sri

    Hello Sri,
    ABAP knowledge is required in BW
    1. in order to enhance the SAP's standart extraction methods. So you need to know how to make changes in structures and already developed abap programmes.
    2. You can change the content of any field while you are laoding data to infoproviders. Especially in start routines, transfer rules and update rules. So you need to know how to change a content of a field in abap based on an algorithm.
    3. In Bex queries also you can change a content of a field by using special type of variables.
    Finally also you need to know how to you functions in ABAP, because most of ready to use functions are available in SAP Abap dictionary.
    Hope helpful for you,
    Sarhan.

  • Basic ABAP knowledge for Functional consultants

    Hi Gurus
    I am interested in familiar with some ABAP knowledge as a Functional consultant.
    Please provide me some basic information
    Thanks
    Raju

    Hi,
    Use the following links....
    Reprots
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    Dictionary
    http://sapabap.iespana.es/sapabap/manuales/learnabap/
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea31446011d189700000e8322d00/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf
    ABAP objects
    Please check this online document (starting page 1291).
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Also check this links as well.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.futureobjects.de/content/intro_oo_e.html
    http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    SAPScripts
    http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
    http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
    http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
    http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
    http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
    http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
    SAP SCRIPT FIELDS
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
    scripts easy material
    http://www.allsaplinks.com/sap_script_made_easy.html
    Check these step-by-step links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    for Smartforms material
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
    http://www.sap-img.com/smartforms/smart-006.htm
    http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
    Re: Need FAQ's
    check most imp link
    http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    BAPI
    http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sapgenie.com/abap/bapi/example.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    List of all BAPIs
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.topxml.com/sap/sap_idoc_xml.asp
    http://www.sapdevelopment.co.uk/
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    ALV programs.
    http://www.geocities.com/mpioud/Abap_programs.html
    . How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    ALV
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    Top-of-page in ALV
    selection-screen and top-of-page in ALV
    ALV Group Heading
    http://www.sap-img.com/fu037.htm
    ALV
    http://www.geocities.com/mpioud/Abap_programs.html
    Pls U search our SDN also.
    Regards
    Rajesh.

  • Can i Start XI without ABAP knowledge..

    Hi All,
    I am a Java/J2EE developer, I don’t have ABAP knowledge.
    I want to learn SAP XI. I heard the ABAP is a must before we start XI. Is it true? or with out ABAP knowledge I can start XI..
    Please suggest..
    Thanks,
    Shridhar.

    Hi Sridhar,
    This is one topic on which there has been a lot of debate on SDN, but , my opinion is that knowing ABAP or JAVA is not absolutely necessary to learn XI.
    But knowing either of them or even both is sure is an added advantage esp for debugging , mapping etc.
    I would suggest this link on SAP help for any info that you want on XI,
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
    Further, this thread deals with everything that is needed for a starter on XI. Do check it out,
    JDBC Receiver: exact SQL statement
    /message/527697#527697 [original link is broken]
    Re: XI Beginner
    Regards,
    Bhavesh

  • I need information about Web dynpro ABAP Exception : ICF Service Node

    I need information about Web dynpro ABAP Exception :
    ICF Service Node "/sap/bc/webdynpro/sap/abcd/undefined" does not exist.
    Here abcd is application name.
    ICF Service Node exists and activated but kindly let me know from where "undefined" is coming .
    Please let me know your comments /views about  this.

    Hi,
    I think ur webdynpro service is not active after upgradation.
    You have manually activate it.
    Go go Tcode SICF,Execute the Initial screen,
    and in this new screen give service  as your application name and click on filter.
    You will get your service below which will be ur application name .
    right-Click on the deactivate and activate it or just activate it,.
    This shd work

  • ABAP needed: New Value/Old Value in Update Rules

    Hi all
    I'm updating some attributes in IObj by ABAP routine. Is it possible to get not only new value of attribute but the old one to compare them?
    Is it possible to get others attribute old and new values?
    I'll illustrate it with example.
    Say, IObj has 3 attributes:
    0ACC_GRP
    0DT_FROM
    0DT_TO
    if NEW value of 0ACC_GRP <> OLD value of 0ACC_GRP then
    new 0DT_FROM = SYSDAT
    new 0DT_TO = old 0DT_FROM
    else
    new 0DT_FROM = old 0DT_FROM
    new 0DT_TO = old 0DT_TO

    My case quite simple I guess.
    I got 0CUSTOMER infoobject and appended it with several time-dep attributes. After it my Update rules were deactvated.  I got error message with prompt to fill out FROM_DATE, TO_DATE as key fields in every attribute (time-dependable and none time-dependable) while was trying re-activate Update Rules.
    So, what's wrong with that? What I supposed to do with all those to/from date key fields  in my Update Rules??
    Edited by: Gediminas Berzanskis on Jul 2, 2008 3:44 PM

  • ABAP Help on Update Rule Needed

    Hello.  I am trying to write a routine on an key figure in an update rule.  Basically, I am trying to load a custom key figure with either a 1 or a 0. 
    Here is the pseudocode:
    IF
    (((GI_DATE - ACT_GI_DTE) < 0) OR
      ((GI_DATE - ACT_GI_DTE) > 3)
    THEN
        NEW_KEY_FIGURE = 1
    ELSE
        NEW_KEY_FIGURE = 0
    ENDIF.
    Here is the code I currently have in the routine.  Any ideas on where I am going wrong here?  I am not an ABAP developer so please keep this in mind when responding.
    result value of the routine
      CLEAR RESULT.
    if the returncode is not equal zero, the result will not be updated
      IF COMM_STRUCTURE-GI_DATE - COMM_STRUCTURE-ACT_GI_DTE < 0 OR
         COMM_STRUCTURE-GI_DATE - COMM_STRUCTURE-ACT_GI_DTE > 3.
         COMM_STRUCTURE-NEW_KEY_FIGURE = 1.
      ELSE.
         COMM_STRUCTURE-NEW_KEY_FIGURE = 0.
      ENDIF.
      RESULT = COMM_STRUCTURE-NEW_KEY_FIGURE.
      RETURNCODE = 0.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    Thanks for any help you can give.

    Hi,
    I think you can not put "-" in if command, so code should be like this:
    data: datediff type n.
    result value of the routine
    CLEAR RESULT.
    clear datediff.
    detediff = COMM_STRUCTURE-GI_DATE - COMM_STRUCTURE-ACT_GI_DTE.
    IF datediff < 0 OR datediff > 3.
    Result = 1.
    ELSE.
    Result = 0.
    ENDIF.
    RETURNCODE = 0.
    if abort is not equal zero, the update process will be canceled
    ABORT = 0.
    Regards,
    Andrzej

  • 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

Maybe you are looking for