Standard function for specified return

Hi,
I have an issue I want your help with.
This is only valid if numbers 5 or 6 are in the input.
I want to return the last 2 digits from the input parameter. for example. Input: 123456. Output: 56.
Or if there's only 12345 I want to return 5.
I can't do any substring because the input parameter could be whatever. example. 125. Example: 6.
Summary. I need a function that returns the last digits of the input parameter only if the input includes 5 or 6, or both.
Hope you understand.
Regards.

Below UDF handles all possible inputs as per your requirement.
public String returnLast2Digits(String var1, Container container) throws StreamTransformationException{
  if( var1.length()>1){
      String str2 = var1.substring(var1.length()-2,var1.length());
        if(str2.substring(0,1).equals("5")&& str2.substring(1,2).equals("6")){
           return  str2;
       else if(str2.substring(1,2).equals("5") || str2.substring(1,2).equals("6")){     
           return str2.substring(1,2);
       else{
          return "";
   }else{
       if(var1.equals("5") || var1.equals("6")){
          return var1;
       } else{
          return "";
Edited by: Baskar Gopal on May 17, 2011 2:54 PM

Similar Messages

  • Standard function for SELECT???

    I need to do a dynamic select, because i only know table name dynamically.
    I found DB_UPDATE_TABLE for update operations, but i need a similar function for select??
    Any ideas???

    Hi,
    check this code...
    For dynamic table name....
    REPORT demo_select_dynamic_database .
    DATA wa TYPE scarr.
    DATA name(10) TYPE c VALUE 'SCARR'.
    SELECT *
    INTO wa
    FROM (name) CLIENT SPECIFIED
    WHERE mandt = '000'.
    WRITE: / wa-carrid, wa-carrname.
    ENDSELECT.
    <b>For dynamic field list</b>
    REPORT demo_select_dynamic_columns .
    DATA: itab TYPE STANDARD TABLE OF spfli,
                wa LIKE LINE OF itab.
    DATA: line(72) TYPE c,
    list LIKE TABLE OF line(72).
    line = ' CITYFROM CITYTO '.
    APPEND line TO list.
    SELECT DISTINCT (list)
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM spfli.
    IF sy-subrc EQ 0.
    LOOP AT itab INTO wa.
    WRITE: / wa-cityfrom, wa-cityto.
    ENDLOOP.
    ENDIF.
    Regards
    Sudheer

  • Standard function for returninf time difference in days and hours.

    Hello all,
                Can somebody tell me whether there exists some standard function module which can calculate the time difference and returns the calculated time in the form of days and hours ?
    e.g. the time difference between the date 1.12.2007 from 7.00 pm to the date 1.1.2008 till 9.00 pm is
    30 days  and 2 hours or 30 : 2.
    answer as soon as possible.
    Thanks and regards,
    me

    Thanks a lot ya..
    thats an absolutely correct solution to my problem.  )

  • Standard function for settlement period

    Hello
    Does someone knows if there is a standard function that could define the settlement period based on a date (DD.MM.YYYY)?
    The aim of this is to use it in report RKO7CO88 thanks to a link with table TVAR because we would like to run in background the settlement without having to change every month the variant.
    Kind regards
    Chris

    Hello Srikanth,
    create 2 variables ...one for fiscal year and another for posting period...
    for the column which should take the previous period...right click on the variable and you will see offset...put in -1....but what if the user enters 2006.001...should it take 2005.012 ?? In that case you should write an abap code i think ....

  • Regarding Standard function

    Hi
    I am getting 6 digit number from the source.
    ex 103924
    in the target i want 1039.24
    Please tell me is there any standard function for this and tell me how to use it.
    regards
    venkat.

    Hi,
    You can use the FormatNumber API and formulate the no as per your requirment.
    Or Best way if the no of digits are not fixed then Multiply the Source field by 0.01
    Source Field--> Multiply (0.001 Constant) --> Target field
    Thanks
    swarup

  • E-Recruitment and Questionares (Standard function modules)

    Hi,
    On HR E-Recruitment I am trying to get a function which I can used to read answers from a given questionnaire. For example for every candidate applying for a requisition/position I want to be able to find which questionnaires they have completed and what answers they have given to a given question. I am hoping that there is a standard function for this. please point me in the right direction.
    If there is no standard solution have any one of you guys done this sort of thing before.
    Regards and many thanks in advance for your help.
    Andy.

    Hello Tania,
    using class cl_hrrcf_qa_bl is really the easiest way as otherwise you would have to read quite a number of tables. I have never had any substantial troubles w/ this class. You might either have not passed the correct parameters or miss some overall configuration, e.g. no candidate for your user.
    Best approach here is in my opinion to check what the cx_hrrcf exception tells you. If you cannot see this in the debugger just add the following to your test program.
    DATA:
      lr_exc TYPE REF TO CX_HRRCF.
    TRY:
    *   your code
      CACTH cx_hrrcf INTO lr_exc.
        cl_hrrcf_exception_handler=>write_exception_log( ex = lr_exc ).
    ENDTRY.
    This will write the error to the application log where you can check it in T-Code SLG1.
    Best Regards
    Roman
    Best Regrads
    Roman

  • Do we have function for automatic post GI when post GR

    Dear Guru,
    Do we have standard function for automatic post GI when we post GR
    or
    Automatic post GR when we post GI?
    We have this requirement but now we don't have a solution except create a new customize program.
    Please kindly advice.
    Thank you very much.
    Saiyaman

    I'm sorry I did not explain the exactly requirement.
    Actually we have pipeline material but I don't want to use material type PIPE.
    So when we post GI the material (261 or 201), we would like to post GR 501 immediately before GI.
    or
    When we post GR 501 of that material, system will automatic post GI material 261 immediately.
    Please kindly advice.
    Thank you.

  • Creating Classification view for material through Standard Function

    hi,
    I have created the material code through BAPI_MATERIAL_SAVEDATA. For quality inspection i have used BAPI_MATINSPCTRL_SAVEREPLICA. i have to create classification view for that material code. Can anyone suggest me which standard function helps me to create the classification view.
    Thanks in advance.
    Senjey

    hi,
    i have tried that function module. I have mentioned the code below.
    i_object = '000000151860630000'.
    i_alloc_num-CHARACT = 'THICKNESS'.
    i_alloc_num-VALUE_FROM = '5.70'.
    append i_alloc_num.
    i_alloc_char-charact = 'SHAPES'.
    i_alloc_char-VALUE_CHAR = 'PLATE'.
    append i_alloc_char.
    clear  i_alloc_char.
    i_alloc_char-charact = 'CATEGORY'.
    i_alloc_char-VALUE_CHAR = 'CS'.
    append i_alloc_char.
    clear  i_alloc_char.
    CALL FUNCTION 'BAPI_OBJCL_CREATE'
      EXPORTING
        OBJECTKEYNEW            = i_object
        OBJECTTABLENEW          = 'MARA'
        CLASSNUMNEW             = 'RAWMATERIAL'
        CLASSTYPENEW            = '001'
      STATUS                  = '1'
      STANDARDCLASS           =
      CHANGENUMBER            =
      KEYDATE                 = SY-DATUM
      NO_DEFAULT_VALUES       = ' '
    IMPORTING
      CLASSIF_STATUS          =
      TABLES
        ALLOCVALUESNUM          = i_alloc_num
        ALLOCVALUESCHAR         = i_alloc_char
        RETURN                  = i_ret.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT = 'X'.
    But i am getting the error 'Assignment exists and is valid '.
    Please help.
    Regards,
    Sengathir.J

  • Standard Function Module for OB52

    Hi,
      Is there any standard function module or BAPI for OB52 transaction.
      PLease let me know.
    Regards,
    Raghu

    Hi,
    OB52 is basically a transaction variant of SM30 for maintaining the view V_T001B.
    So there will not be any BAPI available to maintain the same.
    Regards,
    Ankur Parab

  • Standard function module for checking the sales organization and plant

    Hi all,
        Does have standard function module for checking the relationship between sales organization and plant?
    Thanks a lot!
    Nina

    hi
    good
    check these BAPIS
    BAPI_SALESGROUP_GET_DETAIL     Sales Group: Display Name                                                
    BAPI_SALESOFFICE_GET_DETAIL    Sales Office: Display Name                                               
    BAPI_SALESOFFICE_GRP_EXIST     Sales Office / Sales Group: Existence Check                              
    BAPI_SALESORG_EXIST            Sales Organization: Existence Check                                      
    BAPI_SALESORG_GET_DETAIL       Sales Organization: Display Data                                         
    BAPI_SALESORG_OFFICE_EXIST     Sales Organization / Sales Office: Existence Check                       
    PLANT=>
    BAPI_PROMO_GETSITEPLANNING     Detailed Data for the Plants Involved in a Promotion   
    thanks
    mrutyun^

  • Standard function modules for selection from vbak/vbup/ekko/ekpo

    hi experts ,
    do you know if there is an existing standard function modules for selection from vbak/vbup/ekko/ekpo.
    please help

    Hi,
    for VBAK
    ADSPCM_READ_VBAK               Read VBAK (with SPEC2KM-data)
    PRS_GET_GLOBAL_VBAK            Get global structure VBAK
    Regards,
    Jyothi CH.
    Edited by: Jyothi Chinnabathuni on Feb 23, 2009 2:46 PM

  • How to find standard function modules for IDOCs

    Hi,
    Can anyone tell me is there any way to find the standard function module for IDOC. I have checked BD60 but it's not available. For example  Idoc type WPUBON01 and I need to know the function module. Can anyone tell me the way out.
    Secondly, if anyone can provide me the code to map the file fields and idoc segements.
    Regards

    Use WE82 to find message type associated with Idoc type.
    Then use this message type as a search string to find the FM.
    The associated FMs are.
    POSED_FILL_OVERVIEW_ENT_WPUBON
    POSED_INIT_DATA_WPUBON       
    POSED_LOCK_DATA_WPUBON       
    POSED_OVERVIEW_ASSIGN_WPUBON 
    POSED_READ_DATA_FROM_DB_WPUBON
    POSED_READ_TR_DATA_WPUBON    
    POSED_SAVE_DATA_WPUBON       
    POSED_SEARCH_STRING_WPUBON   
    POSED_STORE_DATA_WPUBON      
    POSED_UNLOCK_DATA_WPUBON     
    POSED_UPDATE_DATA_WPUBON     
    POSED_UPDATE_TR_DATA_WPUBON  
    Thanks,
    Utsah Garg.

  • Is there any standard function available for generation of RIN number.

    Hi experts,
    RIN is Renewable Identifiaction Number.
    Structure for a RIN is a 34-character numeric code in the format:
         YYYYCCCCFFFFFBBBBBRRDKSSSSSSEEEEEE
    YYYY  = Year of Batch Production (when it leaves the facility)
    CCCC = Company registration ID
    FFFFF = Facility registration ID
    BBBBB = Producer assigned Batch Number
    RR  = Equivalence Value for the renewable fuel
    D = Renewable Type Flag (1 - cellulosic; 2 - non-cellulosic)
    K = RIN Type Flag (1 - standard, 2 - extra-value)
    SSSSSS  = RIN Block Starting Gallon Number 
    EEEEEE  = RIN Block Ending Gallon Number 
    Is there any standard function avaiable in R3 to generate such number?
    Please reply asap.
    Thank you in advance.

    Hi deepak,
    1. we can use the FM
    DATE_CHECK_PLAUSIBILITY
    regards,
    amit m.

  • Standard function support for bond issueing?

    Dear all,
    Within Treasury and Risk Management, are there some standard functions to handle bond issueing?
    The requirement is mainly to record information of bond details, interest payment and repayment, and currently we don't take postings to GL and payments into consideration.
    Thanks and cheers,
    leechey

    Hi,
    Bond Issue is available as a standard in TRM.  You need to create a separate security account which is a liabilities account for issuing bonds.  Bond issues are also managed in similar way to other bonds through a security master.
    Please check the following for more info on bond issue:
    http://help.sap.com/erp2005_ehp_05/helpdata/en/48/c1f409568f04e7e10000000a42189c/frameset.htm
    Regards,
    Ravi

  • "Control + F5"  standard filter functionality for ALV Grids

    Hi all,
    After an ALV Grid is displayed on screen there is a standard functionality to filter a selected column.
    You can select a column (click on the head) of the ALV, then "Control + F5" and a pop-up appears to insert a value or a range by which the filtration is going to be done.
    But a I have problem with a concrete field. It doesn`t seem different on comparison with other fields (CHAR30), but I don`t know why it doesn`t work correctly as others.
    Have you had any situation like this ??
    Thanks & sorry for my bad english,
    Rubè

    Hi Frank,
    When you are entering  89012  and pressing enter the additional zeros are adding up because of the data type of VBELN We have standard conversion routine attached with this .So when ever u wrtie any text that routine will works.
    Can you please check what data type are you using in the internal table that you are binding  to the node?
    Thanks and Regards,
    NSingh
    Edited by: Nsingh on Feb 17, 2012 4:52 AM

Maybe you are looking for

  • Output type neu not coming only one vendor

    Hi I have maintained for my condition record in nace t.code  for purchase order key combinatinon for document type ZCPO so when ever i creating po in me21n t.code using doc type ZCPO my outputype neu coming automaticaly,only one vendor code for my do

  • Crystal Runtime 10.5 for Visual Studio 2008 - viewer/full version support

    Hi - can reports developed in VS 2008 (CR basic 10.5) be run externally using a full or viewer version ?  If so, is there a restriction on which versions can be used for this (2008 / 11 / 13 etc) and whether the version must be full vs viewer ? The b

  • InDesign CS4 Debug not working on Windows

    Dear All, Two days back I purchased Bronze ASN memebership. This is the first time when I am trying debug version of InDesign. I have installed InDesign CS4 Debug on both Mac & Windows. On Mac it is working fine, but on windows it is not working. Deb

  • Multiple Errors While Attempting to Sync

    When I attempt to sync my 2nd generation iPod Touch (iOS 4) with my iTunes (v 9.2), I receive multiple errors: Can not copy song due to unknown error 0xE800400C, the device has timed out, and an internal device error occurred. I have tried just about

  • About to buy E-72. Had a few questions regarding N...

    I use Vodafone in India. I live in India and frequently travel to Nigeria on business. 1) I wanted to know if Nokia messaging will work when I go to Nigeria on a different sim/carrier (MTN)? 2) Does Nokia Messaging just require a data plan or wifi or