Application Development 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: 

Blocks in ALV side by side

Former Member
0 Kudos
198

Hi Experts,

I have a requirement that is of output with 3 Blocks of ALV side by side. How can I do this. Can anybody help me in this regard.

Thanks,

bsv.

15 REPLIES 15

Former Member
0 Kudos
150

hi,

i dont know about side by side but can give code for one after another.....

0 Kudos
150

Hi Dhwani shah,

Sorry, I have to make that side by side ALV only.

Thanks,

bsv.

p291102
Active Contributor
0 Kudos
150

Hi,

Following report is the one type BLOCK report .

REPORT YMS_EDITBLOCKALV.

TABLES : rmmg1,MCHB, mkpf.

DATA: BEGIN OF t_mseg OCCURS 0,

zeile LIKE mseg-zeile,

menge LIKE mseg-menge,

meins LIKE mseg-meins,

matnr LIKE mseg-matnr,

werks LIKE mseg-werks,

charg LIKE mseg-charg,

bwart LIKE mseg-bwart,

END OF t_mseg.

DATA:BEGIN OF t_mchb OCCURS 0.

INCLUDE STRUCTURE mchb.

data flag type c.

  • matnr LIKE mchb-matnr,

  • charg LIKE mchb-charg,

  • werks LIKE mchb-werks,

  • clabs LIKE mchb-clabs,

DATA END OF t_mchb.

TYPE-POOLS slis.

data: progname like sy-repid,

fieldcattab TYPE slis_t_fieldcat_alv WITH HEADER LINE.

data tabindex type i.

data wa_matnr LIKE mchb-matnr.

progname = sy-repid.

SELECTION-SCREEN BEGIN OF BLOCK b_b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS s_docno FOR mkpf-mblnr OBLIGATORY.

PARAMETERS p_docyr LIKE mkpf-mjahr OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b_b1.

START-OF-SELECTION.

SELECT zeile

menge

meins

matnr

werks

charg

bwart

FROM mseg

INTO TABLE t_mseg

WHERE mblnr IN s_docno AND mjahr = p_docyr.

CLEAR fieldcattab.

fieldcattab-col_pos = 1.

fieldcattab-fieldname = 'ZEILE'.

fieldcattab-tabname = 'T_MSEG'.

fieldcattab-fix_column = 'X'.

fieldcattab-seltext_l = 'Item'.

APPEND fieldcattab.

CLEAR fieldcattab.

fieldcattab-col_pos = 2.

fieldcattab-fieldname = 'MENGE'.

fieldcattab-tabname = 'T_MSEG'.

fieldcattab-seltext_l = 'Quantity'.

APPEND fieldcattab.

CLEAR fieldcattab.

fieldcattab-col_pos = 3.

fieldcattab-fieldname = 'MEINS'.

fieldcattab-tabname = 'T_MSEG'.

fieldcattab-seltext_l = 'Unit'.

APPEND fieldcattab.

CLEAR fieldcattab.

fieldcattab-col_pos = 4.

fieldcattab-fieldname = 'MATNR'.

fieldcattab-tabname = 'T_MSEG'.

fieldcattab-seltext_l = 'Material'.

APPEND fieldcattab.

CLEAR fieldcattab.

fieldcattab-col_pos = 5.

fieldcattab-fieldname = 'WERKS'.

fieldcattab-tabname = 'T_MSEG'.

fieldcattab-seltext_l = 'Plant'.

APPEND fieldcattab.

CLEAR fieldcattab.

fieldcattab-col_pos = 6.

fieldcattab-fieldname = 'CHARG'.

fieldcattab-tabname = 'T_MSEG'.

fieldcattab-seltext_l = 'Batch No'.

APPEND fieldcattab.

CLEAR fieldcattab.

fieldcattab-col_pos = 7.

fieldcattab-fieldname = 'BWART'.

fieldcattab-tabname = 'T_MSEG'.

fieldcattab-seltext_l = 'Inventory'.

fieldcattab-hotspot = 'X'.

APPEND fieldcattab.

end-of-selection.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = PROGNAME

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USERCOMMAND1'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = fieldcattab[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT = fieldcattab

  • IT_HYPERLINK =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t_mseg

  • EXCEPTIONS

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

