How to get pattern from the string?

Friends,
I have 3 strings variables.
Name1,Name2 and Name 3.
I want to search following terms in above variables.
'T1' 'TURC1' 'TURC 1' and 'TURC 1X'  " X=any character
'T2' 'TURC1' 'TURC 2' and 'TURC 2X'  " X=any character
'T3' 'TURC1' 'TURC 3' and 'TURC 3X'  " X=any character
'T4' 'TURC1' 'TURC 4' and 'TURC 4X'  " X=any character
If T1      found, then v_res = 1.
If TURC1   found, then v_res = 1.
If TURC 1  found, then v_res = 1.
If TURC1X  found, then v_res = 1X.
Same for 2 3 and 4.
So, How can I do this?

Hi,
    Try below code
Do for remaining same Strings
DATA : name1 TYPE string,
       name11 TYPE string,
       name2 TYPE string,
       name3 TYPE string.
DATA : v_res(2) TYPE n,
       w_fdpos TYPE sy-fdpos,
       str TYPE i,
       ch TYPE c.
name1 = 'ABCT1XRYTURC1JJTURC 1LLTURC 1A'.
str = STRLEN( name1 ).
FIND 'T1' IN name1.
IF sy-subrc = 0.
  v_res = 1.
  FIND 'TURC1' IN name1.
  IF sy-subrc = 0.
    v_res = 1.
    SEARCH name1 FOR 'TURC 1'.
    IF sy-subrc = 0.
      v_res = 1.
      w_fdpos = syst-fdpos.
      w_fdpos = w_fdpos + 6.
      str = str - w_fdpos.
      name11 = name1+w_fdpos(str).
      SEARCH name11 FOR 'TURC 1'.
      IF sy-subrc = 0.
        CLEAR w_fdpos.
        w_fdpos = sy-fdpos.
        w_fdpos = w_fdpos + 6.
        ch = name11+w_fdpos(1).
        CONCATENATE '1' ch INTO v_res.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.
FIND 'T2' IN name1.
IF sy-subrc = 0.
  v_res = 1.
  FIND 'TURC2' IN name1.
  IF sy-subrc = 0.
    v_res = 1.
    SEARCH name1 FOR 'TURC 2'.
    IF sy-subrc = 0.
      v_res = 1.
      w_fdpos = syst-fdpos.
      w_fdpos = w_fdpos + 6.
      str = str - w_fdpos.
      name11 = name1+w_fdpos(str).
      SEARCH name11 FOR 'TURC 2'.
      IF sy-subrc = 0.
        CLEAR w_fdpos.
        w_fdpos = sy-fdpos.
        w_fdpos = w_fdpos + 6.
        ch = name11+w_fdpos(1).
        CONCATENATE '1' ch INTO v_res.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.
FIND 'T3' IN name1.
IF sy-subrc = 0.
  v_res = 1.
  FIND 'TURC3' IN name1.
  IF sy-subrc = 0.
    v_res = 1.
    SEARCH name1 FOR 'TURC 3'.
    IF sy-subrc = 0.
      v_res = 1.
      w_fdpos = syst-fdpos.
      w_fdpos = w_fdpos + 6.
      str = str - w_fdpos.
      name11 = name1+w_fdpos(str).
      SEARCH name11 FOR 'TURC 3'.
      IF sy-subrc = 0.
        CLEAR w_fdpos.
        w_fdpos = sy-fdpos.
        w_fdpos = w_fdpos + 6.
        ch = name11+w_fdpos(1).
        CONCATENATE '1' ch INTO v_res.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.
