Steps:
1.Get the data into internal table.
- Go to Transaction code SE38.
- Enter the program name which start's with Y or Z< Program name > and click on create Button.
- Enter the Title.
- Select the Attribute Type as Executable Program.
- Click on SAVE button.
- Enter the Logic,
SELECT * FROM EKKO INTO TABLE P_IT_EKKO WHERE EBELN IN P_S_EBELN.
2.Create a custom control Screen.
- Call the custom Container screen.
- To Create screen .
- Double click on Screen Number.
- Pop-up will appear.
- Click on Yes.
- Pop-up will appear.
- Click on Yes.
- Enter the short description.
- Click on Layout.
- Click on Custom Container.
- Drag the Custom Container.
- Enter the Name for Custom Container.
- Save -> Check -> Activate.
- Click on Back.
3.Create object for CL_GUI_CUSTOM_CONTAINER(pass custom control name) .
- Declare the Objects.
- Double click on Screen number.
- Enable the PBO module using CTRL + >.
- Double click on PBO module name.
- Pop-up will appear.
- Click on Pattern.
- Pop-up will appear.
- Click on ABAP object Pattern radio button.
- Click on continue.
- Pop-up will appear.
- Click on Create Object radio Button.
- Enter the Instance name.
- Enter the Class name and click on continue.
- Pop-up will appear.
- Click on Create Object radio Button.
- Enter the Instance name.
- Enter the Class name and click on continue.
- Enter the parent name as Custom container Object name.
Call the method SET_TABLE_FOR_FIRST_DISPLAY).
- Pop-up will appear.
- Click on ABAP object Pattern radio button.
- Click on continue.
- Pop-up will appear.
- Click on Call method radio button.
- Enter the instance name.
- Enter the Class name and method name.
- Click on continue.
Input
Source Code
REPORT ZOOALV_BASIC.
TABLES : EKKO.
DATA : IT_EKKO TYPE TABLE OF EKKO.
DATA : O_CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_ALV TYPE REF TO CL_GUI_ALV_GRID.
SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN.
START-OF-SELECTION.
PERFORM FETCH_DATA USING S_EBELN[] CHANGING IT_EKKO.
CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*& Form FETCH_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_S_EBELN[] text
* <--P_IT_EKKO text
*----------------------------------------------------------------------*
FORM FETCH_DATA USING P_S_EBELN LIKE S_EBELN[]
CHANGING P_IT_EKKO LIKE IT_EKKO.
SELECT * FROM EKKO INTO TABLE P_IT_EKKO WHERE EBELN IN P_S_EBELN.
ENDFORM. " FETCH_DATA
*&---------------------------------------------------------------------*
*& Module STATUS_9000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
CREATE OBJECT O_CUST
EXPORTING
* PARENT =
CONTAINER_NAME = 'CUST'
* STYLE =
* LIFETIME = lifetime_default
* REPID =
* DYNNR =
* NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT O_ALV
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = O_CUST
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
* I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 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.
CALL METHOD O_ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'EKKO'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = IT_EKKO
* IT_FIELDCATALOG =
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_9000 OUTPUT
thank you 🙂
ReplyDeleteThis comment has been removed by the author.
ReplyDelete