FORM usercommand1 USING r_ucomm LIKE sy-ucomm rs_selfield TYPE

slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

tabindex = rs_selfield-tabindex.

read table t_mseg INDEX tabindex.

select * from mchb into table t_mchb where matnr = t_mseg-matnr.

clear fieldcattab.

CLEAR fieldcattab[].

fieldcattab-col_pos = 1.

fieldcattab-fieldname = 'FLAG'.

fieldcattab-tabname = 'T_MCHB'.

fieldcattab-fix_column = 'X'.

fieldcattab-seltext_l = 'Check Box'.

fieldcattab-input = 'X'.

fieldcattab-edit = 'X'.

fieldcattab-checkbox = 'X'.

APPEND fieldcattab.

clear fieldcattab.

fieldcattab-col_pos = 2.

fieldcattab-fieldname = 'MATNR'.

fieldcattab-tabname = 'T_MCHB'.

fieldcattab-fix_column = 'X'.

fieldcattab-seltext_l = 'Material'.

fieldcattab-emphasize = 'C1'.

fieldcattab-input = 'X'.

fieldcattab-edit = 'X'.

  • fieldcattab-checkbox = 'X'.

APPEND fieldcattab.

clear fieldcattab.

fieldcattab-col_pos = 3.

fieldcattab-fieldname = 'CHARG'.

fieldcattab-tabname = 'T_MCHB'.

fieldcattab-seltext_l = 'Batch No'.

fieldcattab-emphasize = 'C2'.

fieldcattab-input = 'X'.

fieldcattab-edit = 'X'.

APPEND fieldcattab.

clear fieldcattab.

fieldcattab-col_pos = 4.

fieldcattab-fieldname = 'WERKS'.

fieldcattab-tabname = 'T_MCHB'.

fieldcattab-seltext_l = 'Plant'.

fieldcattab-emphasize = 'C30'.

fieldcattab-input = 'X'.

fieldcattab-edit = 'X'.

APPEND fieldcattab.

clear fieldcattab.

fieldcattab-col_pos = 5.

fieldcattab-fieldname = 'CLABS'.

fieldcattab-tabname = 'T_MCHB'.

fieldcattab-seltext_l = 'Stock'.

fieldcattab-emphasize = 'C601'.

fieldcattab-input = 'X'.

fieldcattab-edit = 'X'.

APPEND fieldcattab.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = PROGNAME

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USERCOMMAND2'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = FIELDCATTAB[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = t_mchb

  • EXCEPTIONS

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

endcase.

endform.

FORM usercommand2 USING r_ucomm LIKE sy-ucomm rs_selfield TYPE

slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

IF rs_selfield-sel_tab_field = 'T_MCHB-MATNR'.

  • CALL FUNCTION 'ZALV2'

  • EXPORTING

    • CTU = 'X'

  • MODE = 'E'

  • UPDATE = 'A'

    • GROUP =

    • USER =

    • KEEP =

    • HOLDDATE =

    • NODATA = '/'

  • MATNR_001 = '200-200'

    • KZSEL_01_002 = 'X'

    • IMPORTING

    • SUBRC =

    • TABLES

    • MESSTAB =

  • .

**

SET PARAMETER ID 'RID' FIELD RMMG1-MATNR.

CALL TRANSACTION 'MM03' and skip first screen.

    • ENDIF.

    • ENDCASE.

*

  • CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  • EXPORTING

  • i_callback_program = progname

  • i_callback_user_command = 'USERCOMMAND3'

  • it_fieldcat = fieldcattab[]

  • TABLES

  • t_outtab = t_mchb

  • EXCEPTIONS

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

endcase.

ENDFORM.

Thanks,

<b>Sankar M</b>

Former Member
0 Kudos
150

HI,

if u want to display grids side by side by using OOALV.

rgds,

bharat.

0 Kudos
150

Hi bharath,

Any of the way I want to display them blocks side by side.

Thanks,

bsv.

0 Kudos
150

Hi Bharath,

If you have any such example with using OOPS. Could you please provide me that.

Thanks,

bsv.

0 Kudos
150

you can craete two custom controllers side by side in a screen and prepare ALV as usual (filling field catalog and calling methods to display) it will display alv's side by side.

