Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

doubts in Date format..

former_member198892
Participant
0 Kudos

Hi,

i am getting the selection screen date is<b> 01-04-2007 to 30-04-2007.</b>

i am using one query in that 1st time the budat is 01-04-2007(budat = s_budat-low) next time it would be 02-04-2007 like that up to 30-04-2007, it should take.

Is there any function module to get all the date from 01-04-2007 to 30-04-2007.

please guide me.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI..,

You can directly take <b>budat in S_DATE</b> (instead of budat eq s_date-low )....thn it considers all the dates between s_date-low and s_date-high..

regards,

sai ramesh

9 REPLIES 9

Former Member
0 Kudos

Hi,

please check out the sample program below it might help you

report ztest_tmp.

data: datum1 type sy-datum.

data: uzeit1 type sy-uzeit.

data: datum2 type sy-datum.

data: uzeit2 type sy-uzeit.

data: result type sy-uzeit.

datum1 = sy-datum - 1.

datum2 = sy-datum .

uzeit1 = '140000'.

uzeit2 = sy-uzeit.

call function 'GET_DELTA_TIME_FROM_DT'

exporting

t1 = uzeit1

t2 = uzeit2

d1 = datum1

d2 = datum2

importing

t3 = result.

write:/ result.

***********please reward points if the information is helpful to you******

0 Kudos

is there any function module have to get the date from begin date to end date.

my date is 01-04-2007 to 30-04-2007.

Former Member
0 Kudos

HI..,

You can directly take <b>budat in S_DATE</b> (instead of budat eq s_date-low )....thn it considers all the dates between s_date-low and s_date-high..

regards,

sai ramesh

Former Member
0 Kudos

Hi,

You can directly write the Query, use the IN oparator to write the selct.

SELECT SINGLE * FROM <TABLE> where BUDAT in S_BUDAT. 
* Here S_BUDAT is the selection-screen Select-optin

.

Here is the Function modules also

<b>

FIMA_DAYS_BETWEEN_TWO_DATES_2</b>

or <b>FIMA_DAYS_BETWEEN_TWO_DATES</b>

Regards

Sudheer

Former Member
0 Kudos

Hi Thanuskodi,

try this code.

data: begin of itab occurs 0,

date like sy-datum,

end of itab.

*

data: date like sy-datum value '20070401'.

*

do.

itab-date = date. append itab.

date = date + 1.

if date > '20070430'. exit. endif.

enddo.

*

loop at itab. write: / itab-date. endloop.

Regards, Dieter

Former Member
0 Kudos

Hi Thanuskodi,

try this code.

data: begin of itab occurs 0,

date like sy-datum,

end of itab.

*

data: date like sy-datum value '20070401'.

*

do.

itab-date = date. append itab.

date = date + 1.

if date > '20070430'. exit. endif.

enddo.

*

loop at itab. write: / itab-date. endloop.

Regards, Dieter

Former Member
0 Kudos

Hi Thanuskodi,

try this code.

data: begin of itab occurs 0,

date like sy-datum,

end of itab.

*

data: date like sy-datum value '20070401'.

*

do.

itab-date = date. append itab.

date = date + 1.

if date > '20070430'. exit. endif.

enddo.

*

loop at itab. write: / itab-date. endloop.

Regards, Dieter

0 Kudos

Hi Thanus

Trry like this

SELECT gjahr belnr  FROM bseg
                    into corresponding fields of table int_bseg
                    WHERE werks =  itmat-werks
                    AND budat = s_budat-low.
 
 
loop at int_BSEG.<-- loop at ur date declared internal table
 
read table int_bseg WITH KEY BELNR = INT_BSEG-BELNR
        GJAHR = INT_BSEG-GJAHR. <-- to read the same internal table 
 
IF int_bseg-belnr = 'compare value'.
        total = total + int_bseg-belnr. " here goes ur coding part for date "
.......................
 

U can try like thi

DATA : opbal TYPE p DECIMALS 2 VALUE 0.

    SELECT * FROM zs_mkpf_mseg
                    into corresponding fields of table it_opbal
                    WHERE werks =  itmat-werks
                    AND matnr = itmat-matnr
                    AND budat = s_budat-low.


  *  sort  it_opbal by budat.
  loop at it_opbal.
read table it_opbal. 
      IF it_opbal-shkzg = 'S'.
        opbal = opbal + it_opbal-menge.
      ELSEIF it_opbal-shkzg = 'H'.
        opbal = opbal + it_opbal-menge * -1.
      ENDIF.
  endloop.
    append opbal TO itab-opbal.

  ENDFORM.                    " opbal_data

Reward all helpfull answers

Regards

Pavan

Message was edited by:

Pavan praveen

Former Member
0 Kudos

Hi,

you can use the function module

CSCP_PARA1_GET_PERIODS

data:begin of daytab occurs 0.

include structure scscp_period_str.

data:end of daytab.

call function 'CSCP_PARA1_GET_PERIODS'

exporting

i_datuv = s_budat-low

i_datub = s_budat-high

i_timeunit = 'D'

tables

et_dates = daytab.

here u have to put one more logic.

loop at daytab where datuv in s_budat.

endloop.

So u will get all the dates