04-09-2010 2:30 AM
HI,
We have a scenario where implemented the Address validation screens which we want to see only in the dialog mode and the same screens should not be populated when called via BAPI and RFC FM.
I have used the system fields SY-BATCH and S-BINPUT but both of them a re empty in rutime and the screens are called.
Can the gurus in the forum advice the best possible way of supressing the fields.
Thanks,
Suresh
04-09-2010 5:17 AM
Hi!
try use :
1.SY-ONCOM = 'V' => FUNCTION ... IN UPDATE TASK
2. FM TH_IN_UPDATE_TASK
3.some code from SAP:
METHOD background_process.
* Include with constants
INCLUDE tskhincl.
DATA:
l_state TYPE sm04dic-counter,
l_State_x like th_bitvalue4,
l_task_x like th_bitvalue4.
* Get task state
CALL FUNCTION 'TH_USER_INFO'
IMPORTING
task_state = l_state.
* Convert to X-fields to make O-compare possible.
l_State_x = l_state.
* I check for bit TASK_ONLINE.
* It is set if the current process has access to a GUI.
l_task_x = task_online.
IF l_State_x O l_task_x.
r_background = space.
ELSE.
r_background = 'X'.
ENDIF.
ENDMETHOD.
method GET_IN_UPDATE_TASK .
include tskhincl.
data: i type i,
j type i,
x4(4) type x,
task_state(4) type x,
direct_utask_active type c,
remote_utask_on type c.
* check for asynchronous update task
call function 'TH_USER_INFO'
importing
task_state = i.
task_state = i.
j = task_vb.
x4 = j.
if not task_state z x4. "update task is active
in_update_task = 1.
return.
endif.
* check for local update task?
call 'GET_SWITCH_UTASK' id 'MODE' field 'S' "S = state?
id 'STATE' field remote_utask_on.
if remote_utask_on = 'N'.
call 'GET_SWITCH_UTASK' id 'MODE' field 'A' "A = active?
id 'STATE' field direct_utask_active.
if direct_utask_active = 'Y'.
in_update_task = 1. "update task is active
else.
in_update_task = 0. "not in update task
endif.
else.
in_update_task = 0.
endif.
endmethod.
04-09-2010 5:20 AM
We have a scenario where implemented the Address validation screens which we want to see only in the dialog mode and the same screens should not be populated when called via BAPI and RFC FM.
The question might be how you actually implemented it...
For address validation I'd assume you would utilize the Business Address Services BAdI ADDRESS_CHECK with method ADDRESS_POSTAL_CHECK (or possibly customer exit EXIT_SAPLSZAR_001). Within the method you have the flag IM_DIALOG_ALLOWED (or X_DIALOG_ALLOWED in the customer exit), which indicates if dialog processing makes sense or not. Errors can be returned in the return table CH_T_ERROR_TABLE (or ERROR_TABLE for the exit) and SAP will take care if the messages are output directly or stored for example in an application log.
Cheers, harald
04-09-2010 8:08 AM
HI Harrald,
The field IM_DIALOG_MODE is set default as DIALOG allowed in standard method, how can the change be possible. Do you suggest to modify that?
Thanks,
Suresh
04-09-2010 11:48 AM
Hi Suresh,
All I'm saying is that flag IM_DIALOG_ALLOWED should indicate you if you're in dialog mode or not (i.e. whether you actually can issue a dialog window). Are you saying that you're using a standard RFC module which creates an address and the BAdI method ADDRESS_POSTAL_CHECK fires with parameter IM_DIALOG_ALLOWED set to 'X'?
Here's what the SAPhelp says:
If the dialog mode is used, you can add a user dialog which is displayed when the data is incomplete or wrong and allows the user to correct the address or enter the missing data.
The parameter IM_DIALOG_ALLOWED specifies if the context is a dialog context in which an additional user dialog is allowed.
Cheers, harald
04-16-2010 3:34 PM