regards,

Suman

0 Kudos
150

Hi Suman,

Do you have any sample code. Please send me if you have.

Thanks,

bsv.

0 Kudos
150

I don't have a side by side sample code, but i have created 2 OOALVs in a cloumn if u want i can sent that....it will be almost same but difference is u just need to create CUSTOM CONTROLLER side by side in screen rather in my case used one by one.

Suman

0 Kudos
150

In this sample code i have used three custom containers (blocks),

one after the other in screen layout, but in ur case create them side by side and follow the code below:

&----


*& Include ZRFI5172_ALV

&----


*tabll for field catalog (ALV)

DATA : fcat TYPE lvc_t_fcat,

fcat1 TYPE lvc_t_fcat,

fcat2 TYPE lvc_t_fcat.

*Work area for field catalog

DATA : wa_field LIKE LINE OF fcat,

wa_field1 LIKE LINE OF fcat1,

wa_field2 LIKE LINE OF fcat2.

*object for custom container

DATA : g_custom_container

TYPE REF TO cl_gui_custom_container,

g_custom_container1

TYPE REF TO cl_gui_custom_container,

g_custom_container2

TYPE REF TO cl_gui_custom_container,

*object for alv grid

sap_grid

TYPE REF TO cl_gui_alv_grid,

sap_grid1

TYPE REF TO cl_gui_alv_grid,

sap_grid2

TYPE REF TO cl_gui_alv_grid.

*layout for ALV grid

DATA: g_layout TYPE lvc_s_layo,

g_layout1 TYPE lvc_s_layo,

g_layout2 TYPE lvc_s_layo,

g_layout3 TYPE disvariant,

g_layout4 TYPE disvariant,

g_layout5 TYPE disvariant.

DATA: g_curr TYPE t001-waers,

g_date(10) TYPE c,

g_date1(10) TYPE c,

g_bal_date(23) TYPE c,

g_bal_date1(23) TYPE c.

&----


*& Module status_1100 OUTPUT

&----


  • text

----


MODULE status_1100 OUTPUT.

  • pf-status for screen 1100

SET PF-STATUS 'TRADELINE_STATUS'.

  • title for screen 1100

SET TITLEBAR 'TRADELINE_TITLE'.

  • Getting the Summary report header for balance@ Z table date

CONCATENATE text-010

g_date+6(2)

'/'

g_date+4(2)

'/'

g_date+0(4)

INTO g_bal_date.

  • Getting the Summary report header for balance@ Lodgement date

CONCATENATE text-014

g_date1+6(2)

'/'

g_date1+4(2)

'/'

g_date1+0(4)

INTO g_bal_date1.

  • Getting the currency to be diaplayed.

g_curr = g_waers.

ENDMODULE. " status_1100 OUTPUT

&----


*& Module create_objects OUTPUT

&----


  • text

----


MODULE create_objects OUTPUT.

CREATE OBJECT g_custom_container

EXPORTING

  • PARENT =

container_name = 'CUST_CRTL'

  • 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 e143(z1).

ENDIF.

*Create object for sap grid

CREATE OBJECT sap_grid

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = g_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 e144(z1).

ENDIF.

CREATE OBJECT g_custom_container1

EXPORTING

  • PARENT =

container_name = 'CUST_CRTL1'

  • 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 e143(z1).

ENDIF.

*Create object for sap grid

CREATE OBJECT sap_grid1

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = g_custom_container1

  • 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 e144(z1).

ENDIF.

CREATE OBJECT g_custom_container2

EXPORTING

  • PARENT =

container_name = 'CUST_CRTL2'

  • 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 e143(z1).

ENDIF.

*Create object for sap grid

CREATE OBJECT sap_grid2

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = g_custom_container2

  • 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 e144(z1).

ENDIF.

ENDMODULE. " create_objects OUTPUT

&----


*& Module fill_fcat OUTPUT

&----


  • text

----


MODULE fill_fcat OUTPUT.

CONSTANTS : lc_x TYPE c VALUE 'X',

lc_a TYPE c VALUE 'D'.

*Prepare field catalog for all Summary Report

wa_field-fieldname = 'BUKRS'.

