ABAP Command in Transformation routine

Hi
  I had a Internal Table used in Lookup of a Transformation which is being populated from a Active Table of DSO.
  The Internal table has about 5 fields.
  My requirment is to check the data in the IT Stable after the select statement and Replace ',' in the data with '-'....is there any way we can achieve this
Thanks

Hi,
Please use the below code. Its is just a rough work. You implement it as per your specifications,
Loop at <source_packge> assigning <source_field>
replace  ',' with '-' into <source_field>-<internal table field>.
Now that you have replcaed. Next step is to modify the same
modify <source_package> from <source_field> transporting <internal table field>.
you can omit transporting addition if you want. No need to specify the index addition when using within loop and endloop
end loop.

Similar Messages

  • ABAP Logic in Transformations-Start or Field Routine

    Hi Experts,
    As i am new to BW Please update me with the ABAP logic  i need to implement in Transformation routine...and please advise me wether i can use that as a Start or field routine for a better performance.
    Target DSO:
    DSO A : Active Table:/BIC/AZDSOA
    Fields (ZLOC,ZPAY_ID,ZNPAY_ID,ZOPAY_ID & ZCHG_DTE)
    Source DSO
    DSO B : Active Table:/BIC/BZDSOA
    (ZLOC,ZPAY_ID)
    DSO C : Active Table:/BIC/CZDSOA
    Fields (ZLOC,ZPAY_ID,ZNPAY_ID & ZCHG_DTE(date))
    While Transfering Data from DSO B-->DSO A
    It should check DSO C for that ZLOC & ZPAY_ID
    If ZCHG_DTE IS Blank then it should pick ZNPAY_ID for that ZLOC & ZPAY_ID from DSO C and update ZNPAY_ID in DSO A
    if ZCHG_DTE IS not Blank then it should pick ZPAY_ID for that ZLOC & ZPAY_ID from DSO C and update ZOPAY_ID & ZCHG_DTE in DSO A
    ZPAY_ID - Pay ID
    ZNPAY_ID -New Pay ID
    ZOPAY_ID -Old Pay ID
    ZCHG_DTE -Change Date
    ZLOC     -Location.
    Logic in words:
    If Change date is Blank then it should pick new pay id for that Location & Pay Id and update NEw pay id field in DSO A
    If Change date is not Blank then it should pick  pay id for that Location & Pay Id and update old pay id field  & change date in DSO A
    Please update me with releavent code
    Thanks

    It must have something to do with your input variables - I ran this FM locally using my DOB and today's date and it worked fine.
    make sure your input date types are in the correct format for the FM.

  • Calling a function module from within a transformation routine

    I created a routine within a transformation and experience the following weird behavior now:
    When I call a function module within that routine, the load fails with the following error message:
    Exceptions in Substep: Rules
    When I click on the button next to this text, it point me to my function module call.
    What I do not understand is, that the following two scenarios work fine:
    - Having the same function call (with fake values) in a plain ABAP program works beautilfully
    - If I copy the content of my function module directly into my transformation routine, everything works fine as well
    I am now wondering whether the routine does not "see" the function module I am calling. The module resides in a different package. Is that a problem? Do I have to include something first?
    Here is the code that calls my FM (
    CALL FUNCTION 'Z_CA_CONVERT_US_COST'
         EXPORTING
            PSOURCEVAL                      = SOURCE_FIELDS-/BIC/USFRZMFC
            PSOURCEUOM                      = SOURCE_FIELDS-BASE_UOM
            PUSITM                          = SOURCE_FIELDS-/BIC/USITM
            PTARGETUOM                      = PRODUCTION_UOM
         IMPORTING
            PTARGETVAL                = RESULT
         EXCEPTIONS
           CONVERSION_NOT_MAINTAINED = 1
           PARTNO_NOT_FOUND          = 2
           OTHERS                    = 3.
    Thanks a lot for your help. Points will be assigned.
    Dennis

    Good catch, BI Learner. This was exactly it: when assigning the values from SOURCEFIELDS directly to the import/export parameters, you have to make sure that the types are EXACTLY the same, otherwise it will not work (the routine stops with an error when calling the FM, but there is no dump).
    Therefore, to solve my problem, I created the declarations precisely as expected by the FM and assigned the values to these fields:
    DATA:
          SOURCEVAL TYPE  /BIC/OIINVQTY,
          SOURCEUOM TYPE  /BIC/OIUSUOM,
          USITM TYPE  /BIC/OIUSITM,
          TARGETUOM TYPE  /BIC/OIUSUOM,
          CONVERTED_COST TYPE  /BIC/OIINVQTY.
    DATA PRODUCTION_UOM TYPE /BIC/OIUSUOM.
    " get the Production UOM
        SELECT SINGLE I~/BIC/USPRDUOM
          FROM /BIC/PUSITM AS I
          INTO PRODUCTION_UOM
          WHERE I~/BIC/USITM = SOURCE_FIELDS-/BIC/USITM AND I~OBJVERS = 'A'.
        IF ( SY-SUBRC = 4 ). " no records found
          "RAISE PARTNO_NOT_FOUND.
          RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.
        ENDIF.
    " load the parameters
        SOURCEVAL = SOURCE_FIELDS-/BIC/USFRZMFC.
        SOURCEUOM = SOURCE_FIELDS-BASE_UOM.
        USITM = SOURCE_FIELDS-/BIC/USITM.
    " then you can call the FM
        CALL FUNCTION 'Z_CA_CONVERT_US_COST'
          EXPORTING
            PSOURCEVAL                = SOURCEVAL
            PSOURCEUOM                = SOURCEUOM
            PUSITM                    = USITM
            PTARGETUOM                = PRODUCTION_UOM
          IMPORTING
            PTARGETVAL                = CONVERTED_COST
          EXCEPTIONS
            CONVERSION_NOT_MAINTAINED = 1
            PARTNO_NOT_FOUND          = 2
            OTHERS                    = 3.
    " ... [do the rest]
    Thanks for your help,
    Dennis

  • Help in transformation routine

    I have to put an indicator for delivery block in transformation routine.
    Logic: if headed delivery block 'LIFSK' is not blank, result is 'X'.
    Here is my code which is not working:
    IF SOURCE_FIELDS-LIFSK NE ''.
          RESULT = 'X'.
        ENDIF.
    But this code is not doing anything. I tired using 'test' function in transformation, it gives abap dump.
    What is the problem. Code is in right place in transformation routine.
    A similar code for item level block is working:
    More details:
    $$ begin of routine - insert your code only below this line        -
        ... "insert your code here
    *--  fill table "MONITOR" with values of structure "MONITOR_REC"
    *-   to make monitor entries
        ... "to cancel the update process
       raise exception type CX_RSROUT_ABORT.
        ... "to skip a record
       raise exception type CX_RSROUT_SKIP_RECORD.
        ... "to clear target fields
       raise exception type CX_RSROUT_SKIP_VAL.
        IF SOURCE_FIELDS-ZZ_LIFSP ne ''.
          RESULT = 'X'.
        endif.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_ZDELIBLK
    Thanks
    Jeff
    Edited by: Jeff Edwards on Aug 17, 2008 10:34 PM

    No luck.
    Error analysis
        The following checkpoint group was used: "No checkpoint group specified"
        If in the ASSERT statement the addition FIELDS was used, you can find
        the content of the first 8 specified fields in the following overview:
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
    ST22 / ABAP Editor :
    *-- Get field name from source field with extern posit.
      READ TABLE i_t_seg_source ASSIGNING <ls_s_seg_source>
        WITH KEY segid = i_segid.
      ASSERT sy-subrc = 0.
      IF sy-subrc = 0.
        READ TABLE <ls_s_seg_source>-t_field ASSIGNING <ls_s_field>
          WITH KEY position = l_posit_source_ex.
    > ASSERT sy-subrc = 0.
      ENDIF.
    *--  r_s_parameter-param_id has to be set out side due to type inheritance of RuleStepMapping
      CONCATENATE '<' <ls_s_seg>-y__nm '>' INTO
      c_s_connector-s__nm.
      c_s_connector-f__nm = <ls_s_field>-fieldname.
    ENDMETHOD.

  • ABAP code in transformation

    Hello,
    I have a transformation routine as follows:
    DATA:l_lifnr1 TYPE /BI0/MBATCH-VENDOR,
             l_greybatch TYPE /BI0/MBATCH-BATCH,
             oref   TYPE REF TO cx_root,
              l_num type i,
              l_len  type i,
              l_len1(2)  type c.
        l_len = strlen( SOURCE_FIELDS-/BIC/ZBAT_SUP ).
        l_len1 = ( l_len - 1 ).
        try.
            concatenate SOURCE_FIELDS-/BIC/ZBAT_SUP+0(l_len1) 'G' into
            l_greybatch.
          catch CX_SY_CONVERSION_NO_NUMBER INTO oref.
        ENDTRY.
    =============
    this transformation is between a infosource and infoobject. When i run the DTP, it gives an error at the line "concatenate SOURCE_FIELDS-/BIC/ZBAT_SUP+0(l_len1) 'G' into l_greybatch."
    This -/BIC/ZBAT_SUP is calculated using a routine in the transformation between the datasource and the infosource. The same DTP is used for both load across both these transformations.
    what is wrong? any suggestions?

    Hello Siegfried,
    Thank you very much.
    As you rightly pointed out -/BIC/ZBAT_SUP is not filled.
    But i didnt want to fill it in the second transformation(between the infosrc and infoobject) becoz, this is used for populating 2 differnt objects for which there are different rules. I will have to run the logic(for populating -/BIC/ZBAT_SUP) twice in these 2 rules.
    Hence i was trying to populate it in the first transformation(between the datasrc and the infosrc) and then use this value in the 2 rules in the second transformation.
    Can you give me some other logic to do the same with the necessary ABAP code?
    Following is the routine use to populate -/BIC/ZBAT_SUP in the first transformation:
    $$ begin of routine - insert your code only below this line        -
    DATA: l_charg TYPE /BIC/AZMM_O0100-BATCH.
          SELECT SINGLE /BIC/ZBAT_SUP FROM /BIC/AZMM_O0100
          into l_charg
              WHERE BATCH = SOURCE_FIELDS-CHARG.
         RESULT = l_charg .
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_ZBAT_SUP
    ====================================================
    The second transformation populates 2 different vendor fields in 2 different rules. Both the rules use the follwing 2 routines:
    $$ begin of routine - insert your code only below this line        -
        DATA:l_lifnr1 TYPE /BI0/MBATCH-VENDOR,
             l_greybatch TYPE /BI0/MBATCH-BATCH,
             oref   TYPE REF TO cx_root,
              l_num type i,
              l_len  type i,
              l_len1(2)  type c.
        l_len = strlen( SOURCE_FIELDS-/BIC/ZBAT_SUP ).
        l_len1 = ( l_len - 1 ).
          try.
              concatenate SOURCE_FIELDS-/BIC/ZBAT_SUP+0(l_len1) 'G' into
              l_greybatch.
         move SOURCE_FIELDS-/BIC/ZBAT_SUP(l_len1) to l_greybatch.
         move 'G' to l_greybatch+l_len1(1).
            catch CX_SY_CONVERSION_NO_NUMBER INTO oref.
          ENDTRY.
    *Populating Supplying(finished) batch vendor
          select single VENDOR from /BI0/MBATCH
          into l_lifnr1
          where BATCH = l_greybatch.
          RESULT = l_lifnr1.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_0VENDOR
    =====================================================
    METHOD compute_ZVENDOR.
      IMPORTING
        request     type rsrequest
        datapackid  type rsdatapid
        SOURCE_FIELDS-/BIC/ZBAT_SUP TYPE /BIC/OIZBAT_SUP
       EXPORTING
         RESULT type tys_TG_1-/BIC/ZVENDOR
        DATA:
          MONITOR_REC    TYPE rsmonitor.
    $$ begin of routine - insert your code only below this line        -
    DATA:l_lifnr1 TYPE /BI0/MBATCH-VENDOR.
    *Populating Supplying(finished) batch vendor
                select single VENDOR from /BI0/MBATCH
                into l_lifnr1
                where BATCH = SOURCE_FIELDS-/BIC/ZBAT_SUP.
         RESULT = l_lifnr1.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_ZVENDOR
    ===================================
    thank you....

  • How to know infopackage request ID in transformation routine ?

    Hi All,
    I'm looking for the ABAP code to know the infopackage request ID in transformation start or end routine
    I can see this ID when I clic on "manage" on a PSA (looks like for instance REQU_D706H24SFFUIGNKMQMPPAIJLM)
    I need it in transformation routine
    Thanks for your help
    Sebastien Lepeltier

    Sorry Sat but again with the code :
    field-symbols: <l_requnr> type any.
    data: l_requnr_fieldnm type string value 'l_requnr'.
    assign (l_requnr_fieldnm) to <l_requnr>.
    I have this error message in debug mode : Field symbol <L_REQUNR> is not yet assigned
    Thanks Joe for the answer but in
    IMPORTING
    request TYPE rsrequest
    datapackid TYPE rsdatapid
    request and datapackid are filled with information of the current DTP not infopackage source
    Sebastien

  • REGEX statement not working in transformation routine?

    hi,
    I need to include the REGEX ABAP key word in transformation routine for one of the fields--
    FIND all OCCURRENCEs OF REGEX
    But when i include this statement it says:
    E: statement "REGEX" is not defined.check your spelling--
    but same statement when i copy in SE38 ABAP editor it works very fine--
    May i know what is the reason?
    i had tried with all possible single quotes before posting here

    Is that the entire statement?  It looks like it is interpeting REGEX as a variable.  It should look something like this:
    FIND all OCCURRENCEs OF REGEX '(\b\S+\b)(-?)' IN g_result

  • Not able to remove the ABAP code from Transformation

    Hello Experts,
    We have transformation for DSO in that for one infoobject, field routine is written, Break Point is hard coded there and it's move to production. Now we are trying to remove that break point from development and then move it production.
    we are doing following activity to remove the break point.
    1. Open the transformation.
    2. Open the field routine.
    3. Going to ABAP code in field  routine.
    4. Remove the hard coded Break Point from ABAP code.
    5. Saving the code.
    6. It's taking to again filed routine window.
    7. We close the window and activate the transformation.
    8. When again check the ABAP code in field routine then it shows hard coded Break Point again.
    9. Not able to remove the hard coded break point.
    Can anyone know how to do this.
    Help will be appreciated.
    Thanks

    Hi,
    As pointed above, after point 6 don't simply close the window but click on Transfer Value and then activate your transformation. Refresh the system and check again.
    Regards,
    Arminder

  • Transformation routine on 2 different targets fields

    Hi gurus,
    I have been trying do some ABAP transformation routines, I did 1 and it was good works fine, then I tried to create another transformation routine on a different target field of the same DSO, and for some reason what I did on the global declaration on the other transformation is in this transformation and if I do a change in the second transformation it shows in the first transformation, other thing is that in the second transformation anything works, I got errors for everything and are not very specific. I may be skipping some basic steps; maybe I canu2019t create 2 transformation routines in the same transformation?
    Thanks

    Hi,
    There can be just 1 start routine.
    These are execute once. Also the declarations done in the global section remain visible in all the transformation routines.
    You can write multiple transformation(field level) routines.
    -Mayuri

  • Transformation Routine to convert single record into multiple

    All,
    I need your help with ABAP Syntax.  My requirement is to take a single record and convert it to multiple records into a DSO with a condition to not create a record if a KF value is 0.
    R/3 Data Record:
    Employee | Date | Char1 | KF1 | Char2 | KF2 | Char3 | KF3 | Char4 | KF4
    Conversion Result into DSO:
    Employee | Date | Char1 | KF1
    Employee | Date | Char2 | KF2
    Employee | Date | Char3 | KF3
    Employee | Date | Char4 | KF4 (This record will not be written if no value is in KF4)
    I have read about the result table in update rules, however within BI 7.0 Transformations I am unfamiliar as to where the RESULT_TABLE function applies.  Has this been replaced by the Expert Routine?
    Could any ABAP expert provide sample code as to how I would perform this conversion in a Transformation Routine?
    Thanks,
    David

    Thanks Alex for your response.
    I did find a solution to this as it turns out to be fairly simple, however I executed the routine as an Expert Routine instead of a Start Routine.  I was advised to do the transformation here.
    The basic concept is defined below:
    Loop at source_package assigning -kf2.
              Append result_fields to result_package.
           Endif.
    -- Kf3u2026  and so on
    Endloop.
    Basically the APPEND statement is used to create the additional records.

  • In ECC 6.0 I am getting Slin Error -ABAP command is obsolete

    Hi All,
    In Hr ABAP we will start basic coding with
    TABLES pernr . 
    infotypes:0002.  
    By using this I am getting the following SLIN Error :
    Program:  ZHCP0026  Row:     32
    he current ABAP command is obsolete
    Within classes and interfaces, you can only use "TYPE" to refer to ABAP Dictionary
    types, not "LIKE" or "STRUCTURE".
    nternal Message Code: MESSAGE G/B
    (The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
    EXTENDED CHECK OFF/ON)
    INFOTYPES : 0380,
    The current ABAP command is obsolete
    Tables with headers are no longer supported in the OO context.
    Internal Message Code: MESSAGE G1D
    (The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
    EXTENDED CHECK OFF/ON)
    Can some one help me , how to rectify this slin error ?
    Thanks,
    Suresh.
    Edited by: suresh kumar on Feb 25, 2009 2:22 PM

    Hi Suresh,
    Am too facing the same problem. if you could find a solution, pls let me know.

  • How to run others applications with abap commands

    Is there a mothed that can use it to run an application with abap statement?
    for example: how to open a text file in program with abap command?
    thank you very much.

    CALL FUNCTION '<b>WS_EXECUTE'</b>
    EXPORTING
      DOCUMENT                 = ' '
      CD                       = ' '
       <b>COMMANDLINE</b>              = ''
      INFORM                   = ' '
      <b> PROGRAM                 </b> = 'NOTEPAD'
      STAT                     = ' '
      WINID                    = ' '
      OSMAC_SCRIPT             = ' '
      OSMAC_CREATOR            = ' '
      WIN16_EXT                = ' '
      EXEC_RC                  = ' '
    IMPORTING
      RBUFF                    =
    EXCEPTIONS
      FRONTEND_ERROR           = 1
      NO_BATCH                 = 2
      PROG_NOT_FOUND           = 3
      ILLEGAL_OPTION           = 4
      GUI_REFUSE_EXECUTE       = 5
      OTHERS                   = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Here...
    In the <b>CommandLine</b> you can give the path where the file is located like for Example
    C:\Test\Hello.txt.
    In the <b>Program</b> you need to give the application that you want to open that file.
    if helpful reward points...
    Regards,
    Vivekananda Varma Dandu

  • Error in Transformation Routine

    Hi all,
    I have  written a code in transformation routine. I have debugged the code. The code which I have written is working fine. The value in 'Result' is correct and till here the code executes without any error. After that , system throws an error which I cannot understand as this is the system generated code.
    I wanted to paste the error analysis here but i dont have any option to copy from there. Message class is "RSBK". Number is 299
    Any ideas?
    Regards,
    Aisha Ishrat
    ICI Pakistan Ltd.

    Hi AI,
       As I told you earlier ... jsut copy and paste the code I sent you in the end routine ... if the end routine contains your data then we are sure that the transformations have worked fine ... if it does not contain any data then we are sure something has gone wrong during the transformation.... you cannot find the problem until you are sure where it is happening.... lets work on this and get it out of our way... I am waiting for your response.
      Another point if anything has gone wrong while doing the transformations for location then the end routine will not have location info ... this is why I suggest you to put the code above in the end routine and debug ... this will give you a fair idea as to what has happened and where the problem arises.... Hope this helps.
    best regards,
    Kazmi

  • Target value in transformation routine

    Hi
    How can I get the value of target field, which is already present, in the transformation routine?
    For Example, I have a transformation between ODS DS1 and ODS DS2. DS1 has fields DS1_F1, DS1_F2 and DS2 has fields DS2_F1, DS2_F2. Now I have written a transformation routine for target field DS2_F1 with input DS1_F1. In this routine, I want to get the value of DS2_F1, which is already present, before the result is being updated. How can I get it?
    Thanks & Regards
    Tejo

    Hi,
    Use end routine concept here .
    Regards,
    Anil Kumar Sharma .P

  • Table Declaration in Transformation Routine

    Hi all,
    I have declared a table in transformation routine as follows :
    DATA : BEGIN OF VACATIONS OCCURS 0,
           DATE TYPE D,
           END OF VACATIONS.
    System is giving following error on this :
    ' E:Tables with headers are no longer supported in the OO context.'
    What should I do now?
    Regards,
    Aisha Ishrat
    ICI Pakistan Ltd.

    Hi Al,
       Let me explain here ... because you are doing what is being told to do without actually understanding your purpose. Let me take a scenario. You want to read a database table for sales orders populate it into the internal table. Then you wnat to loop at the internal table you populated and print the output. For this what you need is an internal table where your data will be stored - simply put its a 2 dimentional array. so your data once put into the internal table would look like:
    Sales_Order  Sold_To_Party
    1                        1
    2                        3
    3                        5
    4                        1
    Now what you do is read it - which means you are going to read one line at a time, which means a structure not an internal table, which was the purpose of the header line. but since header lines are not supported you need a different work area (structure). So that when you read the first line your structure contains as follows:
    1                       1
    When you read the second line your structure or work area contains the second line:
    2                        3
    so on.....
    From the explaination above you must be clear that you need an internal table to store data temporarily and a structure to manipulate a single record. Now the cod would look like:
    DATA: it_vbak type table of VBAK.
    DATA: wa_vbak type vbak.
    Notice above that one is using a "table" while declaring and the other is not.
    Select * from VBAK into table it_vbak.
    loop at it_vbak into wa_vbak.
    note above that you are looping at the internal table and populating one record
    into the work area.
       write:/ wa_vbak-vbeln.
    endloop.
    Hope this helps. Ask if you have any more concerns.
    Best regards,
    Kazmi

Maybe you are looking for

  • Add New Field in KB15N

    Hello Friends, I need to add one field in the KB15N screen. I feel that I must use the coding block feature to first add the field in the structure CI_COBL and then follow the rest of the process. Is this is the right approach or is there any other s

  • TS4009 Trouble with iPad,please help

    I keep getting a message on my ipad every few mins saying my storage is almost full,so I purchased 10 GB of storage space and Im still getting this annoying message,any ideas what I need to do to stop this?

  • Connecting DVD player, speakers and stereo receiver to mac pro

    I'd like to 'integrate' my living room system with my Mac Pro. This entails connecting my living room speakers and digital DVD player to my Mac. My stereo receiver is outdated so I plan to buy a new one. The reason I want to connect the DVD player is

  • Color correcting certain parts of a video

    Hello, I am sorta new to Premiere, having come from Final Cut pro. I have a video that has spots that neec color correction. How do I correct those spots, without correcting the whole video? Any help is appreciated.

  • Upgrade to SBO 2007 : a user was added outside the application....

    Hi I just completed the upgrade of a system from 2005 to 2007. But when trying to create a new user, i've got this message : -> a user was added outside the application. Delete it, or perform "Restore Numbering" Do you have any idea on the way to ove