Skip to Content
0
Former Member
Mar 10, 2007 at 10:59 PM

Virtual Key Figures

24 Views

Hi

I have the query with the following structure:

2006

2007

January

February | |

........etc | |

December | |

when executing the question the entrance variable is year (2007) I need to obtain the number of days of a month and the present month to obtain the day of execution report (ex.: 10/03/2007) = 10

I decide using virtual key and the code is the next:

ZXRSRTOP

data: g_t_chanm type rrke_s_chanm,

g_t_kyfnm type rsdkyf.

data: g_pos_ZIC_C03_0FISCPER3 type i,

g_pos_ZIC_C03_0FISCYEAR type i,

g_pos_ZIC_C03_ZCANDMES type i.

ZXRSRU02

case i_s_rkb1d-infocube.

when 'ZIC_C03'.

g_t_chanm-mode = rrke_c_mode-read.

g_t_chanm-chanm = '0FISCPER3'. append g_t_chanm to e_t_chanm.

g_t_chanm-chanm = '0FISCYEAR'. append g_t_chanm to e_t_chanm.

g_t_kyfnm-kyfnm = 'ZCANDMES'. append g_t_kyfnm to e_t_kyfnm.

endcase.

ZXRSRZZZ

FORM USER_ZIC_C03 USING i_s_rkb1d TYPE rsr_s_rkb1d

CHANGING c_s_data TYPE any.

Data:

diavar like sy-datum,

meshoy(6) type n,

mesvar(6) type n,

CANDMES(2) TYPE N.

field-symbols: <0FISCPER3>, <0FISCYEAR>, <ZCANDMES>.

assign: component g_pos_ZIC_C03_0FISCPER3

of structure c_s_data to <0FISCPER3>,

component g_pos_ZIC_C03_0FISCYEAR

of structure c_s_data to <0FISCYEAR>.

Concatenate <OFISCYEAR> <0FISCPER3>+1(2) ‘01’ into diavar.

Meshoy = SY-DATUM(6).

Mesvar = diavar(6).

If meshoy = mesvar.

<ZCANDMES> = SY-DATUM+6(2).

Elseif mesvar < meshoy.

CALL FUNCTION ‘/OSP/GET_DAYS_IN_MONTH’

EXPORTING

IV_DATE = DIAVAR

IMPORTING

EV_DAYS = CANDMES.

<ZCANDMES> = CANDMES.

Else.

<ZCANDMES> = 0.

Endif.

ENDFORM.

But in the allocation <ZCANDMES> = SY-DATUM+6(2). the abap error occurs

MOVE_TO_LIT_NOTALLOWED_NODATA" C

SAPLXRSR" or "ZXRSRZZZ"

apparently I am assigning bad the variable please somebody can say to me as I can develop this code

R.A.