Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Request to check my coding..... Urgent

Former Member
0 Likes
713

MY program is with ALV_Grid

1. Selection Screen

Customer Number: KUNNR

Billing Date: FKDAT

Now Using the above Selection screen inputs, I want to generate the following fields in the output.

2. Output Screen

Invoice No: VBELN

Invoice Date: FKDAT

Customer Number: KUNNR

Customer Name: NAME1

Material Description: MAKTX

Payment Terms: ZTERM

Net Value: NETWR

Ship-to City: ORT01

Sold-to party: KUNAG

Ship-to party: KUNNR

Tables Used:

Delivery: LIKP, LIPS

Invoice:VBRK, VBRP

Customer: KNA1

Material: MARA

Material Description: MAKT

Now the Problem what I got is....How to link between these tables...ie., what common fields can be used between these tables so that I can use FOR ALL ENTRIES and retrieve the above output fields.

3. Create Dictionary Structure for Output Data

4. Create Dynpro (Screen 9000)

5. Create ALV Grid Object and Call Method "set_table_for_first_display" of alv obj in PBO Module of Screen

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

this is my coding so can

&----


*& Report ZTESTALVOOPS

*&

&----


*&

*&

&----


REPORT ZTESTALVOOPS.

tables: KNA1, KNVV,VBAK,VBFA, VBRK, mara.

data gr_alv_grid type ref to cl_gui_alv_grid.

data gc_custom_control_name type scrfname value 'CC_ALV'.

data gr_custom_container type ref to cl_gui_custom_container.

data gt_fieldcat type lvc_t_fcat.

data gs_layout type lvc_s_layo.

types: lvc.

                            • selection screen *******************

select-options: so_kunnr for kna1-kunnr,

so_fkdat for vbrk-fkdat.

data begin of gt_list occurs 0.

include structure ZDIC_STRUC. " Dictionary Structure for Output Data

data end of gt_list.

                                • start of selection **********************

                                        • end of selection *************************

call screen 9000.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'SET_STATUS'.

SET TITLEBAR 'FIRST' of program prg with cnt.

perform disp_alv. " DISPLAY ALV GRID

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Form disp_alv

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM disp_alv .

if gr_alv_grid is INITIAL.

CREATE OBJECT GR_CUSTOM_CONTAINER

EXPORTING

  • PARENT =

CONTAINER_NAME = gc_custom_control_name

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

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

I_PARENT = gr_custom_container

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

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

perform prepare_fieldcat changing gt_fieldcat.

perform prepare_layout changing gs_layout.

CALL METHOD GR_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

IS_LAYOUT = gs_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING = gt_exclude

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = gt_list[]

IT_FIELDCATALOG = gt_fieldcat

  • IT_SORT = gt_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.

else.

CALL METHOD GR_ALV_GRID->REFRESH_TABLE_DISPLAY

  • EXPORTING

  • IS_STABLE = gt_list[]

  • I_SOFT_REFRESH = gt_list[]

EXCEPTIONS

FINISHED = 1

others = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

ENDFORM. " disp_alv

&----


*& Form prepare_fieldcat

&----


  • text

----


  • <--P_GT_FIELDCAT text

----


FORM prepare_fieldcat CHANGING P_GT_FIELDCAT type lvc_t_fcat.

data ls_fcat type lvc_s_fcat.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

I_STRUCTURE_NAME = 'dic_struc'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

CT_FIELDCAT = p_gt_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.

*loop at p_gt_fieldcat into ls_fcat.

*

*case ls_fcat-fieldname.

*when 'CARRID'.

*ls_fcat-hotspot = 'X'.

*ls_fcat-outputlen = '10'.

*ls_fcat-coltext = 'Carrier ID'.

*modify p_gt_fieldcat from ls_fcat.

*

*when 'PAYMENTSUM'.

*ls_fcat-no_out = 'X'.

*ls_fcat-outputlen = '10'.

*modify p_gt_fieldcat from ls_fcat.

*endcase.

*

*endloop.

ENDFORM. " prepare_fieldcat

&----


*& Form prepare_layout

&----


  • text

----


  • <--P_GS_LAYOUT text

----


FORM prepare_layout CHANGING P_GS_LAYOUT type lvc_s_layo.

p_gs_layout-zebra = 'X'.

