Need to compare two fields and populate the other fields.

Hi All,
I have scenario like this.
DATA: text1(150) type C
VALUE 'Step: SHORT DUMP; Scenario: PRE; Date :09.07.2007. Time :13:08:33.'.
DATA: text2(150) TYPE C
      VALUE 'Step: &; Scenario: &; &',
DATA: text_A(150) TYPE C,
          text_B(150) TYPE C,
           text_C(150) TYPE C.
Now I need to compare text1 and text2 and populate text_A, text_B and text_C as follows.
text_A = SHORT DUMP
text_B = PRE
text_C = Date :09.07.2007. Time :13:08:33.
Basically I need to fill text_A, text_A and text_A with the values in text1 which are replaced by '&'.
Can anyone suggest me a code snippet to do it?
Thanks in advance.
Regards
Ankit

Sorry for slow response - I'm in a different timezone I think... Well it's not a short algorithm, but you could try something like the following (there's probably a sweeter algorithm, but this is what occured to me overnight)... I realise that it's not foolproof as you could have words substituted in for the "&" that also appear in the original message text and that would skew the results...
Jonathan
report zlocal_jc_get_msgvars.
types:
  gty_char150(150)      type c.
parameters:
  p_text_1              type gty_char150 lower case,
  p_text_2              type gty_char150 lower case.
initialization.
  perform initialization.
start-of-selection.
  perform extract_msgv.
*&      Form  initialization
form initialization.
*" Default screen variables
  concatenate
    'Step: SHORT DUMP; Scenario: PRE;'
    'Date :09.07.2007. Time :13:08:33.'
    into p_text_1 separated by space.
  p_text_2 = 'Step: &; Scenario: &; &'.
endform.                    "initialization
*&      Form  extract_msgv
form extract_msgv.
*" Work out the values that have been substituted
*" into p_text2 to make p_text1
  data:
    l_text_a            type gty_char150,
    l_text_b            type gty_char150,
    l_text_c            type gty_char150,
    l_text_d            type gty_char150,
    l_tabix_1           type i,
    l_tabix_2           type i,
    l_word_1            type gty_char150,
    lt_word_1           type gty_char150 occurs 10,
    l_word_2            type gty_char150,
    lt_word_2           type gty_char150 occurs 10,
    l_result            type gty_char150,
    l_tabix             type sy-tabix,
    l_tabix_next        type sy-tabix,
    l_tabix_from        type sy-tabix,
    l_tabix_to          type sy-tabix,
    lt_tabix            type sy-tabix occurs 4,
    lt_result           type gty_char150 occurs 10.
*" Break the strings into words
  split p_text_1 at space into table lt_word_1.
  split p_text_2 at space into table lt_word_2.
  format reset.
  format color col_total.
  write: / p_text_1(80).
  write: / p_text_2(80).
  format reset.
*" Look at where the words in the shorter string appear in the longer
  loop at lt_word_2 into l_word_2.
    add 1 to l_tabix_2.
    write: / 'P_TEXT_2, Word', l_tabix_2, l_word_2.
    if l_word_2+0(1) = '&'.  "placemarker
      continue.
    endif.
*" examine the expanded version
    read table lt_word_1 into l_word_1
      with key = l_word_2.
    if not sy-subrc is initial.
      write: /
        'ERROR: Word not found in expanded version' color col_negative.
      continue.
    endif.
    l_tabix_1 = sy-tabix. "Where we found word from short msg
    append l_tabix_1 to lt_tabix.
  endloop.
*" add pointer to end of list of words too
  describe table lt_word_1 lines l_tabix_1.
  add 1 to l_tabix_1. "because we subtract 1 below...
  append l_tabix_1 to lt_tabix.
  loop at lt_tabix into l_tabix_from.
    l_tabix = sy-tabix.
    write: / l_tabix_from.
*" get the range of words we want by getting next tabix row
*" and subtracting 1
    l_tabix_next = l_tabix.
    add 1 to l_tabix_next.
    read table lt_tabix into l_tabix_to index l_tabix_next.
    if not sy-subrc is initial. "no more words...
      exit.
    endif.
    add      1 to   l_tabix_from.
    subtract 1 from l_tabix_to.
    loop at lt_word_1 into l_word_1
      from l_tabix_from to l_tabix_to.
      write: / l_word_1 color col_positive.
* Push into text_A, text_B, text_C, text_D
      case l_tabix.
        when 1.
          concatenate l_text_A l_word_1 into l_text_a
            separated by space.
        when 2.
          concatenate l_text_b l_word_1 into l_text_b
            separated by space.
        when 3.
          concatenate l_text_c l_word_1 into l_text_c
            separated by space.
        when 4.
          concatenate l_text_d l_word_1 into l_text_d
            separated by space.
      endcase.
    endloop.
  endloop.
  uline.
  format reset.
  format color col_group.
  write: / 'TEXT_A', l_text_a(80).
  write: / 'TEXT_B', l_text_b(80).
  write: / 'TEXT_C', l_text_c(80).
  write: / 'TEXT_D', l_text_d(80).
  format reset.
endform.                    "extract_msgv

Similar Messages

  • Compare two tables and log the difference

    Hi,
    I want to compare two tables and log the difference in new table with the fields as (old value,new value, column name). The column name should be the changes value column

    Can you show an example?
    SELECT Foo.*, Bar.*
       FROM Foo
            FULL OUTER JOIN
            Bar
            ON Foo.c1 = Bar.c1
               AND Foo.c2 = Bar.c2
               AND Foo.cn = Bar.cn
     WHERE Foo.key IS NULL 
        OR Bar.key IS NULL; 
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • TS2972 used to be able to pick out which songs in iTunes in my computer were not on a 2nd computer on homeshare in iTunes 10.  Now with V11, cant find the button that compares two libraries and finds the songs that are different.  Anyone know how to do th

    Used to be able to pick out which songs in iTunes in my computer were not on a 2nd computer on homeshare in iTunes 10.  Now with V11, cant find the button that compares two libraries and finds the songs that are different.  Anyone know how to do this now?

    Jneklason wrote:
    ~snip~
    I know this email is confusing and really hard to understand...perhaps now you will know how i've been feeling--lost and confused with all the mis-information, with a hit and miss phone, and out of time with all the 1 1/2 hr to 2 hrs EACH wasted on this issue.
    On top of all this, I can't even find out how to file a complaint with anyone higher up than Customer Service.
    I hate to tell you this, but you didn't write an email. You wrote a discussion post on the Verizon Wireless Community forum which is a public peer to peer forum. Unfortunately since you didn't mark your post as a question, the VZW reps that roam this community won't ever see your post. Before you re-post it, don't. Duplicate posts get removed from the community.
    I see there were several missteps both by the reps and yourself in your post. First you should have insisted on returning the phone within the 14 day return policy period. Second which Samsung Galaxy mini model did you purchase? The S3 mini or the S4 mini? Did you do any research prior to deciding on this device. The reps at that time deflected the easiest course of action, by trying to get you to replace the phone under insurance instead of returning the phone. The Early Edge payment option requires the current phone on the line using the early Edge must be returned to Verizon Wireless. Did you once considered going to a third party site like Swappa to purchase a gently used device for your daughter?

  • How to compare two images and display the difference on Front Panel

    HI..
    I have attached two images.
    I want to compare these two images and subtract the differenc from these two images and display the difference(the mouse) on the front panel
    Anyone can help me?
    Really thanks
    Attachments:
    IMG_2117.JPG ‏1677 KB
    IMG_2118.JPG ‏1650 KB

    The missing thing. You have to keep in mind that what you see is not the same as the camera sees.
    So when using IMAQ Substract it gives you the difference of the value of every single pixel!
    In order to find the mouse as only difference you have to manage that every other pixel value stays the same, e.g. with a proper lightening.
    At the other hand you can combine different filters or alogorithms to get the object, e.g. if the object is darker or brighter then everything else in the image you could use a threshold and then use morphologic operations to get the objects size and position.
    Christian

  • Comparing two tables and picking the records

    I have two tables A and B.  I have to compare a column ID in both table A and table B  A.ID=B.ID  And based on the above comparison if the match is found I need to pick the records from table A and if no match then need to pick the records from table B  My problem is if I join then I will have table A and table B as one record and will be difficult to separate out.  Please let me know how this can be acheived.  Thnx.

    I have two tables A and B.  I have to compare a column ID in both table A and table B  A.ID=B.ID  And based on the above comparison if the match is found I need to pick the records from table A and if no match then need to pick the records from table B  My problem is if I join then I will have table A and table B as one record and will be difficult to separate out.  Please let me know how this can be acheived.  Thnx.

  • Customer no to populate the Assignment field for Sales A/c using sort key

    Dear All,
    In 6.0, I am trying to get the Customer number to populate the Assignment field for Sales Account
    We have set the sales account to a 031 sort key - sort by customer, in FS00. When 031 is set, SAP goes to the BSEG table and looks at the KUNNR (customer) field and populates the Assignment field with what is in the KUNNR field of BSEG.
    The problem is: the customer number (KUNNR) does not contain any data in BSEG.
    The KUNNR field of all the other account lines for the document number are blank.
    Is it possible to bring the field in the General Ledger display?
    Does anyone know of a user exit or other solution?
    Thanks,
    Gov

    Hi,
    Check with SD consultant and use Copy control.

  • How to compare two amount colomns in the query ?

    Hi,
    I need to compare two amount colomns in the query and based on that i need to change the color of the colomn
    Is it possible by using exceptions.if yes please tell me how to do it.
    Regards
    Ansari

    Hi,
    you can give this a try:
    1) Create a formula keyfigure (Keyfigure A> Keyfigure B)* 1+(Keyfigure A< Keyfigure B)* 0, so here you get value as either 0 or 1,
    2) Hide this Formula Keygiure for display in the report, and create a exception on this Formula keyfigure for its value 0 or 1 with the desired colors.
    3) While defining the exception on the 3rd tab we get the option to specify the Columns for implication of this exception, their you can specify the desired 2 Keyfigures to be highlighted with the colors.
    Hope this helps ..
    Regards,
    Umesh.

  • Help needed to compare two Key Figures and show out put

    hello experts,
                       I am comparing the Sales data for two year/month. I need to compare these two KF and show the result only if one is greater than the other by 40%. Sample
    Jan/2008                             Jan /2007
    400                                      600
    500                                      300
    300                                      700
    600                                      400 
    The columns should be outputted only if Jan 2008 is greater than Jan 2007 by 40% for all customers in a business area. Thank you all in advance.
    Regards,
    -Akash

    Hi Akash,
    Your requirement could be met by
    Creating a Calculated Key Figure say variance = ( ( Jan2008 - Jan2007 ) / Jan 2008 ) *100
    Then create a new Condition on  Variance so as to display rows only when Variance > 40
    Hope this solves ur issue.Do revert
    Vasavi

  • How to populate the new field of R/3 in BW

    Hi,
    There was a requirement to modify the sap screen in the R/3.
    For the same a new field is created which populate the data via a table in R/3.
    Now I have to populate the same field in BW. I am working on 3.5 Version.
    In R/3 I have a data source and I am not able to see the same available in the data source
    The field is available in the extract structure but I am unable to populate the same in the data source.
    Kindly help.

    The Data Source is picked from the FM.
    Also,my requirement is to display the text values for the new field
    I am going to create a Generic Master Data which will fetch the data from the table which has fields (Code, Langu and the text) and replicate the same to BW.
    Now to populate the code in BW, I need to have the field in the data source and from there I can add the same code field in the bw comm/tran/etc...
    The code is available in the Extraction and not in the data source.
    At the reporting level I will extract the report based on key and text.
    I tried using ROOSFIELD to populate the field in the datasource, but I am not able to do the same.

  • How to populate the relavent fields when clicked on a field

    I am trying to populate the relevant fields of screen(MODULE POOL PROGRAM) when i am 
    clicking on a field. Search help/ value request is provided to that field.
    so Can any one help me with this scenario. IF POSSIBLE PLEASE SEND THE SOLUTION
    WITH THE CODES.
    POINTS WILL BE REWARDED.

    Hi
    use this for F4 help on field
    For F4 Values on Screen:
    PROCESS ON VALUE_REQUEST
    using module call starting with FIELD i.e FIELD field MODULE module
    There are number of function modules that can be used for the purpose, but these
    can fullfill the task easily or combination of them.
    DYNP_VALUE_READ
    F4IF_FIELD_VALUE_REQUEST
    F4IF_INT_TABLE_VALUE_REQUEST
    POPUP_WITH_TABLE_DISPLAY
    DYNP_VALUE_READ
    This function module is used to read values in the screen fields. Use of this
    FM causes forced transfer of data from screen fields to ABAP fields.
    There are 3 exporting parameters
    DYNAME = program name = SY-CPROG
    DYNUMB = Screen number = SY-DYNNR
    TRANSLATE_TO_UPPER = 'X'
    and one importing TABLE parameter
    DYNPFIELDS = Table of TYPE DYNPREAD
    The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD
    to this FM and the values read from the screen will be stored in this table.This
    table consists of two fields:
    FIELDNAME : Used to pass the name of screen field for which the value is to
    be read.
    FIELDVALUE : Used to read the value of the field in the screen.
    e.g.
    DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,
    SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.
    SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read
    APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table
    CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
    DYNAME = SY-CPROG
    DYNUMB = SY-DYNNR
    TRANSLATE_TO_UPPER = 'X'
    TABLES
    DYNPFIELDS = SCREEN_VALUES.
    READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.
    F4IF_FIELD_VALUE_REQUEST
    This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three
    parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
    TABNAME = table/structure
    FIELDNAME = 'field name'
    DYNPPROG = SY-CPROG
    DYNPNR = SY-DYNR
    DYNPROFIELD = 'screen field'
    IMPORTING
    RETURN_TAB = table of type DYNPREAD
    F4IF_INT_TABLE_VALUE_REQUEST
    This FM is used to dsiplay values stored in an internal table as input
    help.This FM is used to program our own custom help if no such input help
    exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD
    is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
    If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    RETFIELD = field from int table whose value will be returned
    DYNPPROG = SY-CPROG
    DYNPNR = SY-DYNNR
    DYNPROFIELD = 'screen field'
    VALUE_ORG = 'S'
    TABLES
    VALUE_TAB = internal table whose values will be shown.
    RETURN_TAB = internal table of type DDSHRETVAL
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    others = 3.
    POPUP_WITH_TABLE_DISPLAY
    This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE
    parameter.The VALUETAB is used to pass the internal table.
    A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .
    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING
    ENDPOS_COL =
    ENDPOS_ROW =
    STARTPOS_COL =
    STARTPOS_ROW =
    TITLETEXT = 'title text'
    IMPORTING
    CHOISE =
    TABLES
    VALUETAB =
    EXCEPTIONS
    BREAK_OFF = 1
    OTHERS = 2.
    e.g.
    DATA: w_choice TYPE SY-TABIX.
    DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,
    values TYPE I,
    END OF i_values.
    PARAMETRS : id TYPE I.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR id
    i_values-values = '0001'.
    APPEND i_values.
    i_values-values = '0002'.
    APPEND i_values.
    i_values-values = '0003'.
    APPEND i_values.
    i_values-values = '0004'.
    APPEND i_values.
    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING
    ENDPOS_COL = 40
    ENDPOS_ROW = 12
    STARTPOS_COL = 20
    STARTPOS_ROW = 5
    TITLETEXT = 'Select an ID'
    IMPORTING
    CHOISE = w_choice
    TABLES
    VALUETAB = i_values
    EXCEPTIONS
    BREAK_OFF = 1
    OTHERS = 2.
    CHECK w_choice > 0.
    READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained
    ...in the structure i_values.
    Other FM that may be used to provide input help is HELP_START .
    Regards
    Anji

  • Technical question:  Is it possible to work on the same Lightroom catalog across two computers and have the catalog sync? If so, how??

    Technical question:
    Is it possible to work on the same Lightroom catalog across two computers and have the catalog sync? If so, how??
    Here's a little more information on what I am trying to do.
    I have a desktop computer with 4tb worth of pictures that has Lightroom and Photoshop on it. I also have a laptop with Photoshop and Lightroom. I would like to be able to edit those same pictures with their current edits that are currently on my desktop on my laptop. If this can be done, I'm sure I need to be on the same wifi network for my laptop to be able to access my desktop's photo library. I am technically savvy enough to map a network drive, but how do I get my two Lightroom catalogs to sync when I make a change on one of my computers? Would i be working only on one catalog? Or two separate catalogs that would need to be manually synced to the other computer? Would it be beneficial to put my lightroom catalog on something like dropbox?
    I'd appreciate any information or tutorials if someone knows how to do this.

    I do this by having my LR catalog and photos on an external drive that I swap between the two computers.  I am on Windows and have the same drive letter assigned to the drive on both computers.
    Because the photos are on a portable drive I back up the portable drive to another hard-drive every night or after important work, because portable drives are susceptible to damage or loss.

  • How to populate the logical_group field in V_LTDX (table for layouts)?

    Hi,
    Scenario:
    I have implemented the ALV using CL_SALV_TABLE. In the grid we have a 'Choose Layout' button where we have the options of choose, change, manage etc. the layouts. If we create a layout, the layout is saved in the table LTDX(view: V_LTDX).
    Issue:
    How do we populate the 'Logical_group' field in the table while creating/changing the layouts?
    Please suggest..
    Regards
    s@k

    Solved..:)
    Solution:
    While creating the ALV grid, use the method 'get_layout' of the class CL_SALV_TABLE and get the reference of the layout in a reference variable.
    Data:
          gw_key       TYPE            salv_s_layout_key.
      gr_layout = gr_grid->get_layout( ).
      gw_key-report = sy-cprog.
      gw_key-logical_group = gc_log_grp." Pass the logical group here say logical group: 0001, 0002, etc. for each ALV
    So, whenever you create/ change a layout on the ALV grid, the system automatically passes this logical group and saves it in the table LTDX.
    Regards
    s@k

  • How to populate the Referance Field Through the Auto Invoice in credit memo

    HI ,
    I m populating the records in RA_INTERFACE_LINES_ALL and creates the cr Memo through the Auto Invoice ,
    but i m like to populate the Referance Field which is exist in Header part of the Cr Memo (Benith the TYPE).
    So plz help me,
    that which column of the RA_INTERFACE_LINE_ALL populates ,that gave me a data in the Referance Field .
    However this referance field is carried out from the table.Column =RA_CUSTOMER_TRX_ALL.ct_reference
    Plz Help..
    Regards,
    DK

    what you did?

  • How to populate the address field in real time from backend?

    Hi Guys,
    I want to populate the address field in srm portal when creating Shopping Cart. I got the data by using some BADI functions. Now the problem is I am not getting the structure/table where I should add that address so that it can reflect in the address field of shopping cart.
    Can anyone help me out?
    Regards,
    Virendra Kedia

    Joe - Work backwards from the value generated during the execution of the trigger. You have the value there so you could save it into a package variable right then (create a package with a variable and assign the value to the variable). Then create a process on the page (after the DML process) to assign the value of your package variable to a page item. Then in the branch back to page 1, pass the item. (Or without messing with the branch, the process could simply assign the package variable directly the the page 1 item -- :P1_ITEM := my_package.my_var; ).
    An alternative would be to use the "returning into" feature of DML to capture the PK of the created record into an item. Then the next page process could use the PK to fetch the new row and get the dbname value for passing to page 1.
    Another option would be to update session state directly in the trigger.
    Scott

  • I bought a 5th Gen Touch. I use iTunes 12 on two computers. One computer allows me to drag and drop. The other does not.The one that allows it has problems. Any idea as to why I can drag and drop on one and not the other. Both are authorized.

    I bought a 5th Gen Touch. I use iTunes 12 on my two computers. I first connected the Touch to my desktop and it allows me to drag and drop mp3 files from my old Classic, which is backed up to a directory. Unfortunately, that computer has gone down before I got a chance to fill the Touch. I have the files on another computer but when I connect the Touch to it, it doesn't allow me to drag and drop the files. I have iCloud set on both systems and I have manual management check marked. I'm not understanding why it allows drag and drop on one PC and not the other when they are both set the same way. My question? What do I need to do to be able to drag and drop in iTunes 12? I didn't do anything special on the computer that allows it so I am at a loss.
    Thank you!

    Oh, also want to add that the PC I'm currently using is:
    Windows Vista Home Premium Service Pack 2
    My other PC was:
    Windows 7 Ultimate
    My MacBook is:
    Max OSX 10.5.something (the last update available for it. .8 maybe? haha)
    Not sure if this stuff is important, but I thought I'd add it.

