‎2009 Apr 21 6:29 AM
Hi Experts,
I have two fields on the selection screen which are currency(single selection) and Bank G/L account number(multiple selection).
With reference to the selection field u2018Bank GL accountu2019 above, there will be a validation check to ensure that all accounts specified have the same
currency (SKB1-WAERS) as the one specified in u2018Currencyu2019 field above.
If not issue an error message.
How to check this?
Rgds,
Krishna.
‎2009 Apr 21 6:34 AM
Use AT SELECTION-SCREEN or AT SELECTION-SCREEN ON END OF <seltab> (selection screen multiple selection field) event to do validations and throw up the error message.
Edited by: Sunil Sawaikar on Apr 21, 2009 7:35 AM
‎2009 Apr 21 6:37 AM
Hi Balakrishna,
Validate the currency .
Get the Currency key for all G/L accounts entered in the selection screen. if the currecy differs then display an error message.
you should have the company code in the selection screen too.
validate the G/L account based on the company code and currency.
Use the AT SELECTION-SCREEN event.
Hope this will help you.
Regards,
Phani.
‎2009 Apr 21 6:55 AM
Hi Thanks for ur reply.
For example i entered 10 G/L account numbers and the currency is USD.
now one of the account number not in the currency USD.in this case i have to put error message that the account<A/C number> does't match with given currency 'USD'. how to check this one.
‎2009 Apr 21 7:10 AM
Try like below.
REPORT ZTEST.
TABLES: skb1.
PARAMETERS: p_waers TYPE waers OBLIGATORY.
SELECT-OPTIONS: s_saknr FOR skb1-saknr.
DATA var TYPE saknr.
AT SELECTION-SCREEN on p_waers.
SELECT SINGLE * FROM skb1 WHERE waers = p_waers.
IF sy-subrc <> 0.
MESSAGE e001(ZTEST). <---- Error Message 1
ENDIF.
AT SELECTION-SCREEN.
LOOP AT s_saknr.
var = s_saknr-low.
SELECT SINGLE * FROM skb1 WHERE saknr = var and waers = p_waers.
IF sy-subrc <> 0.
MESSAGE e002(ZTEST). <---- Error Message 2
EXIT.
ENDIF.
ENDLOOP.
‎2009 Apr 21 7:11 AM
Hi Balakrishna,
try it this way:
Data:
W_SAKNR TYPE SAKNR,
W_LINES TYPE I,
W_INDEX TYPE I VALUE 1.
Data:
BEGIN OF FS_SKB1,
SAKNR TYPE SAKNR,
WAERS TYPE WAERS,
END OF FS_SKB1.
Data:
T_SKB1 LIKE STANDARD TABLE OF FS_SKB1.
Parameters:
P_WAERS LIKE SKB1-WAERS.
Select-options:
S_SAKNR FOR W_SAKNR.
At Selection-screen on P_WAERS.
If P_WAERS is initial.
Message: 'enter a value' type 'E'.
Endif.
At Selection-screen on S_SAKNR.
Select SAKNR
WAERS
from SKB1
into table t_SKB1
where SAKNR in S_SAKNR
and BUKRS eq '0001'.
Describe table t_SKB1 lines W_LINES.
While w_index le w_lines.
Read table t_skb1 into fs_skb1 index w_index.
If p_waers ne fs_skb1-waers.
Message: fs_skb1-saknr type 'I'.
*" Message: " give your message 'A/C', fs_skb1-saknr, 'does't match with given currency', p_waers
*" type 'E'.
Endif.
w_index = w_index + 1.
Endwhile.With luck,
Pritam.
Edited by: Pritam Ghosh on Apr 21, 2009 9:05 AM
‎2009 Apr 21 6:47 AM
hi
USe at selection screen on block .
in that use if conditions as per your requirement
‎2009 Apr 21 6:48 AM
hi ,
use
AT SELECTION-SCREEN.
validate u r fieldsa here currency and G/L accoutns and give proper message
MESSAGE e999 WITH text-008.
ENDIF.
hope it will help u .
‎2009 Apr 21 6:49 AM
Hi
Under event START-OF-SELECTION.....
Depending on the selected currency and entered G/L account check ...whether the G/L account belonging to company code has the same currency selected on the selection screen if not raise error.
This can be done by checking for SY-UCOMM = ONLI.....i..e when Execute button is clicked.
‎2009 Apr 21 6:55 AM
hi,
validate currency for each under START-OF-SELECTION event.
thanks
‎2009 Apr 21 7:15 AM
Hi,
Use At Selction-screen on SKB1-WAERS.
First get all Currency keys for given G/L Accounts.
Then Check with current parameter whether equal or not.
then Display Error message.
‎2009 Apr 21 9:34 AM
use the event AT SELECTION-SCREEN.
AT SELETION-SCREEN ON P_WAERS.
IF P_WAERS IS INITIAL.
Write your code here.
ENDIF.
AT SELETION-SCREEN ON S_SAKNR.
Write your code here.
Regards,
Joan
‎2009 Apr 21 9:42 AM
Hi,
You can do the validation on AT SELECTION-SCREEN
that is,
parameters: p_curr " for currency
select-options : s_gl "for gl accounts
AT SELECTION-SCREEN FOR P_CURR.
select single currency from table into variable
where variable eq p_curr.
if sy-subrc <> 0.
error message.
Likewise you can check it for S_GL also
on AT SELECTION-SCREEN also.
Hope it helps
Regards
Mansi
‎2009 Apr 21 9:45 AM
at selection-screen on so_gl.
loop at so_gl.
select clause pass gl no and check whether it satisfies the currency.
if sy-subrc <> 0.
message e000(zsd) with so_gl-low.
endif.
endloop.