Showing posts with label report. Show all posts
Showing posts with label report. Show all posts

Monday, April 27, 2015

ABAP Report - Program Structure or Template




2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
************************************************************************
* Program Name:
* Author:
* Creation Date:
* Description:
* Quality check:
*----------------------------------------------------------------------*
*======================================================================*
* Change History Log
*----------------------------------------------------------------------*
* Date | Change ID | Name | Description | Initials
*----------------------------------------------------------------------*
*
************************************************************************
 
REPORT
 
*-----------------------------------------------------------------------
* TABLE DEFINITIONS
*-----------------------------------------------------------------------
* TABLES: example.
 
*-----------------------------------------------------------------------
* TYPES DEFINITIONS
*-----------------------------------------------------------------------
* TYPES: BEGIN OF texample,
* example TYPE c,
* END OF texample.
 
*-----------------------------------------------------------------------
* TABLE TYPE DEFINITIONS
*-----------------------------------------------------------------------
* TYPES: ttexample TYPE STANDARD TABLE OF texample.
 
*-----------------------------------------------------------------------
* DATA - WORKING FIELDS
*-----------------------------------------------------------------------
* DATA: example TYPE c.
 
*-----------------------------------------------------------------------
* DATA - CONSTANTS
*-----------------------------------------------------------------------
* CONSTANTS:
 
*-----------------------------------------------------------------------
* SELECTION SCREEN
*-----------------------------------------------------------------------
* SELECTION-SCREEN BEGIN OF BLOCK SCR WITH FRAME.
* PARAMETERS: p_example TYPE CHAR255.
* SELECTION-SCREEN END OF BLOCK SCR.
 
************************************************************************
************************** MAIN PROGRAM ********************************
************************************************************************
 
*-----------------------------------------------------------------------
* INITIALIZATION.
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* AT SELECTION-SCREEN.
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_example.
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* START-OF-SELECTION.
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* END-OF-SELECTION.
*-----------------------------------------------------------------------
 
************************************************************************
************************** SUBROUTINES *********************************
************************************************************************

Wednesday, December 24, 2014

Hide Button or Icon in the ABAP Report



Below is the code snippet

Function  :  'RS_SET_SELSCREEN_STATUS' .


FORM remove_dynamic_sel .
  DATAt_exclude TYPE STANDARD TABLE OF sypfkey.
  APPEND 'DYNS' TO t_exclude.

  "DYNS is the dynamic selection screen function code.

  CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
    EXPORTING
      p_status  sy-pfkey
    TABLES
      p_exclude t_exclude.
ENDFORM.  

Sunday, June 12, 2011

Custom Input Help

Below is the custom help for selection options we need to define s-low and s-high withe separated input help

    SELECT t588b~massn
     INTO CORRESPONDING FIELDS OF TABLE i_acthelp
    FROM t588b
    WHERE t588b~USERG '14'
    AND t588b~massn NE ''.

  LOOP AT i_acthelp.
    SELECT SINGLE mntxt FROM t529t INTO i_acthelp-mntxt
      WHERE  sprsl ='EN' AND
       massn i_acthelp-massn.
      MODIFY i_acthelp.
  ENDLOOP.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*     DDIC_STRUCTURE         = ' '
      RETFIELD               'MASSN'
*     PVALKEY                = ' '
*     DYNPPROG               = ' '
*     DYNPNR                 = ' '
*     DYNPROFIELD            = ' '
*     STEPL                  = 0
     WINDOW_TITLE           =  'Action Type'
*     VALUE                  = ' '
     VALUE_ORG              'S'
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
*     CALLBACK_PROGRAM       = ' '
*     CALLBACK_FORM          = ' '
*     CALLBACK_METHOD        =
*     MARK_TAB               =
*   IMPORTING
*     USER_RESET             =
    TABLES
      VALUE_TAB              i_acthelp
*     FIELD_TAB              =
     RETURN_TAB             =  it_return
*     DYNPFLD_MAPPING        =
*   EXCEPTIONS
*     PARAMETER_ERROR        = 1
*     NO_VALUES_FOUND        = 2
*     OTHERS                 = 3
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

  READ TABLE it_return INTO wa_return INDEX 1.
  S_ACTYPE wa_return-fieldval.

