Abap Routine(Urgent)

Hi All,
I have a requirment  i,e for example i got a infoobject named product and the data for that product is cumin as ABCD,but in the target it should be passed as CD by supressin AB in transformation.
So in wot way i can achevie this ,by field routine,formula or start and end routine.
Please let me know ASAP
Thanks
Bobby

Hi Bobby,
As i understood you have product and txt field in your source and you want txt field get populated in target.
If yes then why you need to map 2 fields ?
Is their is some condition you need to check .If yes you can try something like this :
ex:
here if product is 200 and txt is ABCD in you target you will have value CD .
if source_fields-product =  200 .
     result = source_fields-txt+2 .
endif .
Otherwise directly put value :
     result = source_fields-txt+2 .
Refer this doc :
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/609eea32-455e-2c10-c08a-c23adf8c934e?QuickLink=index&overridelayout=true
http://help.sap.com/saphelp_nw70/helpdata/en/43/bcdb7801344defe10000000a422035/content.htm
Regards,
Jaya Tiwari

Similar Messages

  • URGENT ** ABAP ROUTINE HELP

    Hi gurus,
                 I am write a ABAP routine to fetch G/L acount form zpur_acc DSO for a joining consition of PO # and line item #.
    I am not etting the desired result. Can some one please lookinto the code and debug it.
    Here I am reading OI_EBELN and OI_EBELP from the incoming data but since I am in BI7.0 how can I use info object (OI_EBELN , OI_EBELP) directly or it should be referenced via communication structure-filed name? What is the name of communication structure in Bi 7.0?
    data: wa_tab type /BIC/AZPUR_ACC00.
    select single * into wa_tab from /BIC/AZPUR_ACC00
    where
    OI_EBELN = wa_tab-OI_EBELN
    and
    OI_EBELP = wa_tab-OI_EBELP.
    *and objvers = 'A'.
    result = wa_tab-GL_ACCOUNT.
    Warm Regards,
    Anil

    METHOD compute_0GL_ACCOUNT.
      IMPORTING
        request     type rsrequest
        datapackid  type rsdatapid
       EXPORTING
         RESULT type tys_TG_1-GL_ACCOUNT
        DATA:
          MONITOR_REC    TYPE rsmonitor.
    $$ 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
    data: wa_tab type /BIC/AZPUR_ACC00.
    select single * into wa_tab from /BIC/AZPUR_ACC00
    where
    OI_EBELN = wa_tab-OI_EBELN
    and
    OI_EBELP = wa_tab-OI_EBELP.
    *and objvers = 'A'.
    *result = wa_tab-GL_ACCOUNT.
    ... "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.
         RESULT = wa_tab-GL_ACCOUNT.
    $$ end of routine - insert your code only before this line         -
      ENDMETHOD.                    "compute_0GL_ACCOUNT

  • Urgent: ABAP routine in transfer rules

    Hi,
    when i am loading master data from R/3 into BW, i need to filter some records based on material type. there is no option in RSA6 (on R/3) or in Infopackage (BW) to make it available for filter.
    So i assume i need to write ABAP routine in transfer rules. can some one help me with ABAP. i need to load the records only when MTART field(material type) in MARA is "FINI" or "RAW" and skip other records.
    what is difference between deleting the whole data packet and deleting the record.
    Thank you very much in advance
    Regards
    Emil

    Hi
    Write the below code in the start routine of your transfer rules.
    Regards
    Prakash
    DATA: IT_DATA        TYPE STANDARD TABLE OF TRANSFER_STRUCTURE
                         WITH HEADER LINE
                         WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    DATA: S_DATA, T_DATA TYPE TRANSFER_STRUCTURE.
    LOOP AT DATAPAK INTO S_DATA.
    IF S_DATA-MTART EQ 'A' OR S_DATA-MTART EQ 'B'.
    MOVE S_DATA TO T_DATA.
    DELETE S_DATA.
    ELSE.
    DELETE S_DATA.
    ENDIF.
    APPEND T_DATA TO IT_DATA.
    ENDLOOP.
    CLEAR T_DATA.
    DATAPAK[] = IT_DATA[].
    Assigning points is a way of saying thanks on SDN!!

  • Data selection in info package using ABAP routine.

    Hi,
    when we are  scheduling the info package(Infp package name is like XYZ),we want to load past 6 months data from the current date(INFO OBJECT(0CREATEDON) BETWEEN (Sy-Datum - 6 months TO  Sy-Datum),in the selection tab in schedule i want to write the abap routine (type 6).please can any one have this type of code please sedn to me asap.
    this is very urgent.delivery is tomorrow.

    hi Lekha,
    try following code.
    seems you post the same question twice, one posting is sufficient. and please don't forget to reward helpful answers.
    data: l_idx like sy-tabix.
    read table l_t_range with key
    iobjnm = '0CREATEDON'.
    l_idx = sy-tabix.
    DELETE l_t_range
    WHERE iobjnm = '0CREATEDON'.
    L_t_RANGE-SIGN = 'I'.
    L_t_RANGE-OPTION = 'EQ'.
    if not work, try
    L_t_RANGE-OPTION = 'BT'.
    BT = between
    last 6 month
    L_t_RANGE-LOW = sy-datum - 180.
    current date
    L_t_RANGE-HIGH = sy-datum.
    append l_t_range.
    modify l_t_range index l_idx.
    p_subrc = 0.
    $$ end of routine - insert your code only before this line -
    endform.

  • Populate new fields in DSO (DBTable) with ABAP routine

    Hi,
    I've added a couple of fields to a DSO. The DSO contains a large number of records (60m+) and I have a tight window to cutover so the activation time would be an issue if I use a loop transformation. Therefore, I am looking to populate the additional fields directly in the Active table using an ABAP routine.
    One of the fields is a key figure to be derived from an existing CHAR field so would need to apply some logic during update, such as IF <CHAR_FIELD> CA 'ABC'. <KYF_FIELD> = 1 etc.
    Aside from fairly basic Start Routines my ABAP is very poor so was wondering if anyone can help me with the syntax or, preferably some sample code to achieve this.
    Thanks in advance,
    Ad

    Hi,
       In transformation of the cube, choose routine  for char E.
       There you can assign value in RESULT field. Actually RESULT field is assigned to E, find the code below,
    *--  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.
      (* insert your abap code here to find the value of E*.)
         RESULT =                     * assign the value you got for E here.
    rgrs,
    v.sen

  • ABAP Routine in selection of Info package in 3x

    Hello Experts
    We need to load distinct PO data in 3x server.
    I have added this distinct po values in range table of info package abap routine.
    However its not loading for range table values more than two selections/pos.
    If I try to append more than 2 values,only last one is uploaded.
    However after load, in monitor tab-header , selection paramenters I can see all PO values in selection.
    Some how it works only for two inputs (rows) in range table of ABAP routine in infopackage.
    Anybody has faced such issue? any help is appreciated!
    Edited by: Kanchan Angalwar on Jan 30, 2010 9:59 AM

    Hi,
    Please post your ABAP code here

  • Call function in abap routine of infopackage

    Experts,
    Good day. I have a problem concerning the data to be imported in my ods.I can't find a similar thread corcerning my problem. My ‘File date’ field should contain only 2 years and 3months data of recent data. I'm using a call function fima_date_create to filter values of zfile_date.
    CALL FUNCTION 'FIMA_DATE_CREATE'
      EXPORTING
        I_DATE                             = sy-datum
        I_FLG_END_OF_MONTH   = ' '
        I_YEARS                          = 2-
        I_MONTHS                        = 3-
        I_DAYS                             = 0
        I_CALENDAR_DAYS          = 0
        I_SET_LAST_DAY_OF_MONTH       = ' '
      IMPORTING
        E_DATE                             =
        E_FLG_END_OF_MONTH   =
        E_DAYS_OF_I_DATE         =   
    The sy-datum becomes the “High” value and the date generated by this FM will be the “low” value. I already tested this function module and it is what i want. How Should I write the ABAP code for this in the abap routine for my infopackage? Or what steps do I need to take.

    Hi,
    When you choose the option to write a routine for one of the characteristics in the infopackage selections, you get a window to write your code with some prewritten code as below. Modify it as shown below, for your requirement.
    data: l_idx like sy-tabix.
    read table l_t_range with key
         fieldname = 'CALDAY'.
    l_idx = sy-tabix.
    START of YOUR CODE
    <----
    Required logic -
    >
    L_T_RANGE-LOW  = <lower limit of range>.
    L_T_RANGE-HIGH = <upper limit of range>.
         L_T_RANGE-SIGN = 'I'.
         L_T_RANGE-OPTION = 'BT'.
    END of YOUR CODE
    modify l_t_range index l_idx.
    p_subrc = 0.
    Hope this helps.

  • ABAP Routine code for the below logic

    Hello BW Experts ,
    I need to write a complex ABAP routine in BW .
    Following is the detail explaination .
    Can anyone tell me the ABAP code for the below logic?
    It would be a greate help as I am unable to do this
    since last two days.
    WBS Elements are maintained at  IOS and  Warranty levels in R/3 side.
    The IOS WBS is a top level of WBS element and below that the Warranty WBS level.
    The IOS and Warranty WBS elements can be differentiated by means of priority field.
    When priority = i   , WBS Element is known as  IOS Level WBS Element and
    When  priority = Y the WBS element is known as Warranty WBS element.
    The Equipment Number is maintained compulsorily at IOS Level WBS elements only.
    It is not maintained at  Warranty WBS Element.
    But the Cost is maintained at Warranty WBS Elements.
    In BW I need all Warranty WBS ( priority = Y) along with their cost figures and Equipment Numbers.
    But as the Equipment Number is not maintained compulsorily at Warranty WBS level we have asked to
    Copy it from  IOS WBS ( priority = i ) and assign it to Warranty WBS level ( priority = Y ).
    So I have included the Equipment Number in the ODS and in update rules I need to write the routine for it as
    per the above logic.
    The Equipment Number is coming from Master data of  WBS Element.
    The WBS element master data we are loading in BW .
    Also the same WBS Element transaction data is coming from the transaction data data source in BW.
    Following fields / infoobjects and the table names in BW :
    1. Equipment Number : /BIC/ZEQUIPMNT  and table name /BIC/MZWBS_ELEM.
    2. WBS Element       : ZWBS_ELEM  is coming from transaction data data source as well as master data.
                                     In ODS update rules it is coming from  transaction data data source Comm_structure-ZWBS_ELEM.
                                     Also we are loading separetly the master data for ZWBS_ELEM.
                                     The  ZEQUIPMNT is an attribute of ZWBS_ELEM.
    3. Priority                :  PRIORITY     and table name /BIC/MZWBS_ELEM.
                                      The info object name for Priority is 0Priority but in master data table /BIC/MZWBS_ELEM
                                      the field name is    PRIORITY.
                                     When PRIORITY = ' i ' then    ZWBS_ELEM is at IOS Level
                                     When PRIORITY = ' y ' then  ZWBS_ELEM is at Warranty Level.
    4. ODS name :  /BIC/AZCOST00 and same is table name active data table .
    So please tell me the routine Code .
    Best Regards ,
    Amol.

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • ABAP Routine in UR Help

    Hi Friends
    We are on BI7 and ECC6.
    We have to get the quantities into BI from ECC for that we are using one field from 2lis_11_vaitm. But we want to count the quantity only when material is a complete package all other values should be 0. Packages are described in the material as for example DMS PACKAGE , DST PACKAGE , DTTS PACKAGE DTTTT PACKAGE.
    Now My thinking is ,Inorder to do that we have to use the offsets in ABAP routine. But the first few letters are not 3 / 4 fixed it may be 3, 4, 5 or 6 letters the PACKAGE will start from the next word..
    Can any one help me how to write the ABAP logic to get the offset for last 11 letters ?
    regards

    F2 & F3 TYPE I.
    F1 = 'DTTS PACKAGE' (F1 contains the value)
    F2 = LENGTH(F1) (F2 determines the length of the field)
    OR
    F2 = STRLEN(F1)
    F3 = F2 - 11 (F3 determines the difference)
    F4 = F1+F3(11) (F4 picks up value based on offset)
    *Not sure if variables are accepted for offsets.

  • ABAP routine in infopackage that runs function in ECC

    Hi All
    I need to have dynamic filter in the info package
    I have program in ECC that brings me the value that I need to filter in my info packege
    I want to use  ABAP routine in infopackage that runs function in ECC and brings the value that was received from the ECC function
    Is that possible?
    Thanks

    Hi All
    my CTO found the following option
    function module that is "remote-enabled module "
    then you call CALL FUNCTION 'Y_FM_IDOC_CATSDB' DESTINATION 'SAP4.7E'
    you need to define it in SM59
    code example
    data: BEGIN OF IT_SOBSL OCCURS 0,
          SOBSL(2),
          END OF IT_SOBSL.
    DATA: ls_range type STANDARD TABLE OF rssdlrange WITH HEADER LINE.
    SELECT /BIC/ZSPEPROCI FROM /BIC/SZSPEPROCI INTO TABLE IT_SOBSL
                          WHERE /BIC/ZSPEPROCI NOT BETWEEN 'AA' AND 'ZZ'
                          AND /bic/zspeproci ne '' .
    BREAK-POINT.
    LOOP AT IT_SOBSL.
    ls_range-IOBJNM = 'SOBSL'.
    ls_range-LOW = IT_SOBSL-SOBSL.
    ls_range-SIGN = 'I'.
    ls_range-OPTION = 'EQ'.
    APPEND ls_range .
    ENDLOOP.
    loop at ls_range.
      append ls_range to l_t_range.
    endloop.

  • Abap Routine in DTP Filter with selection in a table

    Hi guys,
    I need help please.
    I'm trying include a abap routine in a DTP filter, for this case I need to make a select in a dso table and return a list of criterias.
    Example: for this characteristic 0GL_ACCOUNT i need in a fiter 20 or more 0GL_ACCOUNT of table  "/BIC/DSO_XXX".
    How can I select more than one 0GL_ACCOUNT in a tranparency table  "/BIC/DSO_XXX"... and put in a DTP Fiter.
    DTP FILTER ROUTINE.
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'GL ACCOUNT'.
              l_idx = sy-tabix.
              if l_idx <> 0.
                modify l_t_range index l_idx.
              else.
                append l_t_range.
              endif.
              p_subrc = 0.

    Try this:
    DATA: lv_rows TYPE n LENGTH 10,
            it_zbw_pl_proj LIKE STANDARD TABLE OF /BIC/DSO_XXX 
            lw_zbw_pl_proj LIKE LINE OF it_zbw_pl_proj .
      SELECT COUNT(*) INTO lv_rows FROM  /BIC/DSO_XXX Where <your condition> .
    SELECT * INTO TABLE it_zbw_pl_proj FROM zbw_pl_proj where <your condition>
      IF lv_rows <> 0.
        LOOP AT it_zbw_pl_proj INTO lw_zbw_pl_proj  .
          l_t_range-iobjnm = '/BI0/GL_ACCOUNT'.
          l_t_range-fieldname = 'GL_ACCOUNT'.
          l_t_range-sign = 'I'.
          l_t_range-option = 'BT'.
          l_t_range-low = lw_zbw_pl_proj-GL_ACCOUNT.
          l_t_range-high = lw_zbw_pl_proj-GL_ACCOUNT.
          APPEND l_t_range.
        ENDLOOP.
      ELSE.
        " No data found for Current Forecast Version.
        p_subrc = 4.
      ENDIF.
    I just copied this data from a DTP routine where i am fetching Versions from a DB table zbw_pl_proj. You may need to change the naming convention and performance tune the code ( like defining internal table only to hold GL_account and then only selecting GL_Account from ODS).
    Hope this helps!
    Regards
    Amandeep Sharma
    Edited by: AmanSharma123 on Jul 14, 2011 2:42 PM

  • ABAP routine in Infopackage

    I am in the process of creating an ABAP routine in the Infopackage to load current month based on system data from one cube in BW to another Cube in BW. I am getting the following error in the load. I am not an ABAPer and would appreciate if you can help or guide me with a sample code.
    Here is the error.
    For sel. field '/BIC/Z_APOSNAP', no selection with SIGN = ''; OPTION '' allowed.
    Thank you
    Neelu

    Hi Neelu,
    U can create a ABAP Routine of the type 6 (ABAP Routine),The field you are trying to populate is a select-option so you have to define both Sign and Option along with Low and High values.
    As u want to load current month, from a system values , u can do it from sy-datum.
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = ''/BIC/Z_APOSNAP'.
                l_idx = sy-tabix.
                l_t_range-low = 
                l_t_range-high = 
                l_t_range-sign =
                l_t_range-option =
          modify l_t_range index l_idx.
              p_subrc = 0.
    Just u can fill Sign as 'I' and Option 'EQ'.
    Fill Low and High with values u get from System Data.
    Hope this Helps,
    Thanks,
    Krish
    **awarding points is way of saying thanks in SDN.

  • ABAP routine in the infopackage for Multiple Selection

    Hi experts,
    I want to include a abap routine in the infopackage for Multiple Selection so that I can fetch only the required Material Numbers when the InfoPackage is schedule. As I have the constraints that I have to select certain Material Numbers only, that are not in series - so I cannot select"BT' fuction. Tell me what ABAP Code will work in this scenario.
    Kind regards,
    Rajesh Giribuwa

    Hi,
    The Routine will have to use 'EQ' operator and Append each selections to the Structure.
    ABAP Routine
    InfoPackage definition for Bespoke SIS Structure
    Infopackage routine !
    Regards
    Happy Tony

  • ABAP routine in DTP

    hi,
    I need some help withe ABAP routine in the DTP selection
    I have requirement to load the data for specific company codes on a specific days.
    If the current date is monday then it should pick Taiwan  or
    if the current date is Tuesday the it should pick Australia and Korea or
    if the current date is sunday then it should pick CHINA and Vietnam.
    I want to use only one DTP for this requirement. Please help me with the code for Info Object 0COMP_Code.
    Regards,
    Raghu

    hi,
    I have tried the code and it is not populating any value in the selection.
    Please check
    data: l_idx like sy-tabix.
    data: day like SCAL-INDICATOR.
    *Finding out the day
      clear day.
      CALL FUNCTION 'DATE_COMPUTE_DAY'
        EXPORTING
          DATE = sy-datum
        IMPORTING
          DAY  = day.
      read table l_t_range with key
           fieldname = 'COMP_CODE'.
      l_idx = sy-tabix.
    case day.
        when 1.                                 "Monday
          l_t_range-low = '0711'.
          l_t_range-high = ' '.
          l_t_range-option = 'EQ'.
          l_t_range-sign   = 'I'.
          modify l_t_range index l_idx.
        when 2.                                 "Tuesday
          l_t_range-low = '0355'.
          l_t_range-high = ' '.
          l_t_range-option = 'EQ'.
          l_t_range-sign   = 'I'.
          modify l_t_range index l_idx.
        when 3.                                 "Wednesday
         l_t_range-low = '0211'.
          l_t_range-high = ' '.
          l_t_range-option = 'EQ'.
          l_t_range-sign   = 'I'.
          modify l_t_range index l_idx.
       when 4.
       when 5.
       when 6.
       when 7.
         l_t_range-low = 'China'.
         l_t_range-high = ' '.
         l_t_range-option = 'EQ'.
         l_t_range-sign   = 'I'.
         modify l_t_range index l_idx.
    endcase.
    p_subrc = 0.

  • ABAP Routine in the InfoPackage

    Hello,
    I need to write an ABAP Routine in the infopackage to populate the selection conditions automatically. Coding is for Fiscal year/Period and it should be populated as LOW - Pervious period and HIGH - Current period.
    I tried to do the coding myself but couldn't able to fetch the current and previous periods. I would be grateful if some one can share the code with me.
    Best Regards,
    Nene.

    Hello,
    Try this.
    1) Identify the current period by inputting sy-datum to function module  'DATE_TO_PERIOD_CONVERT'.
    2) Find the first day of current period using function module
        'FIRST_DAY_IN_PERIOD_GET'
    3) Minus one day from the first day of current period to get previous period last date.
    4) Call the same function module 'DATE_TO_PERIOD_CONVERT' by inputting the previous period last date (derived in step 3).
    5) Pass the values to the infopackage code.
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
      read table l_t_range with key
           fieldname = '<field name>.
      l_idx = sy-tabix.
      l_t_range-SIGN   = 'I'.
      l_t_range-OPTION = 'BT'.
      l_t_range-LOW    = <previous period> (refer step 4)
      l_t_range-HIGH   =  <current period>  (refer step 1)
      modify l_t_range index l_idx.
    Thanks
    Viswa
    (Assign points if helpful).

Maybe you are looking for