p_gs_layout-grid_title = 'FLIGHTS'.

p_gs_layout-smalltitle = 'X'.

ENDFORM. " prepare_layout

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when 'BACK'.

SET SCREEN 0.

LEAVE SCREEN.

when 'CANCEL'.

LEAVE PROGRAM.

WHEN 'OTHERS'.

LEAVE PROGRAM.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.::

Can anyone tell the code for selction statement for this program .....

MY program is with ALV_Grid

1. Selection Screen

Customer Number: KUNNR

Billing Date: FKDAT

Now Using the above Selection screen inputs, I want to generate the following fields in the output.

2. Output Screen

Invoice No: VBELN

Invoice Date: FKDAT

Customer Number: KUNNR

Customer Name: NAME1

Material Description: MAKTX

Payment Terms: ZTERM

Net Value: NETWR

Ship-to City: ORT01

Sold-to party: KUNAG

Ship-to party: KUNNR

Tables Used:

Delivery: LIKP, LIPS

Invoice:VBRK, VBRP

Customer: KNA1

Material: MARA

Material Description: MAKT

Now the Problem what I got is....How to link between these tables...ie., what common fields can be used between these tables so that I can use FOR ALL ENTRIES and retrieve the above output fields.

3. Create Dictionary Structure for Output Data

4. Create Dynpro (Screen 9000)

5. Create ALV Grid Object and Call Method "set_table_for_first_display" of alv obj in PBO Module of Screen

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

this is my coding so can

&----


*& Report ZTESTALVOOPS

*&

&----


*&

*&

&----


REPORT ZTESTALVOOPS.

tables: KNA1, KNVV,VBAK,VBFA, VBRK, mara.

data gr_alv_grid type ref to cl_gui_alv_grid.

data gc_custom_control_name type scrfname value 'CC_ALV'.

data gr_custom_container type ref to cl_gui_custom_container.

data gt_fieldcat type lvc_t_fcat.

data gs_layout type lvc_s_layo.

types: lvc.

                            • selection screen *******************

select-options: so_kunnr for kna1-kunnr,

so_fkdat for vbrk-fkdat.

data begin of gt_list occurs 0.

include structure ZDIC_STRUC. " Dictionary Structure for Output Data

data end of gt_list.

                                • start of selection **********************

                                        • end of selection *************************

call screen 9000.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'SET_STATUS'.

SET TITLEBAR 'FIRST' of program prg with cnt.

perform disp_alv. " DISPLAY ALV GRID

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Form disp_alv

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM disp_alv .

if gr_alv_grid is INITIAL.

CREATE OBJECT GR_CUSTOM_CONTAINER

EXPORTING

  • PARENT =

CONTAINER_NAME = gc_custom_control_name

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

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

I_PARENT = gr_custom_container

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

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

perform prepare_fieldcat changing gt_fieldcat.

perform prepare_layout changing gs_layout.

CALL METHOD GR_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

IS_LAYOUT = gs_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING = gt_exclude

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = gt_list[]

IT_FIELDCATALOG = gt_fieldcat

  • IT_SORT = gt_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.

else.

CALL METHOD GR_ALV_GRID->REFRESH_TABLE_DISPLAY

  • EXPORTING

  • IS_STABLE = gt_list[]

  • I_SOFT_REFRESH = gt_list[]

EXCEPTIONS

FINISHED = 1

others = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

ENDFORM. " disp_alv

&----


*& Form prepare_fieldcat

&----


  • text

----


  • <--P_GT_FIELDCAT text

----


FORM prepare_fieldcat CHANGING P_GT_FIELDCAT type lvc_t_fcat.

data ls_fcat type lvc_s_fcat.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

I_STRUCTURE_NAME = 'dic_struc'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

CT_FIELDCAT = p_gt_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.

*loop at p_gt_fieldcat into ls_fcat.

*

*case ls_fcat-fieldname.

*when 'CARRID'.

*ls_fcat-hotspot = 'X'.

*ls_fcat-outputlen = '10'.

*ls_fcat-coltext = 'Carrier ID'.

*modify p_gt_fieldcat from ls_fcat.

*

*when 'PAYMENTSUM'.

*ls_fcat-no_out = 'X'.

*ls_fcat-outputlen = '10'.

*modify p_gt_fieldcat from ls_fcat.

