How to use counter in this case

in my selection screen i have billing doc no-vbeln.
in my ztable i have etimes a field.
when i enter a bill doc no and press f8, my etimes feild in ztable sets to 1.
my requirement is if i enter a bill doc as 97600654 for first time, etimes is 1.
for second time if i enter that same bill doc i.e 97600654 , etimes should be 2 and if third then 3 and so on.
if a new doc is entered then etimes is again 1.
how to code this..plz provide some code.

Hi Rudra,
First You need to create a Ztable(say ZTT_VBELN_COUNT) with Three fields MANDT VBELN ETIMES.
Now in your program add code as below;
DATA wa_vbeln_count type line of ZTT_VBELN_COUNT.
SELECT SINGLE * FROM ZTT_VBELN_COUNT INTO CORESSPONDING FIELDS OF wa_vbeln_count where VBELN = lv_vbeln.
IF SY-SUBRC EQ 0.
   wa_vbeln_count-etimes = wa_vbeln_count-etimes + 1.
ELSE
   wa_vbeln_count-vbeln = lv_vbeln.
   wa_vbeln_count-etimes = 1.
ENDIF.
MODIFY ZTT_VBELN_COUNT FROM wa_vbeln_count.
Regards
Karthik D

Similar Messages

  • How to use to_date for this case?

    Hi,
    I bind parameters in java code.
    The param type in java is Timestamp and the data type in table is date.
    Here is the sql section printted in log:
    2004-08-01 10:00:00.0 <= table.datetime
    Why there is a ".0" after second?
    And how to use to_date to convert "2004-08-01 10:00:00.0"?
    Thanks!

    Hi,
    Here are a few possibilities
    SQL> select cast(timestamp '2004-08-01 10:00:00.0' as date) from dual;
    CAST(TIMESTAMP'2004
    2004-08-01 10:00:00
    SQL> select to_date('2004-08-01 10:00:00.0','YYYY-MM-DD HH24:MI:SS".0"') from dual;
    TO_DATE('2004-08-01
    2004-08-01 10:00:00
    SQL> select to_date(substr('2004-08-01 10:00:00.0',1,19), 'YYYY-MM-DD HH24:MI:SS') from dual;
    TO_DATE(SUBSTR('200
    2004-08-01 10:00:00

  • How to use LIKE in this CASE?

    There are multiple values that start with "Aerospace".  All of them are going to be set to the same value.  I'm trying to write a Case Statement that will replace all of them with the new value, but i can't get the LIKE to work correctly.
      This can probably be done with REPLACE, but It's bugging me that I can't get the LIKE to work.  
    I've tried a few variations, but compiler hasn't like any of them.  I'm hoping to have one line of code that will work for all of the possible choices.
    What is the best way to use a LIKE or similar thing (such as CONTAINS) to set all of the fields with "Aerospace" at the beginning?
    Sorry for the small font above.  I didn't see how to change it.
    'New Sector Focus' = CASE sectorfocus
    WHEN sectorfocus LIKE 'Aerospace%' THEN '201010 - Aerospace & Defense'
    ELSE sectorfocus
    END

    CASE expression looks good. CASE blog: 
    http://www.sqlusa.com/bestpractices/training/scripts/casefunction/
    >Sorry for the small font above.  I didn't see how to change it.
    Use the HTML icon to edit the html code.
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to use recursive in this case?

    I have a tree showed in bweb rowser UI like this
    +- node1          
    | |
    | +- node_value1a    X 
    | +- node_value1b     
    | +- node_value1c      X
    |
    +- node2    X      
    | |
    | +- node2a      X
    | | |
    | | +- node_value2a1   X
    | | +- node_value2a2   X
    | |
    | +- node_value2b     X  
    |
    +- node3          
    |
    +- node_value3a    X 
    +- node_value3b     
    At the begining I will retrieve the user permission for each node value and show them as checked "X" , Each node have a biding userObject with property key and check status and other more(we will focus on node key name and check status only). The parent node will be calculated as checked only if all its children are checked. So every time user click one node or node value(node without children). I will re-calculate the all tree nodes status based on all node_value again and update all check box in UI page. This seems need to go from bottum up since I will do:
    . Upon the clicking of one node(can be any node) I will send a http request back to server with that node key name. I will then do the following:
    if it is uncheck requrest -> updated all its childrens as unchecked -> recalculate all its parent to update their check status to unchecked
    if it is check requrest -> updated all its children as checked -> recalculate all its parent to update their check status.(may be check or uncheck depend on other sibling node status).
    The porpuse is to update that user's access right.
    I get lost when I try coding this feature. Could sonebody here help me out ? Thanks

    So how far have you got so far?

  • How to use two split this method in my code

    How to use two split this method in my code
    if i got one string line which like this
    ("aa!bb!cc~ab!bc!cd") a
    nd want to use two split to spare ! and ~ this seal for my spare point how that output
    has come diff ?
    public static void main(String[] args) {
        String str = "aa!bb!cc~ab!bc!cd";
        String strs[]= str.split("~");
        String strE[]= str.split("!");
        int count =0;
        for(int j=0; j < strs.length; j++){
          for (int i = 0; i < strE.length; i++){   
              System.out.println(count + " " + strE);
    count++;
    the output how can it be like this
    0 aa
    0 bb
    0 cc
    1 ab
    1 bc
    1 cd

    Move your second slit inside the first loop, so you are splitting the substring, not the entire string.

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

  • Oracle:how to use max() function in case expression

    how to use max() function in case expression, Please explain with any example

    Hope this helps and should be self explanatory
    with t as
    (select 1 col,100 col2 from dual union
    select 2 ,100 from dual union
    select 2 ,200 from dual union
    select 3,100  from dual union
    select 3,200  from dual  )
    select col, case when max(col2)=100 then 'with 100 range'
    when  max(col2)=200 then 'with 200 range' end  from t group by col

  • How to use Counter and variable in xslt

    All,
    How to use Counter in XSLT, and How to do a increament for a count variable?
    How to use a Variable in xslt? and How to define variable inbetween XSLT
    If I am using
    Count=Count+1, its throwin an error ...
    Error: Text is not Supported Under a XSLT Element: $count=$count+1
    Regards
    Francis
    Edited by: Francis on Aug 23, 2012 9:33 AM
    Edited by: Francis on Aug 23, 2012 11:23 AM

    How to use a Variable in xslt? and How to define variable inbetween XSLT
    <xsl:variable name="VariableName">
    <xsl:value-of select='/ns0:SyncItemListEBM/ns0:DataArea/ns0:SyncItemList/corecomEBO:ItemSpecificationGroup/corecom:SpecificationGroup[corecom:Name = "GROUP_NAME"]/corecom:Specification[corecom:Name = "SPECIFICATION_NAME"]/corecom:ValueText'/>
    </xsl:variable>
    How to use Counter in XSLT, and How to do a increament for a count variable?
    You can make use of for-each tag, its simplified in XSLT where you dont need counter if at all needed then you can use of position() to identify the loop counter.
    Thanks,
    Vijay

  • HOW TO use DBDataSource in this situation?

    hi all,
      I add a Matrix on system Form(eg:BOM Form),then I want to use Matrix.LoadFromDataSource() to load data.
    the simple code is :
    SAPbobsCOM.Recordset oRecordset = (SAPbobsCOM.Recordset)SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRecordset.DoQuery("select ItemCode,ItemName from OITM ");
                SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)m_SboForm.Items.Item("MatrixFormUID").Specific;
                    SAPbouiCOM.DBDataSource oDBData = m_SboForm.DataSources.DBDataSources.Item("tablename");//this dbdatasource is added before
                    oDBData.Clear();//error occur in this code:Operation is not supported in system Form
                    oRecordset.MoveFirst();
                    while (!oRecordset.EoF)
    oMatrix.LoadFromDataSource();
    how to use LoadFromDataSource() in this situation?if evaluate every control,the speed is too slow.
    thanks

    The quick way is as I wrote you - bind it to datasource (you fill it cell by cell). The code is something like:
    omatrix.Clear()
    oColumn = oColumns.Item("Column name 1")
    oColumn.DataBind.SetBound(True, "table name", "itemcode")
    oColumn = oColumns.Item("Column name 2")
    oColumn.DataBind.SetBound(True, "table name", "itemname")
    oMatrix.LoadFromDataSource();
    There isn`t necessary the while (!oRecordset.EoF) cycle

  • Javascript error on - Help - Learn how to use Numbers with this online...

    I am trying to find out more about Numbers. I am using iTunes 9.1.1 on a Vista PC. I get a Javascript error in Internet Explorer 8 when I try to access:
    Help - Learn how to use Numbers with this online resource.
    http://help.apple.com/numbers/1.0
    The link redirects to the following page:
    http://help.apple.com/iwork/safari/interface/#tan727163ed
    The above page is blank except for boxes for Keynote Help, Pages Help, Numbers help, and a blank input field that seems to do nothing. Here is the Javascript error message from Internet Explorer 8:
    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
    Timestamp: Tue, 1 Jun 2010 20:55:54 UTC
    Message: This command is not supported.
    Line: 1
    Char: 41589
    Code: 0
    URI: http://help.apple.com/iwork/safari/interface/javascript.js

    Link also does not work for me in WIN 7 with IE8. However, it does work in Chrome in WIN 7. It also works in Safari on my G4. Suggest you try Chrome or it may work in another browser like FireFox or Safari in Vista.

  • How do I use count for this query?

    How do I display all the addresses in a table that have more than one (or >1) account number? I wasn't sure how or if I should use count along with group by and having to get the expected results.

    select address from tablename
    group by address having count(1) > 1;

  • How to use counter using PCI 6259

    Hello, users,
    I have a PCI 6259 board and use Labview 7.1.
    I'd like to repetitively count the photon signals at 10ms integration time. I want cumulative counts in every 1 sec (1000ms) (or 1 min (60000ms)) And I want to save counts into txt.file which is open in excel program.
    I am a beginner to use counter using PCI 6259 board.
    1. Could you explain default NI-DAQmx counter terminals, i.e., CTR 0 SRC, CTR 0 GATE, CTR 0 AUX, and CTR 0 OUT?
    2. How do I use them or how can I connect to count TTL pulse using PCI 6259?
    3. As I mention my purpose above, which example is the first step to start working my purpose?
    4. If you know good example, could you tell me about that?
    5. If anyone has labview example which is similar to my aim, could you give me some tips or your examples?
    Any hint, comment or advice would be appreciated.
    Thank you so much for your response.
    Leek2

    I have never used the PCI 6259 but have used counters many times with labview, the coding should be the same independent of the board.  What you want to do is finite buffered edge counting using a internal clock.  The best way to do this is to look at the examples programs and use the express vi to get started, then you can use this code to customize your program exactly as you need.
    To address your questions:
    1. CTR0 means "counter 0" the name of the physical resource sometimes listed at GPCTR0.  Each counter has 4 connections to the outside world:
    source "src"(for counting input TTL signals),
    gate (for synchronizing to external clocks and edges),
    out (for pulse-train out operations)
    and aux (specialty operations such as up/down counting and encoding)
    2.For event counting with internal clocking you will only use the src this is the input from the signal you wish to count (ie PMT discriminator for photon counting).
    3,4,5. Look at the count edge examples, there isn't one that does exactly what you want but I have done this with a 6602 (it has e counters) where I use one set of counters to set up a finite pulse train in your case 1000Hz with 1000 pulses, and another counter to edge count on an external pulse, with the source of this pulse routed from the out of the other counter.  Then you can start the task and read when 1000 samples are in the buffer (about 1 second later).
    Hope this helps,
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • How to use count sql statement?

    i've never used the count function and i'm not sure how to use it to print it onto a html page...my code is below...
    <%
    String tot = (String)session.getAttribute("total");
    int total = Integer.parseInt(tot);
    Class.forName("org.postgresql.Driver");
    // create connection url
    String URL2 = "jdbc:postgresql://dbhost/ug59sxn";
    // pass database parameters to JDBC driver
    Connection Conn2 = DriverManager.getConnection(URL2, "ug59sxn", "hupeswop");
    // query statement
    Statement SQLStatement2 = Conn2.createStatement();
    // generate query
    String Query2 = "SELECT COUNT(*) FROM userteam WHERE total > '"+total+"'";
    // get result code
    ResultSet SQLResult2 = SQLStatement2.executeQuery(Query2);
    int position = (int)SQLResult2 + 1;
    %>
    <TD valign=top>
    <P align=center><FONT size=+1>Welcome <%= session.getAttribute("fName") %> <%= session.getAttribute("surname") %><BR>
    Your Team, <%= session.getAttribute("teamname") %>, are currently lying in position <FONT color=red><% out.println(position) %></font>, with <FONT color=red><%= session.getAttribute("total") %></font> points.<BR>
    </FONT></P>
    <P align=justify>      Use the shorcuts on the left to visit different sections of the game.
    You can change your squad around to prepare for forthcoming games (fixtures can be found in the statistics section),
    transfer a player in to your squad to add some depth or replace injured members, or perhaps browse the statistics section to see how your team is doing in the FFL table.</P>
    <HR>
    <%
    SQLResult2.close();
    SQLStatement2.close();
    Conn2.close();
    %>
    i get the following errors:
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    An error occured between lines: 62 and 84 in the jsp file: /main2.jsp
    Generated servlet error:
    /home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:80: Invalid cast from java.sql.ResultSet to int.
    int position = (int)SQLResult2 + 1;
    ^
    An error occurred at line: 88 in the jsp file: /main2.jsp
    Generated servlet error:
    /home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:108: Invalid type expression.
    out.println(position)
    ^
    An error occurred at line: 88 in the jsp file: /main2.jsp
    Generated servlet error:
    /home/students/ug/ug59sxn/servlets-local/work/localhost/myapp/main2$jsp.java:111: Invalid declaration.
    out.write("</font>, with <FONT color=red>");
    ^
    3 errors, 1 warning
    if anyone can help me out, please do so..thanx in advance...

    You cannot cast a ResultSet object (or any other object for that matter) to a primitive (such as an int)
    Replace the following line of code:
    int position = (int)SQLResult2 + 1;with this:
    int position = 0;
    if(SQLResult2.next())
      position = SQLResult2.getInt(1) + 1;
    }Additionally I noticed that you have put single quotes around total in the following line:
    String Query2 = "SELECT COUNT(*) FROM userteam WHERE total > '"+total+"'";Are you sure that the total column in the userteam table is of string type? If not, you don't need the single quotes.

  • How to use counter as an start and stop trigger in 6009

    Hi ALL.
    I'm using USB 6009 as a subject of to acquire data.
    I would like to know on how to use the counter digital input as a start and stop trigger. 
    The acquisition will only start when the first pulse of the digital signal is received and it will stop when the desired number of pulse is received.
    I was trying to use the VI as attachment as my reference. However, after tried, the VI is not working for USB 6009 as the counter input cannot be used as a trigger.  
    I would be happy if anyone could suggest me some ideas on this matter.
    Thanks.
    Attachments:
    DigitalStartandStopTrigger.vi ‏32 KB

    Hi Kate. 
    Thanks for your response.
    For your information, I've design my VI using the counter method. However, it doesnt work well. Please see the figure below. The file also attached with this reply.
     At first, the first counter from Device 2 will start counting. If the counting equal 0, then the acquisition for Device 1/AIO also the counter of Device 1/ctr0 begin acquiring data and counting the edges respectively.
    However, when I did the test, it doesn't work as wanted. It is happened because when counter of device 2 in not equal to 0, the acquisition for Device 1 not happened as it will go to false state.
    Is there anything that someone could suggest on how to start the acquisition for device 1 only and if the counter of device 2 is equal to 1. I would like the acquisition of device 1 start only when the counter of device 2 is equal to 1. I cannot use the trigger as 6009 is not support for it. 
    -Fird- 
    Message Edited by Fird on 07-02-2009 04:28 AM
    Attachments:
    Acquire Data Test 4.vi ‏27 KB

  • How to use Compare and Swap (CAS) atomic function(Solaris specific) in C

    Hi,
    I have found cas32() atomic function in (solaris 10) </usr/include/sys/atomic.h> (and also there is another atomic.h header file in </usr/include/atomic.h> but this header file does not have any cas32() function declarations) the declaration of cas32 in <sys/atomic.h>
    is as follows
    extern uint32_t cas32(uint32_t *target, uint32_t cmp, uint32_t newval);
    extern ulong_t caslong(ulong_t *target, ulong_t cmp, ulong_t newval);
    extern uint64_t cas64(uint64_t *target, uint64_t cmp, uint64_t newval);
    extern void casptr(void target, void cmp, void newval);
    extern uint8_t cas8(uint8_t *target, uint8_t cmp, uint8_t newval);
    But the problem is when iam using these functions in c programs and compiling
    using gcc it is showing the following error.
    Undefined first referenced
    symbol in file
    cas32 /var/tmp//ccQcsnev.o
    And if i use the function other than cas32 group of instruction
    such as atomic_or_uint()
    whose declaration is extern void atomic_or_uint(uint_t *target, uint_t bits);
    in <sys/atomic.h> it is giving no error where as for CAS32 it showing as undefined symbol.Why it is giving like that we are not able to know.Is it the case that CAS32 instruction only available in Kernel mode and not available to user mode.Please inform us if anyone knows how to use cas32() instruction in the user C programs.As this is usefull for writing Nonblocking versions of stacks and Queues.Is there any way to write
    our own atomic functions?
    Rama

    You are trying to use the old kernel-only CAS functions, use the correct ones like:
    atomic_cas_32.
    DS

Maybe you are looking for