Logic for date

hi all,
in the selection screen i have fields like BUKRS, COST CENTER, PROFIT CENTER, PERIOD, AND YEAR.
The problem is if i give period as 5 i.e., may and year as 2008
i need fetch the records from 1 st may to 31st may only.
can any one please help me how to write code for this.
thanks in advace

Hi,
you the code below :
ranges : gr_date for bsis-budat.
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
    EXPORTING
    i_gjahr              = sp_gjahr
*     i_monmit             = gp_monat
      i_periv              = 'K4'
      i_poper              = sp_monat "Period
IMPORTING
     e_date               = gv_firstday
EXCEPTIONS
   input_false          = 1
   t009_notfound        = 2
   t009b_notfound       = 3
   OTHERS               = 4
  CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
    EXPORTING
      i_gjahr              = sp_gjahr
*           I_MONMIT             = gp_monat
      i_periv              = 'K4'
      i_poper              = sp_monat "Period
   IMPORTING
           e_date               = gv_lastday
         EXCEPTIONS
           input_false          = 1
           t009_notfound        = 2
           t009b_notfound       = 3
           OTHERS               = 4
gr_date-sign = 'I'.
gr_date-option = 'BT'.
gr_date-low = gv_firstday.
gr_date-high = gv_lastday.
append gr_date.
"And use gr_date in the date field of select statement while
"retrieving the data.
"And declare period as T009B-POPER
Thanks,
Sriram Ponna.
Edited by: Sriram Ponna on Jun 19, 2008 12:29 PM

