Application Development and Automation 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: 
Read only

Validations :

Former Member
0 Likes
734

hello everyone,

How to validate FISCAL YEAR -- VBRK-GJAHR.

POSTING PERIOD -- VBRK-POPER.

will be rewarded ..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
686

Hi,

Check the following code.

*validation

AT SELECTION-SCREEN ON P_GJAHR .

SELECT

SINGLE GJAHR

FROM VBRK INTO WA_GJAHR

WHERE GJAHR = P_GJAHR .

IF SY-SUBRC <> 0 .

MESSAGE ' Invalild entry in field GJAHR' TYPE 'E' .

ENDIF .

AT SELECTION-SCREEN ON P_POPER .

SELECT

SINGLE POPER

FROM T009B INTO WA_POPER

WHERE POPER = P_POPER .

IF SY-SUBRC <> 0 .

MESSAGE ' Invalid entry in field POPER' TYPE 'E' .

ENDIF .

  • end of validation

Rewward if helpful.

Regards.

Edited by: Akshay Raj on Mar 10, 2008 10:28 AM

Edited by: Akshay Raj on Mar 10, 2008 10:32 AM

5 REPLIES 5
Read only

Former Member
0 Likes
686

Can you plz explain it clearly?

regards,

Kannan

Read only

0 Likes
686

i have fiscal year and posting period fields in my selection screen.

I have to do validations to the fields on the selection-screen.

so, how to validate these fields ?

to check whether user has entered correct values or not ???

Read only

Former Member
0 Likes
686

Hi,

check the table T009B


data:
period like t009b-poper,
year like bkpf-gjahr.

parameters: p_datum type sy-datum.
parameters: p_bukrs type t001-bukrs.

call function 'FI_PERIOD_DETERMINE'
exporting
i_budat = p_datum
i_bukrs = p_bukrs
importing
e_gjahr = year
e_poper = period.

write:/ period, year.

Regards,

Omkaram.

Read only

Former Member
0 Likes
686

Hi,

Use FM BAPI_COMPANYCODE_GET_PERIOD. It will give you the Fiscal year and Fiscal period corresponding to the company code and date.

Example:

Parameter : P_BUKRS type t001-bukrs.

  • Call FM to get the Posting Period

CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'

EXPORTING

companycodeid = p_bukrs

posting_date = sy-datum

IMPORTING

FISCAL_YEAR = v_fiscal_yr

fiscal_period = v_monat

  • RETURN =

Read only

Former Member
0 Likes
687

Hi,

Check the following code.

*validation

AT SELECTION-SCREEN ON P_GJAHR .

SELECT

SINGLE GJAHR

FROM VBRK INTO WA_GJAHR

WHERE GJAHR = P_GJAHR .

IF SY-SUBRC <> 0 .

MESSAGE ' Invalild entry in field GJAHR' TYPE 'E' .

ENDIF .

AT SELECTION-SCREEN ON P_POPER .

SELECT

SINGLE POPER

FROM T009B INTO WA_POPER

WHERE POPER = P_POPER .

IF SY-SUBRC <> 0 .

MESSAGE ' Invalid entry in field POPER' TYPE 'E' .

ENDIF .

  • end of validation

Rewward if helpful.

Regards.

Edited by: Akshay Raj on Mar 10, 2008 10:28 AM

Edited by: Akshay Raj on Mar 10, 2008 10:32 AM