ALV Grid Dialog Program Variant Problem
Hi Gurus-
Please help!!! I got the following problem-
The ALV dialog screen will have fields with display options as well as a number of fields as input options (editable). Based on user inputs in the input fields and other displayed fields, the user selects "Process"/F8 and it calls the BAPI_MATERIAL_EDIT functions to update material.
The problem is, I want to use variants in the input fields (Maybe REUSE_ALV_VARIANT_F4) when I select a variant it loops through the selected rows and fills out the input fields with the values stored in the variant. I want to use sample ALV grid program such as BCALV*.
The question is, can I use variants in ALV grid dialog program and if yes, how do I define variants to loop through and fill out the values in the input/editable fields on the ALV grid?
Any help will be greatly appreciated! Rep points for sure!
Thanks!!!
hi james ,
look at this link u will get an idea .
http://www.sapfans.com/forums/viewtopic.php?f=13&t=229912
http://sgstocks.tripod.com/alvgrid_control.htm
thanks,
Gaurav.
Edited by: gaurav.singh on Apr 20, 2010 7:53 AM
Similar Messages
-
Multiple ALV Grid Controls per report - problem with default displ.variant
Hi,
I have a report with few screens called sequentialy. Each one of the screens has implemented own instance of ALV Grid Control within custom container, means:
- screen 100 has container Cont100 and grid control "grid100",
- screen 110 has container Cont110 and grid control "grid110"
- screen 120 has container Cont120 and grid control "grid120"
and so on...
Each one of the grid controls is initialized with own field catalog table, with own layout and variant structure definitions. My problem occurs when the user changes the display variant for some of the grid controls and save the layout variant using "default setting" checkbox. In this case next time the program is started all other grid controls behaves like they don't have their own variant definitions, but uses the default setting of the mentioned screen. This leads (usualy) to unsuable grid controls by default, because usualy different controls have no equal field-definition tables. I have the same behaviour even when there are more than 1 ALV grids on a single screen (for example - 2).
For now I don't provide variant variables at selection screen, but it seems there is no way to provide such variables for each one of the grid-controls.
Is anyone aware how to control this? Means no matter if there is default setting in use for some of the grid-controls, how to manipulate other grid-controls not to use this default setting?
Many thanks in advance.
Regards,
Ivaylo Mutafchievcheck this sample code which displays 4 grids in 4 different tabs and with 4 different handles
PROGRAM sapmzsdpp MESSAGE-ID z1.
Table Declarations *
TABLES:
vbpa, " Sales Document: Partner
kna1, " Customer Master
vbap. " Sales Document: Item Data
Tab Strip Declarations *
CONTROLS:
tabstrip_sdpp TYPE TABSTRIP. " Tabstrip
Constants declarations *
CONSTANTS:
c_rep_zm(2) TYPE c VALUE 'ZM', " Outside Sales Representative
c_rep_ve(2) TYPE c VALUE 'VE', " Inside Sales Representative
c_rep_zi(2) TYPE c VALUE 'ZI', " Sales Manager
c_abgru_08(2) TYPE c VALUE '08', " Reason for Rej: SO Not Closed
c_stock_ind_e TYPE c VALUE 'E', " Stock Idctr : Orders on hand
c_gauge(5) TYPE c VALUE 'GAUGE', " Characteristic Name - GAUGE
c_width(5) TYPE c VALUE 'WIDTH', " Characteristic Name - WIDTH
c_gauge_metric(12) " Character Name - GAUGE_METRIC
TYPE c VALUE 'GAUGE_METRIC',
c_width_metric(12) " Character Name - WIDTH_METRIC
TYPE c VALUE 'WIDTH_METRIC',
c_eng_metric(14) " Charac Value - ENGLISH_METRIC
TYPE c VALUE 'ENGLISH_METRIC',
c_coil(4) TYPE c VALUE 'COIL', " For Value COIL
c_spec_bf(7) TYPE c VALUE 'SPEC_BF'," Charac value SPEC_BF
c_wadat_ist(8) " Actual Goods Movement Date
TYPE c VALUE '00000000',
c_mcha(4) TYPE c VALUE 'MCHA', " Database Table 'MCHA'
c_classtype_022(3)
TYPE c VALUE '022', " Class Type : BATCH
c_pipe(2) TYPE c VALUE '06', " Material Pricing Group: Pipes
c_item_ctgry_ztam(4)
TYPE c VALUE 'ZTAM', " Item Cat:Certificate Mnfctr
c_lab_result(10) " Charac Value LAB_RESULT
TYPE n VALUE '0000001392',
c_none_reqd(10) " For Value NONE REQD
TYPE c VALUE 'NONE REQD.',
c_passed(6) TYPE c VALUE 'PASSED', " For Value PASSED
c_pending(12) TYPE c " For Value TEST PENDING
VALUE 'TEST PENDING',
c_bundling(13) " For Value TEST BUNDLING
TYPE c VALUE 'TEST BUNDLING',
c_normal(2) TYPE c VALUE '01'. " Priority: Normal
Internal Table Declarations *
DATA :
Internal table to hold common data for all reports
BEGIN OF t_common_data OCCURS 0,
kunnr LIKE vbak-kunnr, " Customer Number
vbeln LIKE vbap-vbeln, " Sales Document Number
posnr LIKE vbap-posnr, " Sales Document Item Number
ihrez_e LIKE vbkd-ihrez_e, " Mill Order Number
matnr LIKE vbap-matnr, " Material Number
pstyv LIKE vbap-pstyv, " Sales Document Item Category
kwmeng LIKE vbap-kwmeng, " Cumulative Order Quantity
lprio LIKE vbap-lprio, " Delivery Priority
werks LIKE vbap-werks, " Plant
kondm LIKE vbap-kondm, " Material Pricing Group
aedat LIKE vbap-aedat, " Date of Last Change
cuobj LIKE vbap-cuobj, " Configuration
saldata LIKE vbap-zzcust_req_avail,
" Required Availability Date
END OF t_common_data,
Internal table to hold Customer Number
BEGIN OF t_cust_temp OCCURS 0,
kunnr LIKE vbak-kunnr, " Customer Number
END OF t_cust_temp,
Internal table to hold stock details
BEGIN OF t_stock OCCURS 0,
vbeln LIKE mska-vbeln, " Sales Document Number
posnr LIKE mska-posnr, " Sales Document Item Number
matnr LIKE mska-matnr, " Material Number
werks LIKE mska-werks, " Plant
charg LIKE mska-charg, " Batch Number
kalab LIKE mska-kalab, " Valuated Stock
ersda LIKE mska-ersda,
END OF t_stock,
Internal table to hold deliveries
BEGIN OF t_delivery_data OCCURS 0,
vbeln LIKE lips-vbeln, " Delivery Document Number
vgbel LIKE lips-vgbel, " Document No of Ref Document
vgpos LIKE lips-vgpos, " Item No of Ref Item
END OF t_delivery_data,
Internal table to hold released tons & released days
BEGIN OF t_released_tons_days OCCURS 0,
vbeln LIKE likp-vbeln, " Delivery Document Number
btgew LIKE likp-btgew, " Total Weight
bldat LIKE likp-bldat, " Document Date in Document
END OF t_released_tons_days,
Internal table to hold Pre-Production-Pending Orders (Report-1)
BEGIN OF t_pre_prod_ord OCCURS 0,
sortl1 LIKE zcustcode-sortl, " Customer Search Term
ihrez_e1 LIKE vbkd-ihrez_e, " Mill Order Number
salord1(17) TYPE c, " Sales Order Document & Item
descri TYPE char70, " Specification of the Item
speci TYPE char30, " Description of the Item
days_entry LIKE zlgcyinfo-days_since_entry,
" Days Since Entry
dept LIKE zlgcyinfo-bklog, " Department
notes1 LIKE zcsimemo-text, " CSI File Memo Text
*/ Request No. DV2K904687
chng_date LIKE vbap-aedat, " Date of Last Change
END OF t_pre_prod_ord,
Internal table to hold Delinquent Orders (Report-2)
BEGIN OF t_delinquent_ord OCCURS 0,
sortl2 LIKE zcustcode-sortl, " Customer Search Term
ihrez_e2 LIKE vbkd-ihrez_e, " Mill Order Number
salord2(17) TYPE c, " Sales Order Document & Item
descri TYPE char70, " Specification of the Item
speci TYPE char30, " Description of the Item
saldata LIKE vbap-zzcust_req_avail,
schdate LIKE vbep-edatu, " Schedule Line Date
days_late LIKE zlgcyinfo-dayslate,
" Days Late
unit LIKE zlgcyinfo-unit, " Status of Consolidation Units
days_at_unit LIKE zlgcyinfo-daysatunit,
notes2 LIKE zcsimemo-text, " CSI File Memo Text
END OF t_delinquent_ord,
Internal table to hold Processed Material Orders (Report-3)
BEGIN OF t_processed_ord OCCURS 0,
sortl3 LIKE zcustcode-sortl, " Customer Search Term
ihrez_e3 LIKE vbkd-ihrez_e, " Mill Order Number
salord3(17) TYPE c, " Sales Order Document & Item
descri TYPE char70, " Specification of the Item
speci TYPE char30, " Description of the Item
order_tons LIKE vbap-kwmeng, " Cumulative Order Quantity
fin_tons LIKE mska-kalab, " Val.Stock With Unres Usage
fin_days TYPE i, " Finished Days
rel_tons LIKE likp-btgew, " Total Weight
rel_days TYPE i, " No.of.Days Order is Released
status(15) TYPE c, " Status Of Stock
tb_tons LIKE zlgcyinfo-tons, " Tons
notes3 LIKE zcsimemo-text, " CSI File Memo Text
END OF t_processed_ord,
Internal table to hold Flagged Orders (Report-4)
BEGIN OF t_flagged_ord OCCURS 0,
sortl4 LIKE zcustcode-sortl, " Customer Search Term
ihrez_e4 LIKE vbkd-ihrez_e, " Mill Order Number
salord4(17) TYPE c, " Sales Order Document & Item
descri TYPE char70, " Specification of the Item
speci TYPE char30, " Description of the Item
saldata LIKE vbap-zzcust_req_avail,
unit LIKE zlgcyinfo-unit, " Status of Consolidation Units
tons LIKE zlgcyinfo-tons, " Tons
priority LIKE vbap-lprio, " Delivery Priority
notes4 LIKE zcsimemo-text, " CSI File Memo Text
END OF t_flagged_ord,
Internal table to hold CSI memo file data
BEGIN OF t_csi_memo_data OCCURS 0,
vbeln LIKE zcsimemo-vbeln, " Sales Document Number
posnr LIKE zcsimemo-posnr, " Sales Order line item
text LIKE zcsimemo-text, " CSI File Memo Text
END OF t_csi_memo_data,
Internal table to hold Customer Codes
BEGIN OF t_customer_code OCCURS 0,
sortl LIKE zcustcode-sortl, " Sort Field
kunnr LIKE zcustcode-kunnr, " Customer Number
END OF t_customer_code,
Internal table to hold schedule line dates
BEGIN OF t_schedule_line_date OCCURS 0,
vbeln LIKE vbep-vbeln, " Sales Document Number
posnr LIKE vbep-posnr, " Sales Document Item Number
edatu LIKE vbep-edatu, " Schedule line date
END OF t_schedule_line_date,
Internal table to hold Characteristic values
t_configuration
TYPE TABLE OF conf_out
WITH HEADER LINE,
Internal tables to hold legacy data
t_lgcyinfo TYPE TABLE OF zlgcyinfo
WITH HEADER LINE.
Work variables declarations *
DATA:
gv_parvw LIKE kupav-parvw, " Partner function
gv_abgru LIKE vbap-abgru, " Reason to eject sales order
gv_gauge LIKE conf_out-atwtb, " Charac Value Description
gv_width LIKE conf_out-atwtb, " Charac Value Description
gv_ok_code LIKE sy-ucomm, " Usercommand
gv_okcode LIKE sy-ucomm, " User Command
gv_number LIKE sy-dynnr
VALUE '0101', " Initial Sub Screen Number
gv_vbeln LIKE vbak-vbeln, " Sales Order
gv_posnr LIKE vbup-posnr, " Sales Item
*/ Request No. DV2K904687
gv_del_prio LIKE vbap-lprio, " Delivery Priority
gv_obj_key LIKE inob-objek, " Object Key
gv_config LIKE inob-cuobj, " Configuration
gv_lab_result LIKE ausp-atwrt, " Lab Result Value
gv_pass_stock LIKE mska-kalab, " Finished Stock
gv_fail_stock LIKE mska-kalab, " Failed Stock
gv_tp_tons LIKE mska-kalab, " Test Pending Tons
gv_csi_stock LIKE mbew-lbkum, " CSI Stock On Hand
gv_val_stock LIKE mska-kalab, " Valuated Stock
gv_fin_tons LIKE mska-kalab, " Finished Tons
gv_fin_days TYPE i, " Finished Days
gv_rel_tons LIKE likp-btgew, " Released Tons
gv_rel_days TYPE i, " Released Days
gv_no_delivery " Number of Delivery Documents
TYPE i,
gv_bund_tons LIKE zlgcyinfo-tons, " Bundling Tons
gv_net_weight LIKE mara-ntgew, " Net Weight
gv_tb_tons LIKE zlgcyinfo-tons, " Test/Bundling Tons
gv_date LIKE mska-ersda, " Date
gv_tabix LIKE sy-tabix, " Table Index
gv_flg TYPE c, " Flag Variable
gv_exit TYPE c. " For Parameter Exit
Constant declarations for ALV Grid *
CONSTANTS:
c_cont_pre_prod_ord
TYPE scrfname VALUE 'CUST_PPP',
" Custom Container for Report-1
c_cont_delinquent_ord
TYPE scrfname VALUE 'CUST_DIP',
" Custom Container for Report-2
c_cont_processed_ord
TYPE scrfname VALUE 'CUST_PMS',
" Custom Container for Report-3
c_cont_flagged_ord
TYPE scrfname VALUE 'CUST_FLGORD',
" Custom Container for Report-4
c_handle1(3) TYPE c VALUE 'G_1', " Handle for PPP rpt Grid
c_handle2(3) TYPE c VALUE 'G_2', " Handle for DIP rpt Grid
c_handle3(3) TYPE c VALUE 'G_3', " Handle for PMS rpt Grid
c_handle4(3) TYPE c VALUE 'G_4', " Handle for FLGORD rpt Grid
c_true TYPE c VALUE 'X', " For value 'X'
c_save TYPE c VALUE 'A'. " User-Defd & Global Variants
Selection Screen *
SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-014.
PARAMETERS :
p_osr RADIOBUTTON GROUP g1
DEFAULT 'X', " Outside Sales Representative
p_isr RADIOBUTTON GROUP g1, " Inside Sales Representative
p_s_mgr RADIOBUTTON GROUP g1. " Sales Manager
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-005.
SELECT-OPTIONS:
s_pernr FOR vbpa-pernr
OBLIGATORY, " Employee Number
s_kunnr FOR kna1-kunnr, " Customer Number
s_sortl FOR kna1-sortl, " Customer Search Term
s_kondm FOR vbap-kondm. " Material Pricing Group
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-006.
PARAMETERS:
p_open RADIOBUTTON GROUP g2
DEFAULT 'X', " Open Orders
p_closed RADIOBUTTON GROUP g2. " Closed Orders
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-007.
PARAMETERS:
p_var1 LIKE disvariant-variant, " Variant For Report-1
p_var2 LIKE disvariant-variant, " Variant For Report-2
p_var3 LIKE disvariant-variant, " Variant For Report-3
p_var4 LIKE disvariant-variant. " Varinat For Report-3
SELECTION-SCREEN END OF BLOCK b4.
SELECTION-SCREEN END OF SCREEN 500.
*/ Begin of Modification - Request No. DV2K904687
Selection Screen for Changing Sales Order Priority
SELECTION-SCREEN BEGIN OF SCREEN 1100 AS WINDOW.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-044.
PARAMETERS p_sonum LIKE vbap-vbeln." Sales Order Number
SELECT-OPTIONS s_item FOR vbap-posnr." Sales Order Item
PARAMETERS p_delpr LIKE vbap-lprio." Delivery Priority
SELECTION-SCREEN END OF BLOCK b5.
SELECTION-SCREEN END OF SCREEN 1100.
*/ End of Modification - Request No. DV2K904687
CLASS lcl_gv_event_receiveriver DEFINITION *
CLASS lcl_event_receiver DEFINITION DEFERRED.
ALV Grid - Work Variables Declarations *
DATA:
gv_cont_pre_prod_ord TYPE REF
TO cl_gui_custom_container,
" Custom Cont For Report-1
gv_cont_delinquent_ord TYPE REF
TO cl_gui_custom_container,
" Custom Cont For Report-2
gv_cont_processed_ord TYPE REF
TO cl_gui_custom_container,
" Custom Cont For Report-3
gv_cont_flagged_ord TYPE REF
TO cl_gui_custom_container,
" Custom Cont For Report-4
gv_grid_pre_prod_ord TYPE REF
TO cl_gui_alv_grid,
" Grid For Report-1
gv_grid_delinquent_ord TYPE REF
TO cl_gui_alv_grid,
" Grid For Report-2
gv_grid_processed_ord TYPE REF
TO cl_gui_alv_grid,
" Grid For Report-3
gv_grid_flagged_ord TYPE REF
TO cl_gui_alv_grid,
" Grid For Report-4
gv_event_receiver TYPE REF
TO lcl_event_receiver,
" Object For Local Class
gs_lay_pre_prod_ord TYPE lvc_s_layo,
" Work Area for Grid layout
gs_lay_delinquent_ord TYPE lvc_s_layo,
" Work Area for Grid layout
gs_lay_processed_ord TYPE lvc_s_layo,
" Work Area for Grid layout
gs_lay_flagged_ord TYPE lvc_s_layo,
" Work Area for Grid Layout
gs_var_pre_prod_ord TYPE disvariant,
" Layout Structure
gs_var_delinquent_ord TYPE disvariant,
" Layout Structure
gs_var_processed_ord TYPE disvariant,
" Layout Structure
gs_var_flagged_ord TYPE disvariant,
" Layout Structure
t_fcat_pre_prod_ord TYPE lvc_t_fcat
WITH HEADER LINE,
" Field Catalog For Report-1
t_fcat_delinquent_ord TYPE lvc_t_fcat
WITH HEADER LINE,
" Field Catalog For Report-2
t_fcat_processed_ord TYPE lvc_t_fcat
WITH HEADER LINE,
" Field Catalog For Report-3
t_fcat_flagged_ord TYPE lvc_t_fcat
WITH HEADER LINE,
" Field Catalog For Report-4
t_exclude TYPE ui_functions,
" Function Code Table
gs_exclude TYPE ui_func. " Function Code Structure
CLASS lcl_gv_event_receiver DEFINITION *
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_hotspot
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
handle_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
*/ Begin of Modification - Request No. DV2K904687
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
*/ End of Modification - Request No. DV2K904687
ENDCLASS. " LCL_EVENT_RECEIVER DEFINITION
CLASS IMPLEMENTATION *
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_hotspot.
CASE e_column_id-fieldname.
WHEN 'SALORD1'.
CLEAR t_pre_prod_ord.
READ TABLE t_pre_prod_ord
INTO t_pre_prod_ord
INDEX e_row_id-index.
Call VA03 To View Sales Order Line Item Details
PERFORM call_va03 USING t_pre_prod_ord-salord1.
WHEN 'SALORD2'.
CLEAR t_delinquent_ord.
READ TABLE t_delinquent_ord
INTO t_delinquent_ord
INDEX e_row_id-index.
Call VA03 To View Sales Order Line Item Details
PERFORM call_va03 USING t_delinquent_ord-salord2.
WHEN 'SALORD3'.
CLEAR t_processed_ord.
READ TABLE t_processed_ord
INTO t_processed_ord
INDEX e_row_id-index.
Call VA03 To View Sales Order Line Item Details
PERFORM call_va03 USING t_processed_ord-salord3.
WHEN 'SALORD4'.
CLEAR t_flagged_ord.
READ TABLE t_flagged_ord
INTO t_flagged_ord
INDEX e_row_id-index.
Call VA03 To View Sales Order Line Item Details
PERFORM call_va03 USING t_flagged_ord-salord4.
WHEN 'SORTL1'.
CLEAR t_pre_prod_ord.
READ TABLE t_pre_prod_ord
INTO t_pre_prod_ord
INDEX e_row_id-index.
Call ZSD11 for Customer Search Term
PERFORM call_zsd11_cust_code USING t_pre_prod_ord-sortl1.
WHEN 'SORTL2'.
CLEAR t_delinquent_ord.
READ TABLE t_delinquent_ord
INTO t_delinquent_ord
INDEX e_row_id-index.
Call ZSD11 for Customer Search Term
PERFORM call_zsd11_cust_code USING t_delinquent_ord-sortl2.
WHEN 'SORTL3'.
CLEAR t_processed_ord.
READ TABLE t_processed_ord
INTO t_processed_ord
INDEX e_row_id-index.
Call ZSD11 for Customer Search Term
PERFORM call_zsd11_cust_code USING t_processed_ord-sortl3.
WHEN 'SORTL4'.
CLEAR t_flagged_ord.
READ TABLE t_flagged_ord
INTO t_flagged_ord
INDEX e_row_id-index.
Call ZSD11 for Customer Search Term
PERFORM call_zsd11_cust_code USING t_flagged_ord-sortl4.
WHEN 'IHREZ_E1'.
CLEAR t_pre_prod_ord.
READ TABLE t_pre_prod_ord
INTO t_pre_prod_ord
INDEX e_row_id-index.
Call ZSD11 for Mill Order
PERFORM call_zsd11_millorder USING t_pre_prod_ord-ihrez_e1.
WHEN 'IHREZ_E2'.
CLEAR t_delinquent_ord.
READ TABLE t_delinquent_ord
INTO t_delinquent_ord
INDEX e_row_id-index.
Call ZSD11 for Mill Order
PERFORM call_zsd11_millorder USING t_delinquent_ord-ihrez_e2.
WHEN 'IHREZ_E3'.
CLEAR t_processed_ord.
READ TABLE t_processed_ord
INTO t_processed_ord
INDEX e_row_id-index.
Call ZSD11 for Mill Order
PERFORM call_zsd11_millorder USING t_processed_ord-ihrez_e3.
WHEN 'IHREZ_E4'.
CLEAR t_flagged_ord.
READ TABLE t_flagged_ord
INTO t_flagged_ord
INDEX e_row_id-index.
Call ZSD11 for Mill Order
PERFORM call_zsd11_millorder USING t_flagged_ord-ihrez_e4.
WHEN 'NOTES1'.
CLEAR t_pre_prod_ord.
READ TABLE t_pre_prod_ord
INTO t_pre_prod_ord
INDEX e_row_id-index.
Call zsd00087 program to edit CSI Memo Text
PERFORM edit_notes USING t_pre_prod_ord-salord1.
WHEN 'NOTES2'.
CLEAR t_delinquent_ord.
READ TABLE t_delinquent_ord
INTO t_delinquent_ord
INDEX e_row_id-index.
Call zsd00087 program to edit CSI Memo Text
PERFORM edit_notes USING t_delinquent_ord-salord2.
WHEN 'NOTES3'.
CLEAR t_processed_ord.
READ TABLE t_processed_ord
INTO t_processed_ord
INDEX e_row_id-index.
Call zsd00087 program to CSI Memo Text
PERFORM edit_notes USING t_processed_ord-salord3.
WHEN 'NOTES4'.
CLEAR t_flagged_ord.
READ TABLE t_flagged_ord
INTO t_flagged_ord
INDEX e_row_id-index.
Call zsd00087 program to CSI Memo Text
PERFORM edit_notes USING t_flagged_ord-salord4.
ENDCASE. " CASE E_COLUMN_ID ...
ENDMETHOD. " HANDLE_HOTSPOT
METHOD handle_top_of_page.
PERFORM write_report_header.
ENDMETHOD. " METHOD HANDLE_TOP_OF_PAGE
*/ Begin of Modification - Request No. DV2K904687
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
append a separator to normal toolbar
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
append a button for Change Delivery Priority
MOVE 'CHNG_PRIO' TO ls_toolbar-function.
MOVE 'Change SO Delivery Priority'(048)
TO ls_toolbar-quickinfo.
MOVE 'Change SO Priority'(049) TO ls_toolbar-text.
MOVE 0 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. " handle_toolbar
METHOD handle_user_command.
DATA: t_sel_row TYPE lvc_t_roid,
gs_sel_row TYPE lvc_s_roid,
gs_flagged_ord LIKE t_flagged_ord,
lv_lines TYPE i.
CASE e_ucomm.
WHEN 'CHNG_PRIO'.
REFRESH t_sel_row.
CLEAR e_ucomm.
CALL METHOD gv_grid_flagged_ord->get_selected_rows
IMPORTING
et_row_no = t_sel_row.
CLEAR: t_flagged_ord,
gv_vbeln,
gv_posnr,
gv_del_prio.
DESCRIBE TABLE t_sel_row LINES lv_lines.
IF lv_lines GT 1.
MESSAGE i001 WITH 'Select only one row'(043).
ELSEIF lv_lines EQ 1.
READ TABLE t_sel_row INTO gs_sel_row INDEX 1.
READ TABLE t_flagged_ord INTO gs_flagged_ord
INDEX gs_sel_row-row_id.
IF sy-subrc EQ 0.
SPLIT gs_flagged_ord-salord4 AT '-' INTO gv_vbeln gv_posnr.
gv_del_prio = gs_flagged_ord-priority.
CLEAR: s_item, s_item[].
p_sonum = gv_vbeln.
p_delpr = gv_del_prio.
s_item-low = gv_posnr.
APPEND s_item TO s_item.
CLEAR s_item.
ENDIF. " IF sy-subrc EQ 0
ENDIF. " IF lv_lines GT 1
IF lv_lines LE 1.
CALL SELECTION-SCREEN '1100' STARTING AT 30 2
ENDING AT 110 7.
LEAVE TO SCREEN 100.
ENDIF.
ENDCASE. " CASE e_ucomm
ENDMETHOD. " handle_user_command
*/ End of Modification - Request No. DV2K904687
ENDCLASS. " LCL_EVENT_RECEIVER
" IMPLEMENTATION
Form WRITE_REPORT_HEADER *
This subroutine displays Report Header which includes *
Report Name, Executed by, Execution date, Execution Time *
There are no parameters to be passed to this subroutine *
FORM write_report_header.
DATA lv_rep_tit(72) TYPE c.
FORMAT COLOR COL_KEY.
MOVE sy-title TO lv_rep_tit.
CONDENSE lv_rep_tit.
SKIP 1.
WRITE: /3 sy-repid,
25 'California Steel Industries, Inc.'(040),
75 'Page'(041),
80(4) sy-pagno.
WRITE: /3 sy-uzeit,
25 lv_rep_tit,
75 sy-datum.
FORMAT RESET.
ENDFORM. " WRITE_REPORT_HEADER
At selection-output *
AT SELECTION-SCREEN OUTPUT.
CLEAR sy-ucomm.
IF sy-dynnr EQ '0500'.
Initialize layout variant for report-1
CLEAR gs_var_pre_prod_ord.
gs_var_pre_prod_ord-report = sy-cprog.
gs_var_pre_prod_ord-handle = c_handle1.
PERFORM initialize_layoutvariant CHANGING gs_var_pre_prod_ord.
p_var1 = gs_var_pre_prod_ord-variant.
Initialize layout variant for report-2
CLEAR gs_var_delinquent_ord.
gs_var_delinquent_ord-report = sy-cprog.
gs_var_delinquent_ord-handle = c_handle2.
PERFORM initialize_layoutvariant CHANGING gs_var_delinquent_ord.
p_var2 = gs_var_delinquent_ord-variant.
Initialize layout variant for report-3
CLEAR gs_var_processed_ord.
gs_var_processed_ord-report = sy-cprog.
gs_var_processed_ord-handle = c_handle3.
PERFORM initialize_layoutvariant CHANGING gs_var_processed_ord.
p_var3 = gs_var_processed_ord-variant.
Initialize layout variant for report-4
CLEAR gs_var_flagged_ord.
gs_var_flagged_ord-report = sy-cprog.
gs_var_flagged_ord-handle = c_handle4.
PERFORM initialize_layoutvariant CHANGING gs_var_flagged_ord.
p_var4 = gs_var_flagged_ord-variant.
*/ Begin of Modification - Request No. DV2K904687
ELSEIF sy-dynnr EQ '1100'.
DATA t_exclude TYPE TABLE OF sy-ucomm.
SET PF-STATUS 'MENU_1100'.
To use your own GUI status for a selection screen
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = 'MENU_1100'
TABLES
p_exclude = t_exclude.
ENDIF. " IF sy-dynnr EQ '0500'
*/ End of Modification - Request No. DV2K904687
At Selection Screen *
AT SELECTION-SCREEN.
*/ Begin of Modification - Request No. DV2K904687
CASE sy-dynnr.
WHEN '1100'.
IF sy-ucomm IS INITIAL.
CLEAR sy-ucomm.
LEAVE TO SCREEN 1100.
ENDIF. " IF sy-ucomm IS INITIAL
CASE sy-ucomm.
WHEN 'SAVE'.
CLEAR sy-ucomm.
Change Delivery Priority using BAPI method
PERFORM change_del_priority.
CLEAR: sy-ucomm,
gv_vbeln,
gv_posnr,
gv_del_prio,
p_sonum,
s_item,
s_item[],
p_delpr.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
CLEAR: sy-ucomm,
gv_vbeln,
gv_posnr,
gv_del_prio,
p_sonum,
s_item,
s_item[],
p_delpr.
LEAVE TO SCREEN 0.
ENDCASE. " CASE sy-ucomm
WHEN '0500'.
IF sy-ucomm EQ 'CRET'.
LEAVE TO SCREEN 100.
ELSEIF sy-ucomm IS INITIAL.
LEAVE TO SCREEN 500.
ENDIF. " IF SY-UCOMM EQ 'CRET'
ENDCASE. " CASE sy-dynnr
*/ End of Modification - Request No. DV2K904687
Selection Screen: Validations *
AT SELECTION-SCREEN ON s_pernr.
Validate Employee Number
PERFORM validate_employee_number.
AT SELECTION-SCREEN ON s_kunnr.
Validate Customer Number
IF NOT s_kunnr IS INITIAL.
PERFORM validate_customer_number.
ENDIF. " IF NOT S_KUNNR IS INITIAL
AT SELECTION-SCREEN ON s_sortl.
Validate Search Term
IF NOT s_sortl IS INITIAL.
PERFORM validate_search_term.
ENDIF. " IF NOT S_SORTL IS INITIAL
AT SELECTION-SCREEN ON s_kondm.
Validate Product
IF NOT s_kondm IS INITIAL.
PERFORM validate_product.
ENDIF. " IF NOT S_KONDM IS INITIAL
Validate p_var1
AT SELECTION-SCREEN ON p_var1.
CLEAR gs_var_pre_prod_ord.
gs_var_pre_prod_ord-report = sy-cprog.
gs_var_pre_prod_ord-handle = c_handle1.
gs_var_pre_prod_ord-variant = p_var1.
IF p_var1 IS NOT INITIAL.
PERFORM validate_variant CHANGING gs_var_pre_prod_ord.
ENDIF. " IF P_VAR1 IS NOT INITIAL
Validate p_var2
AT SELECTION-SCREEN ON p_var2.
CLEAR gs_var_delinquent_ord.
gs_var_delinquent_ord-report = sy-cprog.
gs_var_delinquent_ord-handle = c_handle2.
gs_var_delinquent_ord-variant = p_var2.
IF p_var2 IS NOT INITIAL.
PERFORM validate_variant CHANGING gs_var_delinquent_ord.
ENDIF. " IF P_VAR2 IS NOT INITIAL
Validate p_var3
AT SELECTION-SCREEN ON p_var3.
CLEAR gs_var_processed_ord.
gs_var_processed_ord-report = sy-cprog.
gs_var_processed_ord-handle = c_handle3.
gs_var_processed_ord-variant = p_var3.
IF p_var3 IS NOT INITIAL.
PERFORM validate_variant CHANGING gs_var_processed_ord.
ENDIF. " IF P_VAR3 IS NOT INITIAL
Validate p_var4
AT SELECTION-SCREEN ON p_var4.
CLEAR gs_var_flagged_ord.
gs_var_flagged_ord-report = sy-cprog.
gs_var_flagged_ord-handle = c_handle4.
gs_var_flagged_ord-variant = p_var4.
IF p_var4 IS NOT INITIAL.
PERFORM validate_variant CHANGING gs_var_flagged_ord.
ENDIF. " IF P_VAR4 IS NOT INITIAL
Selection Screen: Value Request for ALV GRID Variants *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var1.
CLEAR gs_var_pre_prod_ord.
gs_var_pre_prod_ord-report = sy-cprog.
gs_var_pre_prod_ord-handle = c_handle1.
PERFORM f4_variant CHANGING gs_var_pre_prod_ord
gv_exit.
IF gv_exit NE c_true.
p_var1 = gs_var_pre_prod_ord-variant.
ENDIF. " IF GV_EXIT NE c_true
F4 help for variant p_var2
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var2.
CLEAR:
gs_var_delinquent_ord,
gv_exit.
gs_var_delinquent_ord-report = sy-cprog.
gs_var_delinquent_ord-handle = c_handle2.
PERFORM f4_variant CHANGING gs_var_delinquent_ord
gv_exit.
IF gv_exit NE c_true.
p_var2 = gs_var_delinquent_ord-variant.
ENDIF. " IF GV_EXIT NE c_true
F4 help for variant p_var3
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var3.
CLEAR:
gs_var_processed_ord,
gv_exit.
gs_var_processed_ord-report = sy-cprog.
gs_var_processed_ord-handle = c_handle3.
PERFORM f4_variant CHANGING gs_var_processed_ord
gv_exit.
IF gv_exit NE c_true.
p_var3 = gs_var_processed_ord-variant.
ENDIF. " IF GV_EXIT NE c_true
F4 help for variant p_var4
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var4.
CLEAR:
gs_var_flagged_ord,
gv_exit.
gs_var_flagged_ord-report = sy-cprog.
gs_var_flagged_ord-handle = c_handle4.
PERFORM f4_variant CHANGING gs_var_flagged_ord
gv_exit.
IF gv_exit NE c_true.
p_var4 = gs_var_flagged_ord-variant.
ENDIF. " IF GV_EXIT NE c_true
Form validate_employee_number *
This subroutine validates Employee Number *
There are no parameters to need be passed to this subroutine *
FORM validate_employee_number.
DATA lv_pernr LIKE vbpa-pernr.
SELECT SINGLE pernr
INTO lv_pernr
FROM vbpa
WHERE pernr IN s_pernr.
IF sy-subrc NE 0.
MESSAGE e001 WITH text-010.
ENDIF. " IF SY-SUBRC NE 0
CLEAR lv_pernr.
ENDFORM. " VALIDATE_EMPLOYEE_NUMBER
Form validate_customer_number *
This subroutine validates Customer Number *
There are no parameters need to be passed to this subroutine *
FORM validate_customer_number.
SELECT SINGLE kunnr
INTO t_common_data-kunnr
FROM kna1
WHERE kunnr IN s_kunnr.
IF sy-subrc NE 0.
MESSAGE e001 WITH text-011.
ENDIF. " IF SY-SUBRC NE 0
CLEAR t_common_data-kunnr.
ENDFORM. " VALIDATE_CUSTOMER_NUMBER
Form validate_search_term *
This subroutine validates Search Term *
There are no parameters need to be passed to this subroutine *
FORM validate_search_term.
SELECT SINGLE sortl
INTO t_customer_code-sortl
FROM kna1
WHERE sortl IN s_sortl.
IF sy-subrc NE 0.
MESSAGE e001 WITH text-012.
ENDIF. " IF SY-SUBRC NE 0
CLEAR t_customer_code-sortl.
ENDFORM. " VALIDATE_SEARCH_TERM
Form validate_product *
This subroutine validates Product *
There are no parameters need to be passed to this subroutine *
FORM validate_product.
SELECT SINGLE kondm
INTO t_ -
Field catalogue for ALV Grid when program is run in the background
Hi All,
I have an ALV report that contains approx 27 fields. Not all of these fields will be relevant for different Users, and many will want to change the order the fields appear in.
When running on line the User can set a variant to present the data as they wish. However, I need to email this report to the SAP Inbox with the fields displayed in the same Order with uncessary fields hidden as stated in the Field Catalogue.
On-line none of this is an issue, however GET_FRONTEND_FIELDCATALOG cannot be used in Background, and attribute MT_FIELDCAT_LOCAL is Private and cannot be accessed.
I have looked at using Class CL_ ALV_VARIANT to try to read the Variant being used, but couldn't get the information about the Variant coming back, instead I get an error in CL_ALV_VARIANT->LOAD_VARIANT.
Can anybody recommend how to the Field Cat for a Variant for background processing?
Thanks,
Tony.Hi.
You can not use an ALV report in Background or write to spool because it is a kind of dialog program.
You can write only a List report to spool so please find others sulotions.
Hope it helps.
Sayan. -
ALV Grid and Icon : Printing Problem
Hi, i develop some reports using ALV Grid and Icon and i'm facing printing problem, all report that using ALV grid with the option icon = 'X' cannot print properly, all the character field showing improper icon instead of the text. While all the ALV grid report with the option icon = ' ' can print normally.
Thanks.Hi,
Check the Demo Program <b>BCALV_DEMO_TOOLTIP</b>, Here i am able to see the Output Properly, and also able to Print them.
Regards
vijay -
ALV GRID Display Column Width problem when filtering
Hello All,
When i displaying ALV Grid Display ,i selected one column and set filter for that.
the problem is column width at display is 12 charecters but in filter it is allowing only 10 charecters to enter which is wrong. i am unable to set filter.please give solution.
Thanks
Sandeep.Ghello i am calling perform, ineed to set OUTPUTLEN according to field length how can i do that.
FORM fill_fieldcat USING p_field TYPE slis_fieldcat_alv-fieldname
p_text TYPE slis_fieldcat_alv-seltext_l
p_flag TYPE c.
wa_fieldcat-fieldname = p_field.
wa_fieldcat-seltext_l = p_text.
wa_fieldcat-no_out = p_flag.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat. -
ALV grid container toolbar refresh problem
Hi All,
I use OO to display alv (set_table_for_first_display).
I use
it_toolbar_excluding = lt_exclude parameters to hide some buttons.
but when I tried to show up a button in toolbar (when screen comes CHANGE MODE From DISPLAY MODE)
I can not refresh the toolbar.
here is the code.
thanks in advance
IF r_container IS INITIAL .
**ALV Grid
CREATE OBJECT r_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container.
CREATE OBJECT :
v_event_receiver.
CALL METHOD r_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
**ALV Grid
*passing the layout structure, fieldcatalog and output table for display
CALL FUNCTION 'API_RE_CN_GET_DETAIL'
EXPORTING
io_object = lo_busobj
IMPORTING
es_contract = ls_contract
et_object_rel = lt_object_rel
EXCEPTIONS
OTHERS = 0.
IF ld_activity NE '01'.
REFRESH t_itab.
SELECT * FROM zrecn_sp_cond INTO CORRESPONDING FIELDS OF TABLE t_itab
WHERE intreno = ls_contract-intreno.
ENDIF.
gs_fieldcat-fieldname = 'Z_DESC'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '50'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'Z_VALIDFROM'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'Z_VALIDTO'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
gs_fieldcat-fieldname = 'INTRENO'.
gs_fieldcat-ref_table = 'ZRECN_SP_COND'.
gs_fieldcat-outputlen = '10'.
gs_fieldcat-key = 'X'.
gs_fieldcat-edit = edit_flag.
gs_fieldcat-auto_value = 'X'.
gs_fieldcat-no_out = 'X'.
APPEND gs_fieldcat TO gt_fieldcat.
REFRESH :lt_exclude.
PERFORM exclude_tb_functions USING 'LST1' activity CHANGING lt_exclude ."decde to hide or not
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZRECN_SP_COND_STR'
it_toolbar_excluding = lt_exclude
is_layout = fs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = t_itab[].
SET HANDLER v_event_receiver->handle_user_command FOR r_grid.
SET HANDLER v_event_receiver->handle_data_changed FOR r_grid.
SET HANDLER v_event_receiver->handle_hotspot_click FOR r_grid.
SET HANDLER v_event_receiver->handle_toolbar FOR r_grid.
SET HANDLER v_event_receiver->handle_data_changed_finished FOR r_grid.
CALL METHOD r_grid->set_toolbar_interactive.
ELSE .
ls_stable-row = 'X' .
ls_stable-col = 'X' .
CALL METHOD r_grid->refresh_table_display
EXPORTING
is_stable = ls_stable.
ENDIF.Hi
Try this.
if o_grid is initial.
create object <container>
exporting
container_name = 'container1'.
create object o_grid
exporting
i_parent = container_name.
perform fieldcatalog.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
is_variant = gs_variant
i_save = 'A'
i_default = 'X'
it_toolbar_excluding = i_exclude
is_layout = wa_layout
CHANGING
it_fieldcatalog = i_fieldcat[]
it_outtab = i_final_act[].
( after that I think you need to call the method for selecting rows.
like what I did in my code is below:
create object event.
set handler event->handle_double_click for o_grid.
else.
call method o_grid->refresh_table_display. )
*Refreshing ALV Grid display
CALL METHOD o_grid->refresh_table_display
EXPORTING
i_soft_refresh = 'X'
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc 0.
--Exception handling
ENDIF.
endif.
In this code if your o_grid is intial then it will process all the coding before refresh method else if your o_grid is not intial it will refresh the table which is going to be displayed.
I hope this will work for you
Thanks
Lalit Guptaa -
Oo abap-alv in dialog program.
My scenario is: in one screen(module pool) i shud display a 2 column list in alv. when i selct few recs and clik left arrow, those recs shud move 2 left alv.
how can i do this.
shud i have 2 alvs to obtain this? or is there a single method to do this entire thing including the left & right arrows functionality?
can i get any sample codes for this.
note: i am using ecc6.0. so i shud do this only by OO-ABAP.
plz let me know.
tx. kiranHello Kiran,
Here is a sample code.I have used double click event for this.You can use Left push-button instead and write the code in its user-command module.I have used two containers placed side by side and named as <b>CONTAINER1</b> and <b>CONTAINER2</b>.
ZSAMPLE.
DATA:
<b>*first container and grid</b>
cont1 type ref to cl_gui_custom_container,
alv1 type ref to cl_gui_alv_grid,
<b>*second container and grid</b>
cont2 type ref to cl_gui_custom_container,
alv2 type ref to cl_gui_alv_grid,
<b>*table displayed in first grid</b>
itab_spfli type table of spfli,
wa_spfli like line of itab_spfli,
<b>*table displayed in second grid</b>
itab_sflight type table of spfli,
wa_sflight like line of itab_sflight,
ok_code type sy-ucomm.
<b>*local class for handling the double click event of first grid</b>
CLASS lcl_eh DEFINITION
class lcl_eh definition.
Public section.
Methods:DOUBLE_CLICK FOR EVENT DOUBLE_CLICK of cl_gui_alv_grid
importing E_ROW E_COLUMN ES_ROW_NO .
endclass.
DATA: lo_obj TYPE REF TO lcl_eh.
CLASS lcl_eh IMPLEMENTATION
class lcl_eh implementation.
Method double_click.
<b> read table itab_spfli into wa_spfli INDEX e_row-index.
append wa_spfli to itab_sflight.
delete itab_spfli INDEX e_row-index.</b>
CALL METHOD ALV2-><b>SET_TABLE_FOR_FIRST_DISPLAY</b>
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING
IT_OUTTAB = itab_sflight.
CALL METHOD ALV1-><b>REFRESH_TABLE_DISPLAY</b>
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
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.
endmethod.
endclass.
<b>
*selection-screen parameter</b>
PARAMETERS : carrid type spfli-carrid.
AT SELECTION-SCREEN.
SELECT * from spfli into table itab_spfli where carrid = carrid.
call screen 100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'GUI'.
SET TITLEBAR 'xxx'.
<b>*create first container and grid</b>
CREATE OBJECT CONT1
EXPORTING
CONTAINER_NAME = 'CONTAINER1'.
CREATE OBJECT ALV1
EXPORTING
I_PARENT = cont1.
<b>*set handler to handle the double click event</b>
<b>create object lo_obj.
set handler lo_obj->double_click for alv1.</b>
CALL METHOD ALV1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
CHANGING
IT_OUTTAB = itab_spfli.
<b>*create second container and grid</b>
CREATE OBJECT CONT2
EXPORTING
CONTAINER_NAME = 'CONTAINER2'.
CREATE OBJECT ALV2
EXPORTING
I_PARENT = cont2.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
case ok_code.
when 'BACK'.
leave to screen 0.
when 'EXIT'.
leave program.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
regards,
Beejal
**Reward if this helps -
Hi Folks ,
I have tab strip in which in the first three tabs I'm displaying table controls. I have a requirement to display a alv when I click on the fourth tab. The alv has to be displayed on the subscreen related to the fourth tab.
Thank & Regards,
SantoshDATA: grid TYPE REF TO cl_gui_alv_grid,
container TYPE REF TO cl_gui_custom_container,
mycontainer TYPE scrfname VALUE 'ALV1',
gs_layout TYPE lvc_s_layo.
CREATE OBJECT container
EXPORTING
container_name = mycontainer.
CREATE OBJECT grid
EXPORTING
i_parent = container
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.
gs_layout-grid_title = 'Purchase Order'(100).
CALL METHOD GRID->set_table_for_first_display
EXPORTING
i_structure_name = 'EKKO'
is_layout = gs_layout
is_print =
CHANGING
it_outtab = i_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. -
Urgently required on ALV grid Standard program
In the standard program,
BCALV_EDIT_04 ,
when the user click the insert button, it is triggering a method
(get_inserted_row). In this method they are passing a exporting parameter.
My doudbt is :
what is happening when the the method is triggered and where can i see the internal program of that method.
Thank you for ur suggestion in ADVANCE....Hi,
Run this code and look at break-points.
<u>
1st - On the moment of the event trigeer.
1nd - The event was trigeered and the event handler is running.</u>
<b>REPORT zmar.
CLASS main DEFINITION
CLASS main DEFINITION.
PUBLIC SECTION.
EVENTS evt EXPORTING value(e_data) TYPE char01.
METHODS event_trigger.
METHODS set_data IMPORTING i_data TYPE char01.
PRIVATE SECTION.
DATA v_data TYPE char01 VALUE 'X'.
ENDCLASS.
CLASS main IMPLEMENTATION
CLASS main IMPLEMENTATION.
METHOD event_trigger.
the event is trigger
BREAK-POINT.
RAISE EVENT evt EXPORTING e_data = v_data.
ENDMETHOD.
METHOD set_data.
MOVE i_data TO v_data.
WRITE: / 'New v_data value ->', v_data.
ENDMETHOD.
ENDCLASS.
CLASS second DEFINITION
CLASS second DEFINITION.
PUBLIC SECTION.
METHODS event_handler FOR EVENT evt OF main
IMPORTING e_data sender.
ENDCLASS.
CLASS second IMPLEMENTATION
CLASS second IMPLEMENTATION.
METHOD event_handler.
the event was triggered and this method(event handler was called)
BREAK-POINT.
WRITE: 'v_data value ->', e_data.
CALL METHOD sender->set_data( i_data = 'Y' ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: obj_main TYPE REF TO main.
DATA: obj_second TYPE REF TO second.
CREATE OBJECT: obj_main, obj_second.
SET HANDLER obj_second->event_handler FOR obj_main.
CALL METHOD obj_main->event_trigger( ).</b>
Regards.
Marcelo Ramos -
Hi,
I'm using OO for ALV-GRID. I have problems by using TOP_OF_PAGE.
I try it like this:
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_TOP_OF_PAGE
FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID,
HANDLE_PRINT_TOP_OF_PAGE
FOR EVENT PRINT_TOP_OF_PAGE OF CL_GUI_ALV_GRID.
ENDCLASS. "LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*--Handle Print Top of page
METHOD HANDLE_PRINT_TOP_OF_PAGE.
IF SY-PAGNO = 1.
PERFORM PRINT_TOP_OF_PAGE.
ENDIF.
ENDMETHOD. "handle_print_top_of_page
*--Handle Top of page
METHOD HANDLE_TOP_OF_PAGE.
PERFORM TOP_OF_PAGE.
ENDMETHOD. "handle_top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
IS_LAYOUT = GS_LAYOUT
CHANGING
IT_FIELDCATALOG = GT_FIELDCAT
IT_OUTTAB = ITAB.
CREATE OBJECT GR_EVENT_HANDLER.
SET HANDLER GR_EVENT_HANDLER->HANDLE_PRINT_TOP_OF_PAGE FOR GR_ALVGRID.
SET HANDLER GR_EVENT_HANDLER->HANDLE_TOP_OF_PAGE FOR GR_ALVGRID.
FORM PRINT_TOP_OF_PAGE.
WRITE: / 'Print-Header'.
ENDFORM. "print_top_of_page
FORM TOP_OF_PAGE.
WRITE: / 'Screnn-Header'.
ENDFORM. "top_of_page
Has anyone an idea what i shell do??
Thanks
regards, DieterHi Vijay,
i have tried this code (same as you but with MARA).
I created PF-Staus STATUS und screen 100 with container CONTROL
but i don't get any result (IT_MARA has 20 entries).
Which mistake have i done?
REPORT ZGRO_TEST1 MESSAGE-ID ZZ .
DATA: IT_MARA TYPE TABLE OF MARA.
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM.
DATA: G_CONTAINER TYPE SCRFNAME VALUE 'CONTROL',
O_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
O_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
O_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
O_PARENT_TOP TYPE REF TO CL_GUI_CONTAINER,
O_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER.
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
*Event Handler for Top of page
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD TOP_OF_PAGE.
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING O_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
START-OF-SELECTION.
SELECT *
FROM MARA
UP TO 20 ROWS
INTO TABLE IT_MARA.
END-OF-SELECTION.
IF NOT IT_MARA[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'TITLE'.
IF G_CUSTOM_CONTAINER IS INITIAL.
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
FORM CREATE_AND_INIT_ALV .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER.
Create TOP-Document
CREATE OBJECT O_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
Create Splitter for custom_container
CREATE OBJECT O_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
CALL METHOD O_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = O_PARENT_TOP.
CALL METHOD O_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = O_PARENT_GRID.
Set height for g_parent_html
CALL METHOD O_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
CREATE OBJECT G_GRID
EXPORTING I_PARENT = O_PARENT_GRID.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
*Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
IT_OUTTAB = IT_MARA[].
CALL METHOD O_DYNDOC_ID->INITIALIZE_DOCUMENT
EXPORTING
BACKGROUND_COLOR = CL_DD_AREA=>COL_TEXTAREA.
Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = O_DYNDOC_ID.
ENDFORM. "CREATE_AND_INIT_ALV
FORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
DATA : DL_TEXT(255) TYPE C. "Text
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = 'Flight Details'
SAP_STYLE = CL_DD_AREA=>HEADING
SAP_FONTSIZE = CL_DD_AREA=>LARGE
SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
CALL METHOD DG_DYNDOC_ID->ADD_GAP
EXPORTING
WIDTH = 200.
CALL METHOD O_DYNDOC_ID->ADD_PICTURE
EXPORTING
PICTURE_ID = 'ENJOYSAP_LOGO'.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
program ID
DL_TEXT = 'Program Name :'.
CALL METHOD DG_DYNDOC_ID->ADD_GAP.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
CLEAR DL_TEXT.
DL_TEXT = SY-REPID.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
CLEAR : DL_TEXT.
program ID
DL_TEXT = 'User Name :'.
CALL METHOD DG_DYNDOC_ID->ADD_GAP.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
CLEAR DL_TEXT.
DL_TEXT = SY-UNAME.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
Run Date
DL_TEXT = 'Run Date :'.
CALL METHOD DG_DYNDOC_ID->ADD_GAP.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
CLEAR DL_TEXT.
Move date
WRITE SY-DATUM TO DL_TEXT.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
*Time
DL_TEXT = 'Time :'.
CALL METHOD DG_DYNDOC_ID->ADD_GAP.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
CLEAR DL_TEXT.
Move time
WRITE SY-UZEIT TO DL_TEXT.
CALL METHOD O_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = DL_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING
SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
PERFORM DISPLAY.
ENDFORM. " EVENT_TOP_OF_PAGE
FORM DISPLAY.
Creating html control
IF O_HTML_CNTRL IS INITIAL.
CREATE OBJECT O_HTML_CNTRL
EXPORTING
PARENT = O_PARENT_TOP.
ENDIF.
CALL METHOD O_DYNDOC_ID->MERGE_DOCUMENT.
O_DYNDOC_ID->HTML_CONTROL = O_HTML_CNTRL.
Display document
CALL METHOD O_DYNDOC_ID->DISPLAY_DOCUMENT
EXPORTING
REUSE_CONTROL = 'X'
PARENT = O_PARENT_TOP
EXCEPTIONS
HTML_DISPLAY_ERROR = 1.
IF SY-SUBRC NE 0.
MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
ENDIF.
ENDFORM. " display
Regards, Dieter -
ALV Grid - Very Strange Problem
I am facing a very strange problem in ALV Grid. Ours is a ECC5 system on SAP_APPL SAPKH50011 and SAP_BASIS SAPKB64016.
I have implemented the ALV grid in a screen using classes. This grid by default appears in display mode however it can be switched to change mode and back to display mode using a custom button on the ALV toolbar. When the user clicks the change button the grid appears in editable mode. During the back and forth switching of the ALV between Change/Display modes the ALV grid control is not destroyed however the toolbar, fieldcatalog and ALV contents are refreshed.
The data which is entered in an editable cell is validated using the data_changed event which has been implemented locally. If the validation fails an error message is raised using the message statement which is being issued correctly. Now when I correct the data and then click on another cell in the ALV grid the program is being aborted. Any clue why this is happening??Please check this code
In the PBO of the screen set the field catalog and layout , i think this will help not to refresh the field catalog every time swtich between display and change mode
set titlebar sy-dynnr with p_netwk.
call method g_grid->set_frontend_fieldcatalog
exporting
it_fieldcatalog = gt_fieldcat[].
call method g_grid->set_frontend_layout
exporting
is_layout = gs_layout.
call method g_grid->refresh_table_display.
2. Regarding program abort, please paste the first page of system dump
a® -
Page Up and Page Down in ALV Grid
Hello Experts,
I have a simple ALV Grid report program. . If the report displays a lot of records then the scroll ups and downs can be used. However the new requirement is to make the page up, next, prevoius, down function. I have already included a SET PF-STATUS where I copied the standard and added the page up,down,next and previous. Those buttons/icons are now active in the toolbar but its not functioning as expected, nothing happens when it is being clicked. I've read some forums and below are the propose solutions:
- Reduce the SAP work area --> how to reduce it?
- Most forums are about ALV Grid report in OO and Dialog programming whereas a code will be put in PAI and PBO to make the page up, down buttons to function. --> How will this be applied since the report is just a simple report program (not OO or dialog)
What is best solution to apply in my case?
Thanks in advance!
Best Regards,
Alezandrohi kurtt
Perhaps the below code, for scrolling the buttons can help u if the PF status and functionlity is already in place-
module scroll_tab input.
data: v_lines1 type sy-loopc.
clear: ok_code,
save_ok.
ok_code = sy-ucomm.
save_ok = ok_code.
case save_ok.
when 'PU'. "Page Up
tc1-top_line = tc1-top_line - lv_looplines.
if tc1-top_line < 1.
tc1-top_line = 1.
endif.
when 'PD'. "Page Down
tc1-top_line = tc1-top_line + lv_looplines.
if tc1-top_line > lv_lines.
tc1-top_line = ( lv_lines - lv_looplines ) + 1.
endif.
when 'PTU'. "Page total up
tc1-top_line = 1.
when 'PTD'. "Page total down
TC1-TOP_LINE = ( LV_LINES - LV_LOOPLINES ) + 1.
describe table it_vbak lines v_lines1.
tc1-top_line = v_lines1.
endcase.
endmodule. " SCROLL_TAB INPUT
regards
praveen -
Hi,
I need to learn ALV grid, Please give a good material or links to start of with basics of ALV.
Also send me step by step procedure to create simple Alv grid example programs.
Thanks in advance,
Sachidanand.Bhi,
ALV
http://www.geocities.com/mpioud/Abap_programs.html
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
rgd
anver
<b><i>if hlpe d pls mark points</i></b> -
Error in top-of-page in ALV GRID
Friwnds i am trying out a simple alv grid display program with
top of page .
But the top-of-page is coming blank with no logo and text.
Please help me .
Below is the full program.
REPORT zalv_griddisplaypic.
TYPE-POOLS : slis.
DATA : itab TYPE STANDARD TABLE OF spfli,
it_fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv,
drepid LIKE sy-repid.
START-OF-SELECTION.
SELECT carrid
connid FROM spfli INTO corresponding fields of TABLE itab UP TO 10 ROWS.
END-OF-SELECTION.
wa_fcat-fieldname = 'CARRID'.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = 1 .
wa_fcat-emphasize = 'X'.
wa_fcat-just = 'C'.
wa_fcat-outputlen = 15.
wa_fcat-seltext_m = 'CARRIER NO'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-fieldname = 'CONNID'.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = 2 .
wa_fcat-emphasize = 'X'.
wa_fcat-just = 'C'.
wa_fcat-outputlen = 20.
wa_fcat-seltext_m = 'CONNECTION NO'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = drepid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP-OF-PAGE1'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'LOKESH'
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = it_fcat
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab.
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 top-of-page1
text
FORM TOP-OF-PAGE1.
data: header type slis_t_listheader,
wa type slis_listheader,
v1 type char10.
TITLE AREA
wa-typ = 'S'.
wa-info = 'ALV GRID DISPLAY'.
append wa to header.
clear wa.
WRITE sy-datum TO v1 USING EDIT MASK '__/__/_____'.
wa-typ = 'S'.
wa-info = v1.
wa-key = 'DATE :'.
APPEND wa TO header.
CLEAR wa.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = header
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "top-of-page1try to this code.........
REPORT zalv_griddisplaypic.
TYPE-POOLS : slis.
DATA : itab TYPE STANDARD TABLE OF spfli,
DATA GT_HEADER TYPE SLIS_T_LISTHEADER.
it_fcat TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv,
drepid LIKE sy-repid.
START-OF-SELECTION.
SELECT carrid
connid FROM spfli INTO corresponding fields of TABLE itab UP TO 10 ROWS.
END-OF-SELECTION.
PERFORM BUILD_HEADER USING GT_HEADER.
wa_fcat-fieldname = 'CARRID'.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = 1 .
wa_fcat-emphasize = 'X'.
wa_fcat-just = 'C'.
wa_fcat-outputlen = 15.
wa_fcat-seltext_m = 'CARRIER NO'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-fieldname = 'CONNID'.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = 2 .
wa_fcat-emphasize = 'X'.
wa_fcat-just = 'C'.
wa_fcat-outputlen = 20.
wa_fcat-seltext_m = 'CONNECTION NO'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = drepid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP-OF-PAGE1'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'LOKESH'
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = it_fcat
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab.
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 top-of-page1
text
FORM BUILD_HEADER USING HEADER TYPE SLIS_T_LISTHEADER.
data: header type slis_t_listheader,
wa type slis_listheader,
v1 type char10.
TITLE AREA
wa-typ = 'S'.
wa-info = 'ALV GRID DISPLAY'.
append wa to header.
clear wa.
WRITE sy-datum TO v1 USING EDIT MASK '__/__/_____'.
wa-typ = 'S'.
wa-info = v1.
wa-key = 'DATE :'.
APPEND wa TO header.
CLEAR wa.
endform.
form top_of_page1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_header
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID=.
endform. -
ALV Grid Display in Loop.
Hello experts,
I need your help to resolve the issue.
I have made a report:
On selection screen, Release group and release strategy is taken in select options:
SELECT-OPTIONS : S_FRGGR FOR T16FS-FRGGR,
S_FRGSX FOR T16FS-FRGSX.
if s_frgsx is not initial.
select frggr frgsx from t16fs into table i_t16fs where frggr in s_frggr and frgsx in s_frgsx.
else.
select frggr frgsx from t16fs into table i_t16fs where frggr in s_frggr.
endif.
loop at i_t16fs into wa_t16fs.
Inside this all code is written.
endloop.
I have to display the output (from table CDHDR and CDPOS) same as the output of transaction CL24N but in ALV GRID DISPLAY.
I have written all the code to fetch the values and passed final internal table to ALV GRID DISPLAY.
The problem is :
We can select a range of values for release group and release strategy as it is in select-options.
For every release group, more than 10 strategies are present.
For example :
For release group 62, 710 release strategies are present.
In output, I can see output of 1st strategy. When I press the back button, I can see the output of 1st strategy (but values from only CDPOS not from CDHDR) and second strategy (Both values from CDHDR and CDPOS). When I press the back button, I can see the output of 1st (but values from only CDPOS not from CDHDR), second strategy (but values from only CDPOS not from CDHDR)) and third strategy (Both values from CDHDR and CDPOS). Like this…. So on… upto 710th entry.
I want the output of all 710 entries in single ALV GRID DISPLAY.
What can be done?
Regards,
TitikshaHello Manish,
Following is some code for final internal table.
LOOP AT I1_CDPOS ASSIGNING <FS_GT_OUTPUT_ITEM>.
WA_FINAL-CHANGENO = <FS_GT_OUTPUT_ITEM>-CHANGENR.
WA_FINAL-FRGGR = S_FRGGR.
WA_FINAL-FRGSX = S_FRGSX.
WA_FINAL-CLASS = V_CLASS. "<FS_GT_OUTPUT_ITEM>-CLASS. " LIKE KLAH-CLASS,
WA_FINAL-VALUE_OLD = <FS_GT_OUTPUT_ITEM>-VALUE_OLD. " LIKE AUSP-ATWRT,
WA_FINAL-VALUE_NEW = <FS_GT_OUTPUT_ITEM>-VALUE_NEW.
IF WA_FINAL-VALUE_OLD IS NOT INITIAL.
WA_FINAL-ACTION = 'DELETED'. "<FS_GT_OUTPUT_ITEM>-ACTION." TYPE C,
ELSE.
WA_FINAL-ACTION = 'CREATED'.
ENDIF.
IF WA_FINAL-VALUE_OLD IS NOT INITIAL.
WA_FINAL-VALUE = <FS_GT_OUTPUT_ITEM>-VALUE_OLD.
ELSE.
WA_FINAL-VALUE = <FS_GT_OUTPUT_ITEM>-VALUE_NEW.
ENDIF.
READ TABLE I_GT_OUTPUT_HEADER ASSIGNING <FS_GT_OUTPUT_HEADER> WITH KEY CHANGENO = <FS_GT_OUTPUT_ITEM>-CHANGENR.
IF SY-SUBRC = 0.
WA_FINAL-DATE = <FS_GT_OUTPUT_HEADER>-DATE." LIKE CDHDR-UDATE,
WA_FINAL-TIME = <FS_GT_OUTPUT_HEADER>-TIME." LIKE CDHDR-UTIME,
WA_FINAL-USER = <FS_GT_OUTPUT_HEADER>-USER." LIKE CDHDR-USERNAME,
WA_FINAL-TCODE = <FS_GT_OUTPUT_HEADER>-TCODE." LIKE CDHDR-TCODE,
ENDIF.
APPEND WA_FINAL TO I_FINAL.
UNASSIGN <FS_WA_FINAL>.
READ TABLE I_FINAL ASSIGNING <FS_WA_FINAL> WITH KEY CHANGENO = <FS_GT_OUTPUT_ITEM>-CHANGENR
VALUE_OLD = <FS_GT_OUTPUT_ITEM>-VALUE_OLD
VALUE_NEW = <FS_GT_OUTPUT_ITEM>-VALUE_NEW.
IF SY-SUBRC EQ 0.
UNASSIGN <FS_WA_CABNT>.
READ TABLE I_CABNT ASSIGNING <FS_WA_CABNT> WITH KEY ATINN = <FS_GT_OUTPUT_ITEM>-TABKEY+18(10).
IF SY-SUBRC EQ 0.
<FS_WA_FINAL>-ATBEZ = <FS_WA_CABNT>-ATBEZ.
ENDIF.
ENDIF.
ENDLOOP.
And I_FINAL is passed to ALV.
Here the line which is in BOLD and UNDERLINED, data after that is getting displayed only for the last value of Realese strategy and release group, not for others.
Please help.
Regards,
Titiksha
Maybe you are looking for
-
Exception in thread "main" java.lang.NullPointerException: Canvas3D: null GraphicsConfiguration at javax.media.j3d.Canvas3D.checkForValidGraphicsConfig(Canvas3D.java:963) at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:1006) at HelloJava3Da.<init>(H
-
I need some help here. Please follow this quick link and let me know if you have any solution. I emailed Apple but it might be a wait. http://www.ehmac.ca/anything-mac/55394-apple-itunes-store-ca-signing.html
-
Is it possible to replace the "." key on a 15inch tibook? Where do I get the parts and can I do it myself? Thanks. Chris
-
ROUTERS AND ADAPTERS FOR WIRELESS CONNECTIONS WITH DESKTOP PC'S
I am looking for a router with security and antenna's for 3 home based desktop PC's
-
No sound when converting videos
I just got the new iPod and got Quicktime 7 PRO so that I could export videos to iPod format. I go to file export - Movie to iPod (320x240) and then click save and the video is encoded to iPod format but when I import it to my iTunes and iPod, there