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

Vendor validation

Former Member
0 Likes
1,258

In my input screen am using lifnr field as mandatory.I have to enter range of vendors.In that if only one vendor is invalid it must error out only the particular vendor.Any idea to code?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,174

One way is to select LFA1 using the select option LIFNR and deleting the invalid ones. If the delete is successful then inform the user that invalid vendors have been deleted.

Psuedo code...


  select-options: P_LIFNR for LFA1-LIFNR.

select * from LFA1 
into table I_VENDOR_VALIDATED
where LIFNR in P_LIFNR.
loop at  I_VENDOR_VALIDATE.
"Delete invalid vendors - mark variable or issue 'E' message here...
endloop.
"If variable marked, Inform user if some vendors in range had been deleted.
MESSAGE 'Some vendors deleted' TYPE 'I'.

"Use I_VENDOR_VALIDATED for further processing

9 REPLIES 9
Read only

Former Member
0 Likes
1,174

Hi,

You can do as below:


select single lifnr from lfa1 where lifnr in so_lifnr.

if sy-subrc NE 0.
 message I000.
endif.
endselect. 

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,175

One way is to select LFA1 using the select option LIFNR and deleting the invalid ones. If the delete is successful then inform the user that invalid vendors have been deleted.

Psuedo code...


  select-options: P_LIFNR for LFA1-LIFNR.

select * from LFA1 
into table I_VENDOR_VALIDATED
where LIFNR in P_LIFNR.
loop at  I_VENDOR_VALIDATE.
"Delete invalid vendors - mark variable or issue 'E' message here...
endloop.
"If variable marked, Inform user if some vendors in range had been deleted.
MESSAGE 'Some vendors deleted' TYPE 'I'.

"Use I_VENDOR_VALIDATED for further processing

Read only

0 Likes
1,174

Hi what should i declare in the looping part am not clear in that

Read only

0 Likes
1,174

I dont think u need any looping what u need is u must validate low and high of select-options

Read only

0 Likes
1,174

Oh ok.What values can i declare in the high n low value?

Read only

0 Likes
1,174

It may help you



select-options: lifnr for lfa1-lifnr obligatory.

at selection-screen.
 
if lifnr[] is initial.
 
"write select statement to get only valid lifnr
 
elseif not lifnr[] is initial.
 
"write select statement and filter out the invalid lifnr.
 
endif.

Read only

0 Likes
1,174

Hi am new to ABAP so help me .I have written the code as

if lifnr[] is initial.

select single lifnr into gw_lfb1 from lfb1 where lifnr in s_lifnr.

elseif not lifnr[] is initial.

wat should i write in the else if part?I must also show the particular vendor is invalid.

Read only

0 Likes
1,174

Try this code and tell me whether it works for u or not


tables: lfb1.

data: itab like lfb1 occurs0.

at selection-screen.

select-options: p_lifnr for lfa1-lifnr obligatory.

select lifnr from lfb1 into table itab. 
 
loop at itab.
select single * from itab where lifnr in p_lifnr.
 if sy-subrc ne 0.
delete from itab.
write:/ 'invalid vendor', itab-lifnr.
endif.
endloop

Read only

0 Likes
1,174

Hi i have one more doubt regarding using a function module.I have to generate a report in that it must show Error Message: For multiple errors on a single iDoc, multiple records should be shown. i have to use the FM YAPR_CHECK_INVOICE_FOR_ERRORS i have read all the status of idoc using idoc_read_completely.Do u have idea to use the first FM?