Thursday, November 26, 2009

Selection Screen

I have found good tutorial on SAP selection Screen, below code is taken from this site


In this example I will show you below selection screen properties

* Adding button on selection screen
* Define radiobuttons
* Define checkboxes
* Add more than one object in per line of selection screen
* Disable an object
* Hide/Show an object
* Display blue colored parameters

REPORT ZMAVSARTEST.

Tables : Pgmi, Sscrfields.

Data : Begin Of IPgmi Occurs 0,
Werks Type Pgmi-Werks,
Prgrp Type Pgmi-Prgrp,
Nrmit Type Pgmi-Nrmit,
End Of IPgmi.
Data : WPgmi Like Line Of IPgmi.

Selection-Screen Begin of Block b1 With Frame Title TEXT-T01.
Select-Options : Prgrp For Pgmi-Prgrp Default ‘183X366_BTE’ Modif Id OB.
Parameters : Werks Like Marc-Werks Default ‘2000′,
S1 RadioButton Group G1,
S2 RadioButton Group G1,
S3 RadioButton Group G1,
PSay(3).
Selection-Screen End of Block b1.

Selection-Screen Begin of Block b2 With Frame Title TEXT-T02.
Parameters : S4 RadioButton Group G2,
S5 RadioButton Group G2.
Selection-Screen End of Block b2.

Selection-Screen Begin of Block b3 With Frame Title TEXT-T03.
Parameters : S6 RadioButton Group G3 User-Command Radyo,
S7 RadioButton Group G3.
Selection-Screen begin of line.
Parameters p_ch1 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-001 Modif ID SL.
Parameters p_ch2 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-002 Modif ID SL.
Parameters p_ch3 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-003 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch4 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-004 Modif ID SL.
Parameters p_ch5 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-005 Modif ID SL.
Parameters p_ch6 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-006 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch7 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-007 Modif ID SL.
Parameters p_ch8 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-008 Modif ID SL.
Parameters p_ch9 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-009 Modif ID SL.
Selection-Screen end of line.
Selection-Screen begin of line.
Parameters p_ch10 AS checkbox Modif ID SL.
Selection-Screen comment 3(20) text-010 Modif ID SL.
Parameters p_ch11 AS checkbox Modif ID SL.
Selection-Screen comment 27(20) text-011 Modif ID SL.
Parameters p_ch12 AS checkbox Modif ID SL.
Selection-Screen comment 51(20) text-012 Modif ID SL.
Selection-Screen end of line.
Selection-Screen End of Block b3.

TYPE-POOLS icon.
Data : Functxt TYPE Smp_Dyntxt.

Selection-Screen: Function Key 1,
Function Key 2.
Initialization.
S7 = ‘X’.
Functxt-icon_id = ICON_ALARM.
Functxt-quickinfo = ‘Uç’.
Functxt-icon_text = ‘Uç’.
Sscrfields-functxt_01 = functxt.
Sscrfields-Functxt_02 = ‘Button2′.

At Selection-Screen.
Case Sscrfields-Ucomm.
When ‘FC01′.
Message ‘Uçakla mı uçacaksın?’ Type ‘I’.
When ‘FC02′.
Message ‘Button2′ Type ‘I’.
When Others.
Endcase.

At Selection-Screen Output.
Perform CheckRadio.

FORM CheckRadio.
Loop At Screen.
If S6 = ‘X’.
If Screen-Group1 = ‘SL’.
Screen-Active = 0.
Endif.
Elseif S7 = ‘X’.
If Screen-Group1 = ‘SL’.
Screen-Active = 1.
Endif.
Endif.
If Screen-Group1 = ‘OB’.
Screen-Intensified = ‘1′.
Endif.
If Screen-Name = ‘S5′.
Screen-Input = 0.
Endif.
Modify Screen.
Endloop.
ENDFORM.” CheckRadio

Start-Of-Selection.
Perform GetData.
End-Of-Selection.

Form GetData.
* Get your data in this subroutine
EndForm. ” GetData