2014 Jul 14 8:12 AM
Hi,
I have a requirement where I need to check and compare with (Custom table) Bankn with Partner Bank`s bankn.
I have wrote a code in PAI like this.
MODULE CHECK_BANKN INPUT.
Data: l_bankn like (Custom table)-bankn.
select bankn from (Custom Table) into l_bankn
where recno = g_recno.
IF NOT g_head-bankn IS INITIAL.
Read table i_bvtyp with key bankn = i_bvtyp-bankn .
IF l_bankn <> i_bvtyp-bankn.--------->" Comparison of (custom table) Bankn with internal table I_BVTYP-BANKN
MESSAGE w022 WITH text-w06.
ENDIF.
ENDIF.
ENDMODULE.
My Read Table statement is seems to be wrong and my checking condition is also wrong.
So, how to resolve this?
regards,
Kiran
2014 Jul 14 8:24 AM
Hi Kiran,
Do a sy-subrc check after your select & READ statements.
Then proceed with your code.
Thanks,
Sharath
2014 Jul 14 8:24 AM
Hi Kiran,
Do a sy-subrc check after your select & READ statements.
Then proceed with your code.
Thanks,
Sharath
2014 Jul 14 8:54 AM
Ok. i will do the sy-subrc ..
but I need to read i_bvtyp using g_head
(my custom table is in g_head)
I need a proper read statement
regards,
Kiran
2014 Jul 14 8:30 AM
Hi,
First Check i_bvtyp-bankn and l_bankn both are of same type and length
Second add Sy-Subrc eq 0 after read table
Read table i_bvtyp with key bankn = i_bvtyp-bankn .
if sy-subrc = 0 .
.........
endif
2014 Jul 14 8:36 AM
Hi Kiran,
If you observe your read statement, you are comparing the field with it's own table field.
Read table i_bvtyp with key bankn = i_bvtyp-bankn .
Untill unless you read I_BVTYP, i_bvtyp-bankn will be initial and you cannot find the matching record with Null-Value.
So, I think you need compare with l_bankn.
Read table i_bvtyp with key bankn = i_bankn .
Then you can directly raise a message using SY-SUBRC value.
Read table i_bvtyp with key bankn = i_bankn
if SY-SUBRC <> 0 .
<MESSAGE>
endif.
Regards,
Vijay
2014 Jul 14 9:17 AM
Hi...bit slight change in code.. instead of using custom table, i can use G_HEAD for it..
Here I have to do is like need to read i_bvtyp using g_head if not found, Warning message
So, over all, how can i update the code?
IF NOT g_head-bankn IS INITIAL.
Read table i_bvtyp with key bankn = bankn .
if Sy-subrc NE 0.
<message>
Endif.
Endif.
Like this?? Where is the comparison ??
2014 Jul 14 10:50 AM
Hi,
Then your READ statement should be as follows:
READ TABLE I_BVTYP WITH KEY BANK = G_HEAD-<bank_number_field>.
IF SY-SUBRC <> 0.
<message>
ENDIF.
Regards,
Vijay
2014 Jul 14 8:41 AM
Hi Kiran,
select SINGLE bankn from (Custom Table) into l_bankn
where recno = g_recno.
regards,
Archer
2014 Jul 14 8:42 AM
Please check Read table i_bvtyp with key bankn = i_bvtyp-bankn .
Do you want check with condition bankn = i_bvtyp-bankn?
Regards,
Venkat.
2014 Jul 14 8:50 AM
Hi all,
our custom table is stored in G_HEAD.
I have to read i_bvtyp using g_head, if not found Warning msg need to come
Please help me out
Regards,
Kiran
2014 Jul 14 9:13 AM
Then your READ statement should be as follows:
READ TABLE I_BVTYP WITH KEY BANK = G_HEAD-<bank_number_field>.
Regards,
Vijay
2014 Jul 14 9:02 AM
Hi,
For not equal to condition Read table statement cannot be used , instead use loop statement.
Example:
loop at i_bvtyp where bankn <> g_head-bankn.
EXIT.
endloop.
2014 Jul 15 4:49 AM