Search on this Website

Showing posts with label Selection Screen. Show all posts
Showing posts with label Selection Screen. Show all posts

Saturday, July 23, 2011

Different Types of Selection Screens events

What is:
1. at selection-screen on field
2. at selection-screen output
3. at selection-screen block
4. at selection-screen on value-request
5. at selection-screen on help-request and their difference?
For knowing Selection-screens:

First you must have right understanding of Events.
- Events are introduced by Event Keyword. They end when again next processs begins.
Selection-screens are special screen defined in ABAP.
- This ABAP at run time only controls the flow logic of Selection-screens. The PBO and PAI triggers the num of. selection-screens.

The basic form of the selection screen events is the AT SELECTION-SCREEN event. This event occurs after the runtime environment has passed all input data from the selection screen to the ABAP program. The other selection screen events allow programmers to modify the selection screen before it is sent and specifically check user input.

At Selection-screen OUTPUT is trigerred in PBO of selection-screen.
- This allows you to modify the Selection-screen, before it is displayed.

At Selection-screen On Field is triggered in PAI of selection-screens.
- The input fields can be checked,in the corresponding event block. If an error message occurs within this event block, the corresponding field is made ready for input again on the selection screen.

At Selection-screen On Block is trigerred in PAI event.
- You define a block by enclosing the declarations of the elements in the block between the statements SELECTION-SCREEN BEGIN OF BLOCK block - END OF BLOCK block. You can use this event block to check the consistency of the input fields in the block.

At Selection-screen On value request.
- This event is trigerred for F4 help.

At Selection-screen On help request .
- This event is triggered when the user clicks F1 for help on fileds.


Click Here to Read More !!!!

Friday, December 7, 2007

Validation of selection screens

Validation of selection screen can be performed in the AT SELECTION SCREEN event.

Example:

************************************************************************
* AT SELECTION SCREEN *
************************************************************************
at selection-screen.
perform validate_selection_screen using g_returkode.
if g_returkode = c_returkode_error.

exit.
endif.



*&---------------------------------------------------------------------*
*& Form validate_selection_screen
*&---------------------------------------------------------------------*
* Validation of selection screen
*----------------------------------------------------------------------*
* -->P_G_RETURKODE text
*----------------------------------------------------------------------*
form validate_selection_screen using p_returkode.

if s_framd > 12 or s_framd < 1 or s_tilmd > 12 or s_tilmd < 1.
message e998.
p_returkode = c_returkode_error.
exit.
endif.
if s_framd > s_tilmd.
message e997.
p_returkode = c_returkode_error.
exit.
endif.

if s_fraaar < s_tilaar.
message e996.
p_returkode = c_returkode_error.
exit.
endif.

ENDFORM.

Click Here to Read More !!!!

Submitting another report using select-options or ranges

Example 1: Submitting a report using ranges for select-options


* Define range for ltak-tanum
RANGES: r_tanum FOR ltak-tanum.



* Read values from database tabel into the range
* These values are later used for select-options in the report

SELECT * FROM ltak
WHERE lgnum = w_lgnum AND "Warehouse number/complex
vbeln = w_screen1000-io_vbeln. "Transfer order number

MOVE ltak-tanum TO r_tanum-low.
MOVE 'I' TO r_tanum-sign.
MOVE 'EQ' TO r_tanum-option.
APPEND r_tanum.
ENDSELECT.

* Submit report with range

SUBMIT zmm00100 WITH p_tanum IN r_tanum.






Example 2: Submitting a report from ABAP with selection criterias

TYPES: tt_selection TYPE STANDARD TABLE OF rsparams.

DATA: l_iblnr TYPE st_iblnr,
* Define internal table and work area for select-options
l_selection TYPE rsparams,
li_selection TYPE tt_selection.

* Create selectIon table
LOOP AT gi_iblnr INTO l_iblnr.
CLEAR l_selection.
l_selection-selname = 'IM_IBLNR'. "Option name
l_selection-kind = 'S'. "S= select options P=Parameters

l_selection-sign = 'I'. "Sign
l_selection-option = 'EQ'. "Option
l_selection-low = l_iblnr-iblnr. "Value
APPEND l_selection TO li_selection.
ENDLOOP.

* Submit report
SUBMIT rm07idif WITH SELECTION-TABLE li_selection AND RETURN.

Click Here to Read More !!!!

Disable Parameters in Report Selection Screen

Q:

Dear all,
I have parameters in my ABAP/4 reporting program:
parameters: date like sy-datum,
division (1) type c.
parameters: r1 radiobutton group rad1,
r2 radiobutton group rad2.



How to change below code into ABAP/4 language
if r1 ne space.
division = invisible.
elseif r2 ne space.
divisio = visible.
endif.

thank you

A:

Try something like this in the even AT SELECTION-SCREEN or AT SELECTION-SCREEN

OUTPUT (whichever makes sense for what you are doing...)

LOOP AT SCREEN.

If screen-name = division.
if r1 ne space.
screen-invisible = 1.
elseif r2 ne space.
screen-invisible = 0.
endif.
modify screen.
endif.

ENDLOOP.

You may also try adding a statement for screen-input and/or screen output
instead. That way they are still visible, but you can't change them.

Click Here to Read More !!!!

Clearing selection screen input without any Previous Input

After executing a report, the green arrow back key will takes us back to
> the selection screen with the original input on it.
>
> However, my client would like to see the selection screen without any
> previous input on it, so he could start entering new input without
> deleting/overwriting the old ones. Is it possible to do that?
>
> Any hints will be greatly appreciated.
>


Use this part of code:


DATA: EXECUTED TYPE N.

your data definitions starts here

AT SELECTION-SCREEN OUTPUT.
IF EXECUTED = 1.
EXECUTED = 0.
CLEAR: var1, var2, etc.
REFRESH: selop1.
here you have to clear all your parameters, select options etc.
ENDIF.

START-OF-SELECTION.
EXECUTED = 1.
your main coding starts here.
END-OF-SELECTION.

Kind regards, Ingo-Willy Raddatz.

Click Here to Read More !!!!

How to Create F1 or F4 help on Selection Screen

Example 1: F1 Help

This tip has been copied from SearchSap.com
Tip submitted by: Rajeev Dev


Create F1 help for custom ABAP programs at field level. This method can help companies to eliminate the off-line documentation for custom programs. On top of that, users are not required to search for help documentation for a custom program.
Logo is: "Press F1 for help anywhere in SAP".


This is done by using "help-request" events.

Sample code:

at selection-screen on help-request for

message xxxx (ZZ)

You can maintain messages with varied degree of details here. You can also specify examples in messages long text to clarify the contents of program to your valued users.


Example 2: F4 Help
To control F4 help in a selection screen use the

AT SELECTION-SCREEN ON VALUE-REQUEST FOR
event.

Note that for ranges both the low and high value of the field
must have there own ON VALUE-REQUEST

Example:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-low.
PERFORM f4_help_prctr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-high.
PERFORM f4_help_prctr.

REPORT f4help.

PARAMETERS:
p_auart LIKE vbak-auart.



START-OF-SELECTION.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_auart.
PERFORM f4_help_aaurt.


*---------------------------------------------------------------------*
* FORM f4_help_auart *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*

FORM f4_help_auart.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'VBAK'
fieldname = 'AUART'
* SEARCHHELP = ' '
* SHLPPARAM = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
* VALUE = ' '
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '

* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* TABLES
* RETURN_TAB =
* EXCEPTIONS
* FIELD_NOT_FOUND = 1
* NO_HELP_FOR_FIELD = 2
* INCONSISTENT_HELP = 3
* NO_VALUES_FOUND = 4
* OTHERS = 5
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

Click Here to Read More !!!!

Returning to report and refresh data after call to selection screen

The scenario:

You have a report, and call a dialog screen where you modify data in the reports underlying table. After modifying the data you want to return to the report screen, and have it refreshed so that i displays the changes in the underlying table.


report zrev03 no standard page heading.

start-of-selection.
* Initial display of report
perform write_report.

* You have to display your own report headings that called from both the main report and the
* sub report ( The second display )

top-of-page.
perform page_header.

top-of-page during line-selection.
perform page_header.


case sy-ucomm.
when 'CHG'.
* Call dialog screen where data chenages are input. The code could be something like:
set parameter id 'ZR1' field itab-zzrevomr.
call transaction 'ZRE3'.

* After you return from the dialog screen you want to remove the old report so you
* don't redisplay it when you use the back button
sy-lsind = 0.
* Write the report again with new data
perform write_report.



form write_report.
*Here goes code that retrieves data for the report and write it, it could be something like:
select * from zrevomr into table itab.
loop at itab.
write: / itab-zzrevomr, itab-zzrevomrtx.

endloop.
endform.

form page_header.
* .... Code for page header
endform.

Click Here to Read More !!!!