FIND 'T4' IN name1.
IF sy-subrc = 0.
  v_res = 1.
  FIND 'TURC4' IN name1.
  IF sy-subrc = 0.
    v_res = 1.
    SEARCH name1 FOR 'TURC 4'.
    IF sy-subrc = 0.
      v_res = 1.
      w_fdpos = syst-fdpos.
      w_fdpos = w_fdpos + 6.
      str = str - w_fdpos.
      name11 = name1+w_fdpos(str).
      SEARCH name11 FOR 'TURC 4'.
      IF sy-subrc = 0.
        CLEAR w_fdpos.
        w_fdpos = sy-fdpos.
        w_fdpos = w_fdpos + 6.
        ch = name11+w_fdpos(1).
        CONCATENATE '1' ch INTO v_res.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.
Regards
Bala Krishna

Similar Messages

  • How to get data from the GUIBB FORM on processing method PROCESS_EVENT?

    Hello Community,
    one more question do I have.
    I need to process some form data, that were entered by a user. One field was additional added via the method IF_FPM_GUIBB_FORM~GET_DEFINITION, so it is not in the BOL.
    I listen to an FPM_EVENT in the IF_FPM_GUIBB_FORM~PROCESS_EVENT.
    IF io_event->mv_event_id EQ 'FPM_SAVE_AND_BACK_TO_MAIN' OR io_event->mv_event_id = 'FPM_SAVE_1'.
         " Here I need to access the data from the GUINN FROM
      ENDIF.
    How can I access to the data, entered in the GUIBB FORM?
    Thank you and best regards, Christian

    Hello Jens and Christian,
    Thanks very much for your help.
    Could you help me check where the problem is ? My detail step is as below:
    1.      Structure     'S_TR_FILE' ,  which  include component  'MIME_TYPE' with data type 'String'  and 'UPLOAD_FILE' with data type 'String'.
    2.    IF_FPM_GUIBB_FORM~GET_DEFINITION
        DATA: lo_structdescr    TYPE REF TO cl_abap_structdescr.
        FIELD-SYMBOLS: <ls_new_field_descr> TYPE fpmgb_s_formfield_descr.
        lo_structdescr  ?= cl_abap_typedescr=>describe_by_name( 'S_TR_FILE' ).
        eo_field_catalog = lo_structdescr.
        APPEND INITIAL LINE TO et_field_description ASSIGNING <ls_new_field_descr>.
        <ls_new_field_descr>-name = 'MIME_TYPE'.
        <ls_new_field_descr>-label_by_ddic = 'X'.
        <ls_new_field_descr>-visibility = '01'.
        <ls_new_field_descr>-default_display_type = 'IN'.
        UNASSIGN <ls_new_field_descr>.
        APPEND INITIAL LINE TO et_field_description ASSIGNING <ls_new_field_descr>.
        <ls_new_field_descr>-name = 'UPLOAD_FILE'.
        <ls_new_field_descr>-label_by_ddic = 'X'.
        <ls_new_field_descr>-visibility = '02'.
        <ls_new_field_descr>-default_display_type = 'FU'.
        <ls_new_field_descr>-mime_type_ref = 'MIME_TYPE'.
    3.  After the OVP page is displayed, I select a xlsx file in 'UPLOAD_FILE', and click "upload" button(toolbar on the top  page) , I can't get any data from IS_DATA in flush method or CS_DATA in Get_DATA.
    Thanks& Best Regards,
    Yupeng

  • How to get 'linenum' from the order form matrix

    I'v been trying to get this to work for the past 4 hours now and I can't find a solution.
    I have a button on the sales order form, when the user clicks on this button a second screen will appear with more information (stored in a usertable).
    However to be able to get this information from my usertable I need to have the linenum of the selected line (in the matrix).
    I know I can get the 'row' property but this doesn't give me the linenum (wich is the unique key in the RDR1 table).
    Also the 'visorder' column doesn't work since I have textlines in the order that can be placed anywhere and can be more than 1.
    Consider the following scenario:
    Order with the following lines:
    Textline
    article line (actual orderline)  (linenum = 1 / visorder = 0 / row = 2)
    article line (actual orderline)  (linenum = 2 / visorder = 1 / row = 3)
    article line (actual orderline)  (linenum = 3 / visorder = 2 / row = 4)
    textline
    article line (actual orderline)  (linenum = 4 / visorder = 3 / row = 6)---- (this line has been deleted)
    article line (actual orderline)  (linenum = 5 / visorder = 3 / row = 6)
    So in total 6 lines.
    How do I get the 'linenum' from the last line (note that linenum 4 has disappeared because of the deleted row)?
    I looked into using the dbdatasource but with this I gets the entire RDR1 table (for that order) and can't get the linenum (correct one) out off it since the textlines mess up the order.
    Anyone know how to do this?

    Hi Marc,
    Assuming the document is saved, you can use something like the following:
    SAPbouiCOM.Form sboForm = (SAPbouiCOM.Form)_sboApp.Forms.GetForm(ItemEvent.FormTypeEx, ItemEvent.FormTypeCount);
    SAPbouiCOM.Matrix sboMatrix = (SAPbouiCOM.Matrix)sboForm.Items.Item("38").Specific;
    // Get the document number
    SAPbouiCOM.EditText sboEdit = (SAPbouiCOM.EditText)sboForm.Items.Item("8").Specific;
    string sDocNum = sboEdit.Value;
    if (sDocNum == "") // No document is selected in this window so report error
        _sboApp.SetStatusBarMessage("No document has been selected", SAPbouiCOM.BoMessageTime.bmt_Short, true);
    else
        if (sboForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE || sboForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE) // Document must be saved to ensure VisOrder is correct in the database
            _sboApp.SetStatusBarMessage("Please save the document first", SAPbouiCOM.BoMessageTime.bmt_Short, true);
        else
            int iVisOrder = -1;
            string sMessage = "The Line Numbers on this document are: " + System.Environment.NewLine;
            for (int i = 1; i < sboMatrix.RowCount; i++) // Last row is always blank so loop while i is LESS than RowCount
                SAPbouiCOM.ComboBox sboCombo = (SAPbouiCOM.ComboBox)sboMatrix.Columns.Item("257").Cells.Item(i).Specific;
                string sLineType = sboCombo.Selected.Value.ToString();
                if (sLineType == "") // Not a text line or a subtotal
                    iVisOrder++; // Increment your counter to get the next VisOrder value
                    SAPbobsCOM.Recordset sboRec = (SAPbobsCOM.Recordset)_sboCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
                    try
                        sboRec.DoQuery("select T0.LineNum from RDR1 T0 inner join ORDR T1 on T0.DocEntry = T1.DocEntry where T0.VisOrder = " + iVisOrder.ToString() + " and T1.DocNum = " + sDocNum);
                        if (!sboRec.EoF)
                            sMessage += "Row " + i.ToString() + " in the matrix is LineNum " + sboRec.Fields.Item("LineNum").Value.ToString() + System.Environment.NewLine;
                    finally
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(sboRec);
                        sboRec = null;
                        GC.Collect();
            _sboApp.MessageBox(sMessage, 1, "Ok", "", "");
    Basically you have a counter that you increment if the matrix line is not a text or subtotal line. This will match the VisOrder value in the RDR1 table which you can use to get the LineNum value.
    Kind Regards,
    Owen

  • How to get values from the page excpet pagecontext.getparameter

    i have a requirement wherein i am passing paramteres from the "submit" button.but the problem being that,i have multiple rows in my page.what is happening is that my "submit" button is passing the values of the previous row,instead of the current row.this is i think because "commit" gets called later and params are passed before it.
    how do i solve this problem
    or if i can get to get paramteres in a advance table layout,i l be able to achieve my requirement.beacuse in advance table layout,i am not able to do pagecontext.getparameter("---" of the item

    thanks guys,
    i did try working with row refrence but it returns a null only.
    my requirement was that i had update functionality as well as "add new rows" on the same advtbl bean.an whenevr i click on "add new row" and submit,i was always gettin the parameters for the previous row.
    now,i have got a workaround to that,by having a radio button to select rows to update and whenever i click on "add new rows" ,i disable the radio button,and get the handle based on the value from radio group.
    but still row refrence dint work for me.i will appreciate if sum1 can send me the code

  • How to get mp3s from the cd to my iPhone library in iTunes when I hook the phone up to my iMac

    Always before I hook the iphone up to the imac and open up itunes it recognized the phone and synced. Then you click on the phone and you had a choice of "on this phone" and it would show the folders and songs on the phone. Now, when I hook it up it, it will recognize and sync, but there is no "on this phone" choice and I do not know how to get songs or mp3's from my cd that is in the computer drive to my iphone in itunes. Where did this choice go? How do I get things from a disc to my phone?

    Your post is confusing to me because I don't understand the process you are describing.  Normally, you would import your CD music into iTunes, then sync your iPhone to iTunes, capturing the music on your iPhone.  The "On This Phone" tab would be irrelevant.
    Anyway, you can see "On This Phone" by pressing the iPhone icon toward the top of the iTunes window when the iPhone is plugged into iTunes.  "On This Phone" is a tab toward the rear (the "Summary" tab is at the front).

  • How to get data from the Tables (Can func.module help then how to write )

    Hi,
    Can anyone tell the use of functional module to extract the data from R/3.i am working on PM module and need to extract the status of work order and equipment which i can get from First i had to get objnr then i had to go to jsto in jsto i get stsma and estat. by using estat and stsma i can get status in table tj30t here estat is same as stat in jest table.
    how to get all these in bw . any help.
    I need status of work orders and equipments which exists in tj30t or we can get from tj30 tables in the fields txt30 and txt04
    Any one pls help to get all these stuff from R/3 to BW
    Regards
    Srini-----

    Hi
    You need to enhance (write a user exit) for your Data Source.
    Here are some links on UE:
    Enhancment Framework
    ====================
    SAP Help Enhancment Framework
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Enhancements in sap bw
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/59069d90-0201-0010-fd81-d5e11994d8b5
    User Exit Enhancments
    Enhancement
    User exit
    BADI
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Reg's
    Edan

  • How to Get XML from the PDF form generated using Designer that is stored in LC

    We have a Requirement of Generating reports on what a PDF form is comprised of? It is easy for us to scan / parse the XML format of the PDF form and get all the relavent Info we need. We are able to see the XML format of the PDF form when we open up the Form in Designer.
    But we are trying to run this report in a Batch Mode for many PDF files. I need to know how to get a XML format of the PDF file that is stored in LC that was developed using Designer. Once we are able to get the XML of the PDF form it is just a scan / parse to get the relavent data.
    Can some one tell me how to get the XML format of a PDF file stored in the LC?

    If I place the PDF form on the LC server - Can you let  me know of the tools you are referring to get XML design from the PDF form?
    Is it through a Process Orchestration I need to run the PDF through to get a XML design out of it?
    I am fine in storing the PDF in the LC server? How will I get the XML design (XML) from this PDF on the server?

  • How to get music from the iPod to my computer?

    Is it possible to get the music from an ipod and put it on your computer? Because i would like to switch all my music from my ipod to my new computer, and i got rid of all the original music.

    Hello karakamikaze,
    And welcome to Apple Discussions!
    There are several ways you can pull the music off your iPod and onto iTunes. The first link below provides step-by-step instructions for the direct method if you have a PC as well as a few third party applications (for both the Mac and PC) if you choose to go that route instead. You can also do a simple Google search for "copy music from iPod to computer" and you should receive a number of sites that can help you out.
    Just make sure that when you have your iPod plugged into your computer, that you don't hit "Erase and Sync" before completing the task of copying your music over.
    Also, if you have any purchased music, you will probably have to re-authorize your computer by heading to the Store drop down menu and choosing "Authorize computer."
    [5 Ways to Copy Music OFF your iPod and onto iTunes|http://www.metaphoriclabs.com/articles/5-ways-to-copy-music-off-your-ipo d-windows-mac-os-x>
    Here are a few more helpful sites.
    [Copying Content from your iPod to your Computer - The Definitive Guide|http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipo d-to-computer]
    Or
    [How to copy songs your iPod to your PC|http://lifehacker.com/software/ipod/how-to-copy-songs-from-your-ipod-to-your -pc-105256.php]
    Also, here is an article for the direct method that is for both Windows Vista and XP, so the instructions might vary slightly if you are running Windows 7.
    http://ipodtips-tricks.blogspot.com/2008/10/howto-transfer-music-from-ipodto-itu nes.html
    Hope this helps.
    B-rock

  • I set up two identities, the default & one more. How to get mail from the second one?

    I have two different e-mail addresses that I want to get mail from. So the main/default one worked just fine. So I went to options, account settings, identities and set up the second one. But this second one doesn't appear on the start page and still when I Get Mail, it only brings in the mail from the default one. So what do I do?

    You do not place your second account in Identities.
    You go to the Menu Bar and select '''File-New-Existing Mail Account''' and add it there.
    No Menu Bar? Press the alt key.
    If using the '''AppMenu button''', click that and select''' New Message-Existing Mail Account'''

  • How to get data from the user for an Insert Trigger ?

    Hi all and thanks in advance, I need to get some values from the user for a child table when a row inserted into the parent table, is that possible to use ampersand inside an "Insert Trigger" to let the user for inserting some values ?
    Edited by: user9942078 on 17-Dec-2008 16:35

    In a different words,
    When a virus attacked your body your blood cells instantly goes into operation. Just like that -> your trigger activated as a result of your DB operation on objects. So, here also you have no option to manually intervene anything.
    Hmm... Looks like some science fiction movies ultimately pays some price... ;)
    So, trigger basically fires implicitly as a result of any database operation on objects or even on user.
    So, that has to be automatic. And, when you are using & it will ask for some input value - which cannot be done in case of triggers.
    For details please refer the oracle docs.
    Regards.
    Satyaki De.

  • How to get separators from a string

    I need to find the thousand separator, hundred separator and decimal separator from a string. I need to check which separator is available in a string ie., thousand or hundred separator. There may be a case where there is no separators.
    Please suggest me. I would be greatful if you provide me a code snippet.
    Thanks in advance...

    Hi Ananth,
    Try following:
    //For decimal fraction
    if (Count(Split(StrReverse(ToText ({OINV.DocTotal})), '.') ) > 1) then "With Decimal" else "Without Decimal"
    //For Units
    //Convert numbers to string valule
    //Reverse the string so that you cold parse them accordingly in units, hundreds, thousands etc
    //and finally split and parse each comma
    if
        Length
            Split
                    (Split(StrReverse(ToText ({OINV.DocTotal})), '.')[2]) , ','
                )[1]
        ) <= 2
    ) Then "Hundreds"
    Else "Thousands"
    You can continue on length of each subscript in array for hundreds, thousands, millions...
    Cheers,
    Kashif Ali

  • Once Original Checked in, how it gets deleted from the Local PC automatical

    Hi Experts,
    Can someone help me regrding the following requirement:
    When the Originals are checked in into the content server, then the file should be deleted automatically from the Local PC. i.e. When we check in the original in the content serve, the same file which is there on the Local PC should gets deleted automatically.
    Is there a way to do it ?
    Thanks in advance.....

    Hi,
    Yes.. There is a way.. Go to dc30 - Workstation Application, Select one, for example PDF - Double click - Now you can see.. Check Delete Files after check-in.
    Regards,
    Aby

  • How to get photos FROM the computer onto the N8

    When using PC Suite, you could simply take any photos or other files you had on the PC and "drop them" onto the image of the phone while using PC Suite.
    OVI Suite doesn't seem to have this capability - or I just haven't found it.  I know other ways to achieve this, but is there a simple way to do it via OVI Suite?
    Can I use the "watched folders" in OVI Suite for this, and any time I put a photo into one of those folders, it will automatically get transferred to the phone?
    Solved!
    Go to Solution.

    Thanks for all the advice.
    It's nice to have the choice of both solutions:
    a) use the USB file transfer method, and copy photos (or whatever) into the appropriate folders as you guys suggested, and
    b) "use the 'Watched Folders' for this.. When you put any photo in this.. it will also be visible in the OVI Suite... then... Drag-and-Drop the photo on to the Phone Icon in the Bottom-Left window of the OVI Suite...
    If I had lots of time, I'd do it the first way.  If I was in a hurry, the second method is "easier" and sounds like it works the way I expected it to.  I will try both out tonight.
    (It's nice to know about the "watched folder" concept - I can put photos and things in it anytime, and the next time I run OVI Suite, it will be obvious as to what I intended to transfer.  Thanks!!)

  • How to get pixes of the String  ?

    In Stirng Object ,it'a provide String.length() to get the length of String ,But I tried to get the pixes of this Stirng . How can I do that?
    Best regards.

    Sorry,I would not describe this clearly.
    Exapmle we use below methed:
    public void paint( Graphics g )
    g.drawRect( 100,100 , 10, 10 )
    It's will paint a Rectangle with 10 "pixes" width and 10 "pixes" height on itself component .

  • How to get substring from a string?

    For example, there is a string:
    C-REVF-00003 0010 Development
    how the program get the value '0010'?

    Hi,
    Use Split command.
    Syntax
    SPLIT <c> AT <del> INTO <c1>... <cn> INTO TABLE <itab>.
    Searches the field <c> for the character <del> and places the partial fields before and after <del>
    into the target fields <c1> … <cn>, or into a new line of the internal table <itab>.
    Ex.
    DATA: STRING(60),
    P1(20) VALUE '++++++++++++++++++++',
    P2(20) VALUE '++++++++++++++++++++',
    P3(20) VALUE '++++++++++++++++++++',
    P4(20) VALUE '++++++++++++++++++++',
    DEL(3) VALUE '***'.
    STRING = ' Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5'.
    WRITE STRING.
    SPLIT STRING AT DEL INTO P1 P2 P3 P4.
    WRITE / P1.
    WRITE / P2.
    WRITE / P3.
    WRITE / P4.
    The output appears as follows:
    Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5
    Part 1
    Part 2
    Part 3
    Part 4 *** Part 5
    Regards,
    Bhaskar

Maybe you are looking for

  • How do I use the App store with macbook pro and mac pro

    I currently use the app store with the mac book, but want to buy (share?) apps and music with the mac pro. I can't find anything that specifically outlines how this works. I use SplashID with the macbook and an iPhone, and want to use it (and sync it

  • From Database pass in Provisioning job

    Hello SDN, I'm trying in a provisioning job to get some data from the database and then sending it back onto the database, here i found the 'from database' pass satisfying. The problem is i'm getting this wired error: "Fromsource ODBC is a illegal ty

  • Two hotmail account, 1 want to use, other has the dev account?

    I have two hotmail accounts (a .com and a .co.uk).  I've been using the .com one fine and its registered as a dev account (for mobile 8 - it would appear that it isn't for windows apps) but pretty much all my actual stuff I (personal) use is on my .c

  • Frozen Start screen

    When I try to start instead of an apple symbol I got a circle with a line through it and a flashing folder with a question mark in it. I then pressed apple s when trying to boot it and it says this message... .Looking for Kernel cache file 'system\li

  • Files as an audiobook

    I have a cd with an audiobook(mp3s) on it, but all the chapters are as seperate files, how can I merge them all together as one audiobook?