ABAP Trim Statement

hi,
Have an issue where special characters you can't see via se16 are at the end of a character field. I need a way to strip them off via abap. Is there a good way to do this? New to abap, so be gentle. Have tried about everything including shift. Is there a trim command that can be used?
Thanks in advance.

HI,
The VB "trim" sentence is CONDENSE in ABAP. But CONDENSE drops all spaces before and after the string. I think you are looking for something like mid$, Left$ or Right$ (in VB again).
You can use substrings to do that, like
Code:
    DATA: chars TYPE I.
chars = strlen( yourstring ) - 1.
IF yourstring+chars = yourspecialchar.
  yourstring = yourstring(chars).
ENDIF.
That mini-code sample takes the lenght of your string (minus the last character), and checks that last character. If that last one is the special one you are trying to drop, the sentence between IF-ENDIF drops it.
Substrings are used like
Code:
        string+pos1(pos2)
where pos1 is the amount of characters displaced from the beguinning and pos2 the number of characters taken.
IE: string+pos1(pos2) would be the same than VB's Mid$(string, pos1, pos2)
Wish it helps,
Cheers,
Chandra Sekhar.

Similar Messages

  • ABAP "WRITE" Statements for Debugging

    Just curious to know if one can use ABAP write statements in Update Rules for debugging and auditing, and where the results are actually written to, and if they're accessible via the AWB.
    Thank you.

    Jerry you can write to the monitor from within the update rules.
    The debug message you were going to write out instead go ahead and append your message to the monitor structure.
    FORM compute_data_field
    TABLES   <b>MONITOR</b> STRUCTURE RSMONITOR  
    USING    COMM_STRUCTURE LIKE /BIC/CS8ZTESTODS
             RECORD_NO LIKE SY-TABIX
             RECORD_ALL LIKE SY-TABIX
             SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
    CHANGING RESULT LIKE /BIC/VZTESTCUBT-INVCD_QTY
             RETURNCODE LIKE SY-SUBRC
             ABORT LIKE SY-SUBRC.
    You will then be able to view any messages you have added to the monitor in the monitor.
    Hope this helps.
    Cheers

  • Where to do the abap sql statement in sapscript (PO)

    Hi, all.
    Hope anybody can guide me to find a solution.
    My situation now is i have to do a purchase order in SAPSCRIPT starting from a standard po. I already found out all the related details as below:
    Program           SAPFM06P
    FORM routine      ENTRY_NEU
    Form              MEDRUCK
    So, now the problem now is I have to add some more data on my print out PO. After figure out for some time, I don't know where to do my abap sql statement. Like example, I want to retriece some data from the ADRC table. I opened the standard program SAPFM06P to add in the some sql statement, but i dun know where should i add in. Bcz if we straight away put the related ADRC field in our sapscript, it is useless, right?
    Thanks in advance.

    Thanks a lot.
    So, how should i add in code in order to fetch the data frm ADRC by using that routine. Because i only the codes like below. I don't where should i start add in.
    Form entry_neu using ent_retco ent_screen.
      data: l_druvo like t166k-druvo,
            l_nast  like nast,
            l_from_memory,
            l_doc   type meein_purchase_doc_print.
      clear ent_retco.
      if nast-aende eq space.
        l_druvo = '1'.
      else.
        l_druvo = '2'.
      endif.
      call function 'ME_READ_PO_FOR_PRINTING'
           exporting
                ix_nast        = nast
                ix_screen      = ent_screen
           importing
                ex_retco       = ent_retco
                ex_nast        = l_nast
                doc            = l_doc
           changing
                cx_druvo       = l_druvo
                cx_from_memory = l_from_memory.
      check ent_retco eq 0.
      call function 'ME_PRINT_PO'
           exporting
                ix_nast        = l_nast
                ix_druvo       = l_druvo
                doc            = l_doc
                ix_screen      = ent_screen
                ix_from_memory = l_from_memory
                ix_toa_dara    = toa_dara
                ix_arc_params  = arc_params
                ix_fonam       = tnapr-fonam          "HW 214570
           importing
                ex_retco       = ent_retco.
    endform.
    Or i come wrong place to add in any coding. Plz guide me.
    Thanks in advance.

  • Comparison between ABAP command statements in different versions

    Hi,
    I'm looking for information on version wise difference in ABAP statements. Can someone provide help in this area.
    I need a list of Commands along with there syntax in different versions of ABAP (ECC 5.0 and 4.7).
    Is there any system table where this information is maintained?
    Regards,
    Gajendra Bhatt

    Hi Gajendra ,
    I doubt if SAP has some document which shows the history of all ABAP commands as to how they behaved in which version. The only option you have is go through the following notes and compile the info manually -
    0000178452 Release upgrade from 4.0 to 4.5 for customers prog
    0000452229 Release upgrade from 6.10 to 6.20 for customer pro
    0000178725 Release upgrade from 4.5 to 4.6 for customer progr
    0000689951 Release upgrade from 6.20 to 6.40 for customer pro
    0000178482 Rel. upgrade from 3.0 to 4.0 for customer programs
    0000857904 0003 0.460 Upgrade from Release 6.40 to 7.0: Customer program
    0000367676 0061 0.450 Release upgrade from 4.6 to 6.10 for customer prog
    0000099025 0004 0.340 Change from 4.0A/B to 4.5A for customer programs 
    Cheers.

  • ABAP select statements takes too long

    Hi,
    I have a select statement as shown below.
    SELECT * FROM BSEG INTO TABLE ITAB_BSEG
                         WHERE  BUKRS = CO_CODE
                         AND    BELNR IN W_DOCNO
                         AND    GJAHR = THISYEAR
                         AND    AUGBL NE SPACE.
    This select statement runs fine in all of R/3 systems except for 1. The problem that is shown with this particular system is that the query takes very long ( up to an hour for if W_DOCNO consists of 5 entries). Sometimes, before the query can complete, an ABAP runtime error is encountered as shown below:
    <b>Database error text........: "ORA-01555: snapshot too old: rollback segment   
    number 7 with name "PRS_5" too small?"                                       
    Internal call code.........: "[RSQL/FTCH/BSEG ]"                              
    Please check the entries in the system log (Transaction SM21).  </b> 
    Please help me on this issue. However, do not give me suggestions about selecting from a smaller table (bsik, bsak) as my situation does not permit it.
    I will reward points.

    dont use select * ....
    instead u declare ur itab with the required fields and then in select refer to the fields in the select .
    data : begin of itab,
             f1
             f2
             f3
             f4
             end of itab.
    select f1 f2 f3 f4 ..
         into table itab
    from bseg where ...
    . this improves the performance .
    select * is not advised .
    regards,
    vijay

  • ABAP - CASE STATEMENT - How to get out of WHEN statement??

    Hi ABAP experts,
    I am implementing an User exit related to inbound Sales order.
    All my IDoc contain,  E1EDP02 001
                                   E1EDP02 002 segments.
    Case w_e1edp02-qualf.
    when '001'
    clear lv-tabix.
    lv-tabix = sy-tabix + 1.
    Read int_edidd into wa_edidd index lv_tabix.
    if wa_edidd-segnam = 'E1EDP05'
    if wa-e1edp05-qualf = '002'  " Always this is giving the current segment data. when i debug, it is showing QUALF = '001'. What should i do here to get the next segment data.
    EXIT.
    else.
    <statements>.
    endif.
    when '002'.
    <statements>.
    endcase.
    Can anyone tell me what should i do in the first WHEN statement to check the next segment qualifier.
    Thanks and Waiting for your answer.
    Regards,
    Creasy Matt

    ur question is not clear...
    Case w_e1edp02-qualf.
    when '001'
    clear lv-tabix.   
    lv_tabix = lv_tabix + 1.   "seems u want to loop wa_edidd
    Read int_edidd into wa_edidd index lv_tabix.
    if wa_edidd-segnam = 'E1EDP05'
    if wa-e1edp05-qualf = '002'  "            "is it the correct work area????
    EXIT.
    else.
    <statements>.
    endif.
    when '002'.
    <statements>.
    endcase.
    i think u can do like dis...
    Case w_e1edp02-qualf.
    when '001'
    LOOP AT int_edidd into wa_edidd .
    if wa_edidd-segnam = 'E1EDP05'
    if wa-edidd-qualf = '002'           
    EXIT.
    else.
    <statements>.
    endif.
    ENDLOOP.

  • ABAP FORM statement

    Hello all,
    I need some help in understanding structure of FORM statement.
    FORM formA TABLES i_t_data STRUCTURE Z_BIW_KNA1_S.
    Can someone explain me the significance of TABLES and STRUCTURE and their usage.
    Thanks a lot.

    Hi Sachin,
    normally you don't need to declare tables in a program. What you need is a work area that might look like a table. This can be done by:
    data: wa_kna1 type kna1.
    And if you are doing a select you should not use
    select * from kna1 ...
    you should use
    select * into wa_kna1 from kna1 ...
    If you need to know more about these programming details you should post your questions in the abap forum.
    Hope this helps!
    regards
    Siggi
    Message was edited by: Siegfried Szameitat

  • ABAP - Case Statement

    Hi ABAPers,
    I have an ABAP code just like the pseudo code below.
    Case Val.
    When 'A'.
    <Some Conditional Statements>.
    When 'B'.
    <Some Statements>.
    endcase.
    A and B values are depend on 'Val'.
    My program executes the above code almost everytime. when the conditional statement of Case (A) is successful, then I dont want my program to execute the case(B).
    When the conditional statement of case(A) is unsuccessful, then only i want to execute case (B). Can anyone please tell me how to correct my code to suit the above situation.
    Thanks,
    Creasy Matt
    Edited by: Vijay Babu Dudla on Jan 19, 2009 11:20 PM

    Why case statement does  not support for small alphabet letters ( a, b, c,..z) ?
    here i have attached some code .. this is not working for small letters but works for caps letter.
    what is the reason . ?
    PARAMETERS: uname(10) TYPE C.
    CASE uname.
       WHEN 'karthi'.  " but work for caps letter . when 'KARTHI'.
         WRITE: ' user name is' ,uname.
       WHEN OTHERS.
         WRITE 'Your name is not karthi'.
    ENDCASE.
    Thank you friends

  • Problem saving "space" in ABAP TRANSFER statement

    Hello all,
          I have an internal table that I loop through and write that data to a file using TRANSFER statement. Here is an exmaple of my code:
    data: l_xml_out type string.
    BEGIN OF itab_out OCCURS 0,
                record(some length) TYPE c,
             END OF itab_out,
    Here is an example Itab_out data
    RECORD1:
    " Bon Appetit "
    RECORD2:
    "Managment Co"
    LOOP AT itab_out
                  INTO l_xml_out.
            TRANSFER l_xml_out TO "somefile".
          ENDLOOP.
    When I transfer to file record1 is appended to record2 which i sfine but I am losing space for example I want "Bon Apetite Management Co" but I get "Bon ApetiteManagementCo"! (Space is gone). How do I preserve the space? I did reserach on SDN but could not get my problem resolved. Please provice any feedback if you can.
    Thanks.
    Mithun

    >
    Mithun Dha wrote:
    > Sorry, I might not have provided you all information. I know concatenate but my internaltable has like 20000 records and we are looping through those records into "string" type data variable and transferring to file. The internal table records I gave in my posting was just an example. Thanks for your quick feedback.
    >
    > Mithun.
    So, Can't you concatenate to string type? Yes, you have to concatenate before transfer for 20000 records.
    data: l_text(20) type c,
          l_text1(20) type c,
          l_string type string.
    l_text = 'This is text'.
    l_text1 = 'This is text1'.
    CONCATENATE l_text l_text1 into l_string SEPARATED BY space.
    write the concatenate within the loop and then transfer the string to data set.
    Edited by: Sampath Kumar on Nov 10, 2009 8:04 AM

  • ABAP Select statement performance (with nested NOT IN selects)

    Hi Folks,
    I'm working on the ST module and am working with the document flow table VBFA. The query takes a large amount of time, and is timing out in production. I am hoping that someone would be able to give me a few tips to make this run faster. In our test environment, this query take 12+ minutes to process.
        SELECT vbfa~vbeln
               vbfa~vbelv
               Sub~vbelv
               Material~matnr
               Material~zzactshpdt
               Material~werks
               Customer~name1
               Customer~sortl
          FROM vbfa JOIN vbrk AS Parent ON ( Parentvbeln = vbfavbeln )
                 JOIN vbfa AS Sub ON ( Subvbeln = vbfavbeln )
                 JOIN vbap AS Material ON ( Materialvbeln = Subvbelv )
                 JOIN vbak AS Header ON ( Headervbeln = Subvbelv )
                 JOIN vbpa AS Partner ON ( Partnervbeln = Subvbelv )
                 JOIN kna1 AS Customer ON ( Customerkunnr = Partnerkunnr )
          INTO (WA_Transfers-vbeln,
                WA_Transfers-vbelv,
                WA_Transfers-order,
                WA_Transfers-MATNR,
                WA_Transfers-sdate,
                WA_Transfers-sfwerks,
                WA_Transfers-name1,
                WA_Transfers-stwerks)
          WHERE vbfa~vbtyp_n = 'M'       "Invoice
          AND vbfa~fktyp = 'L'           "Delivery Related Billing Doc
          AND vbfa~vbtyp_v = 'J'         "Delivery Doc
          AND vbfa~vbelv IN S_VBELV
          AND Sub~vbtyp_n = 'M'          "Invoice Document Type
          AND Sub~vbtyp_v = 'C'          "Order Document Type
          AND Partner~parvw = 'WE'       "Ship To Party(actual desc. is SH)
          AND Material~zzactshpdt IN S_SDATE
          AND ( Parentfkart = 'ZTRA' OR Parentfkart = 'ZTER' )
          AND vbfa~vbelv NOT IN
             ( SELECT subvbfa~vbelv
               FROM vbfa AS subvbfa
               WHERE subvbfavbelv = vbfavbelv
               AND   subvbfa~vbtyp_n = 'V' )           "Purchase Order
          AND vbfa~vbelv NOT IN
             ( SELECT DelList~vbeln
               FROM vbfa AS DelList
               WHERE DelListvbeln = vbfavbelv
               AND   DelList~vbtyp_v = 'C'             "Order Document Type
               AND   DelList~vbelv IN                  "Delivery Doc
                  ( SELECT OrderList~vbelv
                    FROM vbfa AS OrderList
                    WHERE OrderList~vbtyp_n = 'H' )    "Return Ord
          APPEND WA_Transfers TO ITAB_Transfers.
        ENDSELECT.
    Cheers,
    Chris

    I am sending u some of the performance isuues that are to be kept in mind while coding.
    1.Donot use Select *...... instead use Select <required list>......
    2.Donot fetch data from CLUSTER tables.
    3.Donot use Nested Select statements as. U have used nested select which reduces performance to a greater extent.
      Instead  use  views/join .
    Also keep in mind that not use join condition for more for more than three tables unless otherwise required.
    So split select statements into three or four and use Select ......for all entries....
    4.Extract  the data from the database  atonce consolidated upfront into table.
      i.e. use INTO TABLE <ITAB> clause instead of using
    Select----
    End Select.
    5.Never use order by clause in Select ..... statement. instead use SORT<itab>.
    6.When  ever u need to calculate max,min,avg,sum,count use AGGREGATE FUNCTIONS and GROUP BY clause insted of calculating by userself..
    7.Donot use the same table once for Validation and another time for data extraction.select data  only once.
    8.When the intention is for validation use Select single ....../Select.......up to one rows ......statements.
    9.If possible always use array operations to update the database tables.
    10.Order of the fields in the where clause select statement  must be in the same order in the index of table.
    11.Never release the object unless throughly checked by st05/se30/slin.
    12.Avoid using identical select statements.

  • HELP FOR ABAP SELECT STATEMENT

    I am writing below query and getting below current result which is four rows. i would like to have result mentioned below in expected result which is single row.. any idea  how can i do that? It can be easily done in sql-plus using decode or union clause. but please suggest how to do it in abap.
    select distinct
           qmsm~qmnum
           qmel~qmtxt
           qmsm~mncod
           qmsm~pster
           qmsm~peter
           ihpa~parvw
           ihpa~parnr
    from qmsm
    inner join qmma
        on qmsmqmnum = qmmaqmnum
    inner join qmel
        on qmmaqmnum = qmelqmnum
    inner join ihpa
        on qmelobjnr = ihpaobjnr
    into table ztstnotifications
    where
    qmel~qmnum = '000100000166'
    and qmma~material = wa_material
    and qmsm~mncod in ('2','4')
    and ihpa~parvw in ('1A','ZY')
    order by qmsm~qmnum
           qmel~qmtxt
           qmsm~mncod
           qmsm~pster
           qmsm~peter.
    current result
    100000166    will it work                             2    22.10.2009 31.10.2009 SP 1000688
    100000166    will it work                             2    22.10.2009 31.10.2009 ZY AE001
    100000166    will it work                             4    01.01.2010 15.01.2010 SP 1000688
    100000166    will it work                             4    01.01.2010 15.01.2010 ZY AE001
    expected result
    100000166    will it work                             2    22.10.2009 31.10.2009  4    01.01.2010 15.01.2010  SP 1000688 ZY AE001
    Thanks

    I doubt you'll be able to do so in a straight way. I would try to use some imaginative ways, like define an addition internal table with the key fields of your query, and a "long string" field, where I'll add the returned rows.
    Or something like that. if you know the max number of rows this kind of join will return, add that number times the fields needed (parvw1, parnr1, parvw2, parnr2....) and use a LOOP to populate it.

  • Urgent , abap select statement error VBPA ...

    hi gurus,
    please tell me what is the wrong in the following select statment:
    it returns 4 dispite that the data is there in the table VBPA
    like this :
    VBPA
    Cl.                          :     200
    Document                :    0010002449
    Item                         :
    Funct                      :    PE
    Pers.No.  :                    100820
    SELECT SINGLE
      pernr
    INTO  w_pernr
    FROM  vbpa
    WHERE VBELN   EQ '0010002449'
    and   kunnr   EQ 'PE'.

    hi
    good
    wrong one ->
    SELECT SINGLE
    pernr
    INTO w_pernr
    FROM vbpa
    WHERE VBELN EQ '0010002449'
    and kunnr EQ 'PE'.
    SELECT SINGLE
    pernr
    INTO w_pernr
    FROM vbpa
    WHERE VBELN EQ 0010002449
    and kunnr EQ PE.
    change like this and check the difference.
    thanks
    mrutyun^

  • Urgent , abap select statement error ...

    Hi all ,
    here i attached my code , has anyone can tell me where is the error ???
    when i active this code , it showed :
    "comma without preceding colon(after select?)"
    thanks a lot !
    SELECT LIPSERDAT LIPSVBELN LIPSPOSNR LIPSVGPOS LIPS~LFIMG
    LIPSVRKME LIKPWADAT_IST LIKPKUNAG LIKPKUNNR LIKP~VBELN
    VBAPVBELN VBAPMATNR VBAPNETWR VBAPWAERK VBAPMWSBP VBAPNETPR
    VBAPPOSNR VBUPKOSTA VBUPWBSTA VBUPFKSTA VBUPPOSNR VBUPVBELN
    VBPAPARVW VBPAVBELN VBUKCMGST VBUKVBELN VBAKAUART VBAKVBELN
    INTO (
    WASTATUS-ERDAT , WASTATUS-VBELN , WASTATUS-POSNR ,
    WASTATUS-VGPOS , WASTATUS-LFIMG , WASTATUS-VRKME ,
    WASTATUS-WADAT_IST , WASTATUS-KUNAG ,WASTATUS-KUNNR ,
    WASTATUS-LIKPVBELN , WASTATUS-VBAPVBELN , WASTATUS-MATNR ,
    WASTATUS-NETWR , WASTATUS-WAERK , WASTATUS-MWSBP ,
    WASTATUS-NETPR , WASTATUS-POSNR , WASTATUS-KOSTA , WASTATUS-WBSTA ,
    WASTATUS-FKSTA , WASTATUS-VBUPPOSNR , WASTATUS-VBUPVBELN ,
    WASTATUS-PARVW , WASTATUS-VBPAVBELN , WASTATUS-CMGST ,
    WASTATUS-VBUKVBELN , WASTATUS-AUART , WASTATUS-VBAKVBELN )
        FROM ( LIPS inner join LIKP
               on  LIKPVBELN = LIPSVBELN
               inner join VBAP
               on  VBAPVBELN = LIPSVGBEL
               and VBAPPOSNR = LIPSVGPOS
               inner join VBUP
               on  VBUPPOSNR = LIPSPOSNR
               and VBUPVBELN = LIPSVBELN
               inner join VBPA
               on  VBPAVBELN = LIPSVBELN
               inner join VBUK
               on  VBUKVBELN = LIPSVBELN
               inner join VBAK
               on  VBAKVBELN = VBAPVBELN )
            WHERE
               LIPS~VBELN in P_SVBELN
               and LIPS~ERDAT in P_ERDAT
               and LIKP~KUNAG in P_KUNAG
               and LIKP~KUNNR in P_KUNNR
               and VBAP~VBELN in P_PVBELN
               and VBUP~KOSTA in P_KOSTA
               and VBUP~WBSTA in P_WBSTA
               and VBUP~FKSTA in P_FKSTA
               and VBPA~PARVW in P_PARVW
               and VBUK~CMGST in P_CMGST .

    sorry all ,
       i already removed the space on my code like that :
       but it still displayed the error .
    SELECT LIPS~ERDAT
    <b>*LIPSVBELN LIPSPOSNR LIPSVGPOS LIPSLFIMG
    *LIPSVRKME LIKPWADAT_IST LIKPKUNAG LIKPKUNNR LIKP~VBELN
    *VBAPVBELN VBAPMATNR VBAPNETWR VBAPWAERK VBAPMWSBP VBAPNETPR
    *VBAPPOSNR VBUPKOSTA VBUPWBSTA VBUPFKSTA VBUPPOSNR VBUPVBELN
    *VBPAPARVW VBPAVBELN VBUKCMGST VBUKVBELN VBAKAUART VBAKVBELN</b>    FROM ( LIPS inner join LIKP
               on  LIKPVBELN = LIPSVBELN
               inner join VBAP
               on  VBAPVBELN = LIPSVGBEL
               and VBAPPOSNR = LIPSVGPOS
               inner join VBUP
               on  VBUPPOSNR = LIPSPOSNR
               and VBUPVBELN = LIPSVBELN
               inner join VBPA
               on  VBPAVBELN = LIPSVBELN
               inner join VBUK
               on  VBUKVBELN = LIPSVBELN
               inner join VBAK
               on  VBAKVBELN = VBAPVBELN )
    INTO (WASTATUS-ERDAT)
    <b>*WASTATUS-VBELN, WASTATUS-POSNR, WASTATUS-VGPOS,WASTATUS-LFIMG)
    *WASTATUS-VRKME,
    *WASTATUS-WADAT_IST, WASTATUS-KUNAG,WASTATUS-KUNNR,
    *WASTATUS-LIKPVBELN, WASTATUS-VBAPVBELN, WASTATUS-MATNR,
    *WASTATUS-NETWR, WASTATUS-WAERK, WASTATUS-MWSBP,
    *WASTATUS-NETPR, WASTATUS-POSNR, WASTATUS-KOSTA, WASTATUS-WBSTA,
    *WASTATUS-FKSTA, WASTATUS-VBUPPOSNR, WASTATUS-VBUPVBELN,
    *WASTATUS-PARVW, WASTATUS-VBPAVBELN, WASTATUS-CMGST,
    *WASTATUS-VBUKVBELN, WASTATUS-AUART, WASTATUS-VBAKVBELN )</b>        WHERE
               LIPS~VBELN in P_SVBELN
               and LIPS~ERDAT in P_ERDAT
               and LIKP~KUNAG in P_KUNAG
               and LIKP~KUNNR in P_KUNNR
               and VBAP~VBELN in P_PVBELN
               and VBUP~KOSTA in P_KOSTA
               and VBUP~WBSTA in P_WBSTA
               and VBUP~FKSTA in P_FKSTA
               and VBPA~PARVW in P_PARVW
               and VBUK~CMGST in P_CMGST .

  • SAP ABAP Select Statement/ Queries

    Hi.
    select * from mver where matnr= itab-matnr
    and werks = itab-bwkey
    and perkz = 'P'
    and gjahr = gjahr1.
    there are option like 'P' and 'M' i need to select both of them like 'P/M'.
    how can u do tht.
    both "m" and "P" period buckets shd be populated with data and need to be added together to pull the zm001127.

    Hi,
      Create a range and then append both the value 'P' and 'M' to the internal table and use the range in the where clause.
      data: r_range type range of mver-perkz with header line.
    r_range-sign = 'I'.
    r_range-option = 'EQ'.
    r_range-low = 'P'.
    APPEND R_RANGE.
    r_range-sign = 'I'.
    r_range-option = 'EQ'.
    r_range-low = 'M'.
    APPEND R_RANGE.
    select * from mver where matnr= itab-matnr
    and werks = itab-bwkey
    and perkz IN R_RANGE
    and gjahr = gjahr1.

  • ABAP select statement !!

    Hi All,
    I want to write a query on SOOD table like:
    SELECT OBJTP OBJYR OBJNO OBJDES OWNNAM FROM SOOD INTO TABLE IT_SOOD
           WHERE OBJDES  LIKE 'String%'  AND
                 ( SDDAT BETWEEN LV_LASTRUN AND SY-DATUM )      AND
                 ( SDTIM BETWEEN LV_LASTTIM AND SY-UZEIT ).
    but this is not returning me data between the last run date/ last run time and current date/  time.
    Can anybody suggest how to modify the above query in order to fetch correct data.
    Thanks in Advance !!
    Vivek

    >
    vivek kulkarni wrote:
    > Hi All,
    >
    > I want to write a query on SOOD table like:
    >
    > SELECT OBJTP OBJYR OBJNO OBJDES OWNNAM FROM SOOD INTO TABLE IT_SOOD
    >        WHERE OBJDES  LIKE 'String%'  AND
    >              ( SDDAT BETWEEN LV_LASTRUN AND SY-DATUM )      AND
    >              ( SDTIM BETWEEN LV_LASTTIM AND SY-UZEIT ).
    >
    > but this is not returning me data between the last run date/ last run time and current date/  time.
    >
    > Can anybody suggest how to modify the above query in order to fetch correct data.
    >
    > Thanks in Advance !!
    > Vivek
    If the last run date was 01.09.2009 and the last run time was 11:00, this code will pick up data for all dates from 01.09.2009 but only if the time value is > 11:00; so if there was a run at 09:00 on 03.09.2009 you won't pick up that record - and I'm assuming that you would want to pick up that record.
    I think you should only be applying the time check to records where the date = LV_LASTRUN and for later records you should just be checking the date. Something like:
    WHERE (      (            sddat = lv_lastrun  
                                AND  sdtim > lv_lasttim   )
                     OR  (            sddat > lv_lastrun )

Maybe you are looking for

  • Error "Error while trying to synchronize audio and MIDI"

    i am getting this error when i just hit playback. i have a MOTU MKII, and i have no problem with playing music, from iTunes, for example. when i launch Logic, i checked that the audio drivers and devices are set sorrectly both in Logic and in system

  • X130e NO wifi in windows 8

    Hi I have had a problem with updating to windows 8. the wifi is off and I cannot connect to anything it just has in the connections WIFI (OFF). and is also greyed out in the pc settings. When I try and troubleshoot it just comes up with wifi capabili

  • Cannot view Armenian font

    Hello Friends, I am using a blackberry 8310 and anytime I try to view Armenian text on the browser all I get is a blue, filled-in square. For example, if someone writes something in Armenian characters on Facebook and I go to view it, it will show up

  • An error occurred saving the images to the chosen file location

    I am trying to save the scans from my HP Officejet 6500.  I receive the following error message: An error occurred saving the images to the chosen file location. I have Win 7. I can scan and save if I choose to use the picture option but I can't use

  • HT4437 Airplay doesn't work via my iphone anymore

    I've had my airport express for years and have been able to airplay via my iphone 4s. All of a sudden the icon as vanished and i can't play through the phone... I have restarted phone and soft reset the airport but no luck. any advise? Thanks, Jay