Similar Messages

  • Logic For Data Fetching

    I am doing a dump program for qp02 change inspection plan and  unable to fetch the data for qualitative and quantitative fields these fields can be x or '' . iam not getting the fields in plmk table..when i changed these fields STEUERKZ in plmk table gets reflected by adding
    X= . i think there is a different logic for it.If any one
    knows then pls reply me.
    regards.
    Sanchit Sharma

    Hi KR,
    if you want particular items from the table VBREVE (Revenue Recognition: Revenue Recognition Lines)
    Pass all the keyfields in where condition..
    try to provide maximum field values from below list in where condition... if you are not be able to get it directly then try to get it from some other tables and then paas it here...
    VBELN ==> Sales Document
    POSNR ==> Sales Document Item
    SAKRV ==> G/L Account Number
    BDJPOPER ==> Posting year and posting period (YYYYMMM format)
    POPUPO ==> Period sub-item
    VBELN_N ==> Subsequent sales and distribution document
    POSNR_N ==> Subsequent item of an SD document
    also have a look on other tables related to this...
    VBREF
    VBREVAC
    VBREVC
    VBREVE
    VBREVK
    VBREVR
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • Write custom logic for data archiving using Open text(SAP archiving)

    Hi,
    We are currently doing archiving for sales documents and billing documents using Open text. As part of this we need to have a search functionality based on Sales document,customer number, customer address etc...
    since customer address doesn't exist in sales order tables we need to write logic so that the document gets archived and retrieved using the address.
    can you please help me out in how and where to write logic for this...can this be achieved?
    i observed an area on Attribute Object for a Node which gives an option for Event and User exit. can this be used..if so how?
    Thanks,
    Anil

    hi,
    please write more detailed information what do you really need...

  • Formula Logic for Dates in the Cell Editor in Query Designer

    Hi All
    We are on BI7. (This is in the Cell Editor in Query Designer)
    I am trying to create a formula in one cell that enters a date based on the following logic (Lets call this formula A):
    I also have a placeholder "Cell reference" for a Date in another cell in the Cell Editor (Lets call it B).
    I also have two other dates in seperate cells in the Editor (Lets call them C and D)
    What i need to do is check that either C or D are not blank i.e one at least has a date and if so enter the date that is in B in A.
    My formula logic in (Cell A) at the moment is as follows:
    ( Cell C <> 0 ) OR ( Cell D <> 0) * Cell B
    When I run the query It is coming back with either a 1 or  0 depending if there is a date in C or D.
    What I want it to do is to display the actual date of  'Cell B'  in 'Cell A' if  ( Cell C <> 0 ) OR ( Cell D <> 0)
    If the value of B is blank ie no date I also want A to be blank i.e not equal zero or a blank date ie 00/00/0000
    Example 1
    Cell A    08/09/2009
    Cell B    08/09/2009
    Cell C   15/03/2010
    Cell D
    Cell A should = 08/09/2009 as there is a Date in Cell C or D and if so enter the date of Cell B in cell A
    Example 2
    Cell A   
    Cell B    08/09/2009
    Cell C  
    Cell D
    Cell A should = BLANK as there is a NO Date in Cell C or D
    Example 3
    Cell A   
    Cell B  
    Cell C   15/03/2010
    Cell D
    Cell A should = BLANK as there is a No Date in Cell B although a Date in cell C or D.
    Thank you for assistance in advance
    Kind regards
    Stevo

    Hi there,
    It seems you have done almost everything...
    What it seems that is missing is probably the cell reference for Cell C and for Cell D, or did you forget to mention it here?
    So here it is the big idea:
    - In the Cell Editor of the query designer, create a new cell reference for Cell C, let's name it ref_cell_c;
    - In the Cell Editor of the query designer, create a new cell reference for Cell D, let's name it ref_cell_d;
    - In the Cell Editor of the query designer, create a new cell reference for Cell B, let's name it ref_cell_b;
    - In the Cell Editor of the query designer, create a new formula for Cell A, let's name it form_cell_a;
    The form_cell_a should be created by the following:
    ( COUNT(ref_cell_c) + COUNT(ref_cell_d) ) * ref_cell_b
    So COUNT(operand) returns 1 if operand is different of 0 else it returns 0; So if ref_cell_c has any valu or ref_cell_d has any value it should return the value of ref_cell_b.
    Please note that with this formula, if you have values in both ref_cell_c and ref_cell_d this formula returns 2 * ref_cell_b, which is not what you pretend, I'm assuming you'll have value only for the following combinations:
    ref_cell_c has value but ref_cell_d don't have any
    ref_cell_c don't have any value but ref_cell_d has a value
    ref_cell_c don't have any value neighther has ref_cell_d any
    Diogo.

  • Calculation logic for date with respect to time.

    Dear all,
    In BI, i want to get the time for two different dates - how to caculate this
    For example
    Initial date :- 01.08.2007
    Final date :- 24.08.2007  - I want system to calculate the total hours between these dates - the logic should also be applicable if years,months and days are different.
    Regards,
    M.M

    Dear ....
    By subtracting final from the initial we will be able to get if the difference is only in days but if the month or year is differing will the same logic hold good - kindly explain?
    Regards,
    M.M

  • Logic for data transfer

    Hello,
    I have a requirement, wherin there are 10 tables for which the data changed/inserted/deleted for any field needs to be transferred to third party.
    I have gone through the change pointer concept and found that SAP does not recommend this as this will create large number of change pointers in the system
    Second option was to create techincal log for each table to log the change.But here again it will slow down the system as everytime system has to write the log when updating the table.
    Third option was to write report to get all the record for a particular date based on change date from the table and write down into custom table. The custom table is then treated as source. But here the problem comes when there is no 'Change date' field in the table. For some table we do not have change date field.
    Can somebody suggest what should be the best approach to filter the changed data.
    Thank you!
    Arvind

    Hello Arvind,
                       why not u try to achieve IDOC's concept as whatever the change will occur in Database that will store in idoc.And most beneficial thing is this that u can see idoc whenever u want and can easily find out what changes has done by which idoc.So i suggest u to try IDOCs.
    Thanx,
    Vaneet Thakur

  • Basic logic for date

    Hi Folks,
    I have a v_date variable to hold a date value.Now my requirement is:
            v_date:= SYSDATE+2 if date is going to change in next 1 Hour.
    Else assign v_date:= SYSDATE+1
    How to achieve it please.
    Thanks in advance.
    gvk.

    Hi,
    Here's one way:
    v_date := SYSDATE + CASE
                            WHEN  SYSDATE <= TRUNC (SYSDATE) + (23/24)
                            THEN  1
                            ELSE  2
                        END;

  • Treasury - Cash Management 0TR-CM-1 logic for Data Source

    Hi all,
    I am trying to understand how the value of the DATA_SOURC field in the extract structure FTI_BIW_CM in DS 0TR-CM-1 is populated. This value propagates to the InfoProvider (0TRCM_RC1) and standard content queries have a hard-coded restriction to a value of '2' The DS is returning values of 1 and 2 and I need to understand the implications of the two values. The help pages don't provide this information.
    Any help is greatly appreciated.

    Hi,
    Extractor 0TR_CM_1 reads from table FDSB and FDSR. Not sure what could be
    the reason for this code to avoid zero values. Please check with application
    colleagues if zero values are allowed for this field in ECC system.
    Thanks,
    Vimal

  • Need logic for invoice due date and discount due date uncear

    Hi Experts.. am new to ABAP
    i had an issue please need some logics for these..
    Formatting of the Invoice due dates and Discount due date is unclear e.g 20101109,
    Invoice due date and Discount due dates are in correct on 10 and 20 days  reminders on missing credit notes for blocked invoices.
    <removed by moderator>
    Thanks & Regards
    Edited by: Thomas Zloch on May 18, 2011 1:55 PM

    Can you provide more info?
    are you talking about BSID open accounts?
    if yes, use function module DETERMINE_DUE_DATE.
    <removed by moderator>
    Edited by: Thomas Zloch on May 18, 2011 2:10 PM - please do not ask for "award"

  • Logic for finding transfer order creation date for a given delivery??

    Hi,
    I am trying to find a logic for connecting the table LTAK which has ERDAT as the T.O. creation date with LIKP/ LIPS table.
    Can you please help me with this information. 
    Regards,
    Peeyoosh.

    Hi,
      Go to LTAP to get the transfer order number based on delivery ltap-vbeln. Then got to ltak to get the Creation date.
    Hope it helps
    Vinod.

  • Logic for sending data files to multiple instances of Central

    We are using Central Pro Output Server 5.6 with a single Central instance as of default installation on a Windows Server 2003. Data for the transaction files coming from our iSeries system via a printer queue (\\.\pipe\jetform\queuename)
    Now we want to be able to produce more documents from Central much faster and therefore setting up multiple instances of Central. The problem is then where to put the logic for choosing instances.
    The simplest way to do this would be to have iSeries to alternate the data files to different pipes (printer queues) for Central. But as we dont want to change our iSeries configuration for this, is there a way to solve this problem in Central?
    Any help with this is much appreciated

    Central provides no mechanism that I'm aware of that would do anything resembling the job distribution that you are wanting. Central is written to monitor it's input folders and process the files it finds there. Each instance is essentially separate from each other.
    Your source system will need to select the appropriate instance to be used. Either that or you will need to have something between the source system and Central that is doing the distribution. For example, you could have the source system write to a folder that is not being monitored by Central and write a program that runs as a service that does monitor that folder. This program would then distribute the files. The likely drawback of having an intermediary program is that you are likely to not end up getting the documents printed any faster than with a single instance.
    Another possible way, if the source system can create files with different file name extensions, would be to have them all written to the same folder and have each instance checking that particular folder but looking for files with different extensions. This might be problematic, though, because it might also end up with each instance watching the same "control" folder so that doing things like pausing Central would end up with no control of which instance was going to be paused.
    The default setting for Central has it pausing for 5 seconds if it completes a job and there are no more files waiting for it. If your jobs are not coming in faster than Central is processing them then you would be getting some of this delay for your jobs. You could reduce this time or even set Central to process a job as soon as it shows up. I don't know if version 5.6 still has the problem but an earlier version would not "see" a file if it happened to show up exactly when it was looking for more (it was probably showing up milli-seconds after Central looked). This caused that job to just sit there until the next job showed up.
    A major factor in getting the documents produced faster is going to be the speed and number of printers that they are going to - plus the number of pages in each document. For us, the single instance of Central that we are currently using can produce print much faster than our HP9050 printers (50 ppm) can actually print it.
    You must be doing a lot of forms or each job is doing a lot of processing. Our typical print job does 4 tasks (depending on the job this can include things like: passing the file through the transformation agent, updating a mainframe database, FTPing the file to another server for archiving, and producing the print). A typical job with 11 output pages takes only 2-3 seconds. We have a task that runs every morning that retrieves mainframe generated jobs. I just checked one of our servers and it processed 208 jobs in exactly 8 minutes (26 jobs per minute at an average of 2.3 seconds per job). We also thought we'd need multiple instances due to speed but that just isn't the case for us. We have other reasons to move to multiple instances but speed in not a major factor any more.

  • Select - next  logic for copy data

    Hi,
    I have 3 main values from an excel template: a specific data value (i.e. 35), in that same template one is TIME  and the other one is  $$$.
    What I have to do is copy  the $$$ amount starting from the date set in the template (TIME) through X number of months (i.e.35).
    All this is going to be obtained from a template, I cant use prompt.
    Lets say:
    X: 35
    $$. 100
    TIME: 2011.July
    To do:
    Repeat 35 times the amount 100, starting from 2011.July to the next months.
    Therefore, 2011.August, 2011.September,etc,etc---> 2012.Jan....2013-Jan  and so on until the 35 months are reached.
    I am trying to make some logic using the Select command, however I dont quite understand how to perform this. Equally using the logic NEXT i think it will be helpful.
    Any suggestions...? I cant share my logic because im still trying and mine does not work.
    Thanx in advance.
    Velázquez

    Hi Madis,
    Thanx for the response, i reaally appreciate it.
    I created the dim DURACION as user defined. Included for the moment 25 members (numbers) and it wasnt matched to any application.
    Now, the script where i am working is called Test.
    1. I typed in my script the following:
    **SELECT (%MYSET%,ID,Duracion,"[ID]<=MYDURACION")
    2.Entered to BPC Excel - eData - organize package list - select script Test  and added the following:
    'DEBUG(ON)
    PROMPT(RADIOBUTTON,%CHECKLCK%,"Select whether to check work status settings when running logic.",1,{"Yes, check for work status settings before running logic","No, do not check work status settings"},{"1","0"})
    PROMPT(SELECTINPUT,,,"Please select category, entity and time for restatement",%TIME_DIM%)
    PROMPT(Text,%INPUTDURACION%,"Enter No of duracion",,"")
    TASK(Execute formulas,USER,%USER%)
    TASK(Execute formulas,APPSET,%APPSET%)
    TASK(Execute formulas,APP,%APP%)
    TASK(Execute formulas,SELECTION,%SELECTIONFILE%)
    TASK(Execute formulas,FORMULASCRIPT,"FUNCTION MYDURACION=H%INPUTDURACION%")*
    TASK(Execute formulas,LOGICFILE,%APPPATH%..AdminApp%APP%TestAlldoraVentas2.lgx)
    TASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    TASK(Execute formulas,CHECKLCK,%CHECKLCK%)
    Now... im having trouble because after validating & saving, it shows the error:
    - Invalid column name 'MYDURACION' in:select ID from mbrDURACION where <=MYDURACION
    Can you please help me...
    So far, I have the following logic for performing a "calc each period"  once  YEAR.MONTH  is introduced by a prompt.
    The xdim members are making reference to a particular situation, the important stuff here is that if I pass a hardcored # of periods to the XDIM - next logic it works, and im trying to apply your suggestion...
    *CALC_EACH_PERIOD
    *XDIM_MEMBERSET lob=servicios_out
    *XDIM_MEMBERSET consumibles=consumibles_dummy
    *XDIM_MEMBERSET vendedor=04
    *XDIM_MEMBERSET cliente=5
    *XDIM_MEMBERSET oi=400000
    *XDIM_MEMBERSET TIEMPO=%tiempo_set%,next
    *WHEN METRICA
    *IS importe
    *REC(metrica="importe",tiempo=next(1))
    *ENDWHEN
    **SELECT (%MYSET%,ID,Duracion,"[ID]<=MYDURACION")
    However, is there still a way to pass a # of periods by excel?... this is, not using a prompt but by reading the number form a specific CV ?
    Thanx again
    Velázquez

  • Need to build communication redundancy using serial RS-232 for Data Transfer b/w Host and RT irrespective of TCP/IP Data Transfer

    Hi - I would like to build the logic in which it should accomodate the communication redundancy using serial RS-232 for Data Transfer b/w Host and RT irrespective of TCP/IP Data Transfer.
    I want to do data transfer b/w host and RT through RS232 VISA portal whenever TCP/IP ethernet cable has been unplugged from the controller continuosly , it should keep on checking for TCP/IP link re-establishing also , when ever the tcp/ip link established again that time the communication should be using in that link only. This is accomplished by deploying the RT vi as execuatbale file. I made some logic regards to the above said logic , bur it was not working as much I expected.
    I request you to go through the attached two VI's and let me know , what I did wrong in that,
    Please do the needful.
    Attachments:
    TCP_Serial_Host.vi ‏33 KB
    TCP_Serial_RT.vi ‏41 KB

    even i am new to this topic and i am trying to get familiar with these protocols
    refer to tcp server/client examples in labview examples

  • Sql queries for date and year

    Hi Friends,
    I Have a view named - item_sales with 4 column
    Item code
    Item name
    Transaction_YYYYMM (Date stored in YYYYMM format )
    QTY_RECEIVED
    QTY_SOLD
    Sample data is
    ITEM_CODE ITEM NAME  TRANSACTION_YYYMM     QTY_RECD    QTY_SOLD
    AX             TSHIRT                201307                             3000               2000
    AX             TSHIRT                201308                             2000               500
    AX             TSHIRT                201309                             1000              3000
    CX             XLSHIRT              201307                              3000             2000
    CX             XLSHIRT              201308                              3000             2500
    CX             XLSHIRT             201309                               3000             2500
    EVERY MONTH END I WILL RUN THIS QUERY TO FIND OUT THE BELOW DETAILS
    1. TO FIND ITEM_NAME WISE  -  QTY_RECEIVED AND QTY_SOLD ( FOR CURRENT MONTH - EXAMPLE SEP )
    2. TO FIND ITEM_NAME WISE  -  QTY_RECEIVED AND QTY_SOLD   (FOR CURRENT YEAR EXAMPLE FROM JAN TO SEP )
    OUTPUT FOR SEPTEMBER MONTH LOOK LIKE THIS
                                                            SEP-MONTH                              JAN TO SEP
    ITEM_CODE   ITEM_NAME    QTY_RECEIVED  QTY_SOLD      QTY_RECEIVED  QTY_SOLD
    AX                TSHIRT                   1000                 3000                 6000                 5500
    CX                XLSHIRT                  3000                2000                 9000                 7000
    Pls advise me how to write queries for this
    Rdk

    Just FYI, you *can* edit your own posts, you know
    Rdk wrote:
    Transaction_YYYYMM (Date stored in YYYYMM format )
    First "problem". Don't store dates as string. Store them as dates. It will save you so much headache don't the road you won't believe it.
    True, this is a view, so maybe not as critical - assuming the underlying *DATA* is actually a date.
    1. TO FIND ITEM_NAME WISE  -  QTY_RECEIVED AND QTY_SOLD ( FOR CURRENT MONTH - EXAMPLE SEP )
    2. TO FIND ITEM_NAME WISE  -  QTY_RECEIVED AND QTY_SOLD   (FOR CURRENT YEAR EXAMPLE FROM JAN TO SEP )
    So yeah, based on these requirements, I'd recommend you make that column a DATE, not a string. Dates are easier to parse for date-related logic - such as month by month as you need here.
    Using that, here's one way to do it:
    with w_data as (
          select 'AX' item_code, 'TSHIRT ' item_name, to_date('20130701','yyyymmdd') trans_dt, 3000 qty_recd, 2000 qty_sold from dual union all
          select 'AX'          , 'TSHIRT '          , to_date('20130801','yyyymmdd')         , 2000         , 500           from dual union all
          select 'AX'          , 'TSHIRT '          , to_date('20130901','yyyymmdd')         , 1000         , 3000          from dual union all
          select 'CX'          , 'XLSHIRT'          , to_date('20130701','yyyymmdd')         , 3000         , 2000          from dual union all
          select 'CX'          , 'XLSHIRT'          , to_date('20130801','yyyymmdd')         , 3000         , 2500          from dual union all
          select 'CX'          , 'XLSHIRT'          , to_date('20130901','yyyymmdd')         , 3000         , 2500          from dual
       w_base as (
          select item_code, item_name, trans_dt, qty_recd, qty_sold,
                 sum(qty_recd) over (partition by item_code, trunc(trans_dt, 'MM')) mm_recd,
                 sum(qty_sold) over (partition by item_code, trunc(trans_dt, 'MM')) mm_sold,
                 sum(qty_recd) over (partition by item_code, trunc(trans_dt, 'YY')) yy_recd,
                 sum(qty_sold) over (partition by item_code, trunc(trans_dt, 'YY')) yy_sold,
                 row_number() over (partition by item_code order by trans_dt desc) rnum
            from w_data d
    Select item_code, item_name, mm_recd, mm_sold, yy_recd, yy_sold
      from w_base
    where rnum = 1
    IT ITEM_NA    MM_RECD    MM_SOLD    YY_RECD    YY_SOLD
    AX TSHIRT        1000       3000       6000       5500
    CX XLSHIRT       3000       2500       9000       7000

  • In MVC, do i need a View or Page with flow logic for POPUP window

    Hi All,
    I have the below scenario using the MVC pattern.
    I have a main view with 3 trays, each tray has two buttons, for example first tray has Create Order button. When I click on this button, I need a popup window to come with a tableview and a button(Create), where I select some rows and click on the button Create  to create order.
    But as per the MVC pattern I canu2019t call the view (popup) from another view(main view).  So should I create a VIEW or PAGE WITH FLOW LOGIC for the popup? .
    I need 6 popup to be called from the main view and once the function is done close the popup.
    Please suggest me the flow for this scenario.
    Cheers,
    Srini.

    Srini,
    1. You can call the view in pop-up because you will be calling the controller using open.window.
    Here is the sample code:
    method DO_REQUEST .
      data:
            li_vw           type ref to   if_bsp_page,
            lv_form_field   type          string,
            li_md           type ref to   zcl_model01.
      dispatch_input( ).
      li_md ?= get_model( 'm01' ).
      lv_form_field = request->get_form_field( 'invoice_create' ).
      if lv_form_field is initial.
    *------ Request to display main page
        li_vw = create_view( view_name = 'main.htm' ).
        li_vw->set_attribute( name = 'model' value = li_md ).
        call_view( li_vw ).
      elseif lv_form_field eq 'true'.
    *------ Request to display Invoice page in pop-up
        li_vw = create_view( view_name = 'invoice.htm' ).
        li_vw->set_attribute( name = 'model' value = li_md ).
        call_view( li_vw ).
      endif.
    endmethod.
    Layout:
          function do_Invoice()
          { var s=0; r=1; w=300; h=300; x=screen.width/2;
            x=x-w/2;
            var y=screen.height/4;
            y=y-h/2;
            popUp=window.open('main.do?invoice_create=true','win','width='+ w
            +',height='+ h +', left=' + x +',top='+ y +');
    Option2:
    Ofcourse you can't bind the model in page becos those are 2 different things. But all you need to do is access the model to get some value. To know how to access the model from Page w/flow logic look at [this link|Passing model reference to a page in a Popup].
    Raja
    Edited by: Raja Thangamani on Apr 14, 2009 11:22 AM

Maybe you are looking for

  • Boot Camp 2.1 will not install.

    I attempted to install this update on my Mac Book Pro, and it was a no-go. I tried software update (4 times), downloaded the installer through software udpate and ran it(2 times), and then ran the stand-alone installer (4 times). Each time the instal

  • How Much Data Does a 16GB Iphone Hold?

    I'm curious, how many songs, pics, videos, movies does the Iphone Hold?

  • Oracle 8i - problems while looking up an EJB

    I have created and published a EJB in Oracle 8i (in a particular schema) by running the deployejb tool supplied. The ejb was published successfully. On running the client program I get an error saying that the mybeans's HomeHelper class cannot be fou

  • Unable to reclaim free space

    tablespace size: 62G, 14 4G files and 1 6G file, freespace =51G When I try to resize datafiles, I get an error; the max free space per file =1G --- not sure what is using up the space. environment: 10.2.0.3 2-node RAC cluster on Red Hat Linux 4 Can s

  • MySQL timestamp formatting errors

    I'm continuing to have odd formatting errors when pulling data out of a MySQL database.  The one I'm currently having is with time values.  The screenshot shows that the error is being generated in the Variant to Data.vi  The actual time stored in th