wa_field-tabname = 'T_BSID_BSAD'.

wa_field-outputlen = '12'.

wa_field-col_pos = '1'.

wa_field-coltext = text-002. "'Company Code'.

APPEND wa_field TO fcat.

  • CLEAR wa_field.

  • wa_field-fieldname = 'CURR'.

  • wa_field-tabname = 'T_BSID_BSAD'.

  • wa_field-outputlen = '10'.

  • wa_field-col_pos = '2'.

  • wa_field-coltext = text-022."'Currency'.

  • APPEND wa_field TO fcat.

CLEAR wa_field.

wa_field-fieldname = 'KUNNR'.

wa_field-tabname = 'T_BSID_BSAD'.

wa_field-outputlen = '10'.

wa_field-col_pos = '3'.

wa_field-coltext = text-005."'Customer Number'.

APPEND wa_field TO fcat.

CLEAR wa_field.

wa_field-fieldname = 'NAME1'.

wa_field-tabname = 'T_BSID_BSAD'.

    • wa_field-outputlen = '13'.

wa_field-col_pos = '4'.

wa_field-coltext = text-007."'Customer Name'.

APPEND wa_field TO fcat.

CLEAR wa_field.

wa_field-fieldname = 'KLIMK'.

wa_field-tabname = 'T_BSID_BSAD'.

wa_field-outputlen = '12'.

wa_field-col_pos = '5'.

wa_field-coltext = text-008. " 'Credit Limit'.

APPEND wa_field TO fcat.

CLEAR wa_field.

wa_field-fieldname = 'DMBTR'.

wa_field-tabname = 'T_BSID_BSAD'.

    • wa_field-outputlen = '16'.

wa_field-col_pos = '6'.

wa_field-coltext = text-009. "'Current Balance Calculated'.

APPEND wa_field TO fcat.

CLEAR wa_field.

CLEAR wa_field.

wa_field-fieldname = 'BLNC'.

wa_field-tabname = 'T_BSID_BSAD'.

wa_field-outputlen = '23'.

wa_field-col_pos = '7'.

wa_field-coltext = g_bal_date. "'Balance b/f @ (Date taken from Z table) '.

wa_field-fix_column = 'X'.

APPEND wa_field TO fcat.

CLEAR wa_field.

  • CLEAR wa_field.

  • wa_field-fieldname = 'DATE'.

  • wa_field-tabname = 'T_BSID_BSAD'.

  • wa_field-outputlen = '8'.

  • wa_field-col_pos = '7'.

  • wa_field-coltext = text-021. "'Balance b/f Date @ Z Table balance'.

  • APPEND wa_field TO fcat.

  • CLEAR wa_field.

CLEAR wa_field.

wa_field-fieldname = 'INVOICES'.

wa_field-tabname = 'T_BSID_BSAD'.

  • wa_field-outputlen = '13'.

wa_field-col_pos = '8'.

wa_field-coltext = text-012. "'Invoices'.

APPEND wa_field TO fcat.

CLEAR wa_field.

CLEAR wa_field.

wa_field-fieldname = 'PAYMENTS'.

wa_field-tabname = 'T_BSID_BSAD'.

  • wa_field-outputlen = '13'.

wa_field-col_pos = '9'.

wa_field-coltext = text-013. "'Payments'.

APPEND wa_field TO fcat.

CLEAR wa_field.

CLEAR wa_field.

wa_field-fieldname = 'DMBTR'.

wa_field-tabname = 'T_BSID_BSAD'.

wa_field-outputlen = '23'.

wa_field-col_pos = '10'.

wa_field-coltext = g_bal_date1. "'Balance c/f @ (Date of Lodgement from selection screen)'.

APPEND wa_field TO fcat.

CLEAR wa_field.

CLEAR wa_field.

wa_field-fieldname = 'CHECK'.

wa_field-tabname = 'T_BSID_BSAD'.

  • wa_field-outputlen = '13'.

wa_field-col_pos = '11'.

wa_field-coltext = text-020. "'CHECK'.

APPEND wa_field TO fcat.

CLEAR wa_field.

CLEAR g_layout.

g_layout-zebra = lc_x.

  • g_layout-sel_mode = lc_a.

