Not gettting quantity displayed in the alv grid
hi experts
iam displaying vbeln, matnr, quantity, sellingprice etc for an customer using fieldcat. in alv grid.
iam able to get all the fields other than quantity in the output.
i have taken vbap-kwmeng, actually in the va03 it is displaying from komp.
i have tried with the following
wa_fieldcat-col_pos = 5.
wa_fieldcat-fieldname = 'KWMEMG'.
wa_fieldcat-tabname = 'IT_DISPLAY'.
wa_fieldcat-datatype = 'QUAN'.
wa_fieldcat-outputlen = 15.
wa_fieldcat-seltext_m = 'QUANTITY'.
wa_fieldcat-ref_fieldname = 'KWMENG'.
wa_fieldcat-ref_tabname = 'VBAP'.
wa_fieldcat-qfieldname = 'VRKME'.
wa_fieldcat-qtabname = 'VBAP'.
but iam not getting the respective output.
please help
thanks in advance.
maaya
I am not sure why are you not getting :
Just remove col_pos and see the results,and also increase output len to 18.
<b>clear wa_fieldcat.</b>
wa_fieldcat-col_pos = 5. -> first comment and see the results
wa_fieldcat-fieldname = 'KWMEMG'.
wa_fieldcat-tabname = 'IT_DISPLAY'.
wa_fieldcat-outputlen = 18.
wa_fieldcat-seltext_m = 'QUANTITY'.
wa_fieldcat-seltext_s = 'QUANTITY'.
wa_fieldcat-seltext_l = 'QUANTITY'.
<b>append wa_fieldcat to i_fieldcat.</b>
Always clear the wa_fieldcat.
Thanks
Seshu
Similar Messages
-
Not able to display logo on alv grid output
hi
can anybody guide me.
i have written code for displaying logo on alv grid report.
i uploaded bmp image using OAER
but even then i am not able to display logo on the report please help me
i am using 4.7 version..
code...
REPORT ZALVLOGO .
type-pools: slis.
data: i_sflight type table of sflight.
*data: begin of i_sflight occurs 10.
*include structure sflight.
*data: end of i_sflight.
data: it_events type slis_t_event,
wa_events type slis_alv_event.
select * from sflight into table i_sflight.
perform form_fill_table.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_TOP_OF_PAGE = 'top-of-page'
I_STRUCTURE_NAME = 'sflight'
TABLES
T_OUTTAB = i_sflight
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_page
text
--> p1 text
<-- p2 text
FORM top-of-page .
data: t_header type slis_t_listheader,
wa_header type slis_listheader.
wa_header-typ = 'h'.
wa_header-info = 'FLIGHT DETAILS'.
APPEND wa_header to t_header.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = t_header
I_LOGO = 'ENJOY'.
I_END_OF_LIST_GRID =.
ENDFORM. " top_of_page
*& Form form_fill_table
text
--> p1 text
<-- p2 text
FORM form_fill_table .
clear wa_events.
wa_events-name = 'top-op-page1'.
wa_events-form = 'top-of-page'.
append wa_events to it_events.
ENDFORM. " form_fill_tablehi ,
First upload images in SAP using transaction se78
http://www.howforge.com/step-by-step-upload-bitmap-images-to-sap
Then use that Image name to call using function module
in top of -page
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'KAL1_LOGO'
it_list_commentary = lt_top_of_page_no_sel.
Regards
Deepak. -
Total is not getting displayed in the ALV output.
Hi,
Total is not getting displayed in the ALV output.
I m using :REUSE_ALV_BLOCK_LIST_APPEND & REUSE_ALV_BLOCK_LIST_DISPLAY
Are there any issues with it as the same settings are working fine with REUSE_ALV_LIST_DISPLAY
source code:
DATA: layout TYPE slis_layout_alv,
IT_eventS TYPE slis_t_event,
fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
rec_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
TYPES: BEGIN OF ty_tab,
belnr TYPE dberchz-belnr,
belzart TYPE dberchz-belzart,
net TYPE dberchz-nettobtr,
END OF ty_tab.
DATA: lt_tab TYPE STANDARD TABLE OF ty_tab.
SELECT belnr belzart nettobtr
FROM dberchz
INTO TABLE lt_tab[]
WHERE belnr eq '000000000001'.
if sy-subrc ne 0.
ENDIF.
* defining layout
layout-colwidth_optimize = 'X'.
layout-def_status = 'X'.
*defning event
*event
*defining field catalog
fcat-col_pos = 1.
fcat-fieldname = 'BELNR'.
fcat-tabname = 'LT_TAB'.
APPEND fcat.
fcat-col_pos = 2.
fcat-fieldname = 'BELZART'.
fcat-tabname = 'LT_TAB'.
APPEND fcat.
fcat-col_pos = 3.
fcat-fieldname = 'NET'.
fcat-tabname = 'LT_TAB'.
fcat-do_sum = 'X'.
APPEND fcat.
*calling alv
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'YZ_PLR'
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = layout
it_fieldcat = fcat[]
i_tabname = 'LT_TAB'
it_events = IT_EVENTS[]
* IT_SORT =
* I_TEXT = ' '
tables
t_outtab = lt_tab[]
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
Thanks,
GauravHi
No I don't think, this is my code (based on your code) and it works fine:
TYPE-POOLS SLIS.
DATA: BEGIN OF LT_TAB OCCURS 0,
BELNR LIKE BSEG-BELNR,
GJAHR LIKE BSEG-GJAHR,
WRBTR LIKE BSEG-WRBTR,
WAERS LIKE BKPF-WAERS,
END OF LT_TAB.
DATA: LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
REC_FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
START-OF-SELECTION.
FCAT-COL_POS = 1.
FCAT-FIELDNAME = 'BELNR'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-REF_FIELDNAME = 'BELNR'.
FCAT-REF_TABNAME = 'BSEG'.
APPEND FCAT.
FCAT-COL_POS = 2.
FCAT-FIELDNAME = 'GJAHR'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-REF_FIELDNAME = 'GJAHR'.
FCAT-REF_TABNAME = 'BSEG'.
APPEND FCAT.
FCAT-COL_POS = 3.
FCAT-FIELDNAME = 'WRBTR'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-CFIELDNAME = 'WAERS'.
FCAT-REF_FIELDNAME = 'WRBTR'.
FCAT-REF_TABNAME = 'BSEG'.
FCAT-DO_SUM = 'X'.
APPEND FCAT.
FCAT-COL_POS = 4.
FCAT-FIELDNAME = 'WAERS'.
FCAT-TABNAME = 'LT_TAB'.
FCAT-REF_FIELDNAME = 'WAERS'.
FCAT-REF_TABNAME = 'BKPF'.
FCAT-DO_SUM = SPACE.
APPEND FCAT.
SELECT * FROM BSEG INTO CORRESPONDING FIELDS OF TABLE LT_TAB
WHERE BUKRS = 'MAAB'
AND BELNR = '0000000001'.
LT_TAB-WAERS = 'EUR'.
MODIFY LT_TAB FROM LT_TAB TRANSPORTING WAERS WHERE WAERS = SPACE.
*CALLING ALV
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = 'ZPROVAMAX5'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FCAT[]
I_TABNAME = 'LT_TAB'
IT_EVENTS = IT_EVENTS[]
TABLES
T_OUTTAB = LT_TAB[].
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
I've also inserted a currency field
Max -
Error whil adding Header to the ALV grid using OO
Hi Guys,
I want to display the Header for the ALV grid using Splitter .
when i am doing like that .I am getting a screen on the top of that screen I am getting a EMPTY screen .I don't know why likat.
What i need is just to display a Grid with header?Can anybody Please help me reagarding this problem.
the Code is Below.
*& Report Z_TEST_PGM
REPORT Z_TEST_PGM NO STANDARD PAGE HEADING
LINE-SIZE 120 MESSAGE-ID zotc.
Tables : CKMLMV003 , CKMLMV001.
TYPE-POOLS: slis.
Types : Begin of t_CKMLMV003_out,
WERKS type CKMLMV003-WERKS,
MATNR type CKMLMV003-MATNR,
MISCH_VERH type CKMLMV003-MISCH_VERH,
KALNR_BAL type CKMLMV003-KALNR_BAL,
GJAHR type CKMLMV003-GJAHR,
PERIO type CKMLMV003-PERIO,
MGTYP type CKMLMV003-MGTYP,
End of t_CKMLMV003_out,
Begin of t_CKMLMV001_out,
MATNR type CKMLMV001-MATNR,
KALNR type CKMLMV001-KALNR,
LIFNR_ND type CKMLMV001-LIFNR_ND,
EKORG_ND type CKMLMV001-EKORG_ND,
End of t_CKMLMV001_out,
Begin of t_CKMLMV003_Temp,
MATNR type CKMLMV003-MATNR,
GJAHR type CKMLMV003-GJAHR,
PERIO type CKMLMV003-PERIO,
End of t_CKMLMV003_Temp,
Begin of t_Final_out,
MATNR type CKMLMV003-MATNR,
GJAHR type CKMLMV003-GJAHR,
PERIO type CKMLMV003-PERIO,
WERKS type CKMLMV003-WERKS,
LIFNR_ND1 type CKMLMV001-LIFNR_ND,
MISCH_VERH1 type CKMLMV003-MISCH_VERH,
LIFNR_ND2 type CKMLMV001-LIFNR_ND,
MISCH_VERH2 type CKMLMV003-MISCH_VERH,
LIFNR_ND3 type CKMLMV001-LIFNR_ND,
MISCH_VERH3 type CKMLMV003-MISCH_VERH,
LIFNR_ND4 type CKMLMV001-LIFNR_ND,
MISCH_VERH4 type CKMLMV003-MISCH_VERH,
LIFNR_ND5 type CKMLMV001-LIFNR_ND,
MISCH_VERH5 type CKMLMV003-MISCH_VERH,
LIFNR_ND6 type CKMLMV001-LIFNR_ND,
MISCH_VERH6 type CKMLMV003-MISCH_VERH,
LIFNR_ND7 type CKMLMV001-LIFNR_ND,
MISCH_VERH7 type CKMLMV003-MISCH_VERH,
LIFNR_ND8 type CKMLMV001-LIFNR_ND,
MISCH_VERH8 type CKMLMV003-MISCH_VERH,
LIFNR_ND9 type CKMLMV001-LIFNR_ND,
MISCH_VERH9 type CKMLMV003-MISCH_VERH,
LIFNR_ND10 type CKMLMV001-LIFNR_ND,
MISCH_VERH10 type CKMLMV003-MISCH_VERH,
LIFNR_ND11 type CKMLMV001-LIFNR_ND,
MISCH_VERH11 type CKMLMV003-MISCH_VERH,
LIFNR_ND12 type CKMLMV001-LIFNR_ND,
MISCH_VERH12 type CKMLMV003-MISCH_VERH,
LIFNR_ND13 type CKMLMV001-LIFNR_ND,
MISCH_VERH13 type CKMLMV003-MISCH_VERH,
End of t_Final_out,
Begin of t_Final_out1,
MATNR type CKMLMV003-MATNR,
GJAHR type CKMLMV003-GJAHR,
PERIO type CKMLMV003-PERIO,
LIFNR_ND1 type CKMLMV001-LIFNR_ND,
MISCH_VERH1 type CKMLMV003-MISCH_VERH,
LIFNR_ND2 type CKMLMV001-LIFNR_ND,
MISCH_VERH2 type CKMLMV003-MISCH_VERH,
LIFNR_ND3 type CKMLMV001-LIFNR_ND,
MISCH_VERH3 type CKMLMV003-MISCH_VERH,
LIFNR_ND4 type CKMLMV001-LIFNR_ND,
MISCH_VERH4 type CKMLMV003-MISCH_VERH,
LIFNR_ND5 type CKMLMV001-LIFNR_ND,
MISCH_VERH5 type CKMLMV003-MISCH_VERH,
LIFNR_ND6 type CKMLMV001-LIFNR_ND,
MISCH_VERH6 type CKMLMV003-MISCH_VERH,
LIFNR_ND7 type CKMLMV001-LIFNR_ND,
MISCH_VERH7 type CKMLMV003-MISCH_VERH,
LIFNR_ND8 type CKMLMV001-LIFNR_ND,
MISCH_VERH8 type CKMLMV003-MISCH_VERH,
LIFNR_ND9 type CKMLMV001-LIFNR_ND,
MISCH_VERH9 type CKMLMV003-MISCH_VERH,
LIFNR_ND10 type CKMLMV001-LIFNR_ND,
MISCH_VERH10 type CKMLMV003-MISCH_VERH,
LIFNR_ND11 type CKMLMV001-LIFNR_ND,
MISCH_VERH11 type CKMLMV003-MISCH_VERH,
LIFNR_ND12 type CKMLMV001-LIFNR_ND,
MISCH_VERH12 type CKMLMV003-MISCH_VERH,
LIFNR_ND13 type CKMLMV001-LIFNR_ND,
MISCH_VERH13 type CKMLMV003-MISCH_VERH,
End of t_Final_out1.
Global Structures *
Data : i_CKMLMV003_str type t_CKMLMV003_out,
i_CKMLMV001_str type t_CKMLMV001_out,
i_Final_str type t_Final_out,
i_Final_str1 type t_Final_out,
i_CKMLMV003_Temp type t_CKMLMV003_Temp.
Global Internal Tables *
Data : i_CKMLMV003_out type standard table of t_CKMLMV003_out,
i_CKMLMV001_out type standard table of t_CKMLMV001_out,
i_Final_out type standard table of t_Final_out,
i_Final_out1 type standard table of t_Final_out.
ALV Report Internal tables *
DATA : t_fieldcatalog TYPE slis_t_fieldcat_alv,
s_fieldcatalog TYPE slis_fieldcat_alv,
t_basic_fieldcatalog TYPE slis_t_fieldcat_alv,
s_basic_fieldcatalog TYPE slis_fieldcat_alv,
t_sort TYPE slis_t_sortinfo_alv,
v_repid TYPE sy-repid.
*ALV Header declarations
Data: t_header type slis_t_listheader,
i_header_str type slis_listheader,
i_line_event_str TYPE slis_alv_event,
i_events TYPE slis_t_event,
wa_layout type slis_layout_alv.
Data : grid1 type ref to cl_gui_alv_grid,
g_custom_container1 type ref to cl_gui_custom_container,
grid2 type ref to cl_gui_alv_grid,
g_custom_container2 type ref to cl_gui_custom_container,
i_FCAT TYPE LVC_T_FCAT,
i_FCAT_str type lvc_s_fcat,
Structure for layout
i_layout_s TYPE lvc_s_layo,
gt_final1 type table of t_Final_out.
DATA: CCCONTAINER1 TYPE SCRFNAME VALUE 'CCCONTAINER1',
CCCONTAINER2 TYPE SCRFNAME VALUE 'CCCONTAINER2',
G_PARENT_TOP TYPE REF TO CL_GUI_CONTAINER ,
G_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
G_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
G_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER.
Global Variables *
Data :cnt(4) type n value '0',
g_plant type CKMLMV003-WERKS ,
g_QuanTStr type CKMLMV003-MGTYP ,
g_PurchOrg type CKMLMV001-EKORG_ND,
flag type n value '0',
g_cnt6 type n value '0',
g_cnt7 type n value '0',
g_cnt8 type n value '0',
g_cnt9 type n value '0',
g_cnt10 type n value '0',
g_cnt11 type n value '0',
g_cnt12 type n value '0',
g_cnt13 type n value '0'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-011.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) TEXT-006 for field s_matnr.
Select-Options : S_MATNR for CKMLMV003-MATNR .
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) TEXT-007 for field S_WERKS.
SELECT-OPTIONS:S_WERKS for CKMLMV003-WERKS Default '2003'.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) TEXT-008 for field S_GJAHR.
SELECT-OPTIONS:S_GJAHR for CKMLMv003-GJAHR default Sy-DATUM(4) .
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) TEXT-009 for field S_PERIO.
SELECT-OPTIONS:S_PERIO for CKMLMV003-PERIO .
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(25) TEXT-010 for field P_MGTYP.
Parameters : P_MGTYP type CKMLMV003-MGTYP .
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN END OF BLOCK b1 .
At Selection-Screen on s_matnr .
Perform Validate_MatNumber.
At Selection-Screen on s_werks .
Perform Validate_CostingPlant.
At Selection-Screen on s_GJAHR .
Perform Validate_FiscalYear.
At Selection-Screen on s_PERIO .
Perform Validate_Period.
At Selection-Screen on p_MGTYP .
Perform Validate_QuantityStrType.
*& Form Validate_MatNumber
text
Form Validate_MatNumber.
DATA l_MATNR TYPE CKMLMV003-MATNR.
IF NOT S_MATNR[] IS INITIAL .
CLEAR L_MATNR.
SELECT single MATNR FROM CKMLMV003
INTO l_MATNR
WHERE MATNR = s_MATNR-LOW or MATNR = s_MATNR-HIGH.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e999 WITH
'Enter a Valid Material Number'(001).
ENDIF.
ENDIF.
ENDFORM. "Validate_MatNumber
*& Form Validate_CostingPlant
text
Form Validate_CostingPlant.
DATA l_werks TYPE CKMLMV003-WERKS.
IF NOT S_WERKS[] IS INITIAL .
CLEAR L_WERKS.
SELECT single WERKS FROM T001W
INTO l_WERKS
WHERE WERKS = s_WERKS-low or WERKS = s_WERKS-high.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e999 WITH
'Enter a Valid Costing Plant'(002).
ENDIF.
ENDIF.
ENDFORM. "Validate_CostingPlant
*& Form Validate_FiscalYear
text
Form Validate_FiscalYear.
DATA l_GJAHR TYPE CKMLMV003-GJAHR.
IF NOT S_GJAHR-low IS INITIAL or S_GJAHR-high IS INITIAL.
CLEAR L_GJAHR.
SELECT SINGLE GJAHR FROM CKMLMV003
INTO l_GJAHR
WHERE GJAHR LE sy-DATUM(4) .
IF NOT S_GJAHR-low LE sy-DATUM(4) or S_GJAHR-high LE sy-DATUM(4).
MESSAGE e999 WITH
'Enter a Valid Fiscal year'(003).
ENDIF.
ENDIF.
ENDFORM. "Validate_FiscalYear
*& Form Validate_Period
text
Form Validate_Period.
DATA l_PERIO TYPE CKMLMV003-PERIO.
IF NOT S_PERIO[] IS INITIAL .
CLEAR L_PERIO.
SELECT single PERIO FROM CKMLMV003
INTO l_PERIO
WHERE PERIO GE 1 and PERIO LE 12 .
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE e999 WITH
'Enter a Valid Period'(004).
ENDIF.
ENDIF.
ENDFORM. "Validate_Period
*& Form Validate_QuantityStrType
text
Form Validate_QuantityStrType.
DATA l_MGTYP TYPE CKMLMV003-MGTYP.
IF NOT p_MGTYP IS INITIAL.
CLEAR L_MGTYP.
SELECT SINGLE MGTYP FROM CKMLMV003
INTO l_MGTYP
WHERE MGTYP = p_MGTYP .
IF sy-subrc NE 0.
MESSAGE e999 WITH
'Enter a Valid Quantity Structure Type'(005).
ENDIF.
ENDIF.
ENDFORM. "Validate_QuantityStrType
INITIALIZATION of Fields
Class LCL_EVENT_HANDLER DEFINITION.
Public section.
Methods:
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 <br />
PERFORM EVENT_TOP_OF_PAGE USING G_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
Data : G_HANDLER TYPE REF TO LCL_EVENT_HANDLER.
Initialization.
v_repid = sy-repid.
Start-of-Selection.
Perform get_CKMLMV003.
Perform get_CKMLMV001.
Perform Get_Finaldata.
Perform Layout_FieldCatalog.
call screen '101'.
Perform ALVGrid_Final_Display.
*& Form Layout_FieldCatalog
text
Form Layout_FieldCatalog.
s_fieldcatalog-col_pos = 1.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-024.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 2.
s_fieldcatalog-fieldname = 'GJAHR'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-012.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 3.
s_fieldcatalog-fieldname = 'PERIO'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-013.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 4.
s_fieldcatalog-fieldname = 'WERKS'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-025.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 5.
s_fieldcatalog-fieldname = 'LIFNR_ND1'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-014.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 6.
s_fieldcatalog-fieldname = 'MISCH_VERH1'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-015.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 7.
s_fieldcatalog-fieldname = 'LIFNR_ND2'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-016.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 8.
s_fieldcatalog-fieldname = 'MISCH_VERH2'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-017.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 9.
s_fieldcatalog-fieldname = 'LIFNR_ND3'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-018.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 10.
s_fieldcatalog-fieldname = 'MISCH_VERH3'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-019.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 11.
s_fieldcatalog-fieldname = 'LIFNR_ND4'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-020.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 12.
s_fieldcatalog-fieldname = 'MISCH_VERH4'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-021.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 13.
s_fieldcatalog-fieldname = 'LIFNR_ND5'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 14.
s_fieldcatalog-fieldname = 'MISCH_VERH5'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
if g_cnt6 <> '0'.
s_fieldcatalog-col_pos = 14.
s_fieldcatalog-fieldname = 'LIFNR_ND6'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 15.
s_fieldcatalog-fieldname = 'MISCH_VERH6'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
if g_cnt7 <> '0'.
s_fieldcatalog-col_pos = 16.
s_fieldcatalog-fieldname = 'LIFNR_ND7'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 17.
s_fieldcatalog-fieldname = 'MISCH_VERH7'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
if g_cnt8 <> '0'.
s_fieldcatalog-col_pos = 18.
s_fieldcatalog-fieldname = 'LIFNR_ND8'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 19.
s_fieldcatalog-fieldname = 'MISCH_VERH8'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
if g_cnt9 <> '0'.
s_fieldcatalog-col_pos = 20.
s_fieldcatalog-fieldname = 'LIFNR_ND9'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 21.
s_fieldcatalog-fieldname = 'MISCH_VERH9'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
if g_cnt10 <> '0'.
s_fieldcatalog-col_pos = 22.
s_fieldcatalog-fieldname = 'LIFNR_ND10'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 23.
s_fieldcatalog-fieldname = 'MISCH_VERH10'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
if g_cnt11 <> '0'.
s_fieldcatalog-col_pos = 24.
s_fieldcatalog-fieldname = 'LIFNR_ND11'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 25.
s_fieldcatalog-fieldname = 'MISCH_VERH11'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
if g_cnt12 <> '0'.
s_fieldcatalog-col_pos = 26.
s_fieldcatalog-fieldname = 'LIFNR_ND12'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 27.
s_fieldcatalog-fieldname = 'MISCH_VERH12'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
if g_cnt13 <> '0'.
s_fieldcatalog-col_pos = 29.
s_fieldcatalog-fieldname = 'LIFNR_ND13'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-022.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
s_fieldcatalog-col_pos = 30.
s_fieldcatalog-fieldname = 'MISCH_VERH13'.
s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
s_fieldcatalog-seltext_l = Text-023.
append s_fieldcatalog to t_fieldcatalog.
clear s_fieldcatalog.
ENDIF.
ENDFORM. "Layout_FieldCatalog
*& Form get_CKMLMV003
text
Form get_CKMLMV003.
Select WERKS
MATNR
MISCH_VERH
KALNR_BAL
GJAHR
PERIO
MGTYP
from CKMLMV003
into table i_CKMLMV003_out
Where ( MATNR in s_MATNR and
WERKS in s_WERKS and
GJAHR in s_GJAHR and
PERIO in s_PERIO and
MGTYP = p_MGTYP ).
Sort i_CKMLMV003_out by MATNR KALNR_BAL.
ENDFORM. "get_CKMLMV003
*& Form get_CKMLMV001
text
Form get_CKMLMV001.
If Not i_CKMLMV003_out is Initial.
Select MATNR
KALNR
LIFNR_ND
EKORG_ND
from CKMLMV001
into Table i_CKMLMV001_out
for all entries in i_CKMLMV003_out
Where ( KALNR = i_CKMLMV003_out-KALNR_BAL
and WERKS = i_CKMLMV003_out-WERKS
and MATNR = i_CKMLMV003_out-MATNR ).
sort i_CKMLMV001_out by MATNR KALNR.
ENDIF.
ENDFORM. "get_CKMLMV001
*& Form Get_Finaldata
text
Form Get_Finaldata.
Loop at i_CKMLMV001_out into i_CKMLMV001_str.
Loop at i_CKMLMV003_out into i_CKMLMV003_str.
If ( i_CKMLMV001_str-KALNR = i_CKMLMV003_str-KALNR_BAL and i_CKMLMV003_str-MATNR = i_CKMLMV001_str-MATNR ) .
If ( flag = 0 ).
g_plant = i_CKMLMV003_str-WERKS.
g_PurchOrg = i_CKMLMV001_str-EKORG_ND.
g_quantstr = i_CKMLMV003_str-MGTYP.
flag = 1.
ENDIF.
Move i_CKMLMV003_str-MATNR to i_Final_str-MATNR.
Move i_CKMLMV003_str-WERKS to i_Final_str-WERKS.
Move i_CKMLMV003_str-GJAHR to i_Final_str-GJAHR.
Move i_CKMLMV003_str-PERIO to i_Final_str-PERIO.
Move i_CKMLMV003_str-MISCH_VERH to i_Final_str-MISCH_VERH1.
Move i_CKMLMV001_str-LIFNR_ND to i_Final_str-LIFNR_ND1.
Move-Corresponding i_CKMLMV003_str to i_CKMLMV003_temp.
Append i_Final_str to i_Final_out.
Clear : i_CKMLMV003_str .
ENDIF.
ENDLOOP.
Clear : i_CKMLMV001_str , i_Final_str , i_CKMLMV003_temp.
ENDLOOP.
Sort i_Final_out by WERKS MATNR GJAHR PERIO .
Loop at i_Final_out into i_Final_str.
if i_Final_str-MATNR = i_Final_str1-MATNR and i_Final_str-GJAHR = i_Final_str1-GJAHR and i_Final_str-PERIO = i_Final_str1-PERIO and i_Final_str-WERKS = i_Final_str1-WERKS.
cnt = cnt + 1.
Case cnt.
When 2.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH2.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND2.
When 3.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH3.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND3.
When 4.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH4.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND4.
When 5.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH5.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND5.
When 6.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH6.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND6.
g_cnt6 = 1.
When 7.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH7.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND7.
g_cnt7 = 1.
When 8.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH8.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND8.
g_cnt8 = 1.
When 9.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH9.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND9.
g_cnt9 = 1.
When 10.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH10.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND10.
g_cnt10 = 1.
When 11.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH11.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND11.
g_cnt11 = 1.
When 12.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH12.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND12.
g_cnt12 = 1.
When 13.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH13.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND13.
g_cnt13 = 1.
ENDCASE.
ELSE.
if cnt GE 1 .
append i_Final_str1 to i_Final_out1.
Clear : i_Final_str1.
ENDIF.
Move-Corresponding i_Final_str to i_Final_str1.
cnt = 0.
cnt = cnt + 1.
ENDIF.
Clear : i_Final_str.
Endloop.
append i_Final_str1 to i_Final_out1.
if i_Final_str-MATNR = i_Final_str1-MATNR and i_Final_str-GJAHR = i_Final_str1-GJAHR and i_Final_str-PERIO = i_Final_str1-PERIO .
cnt = cnt + 1.
Case cnt.
When 2.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH2.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND2.
When 3.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH3.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND3.
When 4.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH4.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND4.
When 5.
Move i_Final_str-MISCH_VERH1 to i_Final_str1-MISCH_VERH5.
Move i_Final_str-LIFNR_ND1 to i_Final_str1-LIFNR_ND5.
ENDCASE.
**Move-Corresponding i_Final_str to i_Final_str1.
ELSE.
if cnt GE 1 .
append i_Final_str1 to i_Final_out1.
Clear : i_Final_str1.
ENDIF.
Move-Corresponding i_Final_str to i_Final_str1.
cnt = 0.
cnt = cnt + 1.
ENDIF.
Clear : i_Final_str.
Endloop.
append i_Final_str1 to i_Final_out1.
ENDFORM. "Get_Finaldata
*& Form top_of_page
text
Form top_of_page.
clear t_header.
refresh t_header.
i_header_str-typ = 'H'.
I_header_Str-info = Text-035.
append I_header_str to t_header.
clear I_header_str.
Date
I_header_str-typ = 'S'.
I_header_str-key = Text-036.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO I_header_str-info. "todays date
append I_header_str to t_header.
clear: I_header_str.
i_header_str-typ = 'S'.
I_header_Str-Key = 'Quantity Structure Type :'.
I_header_Str-info = g_QuantStr.
append I_header_str to t_header.
clear I_header_str.
i_header_str-typ = 'S'.
I_header_Str-Key = 'Purchase Org :'.
I_header_Str-info = g_PurchOrg.
append I_header_str to t_header.
clear I_header_str.
i_header_str-typ = 'S'.
I_header_Str-Key = 'Plant :'.
I_header_Str-info = g_Plant.
append I_header_str to t_header.
clear I_header_str.
CLEAR i_line_event_str.
i_line_event_str-name = 'TOP_OF_PAGE'.
APPEND i_line_event_str TO i_events.
call function 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
ENDFORM. "top_of_page
*& ALVGrid_Final_Display
Form ALVGrid_Final_Display.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_DEFAULt = c_valx
i_callback_top_of_page = 'TOP_OF_PAGE'
i_Save = c_valx
it_fieldcat = t_fieldcatalog
it_sort = t_sort
it_events = I_events
TABLES
t_outtab = i_final_out1.
ENDFORM. "ALVGrid_Final_Display
*& Form ALVGRID_OO_Display
text
Form ALVGRID_OO_Display.
i_FCAT_str-col_pos = 1.
i_FCAT_str-fieldname = 'MATNR'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-seltext = 'MATERIAL'.
i_fcat_str-scrtext_m = Text-024.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 2.
i_FCAT_str-fieldname = 'GJAHR'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-scrtext_m = Text-012.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 3.
i_FCAT_str-fieldname = 'PERIO'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-scrtext_m = Text-013.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 4.
i_FCAT_str-fieldname = 'WERKS'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-025.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 5.
i_FCAT_str-fieldname = 'LIFNR_ND1'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_fcat_str-scrtext_m = Text-014.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 6.
i_FCAT_str-fieldname = 'MISCH_VERH1'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-015.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 7.
i_FCAT_str-fieldname = 'LIFNR_ND2'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-016.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 8.
i_FCAT_str-fieldname = 'MISCH_VERH2'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-017.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 9.
i_FCAT_str-fieldname = 'LIFNR_ND3'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-018.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 10.
i_FCAT_str-fieldname = 'MISCH_VERH3'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-019.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 11.
i_FCAT_str-fieldname = 'LIFNR_ND4'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-020.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 12.
i_FCAT_str-fieldname = 'MISCH_VERH4'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-021.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 13.
i_FCAT_str-fieldname = 'LIFNR_ND5'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-022.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 14.
i_FCAT_str-fieldname = 'MISCH_VERH5'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
i_FCAT_str-scrtext_m = Text-023.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
if g_cnt6 <> '0'.
i_FCAT_str-col_pos = 15.
i_FCAT_str-fieldname = 'LIFNR_ND6'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
i_FCAT_str-scrtext_m = Text-022.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
i_FCAT_str-col_pos = 16.
i_FCAT_str-fieldname = 'MISCH_VERH6'.
i_FCAT_str-tabname = 'I_FINAL_OUT1'.
s_fieldcatalog-NO_OUT = 'X'.
i_FCAT_str-scrtext_m = Text-023.
append i_FCAT_str to i_FCAT.
clear i_FCAT_str.
ENDIF.
*if not grid1 is Initial.
If sy-SUBRC = 0.
Call Method grid1->set_table_for_first_display
CHANGING
it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
EXCEPTIONS
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
CALL METHOD G_DYNDOC_ID->INITIALIZE_DOCUMENT
EXPORTING
BACKGROUND_COLOR = CL_DD_AREA=>COL_TEXTAREA.
Processing events <br />
CALL METHOD GRID1->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = G_DYNDOC_ID.
Call Method grid2->set_table_for_first_display
CHANGING
it_outtab = i_final_out1[]
it_fieldcatalog = I_FCAT
EXCEPTIONS
Invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
Others = 4.
If sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
Endform. "ALVGRID_OO_Display
Form EVENT_TOP_OF_PAGE using DG_DYNDOC_ID
TYPE REF TO CL_DD_DOCUMENT.
DATA : DL_TEXT(255) TYPE C.
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.
Endform.
*& Module STATUS_0101 OUTPUT
text
MODULE STATUS_0101 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'TITLE'.
Create Object G_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
if g_custom_container1 is initial .
create object g_custom_container1
Exporting
Container_name = CCCONTAINER1
Exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
Others = 5.
Create Object G_SPLITTER
Exporting PARENT = g_custom_container1.
CALL METHOD G_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = G_PARENT_TOP.
*Assigning the Part 2 to GRID
CALL METHOD G_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = g_parent_grid.Hi,
Check if any event is triggered from the event handler class, upon selection.
Usually, the events are handled on double click or on hotspot etc.
Regards,
Satish Kanteti -
How to send the ALV GRID output to spool by using the print button in std t
How to send the ALV GRID output to spool by using the print button in standard tool bar.
We have created a button in the va02 transaction. If user click on the button the new screen will be display on that screen we are populating the alv grid output using the oops concept. But i am unable to send the output to spool using the print button in the standard tool bar.
I am able to display the Print parameter dialog box but i am not able to send it to spool.
Kindly help.
Thanks In Advance.
G.V.RamanaHi Shaik,
There is not properties button in my print screen.
MODULE user_command_0900 INPUT.
WHEN 'EXCEL'.
PERFORM excel_download.
WHEN 'PRI'.
PERFORM print_output.
form Print_output.
CALL FUNCTION 'RSPO_LIST_LAYOUT_FITS'
EXPORTING
columns = 80
device = 'ANY '
lines = 65
maxpenality = 1999
TABLES
layouts = lt_layouts1
EXCEPTIONS
unknown_device = 1
OTHERS = 2.
IF sy-subrc = 0.
LOOP AT lt_layouts1.
IF lt_layouts1-penality < 1000 AND
lt_layouts1-penality < l_min_penality.
l_layout = lt_layouts1-layout.
l_min_penality = lt_layouts1-penality.
ENDIF.
ENDLOOP.
IF NOT l_layout IS INITIAL.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
mode = 'CURRENT'
line_size = 80 "#EC *
new_list_id = l_new_list_id
no_dialog = l_no_dialog
layout = l_layout
IMPORTING
out_archive_parameters = rs_arc_params
out_parameters = rs_pri_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc NE 0. " INS SLIN
ENDIF. " INS SLIN
IF rs_pri_params-linsz LT 80 OR
rs_pri_params-linsz LT gt_stack-s_lprint-width.
gt_stack-print_line_break = 'X'.
ELSE.
CLEAR gt_stack-print_line_break.
ENDIF.
IF l_valid NE 'X'.
rs_pri_params = ls_pri_params_sav.
rs_arc_params = ls_arc_params_sav.
ENDIF.
ENDIF.
ENDIF.
endform. " Print_output
CALL METHOD gv_cost_tot_alv_grand->set_table_for_first_display
EXPORTING
is_layout = gs_layout_cost_tot_grand
CHANGING
it_fieldcatalog = gt_fcat_cost_tot_grand[]
it_outtab = gt_cost_tot_grand[].
Please check my code -
How to increase the alv grid size dynamically
Hi all,
I have to develop the report with the following requirement:
I have to take bwkey from t001k on basis of bukrs and bwkey. this bukrs and bwkey are entered in selection-screen.
I have to select matnr, lbkum, salk3 from mbew on basis of bwkey in selection-screen.(this is select options)
now the ouput should be as follows:
for example :
ef01 efo2 ef03
matnr lbkum salk3 lbkum salk3 lbkum salk3 total
700001 3 4 0 0 0 0 7
700010 0 0 2 1 0 0 3
The output should be as mentioned above.
In the above output,
in the first record for 700001, the total of 3 and 4 is displayed as total 7 and
for 700010 , it is displayed as 3.
the get the output as above in the alv grid,
I have taken bwkeys in t001k and remaining fields from mbew and joined them in final internal table.
now in the final table ifinal, i have the following fields,
matnr lbkum salk3 bwkey total.
now when i want to display the output, it is displaying as normal output like
mantr bwkey lbkum salk3 total
700001 etap 3 4 7
700002 etap 1 2 3
but i want to display in the first mentioned format.
so i tried to attach the bwkey values in it001k(this is internal table for t001k) for the final field catalog so that this bwkeys are displayed as column headings in the final output. but it is not displaying.
Please suggest me the solution to display the output in the above first mentioned
format as soon as possible
points will be awarded.
thanking u in advance.
A.Srinivashi ,
u can set the row count to any number , here I am setting it to 5 using the method set_visible_row_count
1 Change the visible row count to u20185u2019
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
lo_value->if_salv_wd_table_settings~set_visible_row_count( '5' ).
u can also go thru this useful links for CONFIGUIRING ALV :
http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4;jsessionid=(J2EE3417400)ID0488867050DB10849380333905377829End
SAP List Viewer (ALV) [original link is broken]
Configuring ALV
http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9?overridelayout=true
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/db22242d-0701-0010-28a2-aeaa1fefd706;jsessionid=(J2EE3414800)ID0133346050DB00727847586176044227End?overridelayout=true&bcsi_scan_06B6B0A4B65849C2=0
I hope it shud solve ur query.
regards,
amit -
To Display Image in Alv Grid....
Hello Gurus,
I want to display an image/icon ( custom icon ) in the ALV grid.
I know to display standard icons in ALV. But i dont know how to store custom icons in the system.
I want to display an icon or image depending upon certain conditions. i need to display these images/icons for each row of the ALV grid.
Please let me know if i can show images or icons ( not standard ) for each row in ALV grid.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 25, 2008 10:20 AMcheck out CL_GUI_PICTURE and the demo programs
SAP_PICTURE_DEMO
SAP_PICTURE_DEMO_ICON
RSDEMO_PICTURE_CONTROL
you can fit the picture in to the control with the following modes.
DISPLAY_MODE_FIT
other options
DISPLAY_MODE_NORMAL
DISPLAY_MODE_STRETCH
DISPLAY_MODE_NORMAL_CENTER
DISPLAY_MODE_FIT_CENTER
Regards
Raja -
Allow to erase values under the input-check of the ALV Grid Control
Hi,<br />
in my ALV Grid I do have a cell which automatically checks the values entered by the user. When the user does not enter the values belonging to the DDIC Domain Value Range of the data element, the cell is rendered with a red border and an ALV error message comes up telling the user to enter the correct values from the F4 help.
In general, this is really great, but in case the user needs to erase the value, this automatical ALV Grid error message keeps popping up asking him to enter at least one value from the value range.
(I assume this is due to the fact that the Domain value range does not contain the value 'empty'.)
<br />
I would like to keep the functionality of checking the entered value but want to switch off the error message in case nothing was entered. How can I achive this?
<br /> <br />
This is what I did so far: <br />
1. Upon initializing ALV Grid, I define the field catalog like this: <br />
ls_fieldcat-fieldname = 'REACTION'. "#EC NOTEXT <br />
ls_fieldcat-edit = abap_true. <br />
ls_fieldcat-coltext = 'Reaction'. "#EC NOTEXT <br />
ls_fieldcat-outputlen = '8'. "#EC NOTEXT <br />
<br />
* This forces the user to set at least one value; not allowing him to delete it!! <br />
ls_fieldcat-ref_table = 'CRMS_ES_FOREIGN_ATTRIBUTE'. "#EC NOTEXT <br />
ls_fieldcat-ref_field = 'REACTION'. <br />
ls_fieldcat-key = abap_true. <br />
<br />
ls_fieldcat-checktable = '!'. <br />
ls_fieldcat-f4availabl = 'X'. "shows the handle for F4 help <br />
ls_fieldcat-col_id = 7.
<br />
(I would assume here that the ls_fieldcat - structure would allow an additional field which allows empty values, but I could not find one!) <br />
<br />
2. For my ALV Grid instance, I am registering the F4 during initialization:<br />
call method gr_fkt_grid->register_f4_for_fields <br />
exporting <br />
it_f4 = lt_f4. <br />
<br />
ls_f4-fieldname = 'REACTION'. "EC SYNTCHAR <br />
ls_f4-register = abap_true. <br />
insert ls_f4 into table lt_f4. <br />
call method gr_fkt_grid->register_f4_for_fields <br />
exporting <br />
it_f4 = lt_f4. <br />
<br /> <br />
3. Then I am setting the handler while initializing: <br />
set handler lr_grid_event_receiver->handle_f4 <br />
for all instances. <br />
<br /> <br />
4. I also have checking methods in PAI for the ALV cells, but they do not apply in this case, <br />
since ALV itself performs this check described above. I cannot see a chance for <br />
interfering myself in PAI. <br />
<br />
Does anyone have an idea how I could prevent the ALV Grid of bringing up the message "Enter a valid value" and <br />
allowing to delete the cell content while keeping its checks in case the user enters a wrong value? <br />
<br />
Thank you very much,<br />
regards,<br />
Konrad<br />Hi Konrad,
Inside the handler method for event DATA_CHANGED, always suppress the error log by calling method activate_display_protocol with dialog = ''.
Whenever u need error log call method display_protocol based on ok_code(sy-ucomm).
Ex:
method data_changed. " Handler method for event 'DATA_CHANGED'
*Suppressing error log
call method g_o_grid->activate_display_protocol " Always suppress error log when grid is changed
exporting
i_dialog = ''.
if er_data_changed->mt_protocol[] is not initial.
if ok_code = 'BACK' or ok_code = 'SAVE'. " Based on ok_code display error log
*Display error log
call method er_data_changed->display_protocol.
endif.
endif.
endmethod. "data_changed
Might solve ur problem
Thanks,
Edited by: Sap Fan on Oct 14, 2009 5:35 AM -
Urgent : how to select the rows in the ALV Grid Control
How to select the rows in the ALV Grid control,
I am facing the situation where i need to select the row/rows in the Grid control and then to lock the entries,
If anyone have the solution please help me out
<b>Its very Urgent</b>Hi Bharath,
Go through this hope u can understand.
SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
A Multiple columns, multiple rows with selection buttons.
B Simple selection, listbox, Single row/column
C Multiple rows without buttons
D Multiple rows with buttons and select all ICON
Setting and getting selected rows (Columns) and read line contents
You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similar methods for columns.
Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
Data declaration:
DATA:
Internal table for indexes of selected rows
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
Example 1: Reading index of selected row(s) and using it to read the grid table
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a valid line'.
EXIT.
ENDIF.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Example 2: Set selected row(s).
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
exporting
it_index_rows = gi_index_rows.
ENDIF.
Reward points if helpful.
Thanks
Naveen khan -
How to implement functionkeys on the ALV GRID tool bar
Hello All,
I need to implement functionkeys(Ex.given below) to the standard buttons like Ascending order etc. on the ALVGRID Tool Bar . I have implementedObject orient concept( Methods) to display the out put.I tried by using set pf-status but it is not comming.
Ex:
ALV Grid Toll Bar Buttons ( Func.Keys )
Print Preview ( CtrlShiftF10)
Sort in Ascending order ( Ctrl+F6 )
Thanks in Advance.
Vijay
Edited by: Vijay Reddy on Aug 19, 2008 10:12 AM
Edited by: Vijay Reddy on Aug 19, 2008 10:13 AMHi,
check this code,
REPORT zcl_timesheet_approval MESSAGE-ID zcl_msg.
* CLASS L_CL_EVENTS DEFINITION *
* Class for inserting buttons on the toolbar *
CLASS l_cl_events DEFINITION.
PUBLIC SECTION.
METHODS:
toolbar FOR EVENT toolbar
OF cl_gui_alv_grid
IMPORTING e_object
e_interactive,
user_command FOR EVENT user_command
OF cl_gui_alv_grid
IMPORTING e_ucomm .
ENDCLASS. " L_CL_EVENTS DEFINITION
* CLASS L_CL_EVENTS IMPLEMENTATION *
* Implementation of class L_CL_EVENTS *
CLASS l_cl_events IMPLEMENTATION.
METHOD toolbar.
PERFORM event_toolbar USING e_object.
ENDMETHOD. " TOOLBAR
METHOD user_command.
PERFORM event_ucomm USING e_ucomm.
ENDMETHOD. " USER_COMMAND
ENDCLASS. " L_CL_EVENTS IMPLEMENTATION
CONSTANTS:
c_boolean_yes(1) TYPE c " Boolean - yes
VALUE 'X',
c_approve_status(1) TYPE c " Approval status
VALUE 'A',
c_rej_status(1) TYPE c " Rejected status
VALUE 'R',
c_save_status(1) TYPE c " Save status
VALUE 'S',
c_fcode_approve(7) TYPE c " Function code - APPROVE
VALUE 'APPROVE',
c_fcode_rej(6) TYPE c " Function code - REJECT
VALUE 'REJECT',
c_fcode_back(4) TYPE c " Function code - BACK
VALUE 'BACK',
c_fcode_onli(4) TYPE c " Function code - EXECUTE
VALUE 'ONLI',
c_fcode_exit(4) TYPE c " Function code - EXIT
VALUE 'EXIT',
c_fcode_cancel(6) TYPE c " Function code - CANCEL
VALUE 'CANCEL',
c_zero(1) TYPE c " Constant value 0
VALUE '0',
c_alv_scr(7) TYPE c " GUI status : ALV screen
VALUE 'ALV_SCR'.
* Field-string declarations...........................................
DATA:
* Field-string to build fieldcat.
fs_fcat TYPE lvc_s_fcat,
* Field-string for t_temp
fs_temp TYPE type_s_temp.
* Working variables...................................................
* Internal table declarations........................................
DATA:
* Internal table to build fieldcat.
t_fcat TYPE lvc_t_fcat,
* For ALV ...........................................................
DATA:
* To create instance for cl_gui_custom_container
g_grid TYPE REF TO cl_gui_custom_container,
* To create instance for cl_gui_alv_grid
g_alv TYPE REF TO cl_gui_alv_grid,
* To create instance for l_cl_events
g_events TYPE REF TO l_cl_events,
* To assign name for custom container
g_container TYPE scrfname VALUE 'CONTAINER',
* To assign layout
g_fcatlayo TYPE lvc_s_layo.
* AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN.
* To perform user actions on the selection screen
PERFORM user_command.
* MODULE STATUS_0100 OUTPUT *
* This module will create the objects for the instance and display *
* the records *
MODULE status_0100 OUTPUT.
SET PF-STATUS c_alv_scr.
PERFORM set_titlebar USING w_display.
* If program executed in foreground.
IF sy-batch IS INITIAL.
* If g_grid is empty.
IF g_grid IS INITIAL.
* To create object for instance grid
CREATE OBJECT g_grid
EXPORTING
container_name = g_container.
* To create object for object grid
CREATE OBJECT g_alv
EXPORTING
i_parent = g_grid.
ELSE.
* IF W_SUBMIT EQ
CALL METHOD g_alv->refresh_table_display.
ENDIF. " IF G_GRID IS INITIAL
ENDIF. " IF SY-BATCH IS INITIAL
REFRESH t_fcat.
* If w_display eq 'X' .
IF w_display EQ c_boolean_yes.
* To display all records except saved data
PERFORM display_allrecords.
ENDIF. " IF W_FLAG EQ C_BOOLEAN_YES
IF w_submit EQ c_boolean_yes.
* To display submitted records
PERFORM submitted_records.
ENDIF. " IF W_SUBMIT EQ C_BOOLEAN_YES
ENDMODULE. " STATUS_0100 OUTPUT
* MODULE USER_COMMAND_0100 INPUT *
* To perform user actions in the screen 100 *
MODULE user_command_0100 INPUT.
* To update the data in the ALV grid
PERFORM check_changed_data.
w_okcode = ok_code.
CLEAR ok_code.
CASE w_okcode.
WHEN c_fcode_back.
LEAVE TO SCREEN 0.
WHEN c_fcode_exit OR c_fcode_cancel.
LEAVE PROGRAM.
ENDCASE. " CASE W_OKCODE
ENDMODULE. " USER_COMMAND_0100
* FORM BUILD_FCAT *
* To build the field catalog giving managers comment in editable mode *
* -->PR_Tabname type lvc_tname *
* -->PR_Fieldname type lvc_fname *
* -->PR_Coltext type lvc_txtcol *
* -->PR_Colpos type lvc_colpos *
FORM build_fcat USING pr_tabname TYPE lvc_tname
pr_fieldname TYPE lvc_fname
pr_coltext TYPE lvc_txtcol
pr_colpos TYPE lvc_colpos.
CLEAR fs_fcat.
fs_fcat-tabname = pr_tabname.
fs_fcat-fieldname = pr_fieldname.
fs_fcat-coltext = pr_coltext.
fs_fcat-col_pos = pr_colpos.
IF fs_fcat-fieldname EQ 'MNGCOMMENT'.
fs_fcat-edit = c_boolean_yes.
fs_fcat-lowercase = c_boolean_yes.
fs_fcat-dd_outlen = 60.
ELSE.
fs_fcat-edit = space.
ENDIF. " IF FS_FCAT-FIELDNAME...
APPEND fs_fcat TO t_fcat.
ENDFORM. " BUILD_FCAT
* FORM BUILD_FCATD *
* To build fieldcatalog in the display mode *
* -->pr_Tabname type lvc_tname *
* -->pr_Fieldname type lvc_fname *
* -->pr_Coltext type lvc_txtcol *
* -->pr_Colpos type lvc_colpos *
FORM build_fcatd USING pr_tabname TYPE lvc_tname
pr_fieldname TYPE lvc_fname
pr_coltext TYPE lvc_txtcol
pr_colpos TYPE lvc_colpos .
CLEAR fs_fcat.
fs_fcat-tabname = pr_tabname.
fs_fcat-fieldname = pr_fieldname.
fs_fcat-coltext = pr_coltext.
fs_fcat-col_pos = pr_colpos.
fs_fcat-edit = space.
APPEND fs_fcat TO t_fcat.
ENDFORM. " BUILD_FCATD
* FORM ALV_DISPLAY *
* To display data in ALV *
* --> pr_table type standard table *
* --> pr_fcat type lvc_t_fcat *
FORM alv_display USING pr_table TYPE STANDARD TABLE
pr_fcat TYPE lvc_t_fcat .
* Local data declaration....
DATA: lt_exclude TYPE ui_functions.
* To exclude buttons on the ALV grid
PERFORM exclude_tb_functions CHANGING lt_exclude.
* To display ALV
CALL METHOD g_alv->set_table_for_first_display
EXPORTING
i_default = space
is_layout = g_fcatlayo
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = pr_table[]
it_fieldcatalog = pr_fcat[].
ENDFORM. " ALV_DISPLAY
* FORM EVENT_TOOLBAR *
* Setting toolbar in the alv grid *
* -->E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET *
FORM event_toolbar USING e_object
TYPE REF TO cl_alv_event_toolbar_set.
* Local declaration for the button.
DATA: ls_toolbar TYPE stb_button.
* To add Approve button
ls_toolbar-function = c_fcode_approve.
ls_toolbar-butn_type = c_zero.
ls_toolbar-text = text-001.
APPEND ls_toolbar TO e_object->mt_toolbar.
* To add Reject button
CLEAR ls_toolbar.
ls_toolbar-function = c_fcode_rej.
ls_toolbar-butn_type = c_zero.
ls_toolbar-text = text-013.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDFORM. " EVENT_TOOLBAR
* FORM EXCLUDE_TB_FUNCTIONS *
* To exclude buttons from ALV grid *
* <--> PR_EXCLUDE TYPE UI_FUNCTIONS *
FORM exclude_tb_functions CHANGING pr_exclude TYPE ui_functions.
* Local data declaration...
DATA ls_exclude TYPE ui_func.
* To remove the buttons on the ALV grid.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO pr_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
APPEND ls_exclude TO pr_exclude.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
* FORM EVENT_UCOMM *
* After Input in the ALV grid,if user select record and press *
* approve or reject then the record will get updated *
* --> PR_ucomm type sy-ucomm *
FORM event_ucomm USING pr_ucomm LIKE sy-ucomm.
CASE pr_ucomm.
* If e_ucomm contains 'APP' i.e.function code for Approve button
WHEN c_fcode_approve. " To approve selected record
PERFORM app_timesheet USING c_approve_status.
* If e_ucomm contains 'REJ' i.e. function code for Reject
WHEN c_fcode_rej. " To reject selected record
PERFORM app_timesheet USING c_rej_status.
ENDCASE. " CASE E_UCOMM
ENDFORM. " EVENT_UCOMM
* FORM APP_TIMESHEET *
* To get the selected records and update the records in database *
* --> pr_status type char01 *
FORM app_timesheet USING pr_status TYPE char01 .
* Local data declaration......
DATA:
lt_marked_rows TYPE lvc_t_roid, " Table to get rowid
l_fs_marked_row LIKE LINE OF lt_marked_rows.
" Field-string for lt_marked_rows
* To get all the selected rows in the table lt_marked_rows
CALL METHOD g_alv->get_selected_rows
IMPORTING
et_row_no = lt_marked_rows.
* Reading each row id and updating the database.
LOOP AT lt_marked_rows INTO l_fs_marked_row.
* Reading the table t_timesheet with rowid
READ TABLE t_timesheet INTO fs_timesheet INDEX
l_fs_marked_row-row_id.
* If record is there in the table.
IF sy-subrc EQ 0.
CLEAR fs_timesheet-appstatus.
GET PARAMETER ID 'ZEMPID' FIELD w_empid.
* Changing the appstatus.
fs_timesheet-appstatus = pr_status.
fs_timesheet-approvedby = w_empid.
* Updating the database table.
UPDATE zcl_timesheet FROM fs_timesheet.
IF sy-subrc EQ 0.
fs_temp-empid = fs_timesheet-empid.
fs_temp-workdate = fs_timesheet-workdate.
fs_temp-linenum = fs_timesheet-linenum.
append fs_temp to t_temp.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0
ENDLOOP. " LOOP AT LT_MARKED_ROWS...
perform delete_data .
PERFORM refresh_table USING pr_status.
ENDFORM. " APP_TIMESHEET
* FORM CHECK_CHANGED_DATA *
* To change the data *
* No parameters are passsed to this subroutine *
FORM check_changed_data .
* To change the data.
CALL METHOD g_alv->check_changed_data.
ENDFORM. " CHECK_CHANGED_DATA
* FORM REFFRESH_TABLE *
* To refresh output table and issue message according p_status *
* -->PR_STATUS TYPE CHAR01 *
FORM refresh_table USING pr_status TYPE char01.
* To refresh output table.
CALL METHOD g_alv->refresh_table_display.
* Depending upon pr_status message is given.
IF pr_status EQ c_approve_status.
MESSAGE s001.
ELSE.
MESSAGE s002.
ENDIF. " IF P_STATUS EQ C_APPROVE_STATUS
ENDFORM. " REFRESH_TABLE
* FORM SET_TITLEBAR *
* To set titlebar on the screen 100. *
* -->PR_STATUS TYPE CHAR01 *
FORM set_titlebar USING pr_status TYPE char01.
* If pr_status eq 'X'.
IF pr_status EQ c_boolean_yes.
SET TITLEBAR c_alv_scr WITH text-017.
ELSE.
SET TITLEBAR c_alv_scr WITH text-018.
ENDIF. " IF P_STATUS EQ C_BOOLEAN_YES
ENDFORM. " SET_TITLEBAR
* FORM USER_COMMAND *
* According to sy-ucomm the action is performed in the screen 100 *
* No parameters are passsed to this subroutine *
FORM user_command .
CASE sy-ucomm.
* If p_app is selected, submitted data will be displayed for approval
WHEN c_fcode_onli OR c_fcode_approve.
CLEAR sy-ucomm.
* To display the submitted records.
IF p_app EQ c_boolean_yes.
w_submit = c_boolean_yes.
* To get submitted records
PERFORM get_data.
ENDIF. " IF P_APP EQ C_BOOLEAN_YES
* To display all records according to selection.
IF p_disp EQ c_boolean_yes.
w_display = c_boolean_yes.
* To display
PERFORM display_all.
CLEAR w_display.
ENDIF. " IF P_DISP EQ C_BOOLEAN_YES
IF p_sdn EQ c_boolean_yes.
PERFORM GET_GRAPH.
ENDIF.
ENDCASE. " CASE SY-UCOMM
ENDFORM. " USER_COMMAND
* FORM DISPLAY_ALLRECORDS *
* To display all the records in the display mode *
* No parameters are passsed to this subroutine *
FORM display_allrecords .
CLEAR w_display.
PERFORM build_fcatd USING 'T_TIME' 'WORKDATE' text-002 '1'.
PERFORM build_fcatd USING 'T_TIME' 'EMPID' text-009 '2'.
PERFORM build_fcatd USING 'T_TIME' 'PROJECTID' text-003 '3'.
PERFORM build_fcatd USING 'T_TIME' 'PROJECTNAME' text-004 '4'.
PERFORM build_fcatd USING 'T_TIME' 'OBJECTID' text-005 '5'.
PERFORM build_fcatd USING 'T_TIME' 'OBJECTNAME' text-006 '6'.
PERFORM build_fcatd USING 'T_TIME' 'ACTIVITYID' text-007 '7'.
PERFORM build_fcatd USING 'T_TIME' 'ACTIVITYNAME' text-008 '8'.
PERFORM build_fcatd USING 'T_TIME' 'TIMEWORKED' text-010 '9'.
PERFORM build_fcatd USING 'T_TIME' 'DESCRIPTION' text-011 '10'.
PERFORM build_fcatd USING 'T_TIME' 'APPSTATUS' text-012 '11'.
PERFORM build_fcatd USING 'T_TIME' 'BILLSTATUS' text-016 '12'.
PERFORM build_fcatd USING 'T_TIME' 'SDNSTATUS' text-019 '13'.
PERFORM build_fcatd USING 'T_TIME' 'MNGCOMMENT' text-014 '14'.
PERFORM alv_display USING t_time t_fcat.
ENDFORM. " DISPLAY_ALLRECORDS
* FORM SUBMITTED_RECORDS *
* To display submitted records for the manager to approve *
* No parameters are passsed to this subroutine *
FORM submitted_records .
CLEAR w_submit.
* To create object for instance g_events
CREATE OBJECT g_events.
* If w_first equal to space
IF w_first IS INITIAL.
SET HANDLER g_events->toolbar
FOR g_alv.
w_first = c_boolean_yes.
ENDIF. " IF W_FIRST IS INITIAL..
SET HANDLER g_events->user_command
FOR g_alv.
g_fcatlayo-sel_mode = c_approve_status.
REFRESH t_fcat.
* to fill ur field cat table.
ENDFORM. " SUBMITTED_RECORDS
* FORM DELETE_DATA *
* This form is used to delete thedata from output table after updating *
* the database *
* No parameters are passsed to this subroutine *
form delete_data .
loop at t_temp into fs_temp.
loop at t_timesheet into fs_timesheet where
empid = fs_temp-empid
and workdate = fs_temp-workdate
and linenum = fs_temp-linenum.
delete t_timesheet index sy-tabix.
endloop. " LOOP AT T_TEMP INTO FS_TEMP
endloop . " LOOP AT T_TIMESHEET INTO FS_T..
endform. " DELETE_DATA
Hope it helps you.
Regards
Manjari. -
How to display rsa3 with ALV grid
Hello,
In some of tyhe systems i'm working with, RSA3 have a button to display the data in ALV grid. I checked and it's not because of the support package. Cab someone please advice how to add the ALV functionality.
Thanks,
Amir
Edited by: Amir Dror on Jan 13, 2009 12:41 PMHello,
we had the same question and problem.
SAP told us via OSS the following:
"... The ALV grid in RSA3 will be supported with the PI_BASIS 2006_1_700.
But you have PI_BASIS 2005_1_700
Furthermore this software component PI_BASIS is independent from the
BW releases so that you can upgrade the latest support packages of the
PI_BASIS 2006_1_700 in source system"
So if you have PI_BASIS 2005 you won't have the functionality of ALV grid in TC RSA3.
(remark: At the moment I can not confirm that ALV grid in RSA3 is available with PI_BASIS 2006_x_xxx. We plan to upgrade in a few month.)
Best regards -
How to get the alv grid report in another screen when double click on basic
Hi.
I have created an alv report using class cl_gui_alv_grid.I got another report in the same screen,when double clicked on basic list(using double_click event).I want to get this report in another screen.What i have to do?(In classical reports i worked with sy-lsind = 1 ,but how to do here?)
How to set color to the selected rows in the alv grid report?I worked with change_data_from_inside method of cl_gui_alv_grid.But it didn't work out..
With Regards,
Ramana.On double click event . you will have to call another screen say 9000.
now within screen 900 PBO.. you will have to prepare the fieldcatalog/layout.. and the table to be displayed there.
in PAI of screen 9000, you can return to the original ALV.
method double_click.
call screen 9000.
endmethod.
" now in PBO create a module display_alv2
module display_alv2.
'prepare the fieldcat/layout info for new alv
'add the data to the new ALV table
'instantiate the grid call.. etc
'call the ALV
endmodule
"in PAI
module exit.
case sy-ucomm.
when 'ENT1'.
leave to screen 0.
endcase.
endmodule
while preparing the field catalog you can mention the EMPHASIZE field, whish will give color to tht column
E.g
*--Service Order
ls_fieldcat-tabname = 'IT_FINAL_VALID'.
ls_fieldcat-fieldname = 'AUFNR'.
ls_fieldcat-scrtext_m = 'Service Order'.
ls_fieldcat-ref_table = 'AUFK'.
ls_fieldcat-ref_field = 'AUFNR'.
ls_fieldcat-col_pos = 1.
ls_fieldcat-outputlen = 12.
ls_fieldcat-emphasize = 'C400'. "This will add color to the cell
APPEND ls_fieldcat TO fcat_valid.
Hope this helps. -
ALV OO and refreshing the ALV grid
Hi,
i have some problems with my ALV 00 program.
On screen 1 i have to fill in a material number.
For that material i'm getting some data and show in screen 2 in a ALV grid.
Via BACK-button i'm getting back to screen 1 and can fill in another material number.
But the 2nd (and 3rd, etc) time i fill a material, the ALV grid data from material 1 is shown. Even if the internal table I_ALV where the data is, is changed.
What should i do ?
I have initialized the customer container and the grid, but that didn't solved the problem.
regards,
HansHi,
Try clearing and refreshing the alv grid data table in screen 2.
Check with this code. this code is working fine. If we go back and change the input, it is showing the output corresponding to the second input only.
Have you use this method?
<b> GR_ALVGRID->REFRESH_TABLE_DISPLAY</b>
TYPE-POOLS : SLIS.
* Tables *
TABLES:
VBRK,
VBRP.
* Parameters and select options OR SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
S_VBELN FOR VBRK-VBELN.
SELECTION-SCREEN END OF BLOCK B1.
* Internal Tables *
* work areas
DATA: BEGIN OF IT_VBRP OCCURS 0,
VBELN LIKE VBRK-VBELN,
POSNR LIKE VBRP-POSNR,
UEPOS LIKE VBRP-UEPOS,
FKIMG LIKE VBRP-FKIMG,
NETWR LIKE VBRP-NETWR,
MEINS LIKE VBRP-MEINS.
DATA : END OF IT_VBRP.
* Variables *
DATA : GR_ALVGRID TYPE REF TO CL_GUI_ALV_GRID,
GC_CUSTOM_CONTROL_NAME TYPE SCRFNAME VALUE 'CC_ALV',
GR_CCONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
GT_FIELDCAT TYPE LVC_T_FCAT,
GS_LAYOUT TYPE LVC_S_LAYO,
V_FLAG VALUE 'X'.
* Start of Program *
* INITIALIZATION. *
INITIALIZATION.
S_VBELN-LOW = 1.
S_VBELN-HIGH = 1000000000.
S_VBELN-OPTION = 'EQ'.
S_VBELN-SIGN = 'I'.
APPEND S_VBELN.
* SELECTION-SCREEN *
AT SELECTION-SCREEN.
PERFORM VALIDATION.
* START-OF-SELECTION *
START-OF-SELECTION.
PERFORM GET_DATA.
CALL SCREEN 0100.
* END-OF-SELECTION *
END-OF-SELECTION.
* TOP-OF-PAGE *
TOP-OF-PAGE.
* END-OF-PAGE *
END-OF-PAGE.
* AT USER-COMMAND *
*& Form VALIDATION
* text
* --> p1 text
* <-- p2 text
FORM VALIDATION .
SELECT SINGLE VBELN
FROM VBRK
INTO VBRK-VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'no billing documents found'.
ENDIF.
ENDFORM. " VALIDATION
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM GET_DATA .
SELECT VBELN
POSNR
UEPOS
FKIMG
NETWR
MEINS
FROM VBRP
INTO TABLE IT_VBRP
WHERE VBELN IN S_VBELN.
ENDFORM. " GET_DATA
*& Module DISPLAY_ALV OUTPUT
* text
MODULE DISPLAY_ALV OUTPUT.
IF V_FLAG = 'X'.
PERFORM DISPLAY_ALV.
PERFORM PREPARE_FIELD_CATALOG CHANGING GT_FIELDCAT.
PERFORM PREPARE_LAYOUT CHANGING GS_LAYOUT.
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME = 'VBRP'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBRP[]
IT_FIELDCATALOG = GT_FIELDCAT
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ELSE.
<b>CALL METHOD GR_ALVGRID->REFRESH_TABLE_DISPLAY
* 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.</b>
ENDIF.
CLEAR V_FLAG.
ENDIF.
ENDMODULE. " DISPLAY_ALV OUTPUT
*& Form DISPLAY_ALV
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_ALV .
IF GR_ALVGRID IS INITIAL.
CREATE OBJECT GR_ALVGRID
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
I_PARENT = GR_CCONTAINER
* 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.
ENDIF.
ENDFORM. " DISPLAY_ALV
*& Form PREPARE_FIELD_CATALOG
* text
* <--P_GT_FIELDCAT text
FORM PREPARE_FIELD_CATALOG CHANGING P_GT_FIELDCAT TYPE LVC_T_FCAT.
DATA : LS_FCAT TYPE LVC_S_FCAT,
L_POS TYPE I.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'VBELN'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Billing Document'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'POSNR'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Billing Item'.
LS_FCAT-OUTPUTLEN = '6'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'UEPOS'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Higher Level Item'.
LS_FCAT-OUTPUTLEN = '6'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'FKIMG'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Invoice Quantity'.
LS_FCAT-OUTPUTLEN = '13'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'NETWR'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Net Value'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
LS_FCAT-FIELDNAME = 'MEINS'.
LS_FCAT-TABNAME = 'IT_VBRP'.
LS_FCAT-COL_POS = L_POS.
LS_FCAT-SCRTEXT_M = 'Unit of Measure'.
LS_FCAT-OUTPUTLEN = '3'.
APPEND LS_FCAT TO P_GT_FIELDCAT.
CLEAR LS_FCAT.
L_POS = L_POS + 1.
ENDFORM. " PREPARE_FIELD_CATALOG
*& 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 = 'INVOICE DETAILS'.
P_GS_LAYOUT-SMALLTITLE = 'X'.
P_GS_LAYOUT-EDIT = 'X'.
ENDFORM. " PREPARE_LAYOUT
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'CANCEL'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
CALL TRANSACTION 'SE38'.
WHEN 'CHANGE'.
IF GR_ALVGRID->IS_READY_FOR_INPUT( ) = 0.
CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ELSE.
CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 0.
ENDIF.
ENDCASE.
Regards,
Aswin -
Problem in displaying data in alv grid.
Hi Experts,
I am using the class CL_GUI_ALV_GRID for displaying my data in the ALV Grid.
But I have a requirement
If there are more than one record with the same values in some fields I have to display the values in the first record itself . for other records I have to display the record with the fields having different values of the previous record.
And another requirement is When the user use the scroll bar regarding the same datas, the first record displayed will contain the datas used.
How can we achieve this functionality?
Regards
KasinathHi,
while preparing internal table to be passed to ALV, you have to implement the logic for these scenarios.
Regards,
Raghavendra -
hi Experts!!
i am working in the editing of the ALV grids using objects..when we edit the alv i want the same to be update to the DB tables..i tryied most of the methods like GET_CEL_VALUES(this i m getting only cursor value)/ get_changed valuse and also demo perog BCALVEDIT_04 but its not working..i am not understanding how to code. plz suggest me on this that is there any good procedure which i can follwo,,plz replyem...Hi Mahesh,
The major difference between editable and non-editable ALV Grid is "registering edit event".
In your program you might not have registered your ALV Grid as editable. You can try using below code for the same.
Registering edit event
call method w_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified
exceptions
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.
Note: w_grid is ref to cl_gui_alv_grid.
Best Regards
Ali S
Maybe you are looking for
-
Forbid sending window to front after clicking on it.
I have application with main window in AIR which is maximized on whole screen and a few "small" windows which are created from Window component (Window was the only option 'cause times to time I need move it out of main application) and live above ma
-
Default home page links do not work
Before i updated to 34.0.5, I had images on a new tab page and on the default home page, i could click on the quick links. Nothing on the default home page works! I have no images on a new tab page! What happened?
-
Dear experts, We are facing an issue . FI configured in such a way that system is asking Business area during GR. But We are finding no such field in GR to enter. We did not find "Business Area " in field selection configuration also. Can anybody sug
-
Spotlight keeps indexing in snow leopard
Spotlight keeps indexing for the last 2 weeks. I tsometimes has 45 mins till finishing, but when I check later, it still indexing without a estimate of time when it will finish. I have selected my ext. HD not to be index, but it still states it inde
-
So I'm following the advice from Apple to let my iPad run to 0% at least once a month, then charge it to 100%. This supposedly yields a more accurate percentage of charge displayed during regularly usage. Question now is, how to let it go to 0%? For