Want to compare values in knvv and cdpos

i have the value coming from this and this read statement is giving the new value for zterm in wa_knvv. :
CLEAR  wa_knvv.
READ TABLE it_knvv INTO wa_knvv WITH KEY kunnr = wa_final-kunnr
                                             vkorg = wa_tvko-vkorg.
and i am doing this read on cdpos to get the new and old value.
if wa_final-fkdat in s_indate.
read table itemp with key kunnr1 = it_kna1-kunnr.
loop at i_cdhdr where objectid = itemp-kunnr.
if i_cdhdr-objectid = it_kan1-kunnr.
wa_final-username = i_cdhdr-username.
clear i_cdpos.
read table i_cdpos with key OBJECTCLAS = i_cdhdr-OBJECTCLAS
                             OBJECTID   = i_cdhdr-OBJECTID
                             FNAME = 'ZTERM'.
if sy-subrc = 0.
    wa_final-zterm_old  = i_cdpos-value_old.
    wa_final-zterm_new  = i_cdpos-value_new.
    APPEND wa_final TO it_final.
  endif.
how to compare this zterm value coming in wa_knvv with cdpos new value.
and want to output the last new updated value in the ALV.
how can i do it.

934190 wrote:
Hi All,
I want to replace all the values in the result set of my query for one column as some string, how do i do that?
1. My query reults in Column A and Column B
2. Column A (Number - Data type)
3. Column B (Varchar - Data type)
4. Now I want to replace any value in column A as some text when it is not null, same for column B
Appreciate your inputs.
Thanks...Like this?
select decode(column_a, null, null, 'my_text') column_a, decode(column_b, null, null, 'my_text') column_b
  from my_tablePlease read {message:id=9360002}