*Prepare field catalog for all Invoice Extract

wa_field1-fieldname = 'BUKRS'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '12'.

wa_field1-col_pos = '1'.

wa_field1-coltext = text-002. "'Company Code'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

wa_field1-fieldname = 'KUNNR'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '13'.

wa_field1-col_pos = '2'.

wa_field1-coltext = text-005."'Customer Number'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

wa_field1-fieldname = 'NAME1'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '13'.

wa_field1-col_pos = '3'.

wa_field1-coltext = text-007."'Customer Name'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

wa_field1-fieldname = 'GJAHR'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '7'.

wa_field1-col_pos = '4'.

wa_field1-coltext = text-015. " 'Fiscal Year'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

wa_field1-fieldname = 'BELNR'.

wa_field1-tabname = 'T_INVOICE'.

  • wa_field1-outputlen = '10'.

wa_field1-col_pos = '5'.

wa_field1-coltext = text-016. "'Invoice Number'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

CLEAR wa_field1.

wa_field1-fieldname = 'CURR'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '8'.

wa_field1-col_pos = '6'.

wa_field1-coltext = text-022."'Currency'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

wa_field1-fieldname = 'DMBTR'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '13'.

wa_field1-col_pos = '7'.

wa_field1-coltext = text-017. "'Invoice Amount '.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

CLEAR wa_field1.

wa_field1-fieldname = 'BLDAT'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '12'.

wa_field1-col_pos = '8'.

wa_field1-coltext = text-018. "'Date of Shipment'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

CLEAR wa_field1.

wa_field1-fieldname = 'DUEDT'.

wa_field1-tabname = 'T_INVOICE'.

wa_field1-outputlen = '13'.

wa_field1-col_pos = '9'.

wa_field1-coltext = text-019. "'Due Date Calculated'.

APPEND wa_field1 TO fcat1.

CLEAR wa_field1.

CLEAR g_layout1.

g_layout1-zebra = lc_x.

  • g_layout-sel_mode = lc_a.

*Prepare field catalog for all Payment Extract

CLEAR wa_field2.

wa_field2-fieldname = 'BUKRS'.

wa_field2-tabname = 'T_PAYMENT'.

wa_field2-outputlen = '12'.

wa_field2-col_pos = '1'.

wa_field2-coltext = text-002. "'Company Code'.

APPEND wa_field2 TO fcat2.

CLEAR wa_field2.

CLEAR wa_field2.

wa_field2-fieldname = 'KUNNR'.

wa_field2-tabname = 'T_PAYMENT'.

  • wa_field2-outputlen = '13'.

wa_field2-col_pos = '2'.

wa_field2-coltext = text-005. "'Customer Number'.

APPEND wa_field2 TO fcat2.

CLEAR wa_field2.

CLEAR wa_field2.

wa_field2-fieldname = 'NAME1'.

wa_field2-tabname = 'T_PAYMENT'.

wa_field2-outputlen = '13'.

wa_field2-col_pos = '3'.

wa_field2-coltext = text-007. "'Customer Name'.

APPEND wa_field2 TO fcat2.

CLEAR wa_field2.

CLEAR wa_field2.

wa_field2-fieldname = 'GJAHR'.

wa_field2-tabname = 'T_PAYMENT'.

wa_field2-outputlen = '11'.

wa_field2-col_pos = '4'.

wa_field2-coltext = text-015. "'Fiscal Year'.

APPEND wa_field2 TO fcat2.

CLEAR wa_field2.

CLEAR wa_field2.

wa_field2-fieldname = 'BELNR'.

wa_field2-tabname = 'T_PAYMENT'.

wa_field2-outputlen = '13'.

wa_field2-col_pos = '5'.

wa_field2-coltext = text-016. "'Invoice Number'.

APPEND wa_field2 TO fcat2.

CLEAR wa_field2.

CLEAR wa_field2.

wa_field2-fieldname = 'CURR'.

wa_field2-tabname = 'T_PAYMENT'.

wa_field2-outputlen = '11'.

wa_field2-col_pos = '6'.

wa_field2-coltext = text-022."'Currency'.

APPEND wa_field2 TO fcat2.

CLEAR wa_field2.

wa_field2-fieldname = 'DMBTR'.