*endcase.

*

*endloop.

ENDFORM. " prepare_fieldcat

&----


*& Form prepare_layout

&----


  • text

----


  • <--P_GS_LAYOUT text

----


FORM prepare_layout CHANGING P_GS_LAYOUT type lvc_s_layo.

p_gs_layout-zebra = 'X'.

p_gs_layout-grid_title = 'FLIGHTS'.

p_gs_layout-smalltitle = 'X'.

ENDFORM. " prepare_layout

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when 'BACK'.

SET SCREEN 0.

LEAVE SCREEN.

when 'CANCEL'.

LEAVE PROGRAM.

WHEN 'OTHERS'.

LEAVE PROGRAM.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.::

Can anyone tell the code for selction statement for this program .....

4 REPLIES 4
Read only

Former Member
0 Likes
678

Hi

in start-of-selection write as below

declare itab with fields:

vbeln,fkdat,kunnr,zterm,netwr,posnr,matnr,vgbel, maktx,name1,kunag,ort01.

select avbeln afkdat akunag azterm anetwr bposnr bmatnr bvgbel

from vbrk as a join vbrp as b on avbeln = bvbeln

into table itab where a~kunag in s_kunnr and

a~fkdat in s_fkdat.

loop at itab.

select single maktx from makt into itab-maktx

where matnr = itab-matnr and spras = sy-langu.

select single kunag into itab-kunag from likp

where vbeln = itab-vgbel.

select single name1 from kna1 into itab-name1

where kunnr = itab-kunnr.

select single ort01 from kna1 into itab-ort01

where kunnr = itab-kunag.

modify itab index sy-tabix transporting maktx name1 kunag ort01.

endloop.

and use the table ITAB in the ALV fun module

Regards

Anji

Read only

0 Likes
678

Hello Anji Sir,

Iam just learning Abap , so please don´t angry with my questions ..

in my coding i used structure ZDIC_STRUC.. all the field data are stored in that which are displayed as output. In the selection screen i have to declare itab with fields:

vbeln,fkdat,kunnr,zterm,netwr,posnr,matnr,vgbel, maktx,name1,kunag,ort01.

In the start of selection..

loop at itab.

select single maktx from makt into itab-maktx

where matnr = itab-matnr and spras = sy-langu.

select single kunag into itab-kunag from likp

where vbeln = itab-vgbel.

select single name1 from kna1 into itab-name1

where kunnr = itab-kunnr.

select single ort01 from kna1 into itab-ort01

where kunnr = itab-kunag.

modify itab index sy-tabix transporting maktx name1 kunag ort01.

endloop.

..

that rite.. ok

so can you do me a favour , please send me complete code...if u don´t mind

Read only

0 Likes
678

Hello Anji Sir,

Iam just learning Abap , so please don´t angry with

my questions ..

so can you do me a favour , please send me complete

code...if u don´t mind

Sending you the complete code won't help you to learn. You need to try to figure this stuff out yourself and then come back with specific problems, not entire programs for us to check.

Instead of diving straight into an ALV, why not try to just get the data into an internal table and write it out to the screen as a basic report. Concentrate on just the data retrieval first.

Gareth.

Read only

0 Likes
678

Now check the coding for the MY program is with ALV_Grid

1. Selection Screen

Customer Number: KUNNR

Billing Date: FKDAT

Now Using the above Selection screen inputs, I want to generate the following fields in the output.

2. Output Screen

Invoice No: VBELN

Invoice Date: FKDAT

Customer Number: KUNNR

Customer Name: NAME1

Material Description: MAKTX

Payment Terms: ZTERM

PR00_NETVALUE: KBETR

VPRS_COST: KWERT

VPRS_PROFITMARG: KBETR

Ship-to City: ORT01

Sold-to party: KUNAG

Ship-to party: KUNNR

Tables Used:

Delivery: LIKP, LIPS

Invoice:VBRK, VBRP

Customer: KNA1

Material: MARA

Material Description: MAKT

salesDocument VBAK - Head, VBAP – Positions

3. Create Dictionary Structure for Output Data

4. Create Dynpro (Screen 9000)

5. Create ALV Grid Object and Call Method "set_table_for_first_display" of alv obj in PBO Module of Screen

_____________________________________________________________________________________________________

Coding

