2008 Mar 04 12:23 PM
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 its valid. Query from table LFA1 to find out if there is record in the table with user input of Vendor. If its invalid, display message Please enter valid Vendor. If its valid, query from table MARA to fill internal table IT_MATERIALS.
Thanks,
satish
2008 Mar 04 12:28 PM
Hi Satish,
You can very easily do this in PAI either direct check or using CHAIN ..ENDCHAIN.
Regards,
Atish
2008 Mar 04 12:29 PM
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.
2008 Mar 04 12:30 PM
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
2008 Mar 04 12:31 PM
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
2008 Mar 04 12:37 PM
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,
2008 Mar 04 12:41 PM
Frnds what is the relationship between LFA1 and MARA.
I have to fill the table IT_MATERIALS.
Regards,
satish
2008 Mar 04 12:43 PM
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