wa_field2-tabname = 'T_PAYMENT'.

wa_field2-outputlen = '13'.

wa_field2-col_pos = '7'.

wa_field2-coltext = text-017. "'Invoice Amount'.

APPEND wa_field2 TO fcat2.

CLEAR wa_field2.

CLEAR g_layout2.

g_layout2-zebra = lc_x.

  • g_layout-sel_mode = lc_a.

ENDMODULE. " fill_fcat OUTPUT

&----


*& Module display_data OUTPUT

&----


  • text

----


MODULE display_data OUTPUT.

g_layout3-variant = g_save.

CALL METHOD sap_grid->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

i_structure_name = 'gt_display'

is_variant = g_layout3

i_save = 'A'

i_default = 'X'

is_layout = g_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = t_bsid_bsad

it_fieldcatalog = fcat

  • IT_SORT =

  • IT_FILTER =

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4 .

IF sy-subrc <> 0.

MESSAGE e145(z1).

ENDIF.

g_layout4-variant = g_save1.

CALL METHOD sap_grid1->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

i_structure_name = 'gt_display1'

is_variant = g_layout4

i_save = 'A'

i_default = 'X'

is_layout = g_layout1

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = t_invoice

it_fieldcatalog = fcat1

  • IT_SORT =

  • IT_FILTER =

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4 .

IF sy-subrc <> 0.

MESSAGE e145(z1).

ENDIF.

g_layout5-variant = g_save2.

CALL METHOD sap_grid2->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

i_structure_name = 'gt_display2'

is_variant = g_layout5

i_save = 'A'

i_default = 'X'

is_layout = g_layout2

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = t_payment

it_fieldcatalog = fcat2

  • IT_SORT =

  • IT_FILTER =

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4 .

IF sy-subrc <> 0.

MESSAGE e145(z1).

ENDIF.

ENDMODULE. " display_data OUTPUT

&----


*& Module exit INPUT

&----


  • text

----


MODULE exit INPUT.

CALL METHOD g_custom_container->free.

CLEAR t_bsid_bsad[].

CALL METHOD g_custom_container1->free.

CLEAR t_invoice[].

CALL METHOD g_custom_container2->free.

CLEAR t_payment[].

LEAVE PROGRAM.

ENDMODULE. " exit INPUT

&----


*& Module user_command_1100 INPUT

&----


  • text

----


MODULE user_command_1100 INPUT.

MOVE g_ok_code TO g_saveok_code.

CLEAR g_ok_code.

CASE g_saveok_code.

*on BACK leave program

WHEN 'BACK'.

CALL METHOD g_custom_container->free.

CALL METHOD g_custom_container1->free.

CALL METHOD g_custom_container2->free.

CLEAR: g_custom_container,

g_custom_container1,

g_custom_container2.

  • LEAVE PROGRAM.

  • SET SCREEN 1000.

  • CALL TRANSACTION 'Z5172'.

  • CALL SELECTION-SCREEN 1000.

set screen 0.

leave screen.

*on CANCEL leave program

WHEN 'EXIT'.

CALL METHOD g_custom_container->free.

CALL METHOD g_custom_container1->free.

CALL METHOD g_custom_container2->free.

LEAVE PROGRAM.

*on CANCEL leave program

WHEN 'CANCEL'.

CALL METHOD g_custom_container->free.

CALL METHOD g_custom_container1->free.

CALL METHOD g_custom_container2->free.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " user_command_1100 INPUT

0 Kudos
150

Hi Sreeni,

I have just modified my custom controllers, in my code given below and tested, it worked side by side.

Regards,

Suman

0 Kudos
150

Hi Suman,

Could you please provide me that code, so that it will be usefull for me to understand better.

Thanks,

bsv.

0 Kudos
150

Shoot me ur mail address, will send them with screen shots, bcoz as it is a screen (as no coding will be generated).

Suman

0 Kudos
150

Hi Suman,

My mail address is vasu_sri200322@yahoo.co.in.

Waiting for your response.

Thanks,

bsv.

former_member386202
Active Contributor
0 Kudos
150

Hi,

I dont think that its possible n ALV but u can do it in classical report using BACK statement.

Regards,

prashant