Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

alv thro with call methode

hi sir/medam..

i want some selected field display thro alv with objects concept(call methed)..

but i know that fully table how display..

*&----


*& Report ZMG_OBJECT

*&

&----


*&

*&

&----


REPORT ZMG_OBJECT.

tables BSIK.

data:o_docking type ref to cl_gui_docking_container,

o_grid type ref to cl_gui_alv_grid.

DATA: ITAB TYPE STANDARD TABLE OF mara,

DATA: i_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,

WA TYPE BSIK.

w_variant type disvariant.

w_variant-report = sy-repid.

*DATA: ITAB TYPE STANDARD TABLE OF bsik with header line.

*DATA: begin of ITAB1 occurs 0,

*

  • budat like bsik-budat, "postind date.

  • bldat like bsik-bldat, "docuent date.

  • dmbtr like bsik-dmbtr, "amount.

  • xblnr like bsik-xblnr, "refrance no

  • lifnr LIKE bsik-lifnr, "vender code

  • SGTXT like bsik-SGTXT, "text.

  • gsber like bsik-gsber, "buissness area.

  • shkzg LIKE bsik-shkzg, "dabit/credit card

  • BELNR like bsik-BELNR, "document no.

  • WaERS like bsik-waers,

  • bukrs like bsik-bukrs, "company code.

  • end of ITAB1.

*PARAMETERS:

*select-options vendor for bsik-lifnr. "OBLIGATORY,

*select-options com_code for bsik-bukrs. "OBLIGATORY.

*

*select-options sel_date for bsik-budat no-extension.

*

**********************************************************************

*

*select budat bldat dmbtr xblnr lifnr SGTXT GSBER SHKZG BELNR WaERS

*bukrs

  • from bsik into table ITAB where bukrs in com_code and

  • lifnr in vendor.

*

*append i_vop.

*endselect.

select * from mara into table itab up to 100 rows.

call screen 1000.

&----


*& Module STATUS_1000 OUTPUT

&----


  • text

----


MODULE STATUS_1000 OUTPUT.

if o_docking is initial.

SET PF-STATUS 'ZGUI'.

SET TITLEBAR 'TEST'.

CREATE OBJECT O_DOCKING

EXPORTING

  • PARENT =

  • REPID =

  • DYNNR =

  • SIDE = DOCK_AT_LEFT

  • EXTENSION = 50

  • STYLE =

  • LIFETIME = lifetime_default

  • CAPTION =

  • METRIC = 0

RATIO = '95'

  • NO_AUTODEF_PROGID_DYNNR =

  • NAME =

  • 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_GRID

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

I_PARENT = O_DOCKING.

  • 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 FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

I_STRUCTURE_NAME = 'BSIK'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

CT_FIELDCAT = I_FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

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_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

IS_VARIANT = W_VARIANT

I_SAVE = 'A'

  • 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 = ITAB

IT_FIELDCATALOG = I_FIELDCAT

  • 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_1000 OUTPUT

&----


*& Module USER_COMMAND_1000 INPUT

&----


  • text

----


MODULE USER_COMMAND_1000 INPUT.

DATA OK_CODE LIKE SY-UCOMM.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN 'CANCEL' OR 'EXIT'.

PERFORM FREE_OBJECTs.

LEAVE PROGRAM.

WHEN 'BACKE'.

PERFORM FREE_OBJECTs.

SET SCREEN 0.

LEAVE SCREEN.

ENDCASE.

ENDMODULE. " USER_COMMAND_1000 INPUT

form free_objects.

CALL METHOD O_GRID->FREE

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3

.

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_DOCKING->FREE

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3

.

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.

Former Member
Not what you were looking for? View more on this topic or Ask a question