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

Account Validation

Former Member
0 Likes
646

Hi All,

i created one bdc for FI Documents postings

during uploading process , i want validate the accounts,if the account exist in the SAP then only create session otherwise display error log file

how to validate the accounts

Plz give me the sample code

i look forward to your reply

Thanks & Regards

SEK

4 REPLIES 4
Read only

Former Member
0 Likes
588

Hi

It depends on which type of account you need to check.

U can do two validations:

- The first one: check if the account exists;

- The second one: check if the account is defined for the company code.

So

- Vendor account: check if It's in LFA1 and LFB1

- Customer account: check if It's in KNA1 and KNB1

- G/L account: check if It's in SKA1 and SKB1

Max

Read only

0 Likes
588

Hi,

thank you for your reply

if anybody have sample code for account validation plz send me

i look forward to your reply

Thanks Regards

SEK

Read only

0 Likes
588

hi,

try:

select count( * ) from knb1 into sy-dbcnt

where kunnr = itab-kunnr

and bukrs = itab-bukrs.

if sy-dbcnt 0.

-> write to error log

A.

Message was edited by:

Andreas Mann

Read only

0 Likes
588

Hi ,

Thank you for your reply

data : begin of itab,

NEWKO1 LIKE BSEG-NEWKO,

NEWKO2 LIKE BSEG-NEWKO,

ENDOF ITAB.

From the Excel sheet we upload the data into ITAB

loop at itab.

Here the validation part comes

itab-newko the uploaded accounts exist in the sap or not

if sy-subrc ne 0. not exist in sap

the move the data to errtab

delete from itab.

endif.

my main problem is how to validate the uploaded accounts is exist in the sap or not

plz send sample code for validation

i look forward to your reply

Thanks & Regards

SEK