Google Search - Blog...........

ABAP - Express Select-Options Values In SY-LANGU

* ===========================================
* Example of a Macro ( named PUT_CRITERIA )
* for expressing the
* SELECT-OPTIONS criteria
* in simple English (or whatever SY-LANGU )
* in the Top of the pages of a List

* ------------------------------------------
* Syntax :
* PUT_CRITERIA &1 &2 .
* The first place holder &1 is the
* SELECT-OPTIONS Variable
* and the second &2 is a description
* of the Criterion

* ============================================
Report zEx_Criteria LINE-SIZE 255 LINE-COUNT 60 NO
STANDARD PAGE HEADING .
* =================================
* DECLARATIONS
* =================================
data : begin of i_criter occurs 0 ,
mline(60) type c .
data : end of i_criter .
data : log_oper(20) type c .
data : mline1(60) type c .
data : mline2(60) type c .
data : nr_of_limits type i .
* =================================
* Other DECLARATIONS
* =================================
* ------------------------------------------
* ---------> Macro Code <------------- * ------------------------------------------

DEFINE PUT_CRITERIA .

clear : i_criter , LOG_OPER , MLINE1 , MLINE2 .
CLEAR : NR_OF_LIMITS .

IF &1-SIGN = 'I' .

case &1-option .
when 'EQ' .
LOG_OPER = '=' .
NR_OF_LIMITS = 1 .

when 'GE' .
LOG_OPER = '>=' .
NR_OF_LIMITS = 1 .

when 'LE' .
LOG_OPER = '=<' .
NR_OF_LIMITS = 1 .

when 'GT' .
LOG_OPER = '>' .
NR_OF_LIMITS = 1 .

when 'LT' .
LOG_OPER = '<' .
NR_OF_LIMITS = 1 .

when 'NE' .
LOG_OPER = '><' .
NR_OF_LIMITS = 1 .

when 'CP' .
LOG_OPER = 'Pattern' .
NR_OF_LIMITS = 1 .

when 'NP' .
LOG_OPER = 'Not Pattern' .
NR_OF_LIMITS = 1 .

when 'BT' .
LOG_OPER = 'Between' .
NR_OF_LIMITS = 2.

when 'NB' .
LOG_OPER = 'Not Between' .
NR_OF_LIMITS = 2.

endcase .

ELSEIF &1-SIGN = 'E' .

case &1-option .
when 'EQ' .
LOG_OPER = 'Not =' .
NR_OF_LIMITS = 1 .

when 'GE' .
LOG_OPER = 'Not >=' .
NR_OF_LIMITS = 1 .

when 'LE' .
LOG_OPER = 'Not =<' .
NR_OF_LIMITS = 1 .

when 'GT' .
LOG_OPER = 'Not >' .
NR_OF_LIMITS = 1 .

when 'LT' .
LOG_OPER = 'Not <' .
NR_OF_LIMITS = 1 .

when 'NE' .
LOG_OPER = 'Not ><' . NR_OF_LIMITS = 1 .
when 'CP' .
LOG_OPER = 'Not Pattern' .
NR_OF_LIMITS = 1 .

when 'NP' .
LOG_OPER = 'Pattern' .
NR_OF_LIMITS = 1 .

when 'BT' .
LOG_OPER = 'Not Between' .
NR_OF_LIMITS = 2.

when 'NB' .
LOG_OPER = 'Between' .
NR_OF_LIMITS = 2.

endcase .
ENDIF .
CONDENSE LOG_OPER NO-GAPS .

IF NR_OF_LIMITS = 1 .
write &1-low to i_criter-mline .
concatenate
&2
LOG_OPER
i_criter-mline
into i_criter-mline
separated by space .

ELSEIF NR_OF_LIMITS = 2 .
write &1-low to mline1 .
condense mline1 no-gaps .
write &1-high to mline2 .
condense mline2 no-gaps .
I_CRITER = LOG_OPER .
concatenate
&2
i_criter-mline
mline1
'And'
mline2
into i_criter-mline
separated by space .
endif .
append i_criter .
end-of-definition .
* =============================================
* SELECTION SCREEN - ( DEFAULT )
* ==============================================
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME .
SELECT-OPTIONS SCODE1 FOR PA9945-ZZCODE1 .
SELECT-OPTIONS SCODE2 FOR PA9945-ZZCODE2 .
SELECT-OPTIONS SCODE3 FOR PA9945-ZZCODE3 .
SELECTION-SCREEN END OF BLOCK B1 .
* =========================================
* Top of Page
* =========================================
TOP-OF-PAGE.
Write : / 'Report XXX' .
Uline .
Loop at i_criter .
Write : / i_criter-mline .
Endloop .
Uline .
* =========================================
* START OF SELECTION
* =========================================
START-OF-SELECTION .
PERFORM GET_SELECTION_CRITERIA_WORDING .
* ---------------------------------------
* Other Coding of Start of Selection
* ---------------------------------------
* =========================================
* END OF SELECTION
* =========================================
END-OF-SELECTION .
* ---------------------------------------
* Coding of End of Selection
* ---------------------------------------
Write : / 'x' . " To cause Top-of-Page
*-----------------------------------------*
* FORM GET_SELECTION_CRITERIA_WORDING.
*-----------------------------------------*
FORM GET_SELECTION_CRITERIA_WORDING.
clear : i_criter , i_criter[] .
IF NOT SCODE1[] IS INITIAL .
loop at SCODE1.
put_criteria SCODE1 'First Code' .
endloop .
endif .
IF NOT SCODE2[] IS INITIAL .
loop at SCODE2.
put_criteria SCODE2 'Second Code' .
endloop .
endif .
IF NOT SCODE3[] IS INITIAL .
loop at SCODE1.
put_criteria SCODE3 'Third Code' .
endloop .
endif .
EndForm .



ALSO READ:

- F4 (Value On Request) For Files On Presentation Or Application Server.

- Sample Program On Use Of Selection Screen.

- Creating Tab-Strip Selection Screen tab-strip Without Using SE51.

- Change The Height Of The Screen Layout To Make It Full Screen.

- F4 (Value On Request) For Field Using FM RSISP_DDIC_F4_VALUES.

No comments:

Post a Comment