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

How to do validations in FI..?

Former Member
0 Likes
688

Hi gurus,

I have to couple of validations in FI...Would appreciate if someone can help me with the code:

1.

Description: Product is Valid

Pre-requisites: BSEG-ZZPRO < > ‘ ‘

Pseudo code: Store Posting Date BKPF-BUDAT to i_END_DT and BSEG-ZZPRO to i_ZZPRO and check that in Z-table ZTFICO_ZZPRO_V

ZTFICO_ZZPRO_V – END_DT > than i_END_DT where ZZPRO = i_ZZPRO

If not (Product not found or END_DT < BKPF-BUDAT) issue an error message – ‘Product &Product& is not valid’

2.

Description: Product allowed for Profit Center entered

Pre-requisites: BSEG-BUKRS LIKE '2*' AND BSEG-ZZPRO <> ' '

Pseudo code: Store BSEG-ZZPRO to i_ZZPRO and BSEG-PRCTR to i_PRCTR and check in Z-Table ZTFICO_PROD_PRCTR_V

Select * from ZTFICO_PROD_PRCTR_V where ZTFICO_PROD_PRCTR_V-PRCTR = i_PRCTR AND ZTFICO_PROD_PRCTR_V-ZZPRO = i_ZZPRO.

If not found issue error message – Product &i_ZZPRO& not valid for Profit Center &i_PRCTR&

Can someone plz suggest something...

Thanks

Cheers:

Sam

Note: More validations are there but i am right now doing these two..

Please help...

Message was edited by:

Sam williams

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
662

data : i_end_dt like vbkp-budat.

data : x_ztfico_zzpro_v like ztfico_zzpro_v .

data : i_zzpro like besg-zzpro.

data : message(40) type c.

Select single budat from bkpf into i_end_dt.

select single zzpro from bseg into i_zzpro where zzpro <> ' '.

select single * from ztfico_zzpro_v into x_ztfico_zzpro_v where end_dt > i_end_dt and zzpro eq i_zzpro.

if sy-subrc ne 0.

concatenate 'Product' 'Your Product Variable' 'is not valid' into message.

message e000(GIve ur Message class) with message.

endif.

2)

select single zzpro from bseg into i_zzpro where bukrs like '2%' and zzpro <> ' '.

if sy-subrc eq 0.

Select * from ZTFICO_PROD_PRCTR_V where PRCTR = i_PRCTR AND ZZPRO = i_ZZPRO.

if sy-subrc ne 0.

clear messages.

concatenate 'roduct' &i_ZZPRO& 'not valid for Profit Center' &i_PRCTR&

into messages.

message e000(Mclass) with messages.

endif.

endif.

Hi gurus,

I have to couple of validations in FI...Would appreciate if someone can help me with the code:

1.

Description: Product is Valid

Pre-requisites: BSEG-ZZPRO < > ‘ ‘

Pseudo code: Store Posting Date BKPF-BUDAT to i_END_DT and BSEG-ZZPRO to i_ZZPRO and check that in Z-table ZTFICO_ZZPRO_V

ZTFICO_ZZPRO_V – END_DT > than i_END_DT where ZZPRO = i_ZZPRO

If not (Product not found or END_DT < BKPF-BUDAT) issue an error message – ‘Product &Product& is not valid’

2.

Description: Product allowed for Profit Center entered

Pre-requisites: BSEG-BUKRS LIKE '2*' AND BSEG-ZZPRO <> ' '

Pseudo code: Store BSEG-ZZPRO to i_ZZPRO and BSEG-PRCTR to i_PRCTR and check in Z-Table ZTFICO_PROD_PRCTR_V

Select * from ZTFICO_PROD_PRCTR_V where ZTFICO_PROD_PRCTR_V-PRCTR = i_PRCTR AND ZTFICO_PROD_PRCTR_V-ZZPRO = i_ZZPRO.

If not found issue error message – Product &i_ZZPRO& not valid for Profit Center &i_PRCTR&

Can someone plz suggest something...

Thanks

Cheers:

Sam

Note: More validations are there but i am right now doing these two..

Please help...

Message was edited by:

Sam williams

4 REPLIES 4
Read only

Former Member
0 Likes
663

data : i_end_dt like vbkp-budat.

data : x_ztfico_zzpro_v like ztfico_zzpro_v .

data : i_zzpro like besg-zzpro.

data : message(40) type c.

Select single budat from bkpf into i_end_dt.

select single zzpro from bseg into i_zzpro where zzpro <> ' '.

select single * from ztfico_zzpro_v into x_ztfico_zzpro_v where end_dt > i_end_dt and zzpro eq i_zzpro.

if sy-subrc ne 0.

concatenate 'Product' 'Your Product Variable' 'is not valid' into message.

message e000(GIve ur Message class) with message.

endif.

2)

select single zzpro from bseg into i_zzpro where bukrs like '2%' and zzpro <> ' '.

if sy-subrc eq 0.

Select * from ZTFICO_PROD_PRCTR_V where PRCTR = i_PRCTR AND ZZPRO = i_ZZPRO.

if sy-subrc ne 0.

clear messages.

concatenate 'roduct' &i_ZZPRO& 'not valid for Profit Center' &i_PRCTR&

into messages.

message e000(Mclass) with messages.

endif.

endif.

Read only

0 Likes
662

Thanks for the reply...

If i have to do these validations as a function module what will be the importing parameters and how can i do it...it might be that my manager wants to so this as a FM...

Please suggest...thanks...

Read only

0 Likes
662

HI,

Just pass the product number as input and do you want to return the message from the function module as export parameter.

Thanks

Mahesh

Read only

0 Likes
662

I think so we have to return the message from the Function module...

How can i do that...

Also, I have more validations to do...i willl just post in some time...

Thanks for ur help mahesh...Appreciated...

I am awarding u full points for this....