Welcome To My BLOG

This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me

Share this link with your friends

http://www.rebtel.com/u/15163104576

For every friend who signs up using this link and makes a payment, we'll give you 8 €!


Friday, September 24, 2010

Icons on the selection screen

REPORT zsscrbuttons2.

TABLES: sscrfields.

DATA: gd_ucomm TYPE sy-ucomm.

SELECTION-SCREEN BEGIN OF BLOCK period WITH FRAME TITLE text-t02.
SELECT-OPTIONS: so_dates FOR sy-datum NO-EXTENSION.

SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(20) text-fy1. "= Fiscal Year
SELECTION-SCREEN POSITION 33.
PARAMETERS: p_period LIKE qppnp-pabrp.
SELECTION-SCREEN POSITION 36.
PARAMETERS: p_year LIKE qppnp-pabrj.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN PUSHBUTTON /01(29) but1 USER-COMMAND but1.
SELECTION-SCREEN PUSHBUTTON /01(29) but2 USER-COMMAND but2.
SELECTION-SCREEN END OF BLOCK period.

*INITIALIZATION.
INITIALIZATION.
* MOVE 'Fiscal Year' TO BUT1.
MOVE 'Date Period' TO but2.

DATA: icon_name TYPE iconname,
button_text(20) TYPE c,
quickinfo LIKE smp_dyntxt-quickinfo,
icon_str(255) TYPE c.

* Setup button 1 (Fiscal year)
icon_name = 'ICON_ARROW_RIGHT'. " 'ICON_DISPLAY_MORE'.
button_text = 'Fiscal Year'.
CONCATENATE button_text text-akt
INTO quickinfo
SEPARATED BY space.

CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_name
text = button_text
info = quickinfo
* ADD_STDINF = 'X'
IMPORTING
RESULT = icon_str
EXCEPTIONS
OTHERS = 0. "not interested in errors

* place text and icon on button
but1 = icon_str.

* Setup button 2 (Date period)
icon_name = 'ICON_ARROW_LEFT'. " 'ICON_DISPLAY_MORE'.
button_text = 'Date Period'.
CONCATENATE button_text text-akt
INTO quickinfo
SEPARATED BY space.

CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_name
text = button_text
info = quickinfo
IMPORTING
RESULT = icon_str
EXCEPTIONS
OTHERS = 0. "not interested in errors

* place text and icon on button
but2 = icon_str.


************************************************************************
*AT SELECTION-SCREEN.
AT SELECTION-SCREEN.
* Check if buttons have been
IF sscrfields-ucomm EQ 'BUT1'.
gd_ucomm = 'BUT1'.
ELSEIF sscrfields-ucomm EQ 'BUT2'.
gd_ucomm = 'BUT2'.
ENDIF.


************************************************************************
*AT SELECTION-SCREEN.
AT SELECTION-SCREEN OUTPUT.

IF gd_ucomm IS INITIAL.
LOOP AT SCREEN.
IF screen-name CS 'P_PERIOD' OR
screen-name CS 'P_YEAR' OR
screen-name CS 'FY1' OR
screen-name EQ 'BUT2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF gd_ucomm EQ 'BUT1'.
LOOP AT SCREEN.
IF screen-name CS 'P_PERIOD' OR
screen-name CS 'P_YEAR' OR
screen-name CS 'FY1' OR
screen-name EQ 'BUT2'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
IF screen-name CS 'SO_DATES' OR
screen-name EQ 'BUT1'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF gd_ucomm EQ 'BUT2' .
LOOP AT SCREEN.
IF screen-name CS 'P_PERIOD' OR
screen-name CS 'P_YEAR' OR
screen-name CS 'FY1' OR
screen-name EQ 'BUT2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
IF screen-name CS 'SO_DATES' OR
screen-name EQ 'BUT1'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

No comments: