‎2006 Jun 08 6:02 AM
hello,
1. I an using a BAPI in the start-of-selection event .
2. For this BAPI we have a return parameter .
3. If i get a return parameter other than SUCCESS message type I have to display an error message on the selection-screen .
4. The requirement was I need to show this BAPI as an selection-screen event it seeems.
is it posible ?
‎2006 Jun 08 6:05 AM
it's possible. Just code it there. SHow the first entry of return as an error message.
But you'll have to be careful. You probably don't want to always run the bapi but control it by the pfkey used.
‎2006 Jun 08 6:16 AM
hello,
i have coded like this -->
**********************************************************
FORM get_price_details .
Call bapi to get the price details
CALL FUNCTION '/BSHS/SOM_OPEC_SIMULATE_ORDER' DESTINATION p_rfcdes
EXPORTING
import_fixdata = i_fixdata "customer
import_header = i_header
import_man_adress = i_man_adress
IMPORTING
return = e_bapi_return
TABLES
import_items = x_import_items "material
export_atpquantities = x_export_atpquantities
export_pricecondit = x_export_pricecondit
import_atpplants = x_import_atpplants
import_partners = x_import_partners "customer type
export_partners = x_export_partners
import_pricecondit = x_import_pricecondit "price cond
export_items = x_export_items.
To give a message to the user if the BAPI fails to
fetch the data
IF e_bapi_return-type NE 'S' and
e_bapi_return-type eq space.
MESSAGE e000(/bshm/ap_msg) DISPLAY LIKE 'S'
WITH e_bapi_return-message.
MESSAGE e000(/bshm/ap_msg)
WITH e_bapi_return-message.
STOP.
ENDIF.
********************************************************
if i code like this it is displaying the message on the blank screen instead of the selection-screen
what would be the reason ?
‎2006 Jun 08 6:09 AM
Hi sandeep,
1. Yes, its possible.
2. We have to use just one statement extra.
LEAVE LIST-processing.
3. like this.
START-OF-SELECTION.
-
CALL BAPI
IF SY-SUBRC <> 0 "-----ERROR
MESSAGE.......
<b> LEAVE LIST-PROCESSING.</b>
ENDIF.
regards,
amit m.
‎2006 Jun 08 6:20 AM
hello amit ,
the message was displaying in the status bar itself .
but on the blank-selection-screen instead of the selection-screen filled with selection-parameters.
i think leave list-processing is used to leave a list.
but here i don't have a list .
it is an ALV program
‎2006 Jun 08 6:24 AM
Hi again,
1. Whether ALV list or normal list using write statement,
we have to use
LEAVE LIST-PROCESSING
(This statement cancels further processsing,
and returns back to selection screen).
2. To get a taste of it,
just copy paste in new program.
(on screen, enter 'X'
so that it goes further,
IF left blank,
it will give MESSAGE)
3.
report abc.
*----
parameters : a type c.
start-of-selection.
if A <> 'X'.
message 'wrong entry' type 'I'.
leave list-processing.
endif.
write : 'successs'.
regards,
amit m.
‎2006 Jun 08 6:39 AM
hi amit ,
as per ur suggestion i coded like this . check out -->
FORM get_price_details .
Call bapi to get the price details
CALL FUNCTION '/BSHS/SOM_OPEC_SIMULATE_ORDER' DESTINATION p_rfcdes
EXPORTING
import_fixdata = i_fixdata "customer
import_header = i_header
import_man_adress = i_man_adress
IMPORTING
return = e_bapi_return
TABLES
import_items = x_import_items "material
export_atpquantities = x_export_atpquantities
export_pricecondit = x_export_pricecondit
import_atpplants = x_import_atpplants
import_partners = x_import_partners "customer type
export_partners = x_export_partners
import_pricecondit = x_import_pricecondit "price cond
export_items = x_export_items.
To give a message to the user if the BAPI fails to fetch the data
IF e_bapi_return-type NE 'S' and
e_bapi_return-type eq space.
MESSAGE e000(/bshm/ap_msg) DISPLAY LIKE 'S'
WITH e_bapi_return-message.
MESSAGE e000(/bshm/ap_msg)
WITH e_bapi_return-message.
STOP.
leave list-processing.
ENDIF.
*******************************************************
but still the problem persists ./..
what to do ?
‎2006 Jun 08 11:31 AM
Hi again,
1. Just make this small changes,
indicated in bold.
(the message type should be S , I ,W
But NEVER 'E' )
(Remove STOP )
2.
<b>MESSAGE I000(/bshm/ap_msg)</b> "--- Note I (not E)
WITH e_bapi_return-message.
<b>* STOP. "-----Comment this line</b>
leave list-processing.
regards,
amit m.
‎2006 Jun 08 11:37 AM
Hi Sandeep,
Use something like this to display the error message.
Read the return table for the error type 'E'.
if sy-subrc eq 0.
MESSAGE ID 'Message_Class'
TYPE 'S'
NUMBER '021'
DISPLAY LIKE 'E'.
EXIT.
ENDIF.
This will solve your problem.
<b>Reward points if it helps you.</b>
‎2006 Jun 09 12:17 AM
Hi Sandeep,
I'm a bit confused by what you say
"the message was displaying in the status bar itself .
but on the blank-selection-screen instead of the selection-screen filled with selection-parameters."
I think you mean that NO selection screen is shown. But a blank sap screen with the message on the bottom status line. This is standard behaviour for an E message issued from the start-of-selection event.
1. Change your message to an 'S' (this will make it appear on the next screen shown).
2. Instead of the STOP, do this.
data w_seltab type table of rsparams.
get the selection-screen values as entered by the user
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
IMPORTING
SP =
tables
selection_table = w_seltab
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 2
OTHERS = 3
.
this submits the current abap, shows the sel screen
with the values entered by the user
submit (sy-repid) via selection-screen
WITH SELECTION-TABLE w_seltab .
‎2006 Jun 08 6:20 AM
‎2006 Jun 08 6:22 AM
hello kishan,
i am supposed to use only type 'E'.not others.