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

Regarding selection validation

Former Member
0 Likes
1,342

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.

13 REPLIES 13
Read only

Former Member
0 Likes
1,236

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

Read only

Former Member
0 Likes
1,236

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.

Read only

0 Likes
1,236

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.

Read only

0 Likes
1,236

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.

Read only

0 Likes
1,236

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

Read only

kamesh_g
Contributor
0 Likes
1,236

hi

USe at selection screen on block .

in that use if conditions as per your requirement

Read only

Former Member
0 Likes
1,236

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 .

Read only

Former Member
0 Likes
1,236

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.

Read only

Former Member
0 Likes
1,236

hi,

validate currency for each under START-OF-SELECTION event.

thanks

Read only

Former Member
0 Likes
1,236

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.

Read only

Former Member
0 Likes
1,236

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

Read only

Former Member
0 Likes
1,236

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,236

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.