REPORT ZTESTALVOOPS.

tables: KNA1, KNVV,VBAK,VBFA, VBRK, mara.

data gr_alv_grid type ref to cl_gui_alv_grid.

data gc_custom_control_name type scrfname value 'CC_ALV'.

data gr_custom_container type ref to cl_gui_custom_container.

data gt_fieldcat type lvc_t_fcat.

data gs_layout type lvc_s_layo.

types: lvc.

                            • selection screen *******************

select-options: itab_kunnr for kna1-kunnr,

itab_fkdat for vbrk-fkdat.

data begin of gt_list occurs 0.

include structure Zrata_STRUC. " Dictionary Structure for Output Data

data end of gt_list.

                                • start of selection **********************

select avbeln afkdat akunag a vbeln_va avndat_veda a vbeln_va anetwr bposnr bkbetr bkwert bkbetr bmaktx b~vgbel

from vbrk as a join vbrp as b on avbeln = bvbeln

into table itab where a~kunag in s_kunnr and

a~fkdat in s_fkdat.

loop at itab.

select single maktx from makt into itab-maktx

where matnr = itab-matnr and spras = sy-langu.

select single kunag into itab-kunag from likp

where vbeln = itab-vgbel.

select single name1 from kna1 into itab-name1

where kunnr = itab-kunnr.

select single ort01 from kna1 into itab-ort01

where kunnr = itab-kunag.

modify itab index sy-tabix transporting maktx name1 kunag ort01.

endloop.

                                        • end of selection *************************

call screen 9000.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'SET_STATUS'.

SET TITLEBAR 'FIRST' of program prg with cnt.

perform disp_alv. " DISPLAY ALV GRID

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Form disp_alv

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM disp_alv .

if gr_alv_grid is INITIAL.

CREATE OBJECT GR_CUSTOM_CONTAINER

EXPORTING

  • PARENT =

CONTAINER_NAME = gc_custom_control_name

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

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

I_PARENT = gr_custom_container

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

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

perform prepare_fieldcat changing gt_fieldcat.

perform prepare_layout changing gs_layout.

CALL METHOD GR_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

IS_LAYOUT = gs_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING = gt_exclude

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = gt_list[]

IT_FIELDCATALOG = gt_fieldcat

  • IT_SORT = gt_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.

else.

CALL METHOD GR_ALV_GRID->REFRESH_TABLE_DISPLAY

  • EXPORTING

  • IS_STABLE = gt_list[]

  • I_SOFT_REFRESH = gt_list[]

EXCEPTIONS

FINISHED = 1

others = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

ENDFORM. " disp_alv

&----


*& Form prepare_fieldcat

&----


  • text

----


  • <--P_GT_FIELDCAT text

----


FORM prepare_fieldcat CHANGING P_GT_FIELDCAT type lvc_t_fcat.

data ls_fcat type lvc_s_fcat.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

I_STRUCTURE_NAME = 'dic_struc'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

CT_FIELDCAT = p_gt_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.

*loop at p_gt_fieldcat into ls_fcat.

*

*case ls_fcat-fieldname.

*when 'CARRID'.

*ls_fcat-hotspot = 'X'.

*ls_fcat-outputlen = '10'.

*ls_fcat-coltext = 'Carrier ID'.

*modify p_gt_fieldcat from ls_fcat.

*

*when 'PAYMENTSUM'.

*ls_fcat-no_out = 'X'.

*ls_fcat-outputlen = '10'.

*modify p_gt_fieldcat from ls_fcat.

*endcase.

*

*endloop.

ENDFORM. " prepare_fieldcat

&----


*& Form prepare_layout

&----


  • text

----


  • <--P_GS_LAYOUT text

----


FORM prepare_layout CHANGING P_GS_LAYOUT type lvc_s_layo.

p_gs_layout-zebra = 'X'.

p_gs_layout-grid_title = 'FLIGHTS'.

p_gs_layout-smalltitle = 'X'.

ENDFORM. " prepare layout

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

Case sy-ucomm.

When 'BACK'.

SET SCREEN 0.

LEAVE SCREEN.

When 'CANCEL'.

LEAVE PROGRAM.

WHEN 'OTHERS'.

LEAVE PROGRAM.

Endcase.

ENDMODULE. „USER_COMMAND_0100 INPUT