Maybe you are looking for

  • N70 v5.0638.3.0.1 battery life reduced issue

    I updated to v5.0638.3.0.1, and it seems like a BIG ISSUE of this FW release is that the battery drains a lot faster. for example, fully charged my phone saturday morning, used it for 4-5 SMS, 4-5 minutes of 3G Mobile Internet, maybe 5 minutes of cal

  • Verizon sent out an order I called to cancel, I returned the phones as they told me to, yet after months of calls, I am in the pre-collections stage

    So this journey started back in October. I was with sprint, and wanted out of their service, my contract was up, so I went with Verizon as they are the best in my area for service. My original order was for 2 iPhone 6's and an iPhone 5s. Upon finding

  • User forgot to add delivery costs to purchase order

    Got a user that forgot to add delivery costs to a purchase order, now it has been GR and IRd, now they want to add the delivery costs, of course they have to reverse the IR and possibly the GR as well, go to change mode and add this missing condition

  • Component gets disappeared from Frame

    I have Frame on which I have shown few buttons, but if I do leave the frame idle for more than 1/2 hrs button got disappeared, if I do resize the frame button appeared again, I did override the paint method for both Frame and Button. So I want to sto

  • Is there a solution for my battery?

    hi,guys and girls, i just bought a 8510p laptop a couple days ago, sadly to sya that the battery doesn't charge past 45% and then shuts down without any warning,. I am frustrated and wonder if i have got a dead battery? Any symptoms will indicator th