Similar Messages

  • Want to retrieve values from TB028 and TB009

    Hi Experts ,
    I wanted to retrieve value of TB028-BEZ30 ( Description for occupation) depending upon field JOBGR in BUT000 , similarly in Table  TB009-TEXTSHORT(Short name for Address type) wanted to get the value depeding upon ADR_KIND in BUT021.
    But I am not able to retriev this value. I tried using some FMs too but they dont return either of these fields in their o/p parameters
    FM used :
    For retriving TB028 fields
                BAPI_BUPA_CENTRAL_GETDETAIL
    For retiving TB009 fields :
              FSBP_READ_ADDRESS_DATA
              BUP_TB009_SELECT_ALL
              BUPA_ADDRESSES_READ_ALL
    None of these returns the fields I want. Am I missing something here??
    Regards,
    Neel

    Hello Anitha,
    Since u have declared it as global variable there is no need to declare inside the routine.
    If useful award the points.
    Regards,
    Vasanth

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • Compare Solaris based processor and Intel processor for EBS

    We are planning to migrate our 9i database and Application(11.5.10.2) from Solaris to Linux.
    Also planning for some major hardware changes.
    We want to compare sparc V9 processors and Intel Processor.
    Please let us know any documentation which compares both processors
    - Bench marck for Solaris and Inter processors
    - Any calculation like 1 Inter processor = n Solaris based processor
    - Any other related topics .
    Thanks
    TT

    Hi,
    Please see the links referenced in the following threads.
    Hardware for Oracle E-Biz R12(12.0.4)
    Hardware for Oracle E-Biz R12(12.0.4)
    Hardware requirements for Oracle APPS
    Hardware requirements for Oracle APPS
    Question Regarding R12
    http://forums.tangosol.com/forums/thread.jspa?threadID=861380
    Sizing..
    Re: Sizing..
    Regards,
    Hussein

  • I want to compare two columns and replace any equal values with the value in a specific cell

    I want to compare the numbers in two columns and replace all matching numbers in the second columns with the corresponding value from a cell in the same row as the matching number. 

    Me too.
    Barry

  • HT201272 How do i see a list of the apps that have been downloaded and the dates and times and amounts?  Tried to follow the on-line thing but i want to compare what has been downloaded with my visa bill.  HELP!!

    How do i see a list of the apps that have been downloaded and the dates and times and amounts?  Tried to follow the on-line thing but i want to compare what has been downloaded with my visa bill.  HELP!!

    See this -> http://support.apple.com/kb/HT2727

  • I need to create a image using some numeric values and i want to display values in image,

    I need to create a image using some numeric values and i want to display values in image, Numeric values be enterd by text file, excel file or user input by dialog box,
    this is the sample if image.
    http://s17.postimg.org/5xvtzbztn/5_01_03_I.png
    128 x 16 Pixels , Back ground Black, Numbers in Red, Should be same as above picture.
    Because i have hundreds of images to create like this.
    If any one can make a script for this it is very good.
    Sorry about my English.
    Thank you.

    Have you checked out data driven graphics?
    https://helpx.adobe.com/photoshop/using/creating-data-driven-graphics.html

  • I wanted to ask whether the camera for ipod touch comparable to a digital camera? if not are there apps available that can turn it into a digital camera? i want to buy an ipod touch and i like photography....what should i do?plz suggest

    i  wanted to ask whether the camera for ipod touch comparable to a digital camera? if not are there apps available that can turn it into a digital camera? i want to buy an ipod touch and i like photography....what should i do? plz suggest

    The iPod touch has a very rudimentary camera.  It has only a 0.6 MP resolution, no optical zoom, no flash, etc.   There is no app that can improve this as it is limited by the hardware. So it is not a replacement for a digital camera (nor even for an iPhone whose camera has a 5.0 MP resolution.

  • Picking the value of PBEG and PEND incase of multiple entries 2002 on a day

    Hi Experts,
    Our client's business requirement is to have provision handling multiple entries multiple entries of same subtype of IT 2002 on same day with different Time entries.For example one IT 2002 Styp 1 has entry 10 am to 14 pm & other entry of IT 2002 styp 1 as 14 pm to 16 pm.
    In this scenario I want to have TWT with start time of 1st 2002 record i.e 10 & another TWT with end time of last 2002 record i.e. 16.
    I have written a PCR as
    OUTTPORIGS Origin status
        COLOP*     TIP  >TOP curr.TType
      P
        HRS=PBEG   Set
        ADDDB90T3  Add to day balance
        HRS=PEND   Set
        ADDDB90T4  Add to day balance
    But its giving me value of 2002 start time  as (1014=24) & END time (1416=30) respectively.
    Since TIP will have entries with origin E & A as well with P  and any entry can be 1st or last entry depending on time, I can't use VRSTFIRST & VARSTLAST.
    Please suggest me how to handle such scenario through PCR. Is there a way we can make decision on From & To of TIP entries.
    You can also suggest me if such need can be handled at masterdata level so that we can have just one entry
    Regards
    S S
    Hi All,
    Please also suggest me a better operation to pick the value of PBEG and PEND incase of multiple entries various subtypes of 2002 on same day.I need to compare start- end time of 2002 with 2011 entries and calculate total attendence hrs. Once again, I can't use VRSTFIRST & VRSTLAST as 1st & last TIP entry could be come from any infotype viz 2011,2002, 2001.
    Regards
    Sunita
    Edited by: Sunita on Feb 5, 2011 10:02 AM

    If you want to do it the T-SQL way, follow this article I wrote on deleting duplicates..
    http://sqlsaga.com/sql-server/how-to-remove-duplicates-from-a-table-in-sql-server/
    To read about what ranking functions does and how will they help you use this link..
    http://sqlsaga.com/sql-server/what-is-the-difference-between-rank-dense_rank-row_number-and-ntile-in-sql-server/
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • How to compare value of two Combo Box

    I've two Combo Box(cbFirst & cbSecond). I want to compare the value that has been selected by the user and based on the result, output is displayed. In both Combo Box I've provided the value.
    Here is my code:
    var a:Number;
    var b:Number;
    function First(evt:Event):void{
        a = evt.target.value;
        trace(a);   
    cbFirst.addEventListener(Event.CHANGE, First);
    function Second(evt:Event):void{
        b = evt.target.value;
        trace(b);
    cbSecond.addEventListener(Event.CHANGE, Second);
    If (a > b){
         trace("a is greater")
    else
         trace(b is greater);
    The trace statement inside the functions are working fine and the correct value of a & b is printed. But the comparison in the if statement doesn't seem to work. Could you please help me out.

    there's a typo.  fix it or remove it:
    var a:Number;
    var b:Number;
    function First(evt:Event):void{
        a = evt.target.value;
    trace(a);
       compareF();
    cbFirst.addEventListener(Event.CHANGE, First);
    function Second(evt:Event):void{
        b = evt.target.value;
        trace(b);
    compareF()
    cbSecond.addEventListener(Event.CHANGE, Second);
    function compareF(){
    If (a > b){
         trace("a is greater")
    else
         trace(b is greater);

  • How to use CDHDR and CDPOS tables

    Hello Gurus,
    How can the data be extracted from CDHDR and CDPOS tables ?
    For example, I want to find the changes for the material master, what is the object need to be given in the OBJECT value etc..
    I tried to use restricting the transaction MM02 and the date valid from and to, but it is taking longer time.
    Appreciate, if you can provide the objects which can be used to track the changed data like Production orders etc..
    Thanks
    Aadhya

    Hi Aadhya,
    For the Change Document Object (OBJECTCLAS), you can use the following item:
    MATERIAL = material master
    ORDER = production order/maintenance order
    EINKBELEG = purchasing document
    VERKBELEG = sales document
    The Object Value (OBJECTID) is usually the object's number, such as material number, production order number, etc.
    Get the Document Number (CHANGENR) and go to CDPOS to see the changes detail.
    Regards,
    Julian

  • How to compare values in resultset

    i am having problem in comparing result set values. Actually my store proc returns me the following resultset:
    Month | Year | Deductible | Troop | TDC | ReasonCode
    ------------|-----------|-----------------|------------|-------------|--------------------------
    January | 2008 | $100.0 | $0.0 | $0.0 | 1
    ------------|-----------|-----------------|------------|--------------|--------------------------
    January | 2008 | $0.0 | $10.0 | $0.0 | 1
    ------------|-----------|---------------- |-------------|-------------|-------------------------
    January | 2008 | $0.0 | $0.0 | $20.0 | 1
    ------------|-----------|-----------------|-------------|-------------|-------------------------
    March | 2008 | $150.0 | $0.0 | $0.0 | 2
    ------------|-----------|-----------------|-------------|-------------|--------------------------
    March | 2008 | $0.0 | $15.0 | $0.0 | 2
    ------------|-----------|-----------------|-------------|-------------|-------------------------
    March | 2008 | $0.0 | $0.0 | $30.0 | 2
    i will compare month and year fields. i.e if year is same the compare month and if month is same (e.g. January) the first three row of the above table will be clubbed in one row i.e.
    Month | Year | Deductible | Troop | TDC | ReasonCode
    ------------|-----------|-----------------|------------|--------------|--------------------------
    January | 2008 | $100.0 | $10.0 | $20.0 | 1
    how can i do it in my result set?

    Learn SQL
    "Select Month, Year, SUM(Deductible), SUM(Troop), SUM(TDC), ReasonCode from table Group By Month, Year, ReasonCode"Otherwise, loop through the resultset and compare the fields you want to compare using .equals() and sum the values yourself (of course).

  • Value of KNVV structure is not changing

    I am working in customer exit EXIT_SAPMF02D_001 of customer master in include program ZXF04U01
    Here, I want to update the 1 field of KNVV table. So I am changing the structure I_KNVV based on condition but as soon as I leave the form,
    it gets the orignal value of KNVV field.
    Example :
    KNVV-FLD1 = '500001'
    Now I am using  EXIT_SAPMF02D_001 - include program ZXF04U01 and I am getting  '500001' as I_KNVV-FLD1.
    So If I change KNVV-FLD1 = '500002' and continue process, It still gives me KNVV-FLD1 = '500001'.
    How can I change the value in ZXF04U01? I tried with ASSIGN COMPONENT but its not working. Is there anything special required for ASSIGN COMPONENT?
    REgards,
    RH

    Hello,
    This is not the right Customer exit to change KNVV structure,in this KNVV structure is only import parameter thats why it is clearing the knvv value as and when you come out of this. try another exit wchich has KNVV as changing parameter or in Table parameter.
    Thanks and Regards,
    Muralidhar.

  • Plant code like with CDHDR and CDPOS

    Hi Expert
    I have created a report to see the changes made for the following document from CDHDR and CDPOS tables and cluster respectively
    I want to know where I can find the Plant code in these above tables and if so how can i link with the above tables
    I need to display the report with range by plant code, document no, udate and parameter username
    regards

    hi,
    check this code
    TABLES : MARC.
    DATA :BEGIN OF GI_MARC OCCURS 0,
          MATNR LIKE MARC-MATNR,
          WERKS LIKE MARC-WERKS,
          DISPO LIKE MARC-DISPO,
          END OF GI_MARC.
    DATA : CHAR TYPE I,
           COUNT TYPE I,
           VAR TYPE I.
    DATA : BEGIN OF GI_FINAL OCCURS 2000,
           MATNR LIKE MARC-MATNR,
           DISPO LIKE MARC-DISPO,
           USERNAME LIKE CDHDR-USERNAME,
           UDATE LIKE CDHDR-UDATE,
           UTIME LIKE CDHDR-UTIME,
           TCODE LIKE CDHDR-TCODE,
           TABNAME LIKE CDPOS-TABNAME,
           TABKEY  LIKE CDPOS-TABKEY,
           FNAME  LIKE CDPOS-FNAME,
           VALUE_NEW  LIKE CDPOS-VALUE_NEW,
           VALUE_OLD   LIKE CDPOS-VALUE_OLD,
           CHANGENR LIKE CDHDR-CHANGENR,
           END OF GI_FINAL.
    DATA : MATNR LIKE MARC-MATNR,
           DISPO LIKE MARC-DISPO,
           USERNAME1 LIKE CDHDR-USERNAME,
           UDATE1 LIKE CDHDR-UDATE,
           UTIME LIKE CDHDR-UTIME,
           TCODE LIKE CDHDR-TCODE,
           CHANGENR LIKE CDHDR-CHANGENR.
    DATA : GI_CDHDR LIKE CDHDR OCCURS 0 WITH HEADER LINE.
    DATA : GI_CDPOS LIKE CDPOS OCCURS 0 WITH HEADER LINE.
    DATA : OBJECTCLAS LIKE CDHDR-OBJECTCLAS VALUE 'MATERIAL',
           OBJECTID LIKE CDHDR-OBJECTID,
           USERNAME LIKE CDHDR-USERNAME VALUE 'RSS-SPE',
           UDATE LIKE CDHDR-UDATE VALUE '20070101',
           CHANGE_IND LIKE CDHDR-CHANGE_IND VALUE 'U'.
    type-pools: slis.
    data: gt_slis_fcat type slis_t_fieldcat_alv.
    data: gt_fieldcat type slis_t_fieldcat_alv.
    *data: gt_fieldcatall type slis_t_fieldcat_alv.
    data: g_repid like sy-repid.
    data: gs_layout type slis_layout_alv.
    gs_layout-zebra             = 'X'.
    gs_layout-colwidth_optimize = 'X'.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-110.
    SELECT-OPTIONS :  P_DISPO FOR MARC-DISPO.
    SELECT-OPTIONS : RECORDS FOR CHAR.
    SELECTION-SCREEN : END OF BLOCK B1.
    START-OF-SELECTION.
    perform process_data.
    perform f_fieldcat_init using gt_fieldcat[].
    perform alv_display tables gi_final using gt_fieldcat[].
    form process_data.
      SELECT MATNR WERKS DISPO FROM MARC INTO TABLE GI_MARC
                                WHERE DISPO IN P_DISPO
                                AND WERKS = '1011'." Becoz we hav to chk the
    the changes made in the material while extendin tht matrl frm 1011 to
    *other plant.
      IF NOT GI_MARC[] IS INITIAL.
        IF NOT RECORDS-LOW IS INITIAL .
          IF NOT RECORDS-HIGH IS INITIAL.
            DESCRIBE TABLE GI_MARC LINES COUNT.
            IF RECORDS-HIGH < COUNT.
              DELETE GI_MARC FROM RECORDS-HIGH TO COUNT.
            ENDIF.
            IF RECORDS-LOW <> 1.
              IF RECORDS-LOW <> 0.
                DELETE GI_MARC FROM 1 TO RECORDS-LOW.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
      LOOP AT GI_MARC.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            INPUT              = GI_MARC-MATNR
         IMPORTING
           OUTPUT             = GI_MARC-MATNR
    EXCEPTIONS
      LENGTH_ERROR       = 1
      OTHERS             = 2
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        OBJECTID = GI_MARC-MATNR .
        CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
          EXPORTING
      ARCHIVE_HANDLE                   = 0
           DATE_OF_CHANGE                   = UDATE
            OBJECTCLASS                      = OBJECTCLAS
            OBJECTID                         = OBJECTID
      TIME_OF_CHANGE                   = '000000'
           USERNAME                         = USERNAME
      LOCAL_TIME                       = ' '
      DATE_UNTIL                       = '99991231'
      TIME_UNTIL                       = '235959'
          TABLES
            I_CDHDR                          = GI_CDHDR
         EXCEPTIONS
           NO_POSITION_FOUND                = 1
           WRONG_ACCESS_TO_ARCHIVE          = 2
           TIME_ZONE_CONVERSION_ERROR       = 3
           OTHERS                           = 4
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
             EXPORTING
                  TEXT = 'Processing'.
        IF NOT GI_CDHDR[] IS INITIAL.
          LOOP AT GI_CDHDR.
          MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
          MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
          MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
          MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
          MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
          MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
            VAR = 1.
            CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
              EXPORTING
                INPUT              = GI_FINAL-MATNR
                IMPORTING
               OUTPUT             = GI_FINAL-MATNR
             EXCEPTIONS
               LENGTH_ERROR       = 1
               OTHERS             = 2
            IF SY-SUBRC <> 0.
            ENDIF.
            OBJECTID = GI_FINAL-MATNR ."to ensure that objid is in proper
    *format
            SELECT *
                   FROM CDPOS
                   INTO TABLE GI_CDPOS
              PACKAGE SIZE 100
              FOR ALL ENTRIES IN GI_cdhdr
                   WHERE OBJECTID = OBJECTID
                     AND CHANGENR = GI_CDHDR-CHANGENR
                     AND OBJECTCLAS = OBJECTCLAS
                     AND CHNGIND =  CHANGE_IND." only those values will b
    *takn which have been modified nd nt created
            IF SY-SUBRC = 0.
              LOOP AT GI_CDPOS.
          MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
          MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
          MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
          MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
          MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
          MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
                MOVE GI_CDPOS-TABNAME TO GI_FINAL-TABNAME.
                MOVE GI_CDPOS-TABKEY TO GI_FINAL-TABKEY.
                MOVE GI_CDPOS-FNAME TO GI_FINAL-FNAME.
                MOVE GI_CDPOS-VALUE_NEW TO GI_FINAL-VALUE_NEW.
                MOVE GI_CDPOS-VALUE_OLD TO GI_FINAL-VALUE_OLD.
                  APPEND GI_FINAL.
                  CLEAR GI_FINAL.
               ENDIF.
                VAR = VAR + 1.
       ENDSELECT.
              ENDLOOP.
            ENDIF.
          ENDLOOP.
              CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
             EXPORTING
                  TEXT = 'Processing'.
        ENDIF.
      ENDLOOP.
      endform.
    form f_fieldcat_init using lt_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv.
       clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'MATNR'.
      ls_fieldcat-seltext_l    = 'Material number'.
    ls_fieldcat-tabname      = 'GI_final'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'DISPO'.
      ls_fieldcat-seltext_l    = 'mrp controller'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'USERNAME'.
      ls_fieldcat-seltext_l    = 'Username'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'CHANGENR'.
      ls_fieldcat-seltext_l    = 'Change Number'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'UDATE'.
      ls_fieldcat-seltext_l    = 'modified date'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'UTIME'.
      ls_fieldcat-seltext_l    = 'MODIFIED TIME'.
      append ls_fieldcat to lt_fieldcat.
    clear ls_fieldcat.
    ls_fieldcat-fieldname    = 'UDATE'.
    ls_fieldcat-seltext_l    = 'MODIFIED DATE'.
    append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'TCODE'.
      ls_fieldcat-seltext_l    = 'TRANSACTION CODE'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'TABNAME'.
      ls_fieldcat-seltext_l    = 'TABLE NAME'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'TABKEY'.
      ls_fieldcat-seltext_l    = 'TABLE KEY'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'FNAME'.
      ls_fieldcat-seltext_l    = 'FNAME'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'FVALUE'.
      ls_fieldcat-seltext_l    = 'FVALUE'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'VALUE_NEW'.
      ls_fieldcat-seltext_l    = 'NEW VALUE'.
      append ls_fieldcat to lt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'VALUE_OLD'.
      ls_fieldcat-seltext_l    = 'OLD VALUE'.
      append ls_fieldcat to lt_fieldcat.
    endform.                    " f_fieldcat_init
    form alv_display tables  gi_final using gt_fieldcat .
      call function 'REUSE_ALV_LIST_DISPLAY'
       exporting
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
       I_CALLBACK_PROGRAM             = ' Material list '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
         is_layout                      = gs_layout
         it_fieldcat                    = gt_fieldcat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        tables
          t_outtab                       = gi_final
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.
    regards
    siva

  • Comparing records in tables and displaying them

    Hi,
    I have 2 sets of data as follows:
    Set 1
    AcctName |EffDt |     ExpDt|     BalAmt|     Status|
    ABC|     1-Jan-11|     31-Dec-11|     47500|     Active|
    DEF|     5-Jul-11|     4-Jul-12|     46204|     Active|
    GHZ|     5-Feb-11|     4-Feb-12|     43251|     Active|
    Set 2
    AcctName | EffDt | ExpDt| BalAmt | Status|
    ABC | 2 Jan 2010 | 1 Jan 2011 | 47500 | Exp|
    XYZ | 5 Dec 2010 | 3 Dec 2011 | 46564 | Exp|
    ABC | 11 Nov 2010| 10 Nov 2011 | 40142 | Exp|
    I want to compare the set 2 data with set 1 data.
    I need to get an output such that:
    if there exists an Acct with same name and the ExpDt is equal to the Effdt then, the output should be the union of set 1 and set 2 and should not contain the that matching acct from set 2 since there exists a nonzero balanced latest Acct -
    AcctName| EffDt | ExpDt | BalAmt | Status|
    ABC | 1 Jan 2011 | 31 Dec 2011 | 47500 | Act|
    DEF | 5 Jul 2011 | 4 Jul 2012 | 46204 | Act|
    XYZ | 5 Dec 2010 | 3 Dec 2011 | 46564 | Exp|
    GHZ | 5 Feb 2011 | 4 Feb 2012 | 43251 | Act |
    ABC | 11 Nov 2010 | 10 Nov 2011 | 40142 | Exp|
    Can you please help me in comparing these sets and get the desired output?
    Note: Column Names
    AcctName -> Account Name
    EffDt -> Effective Date
    ExpDt -> Expiry Date
    BalAmt -> Balance Amount
    Thanks & Regards,
    869467

    Thanks for the reply.
    Please find the scripts for table creation & insertions below-
    create table set1(AcctName VARCHAR2(50), EffDt DATE, ExpDt DATE, BalAmt NUMBER(10), Status VARCHAR2(10));
    insert into set1 values('ABC','1 Jan 2011','31 Dec 2011',47500,'Active');
    insert into set1 values('DEF','5 Jul 2011','4 Jul 2012',46204,'Active');
    insert into set1 values('GHZ','5 Feb 2011','4 Feb 2012',43251,'Active');
    create table set2(AcctName VARCHAR2(50), EffDt DATE, ExpDt DATE, BalAmt NUMBER(10), Status VARCHAR2(10));
    insert into set2 values('ABC','2 Jan 2010','31 Dec 2011',47500,'Active');
    insert into set2 values('XYZ','5 Dec 2010','4 Dec 2011',46564,'Active');
    insert into set2 values('ABC','11 Nov 2010','10 Nov 2011',40142,'Active');
    Yes I need the output in almost the same way.
    The output should not contain those accts records from set 2 where there exists a record for it in set1 on the expiry date of that acct.
    Thanks & Regards,
    869467

Maybe you are looking for