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

VALIDATIONS

Former Member
0 Likes
652

12001176583 109518 21719 20070628

12001176585 109518 21719 20070628

12001176588 109518 21719 20070628

FIELD 1 : CHECK NUMBER - FROM 'PAYR-CHECT'

FIELD 2 : AMOUNT - 'PAYR-RWBTR'

FIELD 3 : BANK A/C NUM - 'T012K-BANKN'.

ABOVE MENTION ARE RECORDS IN MY FILE WHICH R STORED IN MY INT TABLE.

I HAVE TO VALIDATE ONE BY FEILD BY FEILD AND RECORD BY RECORD.

First : Validate Check number from table PAYR-CHECT

and

Second : Validate Bank A/C no from table T012K-BANKN

Third : If both pass the validation then validate Amount from table PAYR-RWBTR,

Even if the amount does’nt match allow the record to be processed.

Fourth : Records with errors have to captured in a ERROR file,records which have passed the validation to be captured in PROCESS file.

can any one provide the code for the above ?

1 ACCEPTED SOLUTION
Read only

former_member404244
Active Contributor
0 Likes
622

Hi,

do like this

tables : payr,T012K,

Loop at itab.

select chect from payr upto 1 rows where chect = itab-chect.

endselect.

if sy-subrc eq 0.

select amount from payr into table it_amount where amount = itab-amount.

move : itab-chect to itab1-chect,

itab-AMOUNT to itab1-mount.

else

move itab-chect to itab2-chect.

endif.

select bankn from t012k upto 1 rows where bankn = itab-bankn.

endselect.

if sy-subrc eq 0.

move itab-bankn to itab1-bankn.

else.

move itab-bankn to itab2-bankn.

endif.

append itab1.

append itab2.

Now itab1 will have success records and itab2 will have error records.

Regards,

Nagaraj

4 REPLIES 4
Read only

former_member404244
Active Contributor
0 Likes
623

Hi,

do like this

tables : payr,T012K,

Loop at itab.

select chect from payr upto 1 rows where chect = itab-chect.

endselect.

if sy-subrc eq 0.

select amount from payr into table it_amount where amount = itab-amount.

move : itab-chect to itab1-chect,

itab-AMOUNT to itab1-mount.

else

move itab-chect to itab2-chect.

endif.

select bankn from t012k upto 1 rows where bankn = itab-bankn.

endselect.

if sy-subrc eq 0.

move itab-bankn to itab1-bankn.

else.

move itab-bankn to itab2-bankn.

endif.

append itab1.

append itab2.

Now itab1 will have success records and itab2 will have error records.

Regards,

Nagaraj

Read only

Former Member
0 Likes
622

Hi,

you have all the records in itab.

now select chect from payr into table itab1 for all entries in

itab where payr = itab-payr.

select bankn from t012k into table itab2 for all entries in itab

where bankn = itab-bankn.

sort: itab1 by payr,

itab2 by bankn.

loop at itab.

read table itab1 with key payr = itab-payr binary search.

if sy-subrc eq 0.

read table itab2 with key bankn = itab-bankn binary search.

if sy-subrc eq 0.

success -- so move it to another itab2

else.

fail --- so move it to failure internal table.

endif.

else.

fail --- so move it to failure internal table.

endif.

endloop.

regards,

Venkatesh

Read only

Former Member
0 Likes
622

Hi

Am attached a pseudo code for your requirement. This will help you out.

PS: If this answers your query please mark the question answered.

data: it_data type table of XXXX (your type)

data wa_data type XXXX (your type)

loop at it_data into wa_data.

select chect from payr into g_check where wa_data-check.

if sy-subrc = 0.

select BANKN from T012K into g_BANKN where wa_data-BANKN.

if sy-subrc = 0.

do your processing.

else.

move wa_data to ERROR_file.

else.

move wa_data to ERROR_file.

endloop.

Read only

Former Member
0 Likes
622

since you have to check your internal table records against other tables, its better that you fetch the records from other tables also in separate internal tables (using the "for all entries " statement). This is due to performance reasons as you will have to do these validations in a loop on the internal table which holds your records

something like this....

loop at itab_main into wa. "This is your main table of records

*first validation

read table itab2 with key chect = wa-chect. "assuming that you got the records from PAYR in the internal table itab2 using the for all entries in itab_main.

if sy-subrc eq 0.

<do your validations here>

endif.

**similarly do other validations that you need to do.

endloop.

hope this gives some insight....The stress on "For all entries" is to make sure that you don't use a select within a loop which is going to affect the performance of your program.