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

regarding Validations

Former Member
0 Likes
848

Hi i have a module pool program where i have two fields

Material and Vendor.

actually i have arequirement like i have to add validations like this.

I m confused that what shuld i write.

1)•Have validation for input of vendor and material, only allows having one of them has value. If both of vendor and material have values, display message’ Please make either one of material or vendor having value’.

2)•Have validation for input of vendor, to check if it’s valid. Query from table LFA1 to find out if there is record in the table with user input of Vendor. If it’s invalid, display message ‘ Please enter valid Vendor’. If it’s valid, query from table MARA to fill internal table IT_MATERIALS.

Thanks,

satish

7 REPLIES 7
Read only

Former Member
0 Likes
833

Hi Satish,

You can very easily do this in PAI either direct check or using CHAIN ..ENDCHAIN.

Regards,

Atish

Read only

Azeemquadri
Contributor
0 Likes
833

In pai.

if vendor is ne space and material is ne space.

erroe message.

endif.

also in pai.

select vendor from lfa1 into lv_vendor.

if sy-subrc ne 0.

error message.

else.

" put vendor in itab.

endif.

Read only

Former Member
0 Likes
833

hi,

for the first ,

if the m1 and v1 are the fields.

check whether ,

if m1 is not initial and v1 is not initial.

Message 'Please make either one of material or vendor having value’ type I.

Hope this helps u,

Arunsri

Read only

dhruv_shah3
Active Contributor
0 Likes
833

Hi,

For 2) you have to Use the Check..End Check and inside that you have to read the LFA1 table with the data you get from the USer.

For 1) This type of validations never work.

HTH

Regards,

Dhruv Shah

Read only

ravisankara_varaprasad
Active Participant
0 Likes
833

Hi ,

You proceed as below for this requirement.

in PBO event,

if both fields are empty then do nothing.

if either of the fields are initial then hide the other field / make it into display mode.

and then you can do the validation for Vendor on table LFA1 and for material on MARA.

but for retrieving the material numbers based on the given Vendor . first you need to inform the ask the relation ship to read the MARA using LFA1-LIFNR.

I am thinking may be they need to pull the all material of particular Vendor referring to the Purchase Orders.

Thanking You.

Kind Regards,

Read only

Former Member
0 Likes
833

Frnds what is the relationship between LFA1 and MARA.

I have to fill the table IT_MATERIALS.

Regards,

satish

Read only

former_member182354
Contributor
0 Likes
833

Hi,

As far i got to understand your requirement, It is like when you select a valid vendor then the Materials related to that particular vendor should be populated in other Select options ...right ??

To do this first you should have a field common between tables LFA1 and MARA which is not available in SAP.

Anyways for this kind of stuff in Module pool programming you can use Function module - F4IF_INT_TABLE_VALUE_REQUEST...

Regards,

Raghav