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

Validation

Former Member
0 Likes
689

Hi All,

I need to have validation on the BAPI input parameter against the SAP table.

Example:

BAPI Input Parameter:

Name ( is combination of field first name + Last Name in SAP table)

SAP table

Last name

First name

Can I know how I validate this input parameter with the SAP table fields

First name, last name. Please advise with the sample code. Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
651

Hi,

I am not sure how much i am correct but have you tried with any select statement.

Data: l_firstname type <table name>-<field name of first name>.

select single <first name> from <table name> into l_firstname where <first name> = <Table name>-<field name>

and <last name field name> = <table name>-<last name field name>.

In the above i have shown you to validate first name and last name until both matches you can proceed further.

Cheers!!

VEnk@

Read only

0 Likes
651

Hi

Write a select statement as Venkat said...and put a condition saying...if sy-subrc is not equal to zero, then you want an error message to be displayed.

select * "select statement
if sy-subrc <> 0.
write: / "Invalid Name.
endif.

Regards,

Vishwa.

Read only

0 Likes
651

Hi,

First of all, thanks.

How do i split out the data from BAPI input parameter first , then proceed with validation check against the data in table field first name and last name?

Example BAPI input value:

StudentName: Jenny Lee

(Student Name is combination of First name & last name)

SAP table

First name : Jenny

Last name : Lee

Read only

0 Likes
651

Hi

Ever heard about keyword "SPLIT"??

Use:

first and last are two variables.

SPLIT studentname at ' ' into first last.

Then Select * from xxx into itab where firstname(field) = first.

Regards,

Vishwa.

Read only

Former Member
0 Likes
651

thanks all. Managed to solve my own.