Field symbol with top of page in reuse_alv_list
When using the top_of_page in REUSE_ALV_LIST_DISPLAY
I had in the old programm reference to values in the outtab for the header in the new programm I use dynamic tables and I wonder how to add those values in a header.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = h_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
* i_structure_name = 'ZDOORBEL_ALV'
* IT_EVENTS = TEVENTS
is_layout = slayout
it_fieldcat = it_fieldcat[]
it_sort = tsort[]
i_save = a_save
is_variant = variant
TABLES
t_outtab = <ta_output>
in my top_of_page I try to read the current row of <ta_output> but I have no clue on how to do it. I gives the error that there is no workarea assigned to <ta_output>
anybody knows how to read the current line of <ta_output> in top_of_page ?
kind regards
arthur de smidt
I have
* fieldsymbols voor dynamische ALV tabel
FIELD-SYMBOLS: <ta_output> TYPE table ,
<ta_color> TYPE table,
<l_line> TYPE ANY,
<wa_output> type any,
<wa> TYPE ANY,
<l_field> TYPE ANY,
<fs> TYPE ty_pernrs.
FORM top_of_page.
CREATE DATA new_line LIKE LINE OF <ta_output>.
ASSIGN new_line->* TO <wa_output>.
read table <ta_output> assigning <wa_output> index sy-tabix.
if ra_pernr = 'X'.
if <wa_output>-week = space or <wa_output>-pernr = '00000000'.
but still it says that the
The data object "<WA_OUTPUT>" has no structure and therefore no
component called "WEEK" . .
Edited by: A. de Smidt on Jun 26, 2008 11:07 AM
Similar Messages
-
How to pass field in Alv Top-of-page
Edited by: Deepak Mathrani on Aug 12, 2008 12:40 PM
<THREAD LOCKED. Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] to discover why>
Edited by: Mike Pokraka on Aug 12, 2008 2:58 PMHi
sample program
*& Report ZNNR_ALVSAMPLE
REPORT znnr_alvsample NO STANDARD PAGE HEADING.
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
fieldcatalog-EDIT = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'(001) "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
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.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform. -
How i can show the selection screen input field in the top of page in alv
hi ,
how i can show the selection screen input field in the top of page in alv grid output.
tell me the processHi,
excample from my program:
FORM topof_page.
DATA: l_it_header TYPE TABLE OF slis_listheader WITH HEADER LINE,
l_info LIKE l_it_header-info.
DATA: l_it_textpool TYPE TABLE OF textpool WITH HEADER LINE.
DATA: l_key LIKE l_it_textpool-key.
READ TEXTPOOL c_repid INTO l_it_textpool LANGUAGE sy-langu.
DEFINE m_selinfo.
if not &1 is initial.
clear l_it_header.
l_it_header-typ = 'S'.
l_key = '&1'.
translate l_key to upper case.
read table l_it_textpool with key key = l_key.
if sy-subrc = 0.
shift l_it_textpool-entry left deleting leading space.
l_it_header-key = l_it_textpool-entry .
endif.
loop at &1.
case &1-option.
when 'EQ'
or 'BT'
or 'CP'.
write &1-low to l_it_header-info.
when others.
write &1-low to l_it_header-info.
concatenate &1-option
l_it_header-info
into l_it_header-info
separated by space.
endcase.
if not &1-high is initial.
write &1-high to l_info left-justified.
concatenate l_it_header-info
l_info
into l_it_header-info
separated by space.
endif.
if &1-sign = 'E'.
concatenate ']'
l_it_header-info
into l_it_header-info.
endif.
append l_it_header.
clear: l_it_header-key,
l_it_header-info.
endloop.
endif.
END-OF-DEFINITION.
m_selinfo: s_trmdat,
s_trmext,
s_trmint,
s_fkdat,
s_delno,
s_vbeln,
s_deact,
s_kdmat.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = l_it_header[].
ENDFORM.
I hope, this will help you.
Regards
Nicole -
Hi,
Does any one have code or pointers for creating a ALV with top of page using OOPS.
I need to create a top of page with variables like :
Report Name : ZABC
User Name : Z234ASD
Date : System Date
Time : System Time
Transaction : ZXYZ
Thanks
Khan.The code i used to implement top of page for OO ALV is as below but when you proceed to print out the report, it doesn't print out the header as the list output doesn't show the header.
codeREPORT ZTEST1234_ALV_TOP MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
"The Below Definitions Must.....
DATA:
Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
ENDMETHOD. "handle_double_click
METHOD TOP_OF_PAGE. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
START-OF_SELECTION
START-OF-SELECTION.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
"this is for top of page
Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
Split the custom_container to two containers and move the reference
to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
"you can set the height of it
Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
Build fieldcat and set editable for date and reason code
edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
Optionally restrict generic functions to 'change only'.
(The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
"do these..{
Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
text
-->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
Only allow to change data not to create new entries (exclude
generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form SET_DRDN_TABLE
text
FORM SET_DRDN_TABLE.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT ITAB .
First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ITAB-POSNR.
LS_DRAL-INT_VALUE = ITAB-POSNR.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for Reason Code
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM. " set_drdn_table
*& Form EVENT_TOP_OF_PAGE
text
-->DG_DYNDOC_ID text
FORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
"this is more clear.....check it
"first add text, then pass it to comentry write fm
DATA : DL_TEXT(255) TYPE C. "Text
Populating header to top-of-page
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = 'Test Report'
SAP_STYLE = CL_DD_AREA=>HEADING.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
Move program ID
CONCATENATE 'Program Name :' SY-REPID
INTO DL_TEXT SEPARATED BY SPACE.
Add Program Name to Document
PERFORM ADD_TEXT USING DL_TEXT.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
Move User ID
CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
Add User ID to Document
PERFORM ADD_TEXT USING DL_TEXT.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
Move Client
CONCATENATE 'Client :' SY-MANDT INTO DL_TEXT SEPARATED BY SPACE.
Add Client to Document
PERFORM ADD_TEXT USING DL_TEXT.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
Move date
WRITE SY-DATUM TO DL_TEXT.
CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
Add Date to Document
PERFORM ADD_TEXT USING DL_TEXT.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
Move time
WRITE SY-UZEIT TO DL_TEXT.
CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
Add Time to Document
PERFORM ADD_TEXT USING DL_TEXT.
Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
Populating data to html control
PERFORM HTML.
ENDFORM. " EVENT_TOP_OF_PAGE
*& Form ADD_TEXT
To add Text
FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
Adding text
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = P_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING.
ENDFORM. " ADD_TEXT
*& Form HTML
text
FORM HTML.
DATA : DL_LENGTH TYPE I, " Length
DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
Creating html control
IF DG_HTML_CNTRL IS INITIAL.
CREATE OBJECT DG_HTML_CNTRL
EXPORTING
PARENT = DG_PARENT_HTML.
ENDIF.
Reuse_alv_grid_commentary_set
CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
EXPORTING
DOCUMENT = DG_DYNDOC_ID
BOTTOM = SPACE
IMPORTING
LENGTH = DL_LENGTH.
Get TOP->HTML_TABLE ready
CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
Set wallpaper
CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
EXPORTING
PICTURE_ID = DL_BACKGROUND_ID.
Connect TOP document to HTML-Control
DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
Display TOP document
CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
EXPORTING
REUSE_CONTROL = 'X'
PARENT = DG_PARENT_HTML
EXCEPTIONS
HTML_DISPLAY_ERROR = 1.
IF SY-SUBRC NE 0.
MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
ENDIF.
ENDFORM. " HTML
[/code] -
How To Print Field Value in TOP-OF-PAGE During Line Selection.
How To Print Field Value in TOP-OF-PAGE During Line Selection when double click on field.
(If my memory serves me well (not used for long time ago)
Assign values to system fields sy-tvar0 - sy-tvar9, they will replace the placeholders "&0" through "&9" in the list headers and column headers.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE: / 'Interactive Report &3'.
WRITE record-vbeln TO sy-tvar3.
Regards,
Raymond -
Read Data from the dynamic Field Symbol with key ?
Dear All,
I've 2 dynamic internal tables in the form of field symbols.
Now,I want to loop the item field symbol, read the header field symbol content and then move the corresponding into a final field symbol.
How to read the field symbol with key ?
When I'm trying to give the key clause in the paranthesis it's giving a syntax error.
Any clues ?
FYI .....
* Get the Dynamic Field and Value for the Date/Year and convert it into Year value
LOOP AT <fs_t_son> ASSIGNING <wa_son>.
ASSIGN COMPONENT gwa_znrows_def-fieldname OF STRUCTURE <wa_son> TO <fs_year>.
IF sy-subrc = 0.
CLEAR gv_string.
MOVE <fs_year> TO gv_string.
CLEAR gv_year.
gv_year = gv_string.
<fs_year> = gv_year.
ELSE.
* When the Date/year Field is not in the Table then -->
* Get the Dynamic Field and Value
ASSIGN COMPONENT gwa_znrows_def-kfldname OF STRUCTURE <wa_rson> TO <fs_value>.
* Populate field for Dynamic Where condition
CLEAR gv_value.
CONCATENATE '''' <fs_value> '''' INTO gv_value.
CONCATENATE gwa_znrows_def-kfldname '=' gv_value INTO gt_where SEPARATED BY space.
APPEND gt_where.
CLEAR gt_where.
READ TABLE <fs_t_rson> ASSIGNING <wa_rson> ( gt_where ). "Key clause
ENDIF. " if sy-subrc = 0. "Assign
ENDLOOP.
Thanks & regards,
Deepu.KTYPES: BEGIN OF line,
col1 TYPE c,
col2 TYPE c,
END OF line.
DATA: wa TYPE line,
itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,
key(4) TYPE c VALUE 'COL1'.
FIELD-SYMBOLS <fs> TYPE ANY TABLE.
ASSIGN itab TO <fs>.
READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.
The internal table itab is assigned to the generic field symbol <fs>, after which it is possible to address the table key of the field symbol dynamically. However, the static address
READ TABLE <fs> WITH TABLE KEY col1 = 'X' INTO wa.
is not possible syntactically, since the field symbol does not adopt the key of table itab until runtime. In the program, the type specification ANY TABLE only indicates that <fs> is a table. If the type had been ANY (or no type had been specified at all), even the specific internal table statement READ TABLE <fs> would not have been possible from a syntax point of view. -
Field Descriptions without TOP OF PAGE
Hi Experts,
I have one Z report and this was written somebody long back.
This report was normal standard report i.e just writing the table values to screen using WRITE statement.
Eventhogh there is no TOP OF PAGE event in the report, field names were displaying in the screen output with highlighted color.
As soon as WITE statement calling, program is displaying fieldnames automatically? how it possible?
Now, I modified my program by adding another field values to the screen output.
The field which I added it's not showing field name.
How can I display my field description to that output. (without adding TOP OF PAGE)
As I told you report doesn't have TOP OF PAGE event. Please help me.
Thanks
RaghuRaghu,
I'm guessing that your report is organized in a tabular form and by field description you mean column headings. There are two ways to display column headings 1) by explicitely writing the WRITE statements to output to the column headings, 2) by maintaining the standard list & column headings. (in ABAP editor follow menu path GOTO>Text Elements>List Headings.
You can disable the display of standard headings by using addition in NO STANDARD PAGE HEADING as below.
REPORT YTEST NO STANDARD PAGE HEADING
LINE-SIZE 120
LINE-COUNT 65
MESSAGE ZMSG.
Regards,
Gajendra -
Problem with top of page in alv
Hi
i gotta probelm with my alv report in this , in the first level i am displaying the purchase order header details,in the secod level i am displaying the purchase order item detials..
I am getting the top of page contents properly in the header level. but when i double click it for item level i am getting the same top of page header instead of displaying the item level what i have mentioned..
Can any one suggest me some ways to get the item level top of page contents??
Here is my code.
REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
MESSAGE-ID ZZ_9838 .
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: X_I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
X_WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER,
X_IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'Purchase Order Header Details'.
HLINE-TYP = 'H'.
APPEND HLINE TO IT_LISTHEADER.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
IT_FIELDCAT = I_FIELDCAT[]
I_SAVE = 'A'
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING X_IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
X_WA_FIELDCAT-TABNAME = 'IT_EKPO'.
X_WA_FIELDCAT-FIELDNAME = 'EBELN'.
X_WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND X_WA_FIELDCAT TO X_I_FIELDCAT.
CLEAR X_WA_FIELDCAT.
X_WA_FIELDCAT-TABNAME = 'IT_EKPO'.
X_WA_FIELDCAT-FIELDNAME = 'EBELP'.
X_WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND X_WA_FIELDCAT TO X_I_FIELDCAT.
CLEAR X_WA_FIELDCAT.
X_WA_FIELDCAT-TABNAME = 'I_EKPO'.
X_WA_FIELDCAT-FIELDNAME = 'MATNR'.
X_WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND X_WA_FIELDCAT TO X_I_FIELDCAT.
CLEAR X_WA_FIELDCAT.
X_WA_FIELDCAT-TABNAME = 'I_EKPO'.
X_WA_FIELDCAT-FIELDNAME = 'MENGE'.
X_WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND X_WA_FIELDCAT TO X_I_FIELDCAT.
CLEAR X_WA_FIELDCAT.
X_WA_FIELDCAT-TABNAME = 'I_EKPO'.
X_WA_FIELDCAT-FIELDNAME = 'MEINS'.
X_WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND X_WA_FIELDCAT TO X_I_FIELDCAT.
CLEAR X_WA_FIELDCAT.
X_WA_FIELDCAT-TABNAME = 'I_EKPO'.
X_WA_FIELDCAT-FIELDNAME = 'NETPR'.
X_WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND X_WA_FIELDCAT TO X_I_FIELDCAT.
CLEAR X_WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "event_call_ekpo
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE1'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = X_IT_LISTHEADER.
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
*retreiving values from the database table ekko
FORM DATA_RETRIEVAL_EKPO.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
ENDFORM.
FORM BUILD_LISTHEADER_EKPO USING X_IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: HLINE1 TYPE SLIS_LISTHEADER.
HLINE1-TYP = 'H'.
HLINE1-INFO = 'Purchase Order Item details'.
APPEND HLINE1 TO X_IT_LISTHEADER.
ENDFORM.
FORM DISPLAY_ALV_EKPO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKPO
IT_FIELDCAT = X_I_FIELDCAT[]
I_SAVE = 'A'
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKPO
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.
ENDFORM.When you are calling the FM 'REUSE_AVL_GRID_DISPLAY', to display item details, you are passing the form name for 'i_callback_top_of_page' as 'TOP_OF_PAGE' which is for header details. For item details you have created another form, 'F_TOP_OF_PAGE1' pass it to 'i_callback_top_of_page' instead of 'TOP_OF_PAGE' .
-
Hi All,
In my Report i am printing both interactive and alv grid display in same report.means i have one check box it is then report print as a alv format otherwise classical format.
But here i have small problem i am trying print in alv format its automatically trigger the top of page event thatsway a blank screen is generated so please tell how to skip the Top of page event.
Regards,
VenkateshEND-OF-SELECTION.
SORT tab1 BY ebeln ebelp.
DESCRIBE TABLE tab1 LINES tabln.
IF tabln = 0.
MESSAGE ID 'ME' TYPE 'I' NUMBER '260'.
EXIT.
ENDIF.
SORT tab1 BY sortkey knttp ebeln ebelp.
if P_ALV = 'X'.
LOOP AT tab1.
IF tab1-knttp = '1'.
gs_final-str = text-k01.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '2'.
gs_final-str = text-k02.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '3'.
gs_final-str = text-k03.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '4'.
gs_final-str = text-k04.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '5'.
gs_final-str = text-k05.
gs_final-kont1 = tab1-kont1.
gs_final-kont2 = tab1-kont2.
ELSEIF tab1-knttp = '6'.
gs_final-str = text-k04.
gs_final-kont1 = tab1-kont1.
ELSEIF tab1-knttp IS INITIAL.
gs_final-str = 'Stock without Account Assignment'.
ENDIF.
gs_final-ebeln = tab1-ebeln.
gs_final-lifnr = tab1-lifnr.
gs_final-name1 = tab1-name1.
gs_final-aedat = tab1-aedat.
gs_final-udate = tab1-udate.
gs_final-inco1 = tab1-inco1.
gs_final-inco2 = tab1-inco2.
gs_final-ebelp = tab1-ebelp.
gs_final-matnr = tab1-matnr.
gs_final-txz01 = tab1-txz01.
gs_final-paedt = tab1-paedt.
gs_final-eindt = tab1-eindt.
gs_final-eindt1 = tab1-eindt1.
gs_final-labnr = tab1-labnr. "NWC-29042005
gs_final-budat = tab1-budat.
gs_final-menge = tab1-menge.
gs_final-wemng = tab1-wemng.
gs_final-meins = tab1-meins.
gs_final-vbeln = tab1-vbeln.
gs_final-tddat = tab1-tddat.
IF NOT tab1-vbeln IS INITIAL.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/3 wa_tab1-vbeln.
READ TABLE lines INDEX 1.
MOVE lines-tdline TO l_text.
CLEAR lines.
READ TABLE lines INDEX 2.
CONCATENATE l_text lines-tdline INTO l_text SEPARATED BY ' '.
FORMAT COLOR 5 INTENSIFIED OFF.
gs_final-l_text = l_text.
SKIP. "NWC-16092003
ENDAT.
APPEND gs_final to gt_final.
ENDLOOP.
PERFORM maintain_fieldcatlog.
PERFORM Display_data.
ELSE.
LOOP AT tab1.
MOVE tab1 TO wa_tab1.
AT NEW kont1.
RESERVE 5 LINES.
FORMAT COLOR 3 INTENSIFIED.
IF tab1-knttp = '1'.
WRITE:/(20) text-k01, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '2'.
WRITE:/(20) text-k02, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '3'.
WRITE:/(20) text-k03, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '4'.
WRITE:/(20) text-k04, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '5'.
WRITE:/(20) text-k05, 20 ': ', 22(30) tab1-kont1 NO-ZERO,
60(74) tab1-kont2.
ELSEIF tab1-knttp = '6'.
WRITE:/(20) text-k04, 20 ': ', 22(30) wa_tab1-kont1 NO-ZERO,
60 text-k02, 75 ': ', 77(57) wa_tab1-kont2 NO-ZERO.
ELSEIF tab1-knttp IS INITIAL.
WRITE:/ 'Stock without Account Assignment'.
ENDIF.
WRITE 170 ' '.
FORMAT COLOR INTENSIFIED OFF.
ENDAT.
AT NEW ebeln.
RESERVE 4 LINES.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/ wa_tab1-ebeln,
11 ' ',
13 wa_tab1-lifnr,
23 wa_tab1-name1,
60 wa_tab1-aedat NO-ZERO,
73 wa_tab1-udate NO-ZERO,
86 wa_tab1-inco1,
91(37) wa_tab1-inco2,
170 ' '.
ENDAT.
AT NEW ebelp.
RESERVE 3 LINES.
FORMAT COLOR 2 INTENSIFIED OFF.
WRITE:/2 wa_tab1-ebelp,
9 wa_tab1-matnr,
30(40) wa_tab1-txz01,
73(10) wa_tab1-paedt,
84(10) wa_tab1-eindt,
95(10) wa_tab1-eindt1 NO-ZERO,
106(15) wa_tab1-labnr, "NWC-29042005
122(10) wa_tab1-budat NO-ZERO,
133(16) wa_tab1-menge NO-ZERO,
150(16) wa_tab1-wemng NO-ZERO,
167(3) wa_tab1-meins,
170 ' '.
ENDAT.
HIDE: tab1-ebeln, tab1-ebelp.
I
READ TABLE lines INDEX 1.
MOVE lines-tdline TO l_text.
CLEAR lines.
READ TABLE lines INDEX 2.
CONCATENATE l_text lines-tdline INTO l_text SEPARATED BY ' '.
FORMAT COLOR 5 INTENSIFIED OFF.
WRITE: /3(132) l_text,
170 ' '.
SKIP. "NWC-16092003
ENDAT.
ENDLOOP.
ENDIF.
AT LINE-SELECTION.
CHECK NOT tab1-ebeln IS INITIAL.
SET PARAMETER ID 'BES' FIELD tab1-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
CLEAR tab1.
TOP-OF-PAGE.
if P_ALV ne 'X'.
IF sy-pagno = 1.
DETAIL.
WRITE: /2 text-a01.
RESERVE 1 LINES.
SUMMARY.
IF lifnr IS INITIAL.
WRITE: /4 text-a02, 26 'All'.
ELSE.
LOOP AT lifnr WHERE sign = 'I'.
IF lifnr-option = 'EQ'.
WRITE : /4 text-a02, 26 lifnr-low.
ELSE.
WRITE: /4 text-a02, 26 'From', 32 lifnr-low,
44 'to', 48 lifnr-high.
ENDIF.
ENDLOOP.
ENDIF.
IF matnr IS INITIAL.
WRITE: /4 text-a14, 26 'All'.
ELSE.
LOOP AT matnr WHERE sign = 'I'.
IF matnr-option = 'EQ'.
WRITE : /4 text-a14, 26 matnr-low.
ELSE.
WRITE: /4 text-a14, 26 'From', 32 matnr-low,
44 'to', 48 matnr-high.
ENDIF.
ENDLOOP.
ENDIF.
IF ebeln IS INITIAL.
WRITE: /4 text-a03, 26 'All'.
ELSE.
LOOP AT ebeln WHERE sign = 'I'.
IF ebeln-option = 'EQ'.
WRITE : /4 text-a03, 26 ebeln-low.
ELSE.
WRITE: /4 text-a03, 26 'From', 32 ebeln-low,
44 'to', 48 ebeln-high.
ENDIF.
ENDLOOP.
ENDIF.
IF aedat IS INITIAL.
WRITE: /4 text-a04, 26 'All'.
ELSE.
LOOP AT aedat WHERE sign = 'I'.
IF aedat-option = 'EQ'.
WRITE : /4 text-a04, 26 aedat-low.
ELSE.
WRITE: /4 text-a04, 26 'From', 32 aedat-low,
44 'to', 48 aedat-high.
ENDIF.
ENDLOOP.
ENDIF.
IF eindt IS INITIAL.
WRITE: /4 text-a13, 26 'All'.
ELSE.
LOOP AT eindt WHERE sign = 'I'.
IF eindt-option = 'EQ'.
WRITE : /4 text-a13, 26 eindt-low.
ELSE.
WRITE: /4 text-a13, 26 'From', 32 eindt-low,
44 'to', 48 eindt-high.
ENDIF.
ENDLOOP.
ENDIF.
IF bednr IS INITIAL.
WRITE: /4 text-a15, 26 'All'.
ELSE.
LOOP AT bednr WHERE sign = 'I'.
IF bednr-option = 'EQ'.
WRITE : /4 text-a15, 26 bednr-low.
ELSE.
WRITE: /4 text-a15, 26 'From', 32 bednr-low,
44 'to', 48 bednr-high.
ENDIF.
ENDLOOP.
ENDIF.
linno = sy-linno + 1.
BACK.
IF ekorg IS INITIAL.
WRITE: /70 text-a11, 92 'All'.
ELSE.
LOOP AT ekorg WHERE sign = 'I'.
IF ekorg-option = 'EQ'.
WRITE : /70 text-a11, 92 ekorg-low.
ELSE.
WRITE: /70 text-a11, 92 'From', 98 ekorg-low,
104 'to', 108 ekorg-high.
ENDIF.
ENDLOOP.
ENDIF.
IF ekgrp IS INITIAL.
WRITE: /70 text-a12, 92 'All'.
ELSE.
LOOP AT ekgrp WHERE sign = 'I'.
IF ekgrp-option = 'EQ'.
WRITE : /70 text-a12, 92 ekgrp-low.
ELSE.
WRITE: /70 text-a12, 92 'From', 98 ekgrp-low,
104 'to', 108 ekgrp-high.
ENDIF.
ENDLOOP.
ENDIF.
IF werks IS INITIAL.
WRITE: /70 text-a05, 92 'All'.
ELSE.
LOOP AT werks WHERE sign = 'I'.
IF werks-option = 'EQ'.
WRITE : /70 text-a05, 92 werks-low.
ELSE.
WRITE: /70 text-a05, 92 'From', 98 werks-low,
104 'to', 108 werks-high.
ENDIF.
ENDLOOP.
ENDIF.
IF pspid IS INITIAL.
WRITE: /70 text-a06, 92 'All'.
ELSE.
LOOP AT pspid WHERE sign = 'I'.
WRITE:/70 text-a06, 92 pspid-low.
ENDLOOP.
ENDIF.
IF pspnr1 IS INITIAL.
WRITE: /70 text-a07, 92 'All'.
ELSE.
LOOP AT pspnr1 WHERE sign = 'I'.
WRITE:/70 text-a07, 92 pspnr1-low.
ENDLOOP.
ENDIF.
IF elikz EQ 'X'.
WRITE: /70 text-a08, 92 'Open PO only'.
ELSEIF elikz IS INITIAL.
WRITE: /70 text-a08, 92 'All PO'.
ENDIF.
IF stock EQ 'X'.
WRITE: ', Common Stock Items'.
ELSEIF pspnr IS INITIAL.
WRITE: ', All Stock'.
ENDIF.
IF sy-linno >= linno.
linno = sy-linno + 1.
ENDIF.
SKIP TO LINE linno.
ULINE.
ENDIF.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/ 'PO',
12 'Vendor no.',
25 'Company',
60 'PO Crt dt',
73 'Approved dt',
86 'Incoterm',
170 ' '.
FORMAT COLOR 2 INTENSIFIED OFF.
WRITE:/2 'Item',
9 'Material',
30 'Description',
73 'Chged date',
84 'Delv date',
95 'OA date',
106 'OA Number', "NWC-29042005
122 'GR date',
138 'Order Qty',
158 'GR Qty',
167 'UoM',
170 ' '.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/2 'Ship notf #',
15 'ETD.',
26 'ETA',
44 'Shipped Qty',
57 'UoM',
170 ' '.
FORMAT COLOR 5 INTENSIFIED OFF.
WRITE:/2 'Remarks',
170 ' '.
ULINE.
ENDIF.
form MAINTAIN_FIELDCATLOG .
REFRESH gt_fieldcat.
CLEAR gs_fieldcat.
PERFORM fill_fieldcatlog USING:
'01' '01' 'STR' 'GT_FINAL' 'Account Assignment',
'01' '02' 'KONT1' 'GT_FINAL' 'Kont1',
'01' '03' 'KONT2' 'GT_FINAL' 'Kont2',
'01' '04' 'EBELN' 'GT_FINAL' 'PO',
'01' '05' 'LIFNR' 'GT_FINAL' 'Vendor no',
'01' '06' 'NAME1' 'GT_FINAL' 'Company',
'01' '07' 'AEDAT' 'GT_FINAL' 'PO Crt dt',
'01' '08' 'UDATE' 'GT_FINAL' 'Approved dt' ,
'01' '09' 'INCO1' 'GT_FINAL' 'Incoterm Code',
'01' '10' 'INCO2' 'GT_FINAL' 'Incoterm Text',
'01' '11' 'EBELP' 'GT_FINAL' 'Item',
'01' '12' 'MATNR' 'GT_FINAL' 'Material',
'01' '13' 'TXZ01' 'GT_FINAL' 'Description',
'01' '14' 'PAEDT' 'GT_FINAL' 'Chged date',
'01' '15' 'EINDT' 'GT_FINAL' 'Delv date',
'01' '16' 'EINDT1' 'GT_FINAL' 'OA date',
'01' '17' 'LABNR' 'GT_FINAL' 'OA Number',
'01' '18' 'BUDAT' 'GT_FINAL' 'GR date',
'01' '19' 'MENGE' 'GT_FINAL' 'Order Qty',
'01' '20' 'WEMNG' 'GT_FINAL' 'GR Qty',
'01' '21' 'MEINS' 'GT_FINAL' 'UoM',
'01' '22' 'VBELN' 'GT_FINAL' 'Ship notf #',
'01' '23' 'TDDAT' 'GT_FINAL' 'ETD',
'01' '24' 'LFDAT' 'GT_FINAL' 'ETA',
'01' '25' 'LFIMG' 'GT_FINAL' 'Shipped Qty',
'01' '26' 'VRKME' 'GT_FINAL' 'UoM',
'01' '27' 'L_TEXT' 'GT_FINAL' 'Remarks'.
endform. " MAINTAIN_FIELDCATLOG
form FILL_FIELDCATLOG using lv_rowpos TYPE sycurow
lv_colpos TYPE sycucol
lv_fldnam TYPE fieldname
lv_tabnam TYPE tabname
lv_seltext TYPE dd03p-scrtext_l.
gs_fieldcat-row_pos = lv_rowpos.
gs_fieldcat-col_pos = lv_colpos.
gs_fieldcat-fieldname = lv_fldnam.
gs_fieldcat-tabname = lv_tabnam.
gs_fieldcat-seltext_l = lv_seltext.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
endform. " FILL_FIELDCATLOG
form DISPLAY_DATA .
DATA : lv_repid TYPE syrepid.
lv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
it_fieldcat = gt_fieldcat
TABLES
t_outtab = gt_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0. "#EC NEEDED
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " DISPLAY_DATA -
How to display 3 alv with top-of-page using splitter container
Hi,
I want to display 3 different alv in a single container corresponding to the 3 check boxes on selection screen.
i.e.
If user selects 1 check box only one alv should be displayed, if 2 checkboxes selected by user 2 alv should be displayed and same for 3.
I cannot use 3 different containers bcoz if second checkbox is not selected then that place remains blank. So I am using single container and using splitter container dividing it into the no of rows corresponding to the no. of checkboxs selected by user.
Now I also want to display top-of-page for each alv. Please guide me how to achieve this.
Thanks & regards,
Harshadacreate with some IF_ELSE conditions as i have done below. in my case the same things are required. if error table is there only then it will be displayed, else only output will be displayed.
* First Main Container
CREATE OBJECT obj_main1
EXPORTING
container_name = 'CC_CONTAINER'
style = cl_gui_custom_container=>ws_maximizebox.
* create top-document
CREATE OBJECT obj_dyndoc_id
EXPORTING
style = 'ALV_GRID'.
IF pr_view EQ c_x OR pr_stat EQ c_x.
* First Splitter Container
CREATE OBJECT obj_splitter1
EXPORTING
parent = obj_main1
rows = 2
columns = 1.
* Place obj_parent_html in First row First column
* for Top_of_page
CALL METHOD obj_splitter1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = obj_parent_html.
* Place obj_container1 in Second row First column
CALL METHOD obj_splitter1->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = obj_container1.
* Set the height of Top of page
CALL METHOD obj_splitter1->set_row_height
EXPORTING
id = 1
height = 24.
ELSEIF pr_email EQ c_x.
* First Splitter Container
CREATE OBJECT obj_splitter1
EXPORTING
parent = obj_main1
rows = 3
columns = 1.
* Place obj_parent_html in First row First column
* for Top_of_page
CALL METHOD obj_splitter1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = obj_parent_html.
* Place obj_container1 in First row First column
CALL METHOD obj_splitter1->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = obj_container1.
* Place obj_container2 in Second row First column
CALL METHOD obj_splitter1->get_container
EXPORTING
row = 3
column = 1
RECEIVING
container = obj_container2.
* Set the height of Top of page
CALL METHOD obj_splitter1->set_row_height
EXPORTING
id = 1
height = 24.
ENDIF.
Please note there is no need to create a hEADER in the container, but create it for the 1st table only which is always displayed
ags.
Edited by: ags on Nov 4, 2009 4:49 PM
Edited by: ags on Nov 4, 2009 4:50 PM -
ALV output download to excel with top of page
Hi,
i want to download ALV grid output to excel sheet including the top of page. i am using the icon in application tool bar. but only data's are download to excel sheet. i cannot download the top of page. with out write coding in program can we download it. if yes pls explain.
thanks.I'm sorry but I can't find FM with DOWNLOAD_EXCEL_*.
I want to know more detail thing.
plz. give answer to me anytime.
I'm waiting..
Edited by: Kwang Seop Kim on Sep 26, 2008 6:57 AM -
Reg: Download alv grid data with top of page into excel sheet
Hi All,
I have a selection screen with radio button for download .
If that radio button was selected then the data will download into excel sheet (like if we execute normal ALV grid display from there we can download top-of-page and body as it is).
AOO : 2009P
Fiscal year : 2009
Posting period : 00
Local Currency : USD
CO Area Currency :
Accounting standard:
Sector : 23
BB code Period Value LC Periodic Quantity
AHDKGKAJ 200 0Did not get your question
-
Problem with top of page in interactive ALV
Hello all,
I am displaying 2 level ALV list.
If List heading for the first page is 'First level' and for Second level list is 'Second level'.
but when I come back to first level list from second level using back button first level list shows me top of page as 'Second page'.
How to resolve this?
I am using function module approach.
Thanks and Regards,
AnupHello Clemens,
I've only one top of page event. what I am doing is for the first list I am populating a internal table (say A), slis_listheader with 'First level' and passing this to top-of-page event and outputting using REUSE_ALV_COMMENTARY_WRITE.display using REUSE_ALV_GRID_DISPLAY_LVC.
for the second list (at user command 'Double click' ) I am populating another internal table (say B), and slis_listheader with 'Second level'. display using REUSE_ALV_GRID_DISPLAY_LVC.
It works fine till this point. Problem is when i click back button on second level list I get 'Second level' again in top of page for the first level.
where do i set ps_selfield-refresh = 'X'?
Regards,
Anup -
Problem With Insert statement using field symbols with unicode enabled
I was writng a function module for dyanamic operations on the table. We are using the field symbols, function module is unicode enabled.
Assign statements are working fine, with which we created work are <fs_wa_header> and internal table <fs_tb_item> dynamically based on the table name (IM_TB_HENAME) which we get as import parameter.
we have query which is giving us dump.
INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER>.Hi
INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER> is good for inserting a line in the database, so IM_TB_HENAME has to have the name of dictionary table.
U should write:
INSERT <FS_WA_HEADER> INTO (IM_TB_HENAME).
But I believe you can't use the variable IM_TB_HENAME, you should use another field-symbols:
ASSIGN (IM_TB_HNAME) TO <FS_TB_ITEM>.
INSERT <FS_WA_HEADER> INTO <FS_TB_ITEM>.
Max -
Dynamic Field Symbols with Structures
Hello,
I am stuck on a piece of code and looking for some help. I am trying to figure out how to assign values in a structure of a dynamically defined field symbol to the structure inside another dynamically defined field symbol. Here is my code and some comments. Basically I am uploading data via a flatfile and placing it into a dynamically defined field symbol.
DATA:
lr_area TYPE REF TO cl_sem_planarea_attributes,
lr_t_data TYPE REF TO data,
lr_s_data TYPE REF TO data,
lr_s_chas TYPE REF TO data,
lr_s_kyfs TYPE REF TO data.
FIELD-SYMBOLS:
<lt_data> TYPE STANDARD TABLE,
<ls_data> TYPE ANY,
<ls_chas> TYPE ANY,
<ls_kyfs> TYPE ANY.
DATA: ls_chasel TYPE upc_ys_chasel,
ls_charng TYPE upc_ys_charng.
FIELD-SYMBOLS:
<f> TYPE ANY,
<chas> TYPE TABLE,
<kyfs> TYPE ANY.
CALL METHOD cl_sem_planarea_attributes=>get_instance
EXPORTING i_area = i_area
RECEIVING er_instance = lr_area.
CHECK sy-subrc = 0.
CREATE DATA lr_s_data TYPE (lr_area->typename_s_data).
ASSIGN lr_s_data->* TO <ls_data>.
CREATE DATA lr_t_data TYPE (lr_area->typename_t_data).
ASSIGN lr_t_data->* TO <lt_data>.
CREATE DATA lr_s_chas TYPE (lr_area->typename_s_chas).
ASSIGN lr_s_chas->* TO <ls_chas>.
CREATE DATA lr_s_kyfs TYPE (lr_area->typename_s_kyfs).
ASSIGN lr_s_kyfs->* TO <ls_kyfs>.
LOOP AT gt_file INTO ls_file.
CLEAR <ls_data>.
MOVE-CORRESPONDING ls_file TO <ls_kyfs>. " Map key figures
MOVE-CORRESPONDING ls_file TO <ls_chas>. " Map chars
* MOVE-CORRESPONDING ls_file TO <ls_data>. " Map data
* ASSIGN COMPONENT 'ls_chas' OF STRUCTURE <ls_Data> TO <chas> .
* IF sy-subrc = 0.
** <chas> = <ls_chas>.
*MOVE-CORRESPONDING <ls_chas> to <chas>.
* ENDIF.
<chas> = <ls_chas>.
LOOP AT <chas> INTO ls_chasel.
READ TABLE ls_chasel-t_charng INTO ls_charng INDEX 1.
IF sy-subrc = 0 AND ls_charng-option = 'EQ'.
ASSIGN COMPONENT ls_chasel-chanm OF STRUCTURE <ls_chas> TO <ls_data>.
IF sy-subrc = 0.
<ls_data> = ls_charng-low.
ENDIF.
ENDIF.
ENDLOOP.
COLLECT <ls_data> INTO <lt_data>.
ENDLOOP.
Ls_chasel has 2 components:
Chanm (a char 30 which contains the component’s name)
T_CHARNG (a table with values for chanm)
Ls_data has 2 components:
S_chas (a structure with a list of components and values – same list as would have)
S_kyfs (a structure with a list of components and values – same list as would have)
Lt_data is a table of ls_data
I need to get the data in ls_chas into the ls_chas structure of ls_data and the ls_kyfs data into the ls_kyfs structure of ls_chas and append ls_chas to lt_data. Anything that is commented out is something I tried that didn't work. RIght now I get a dump at the 'loop at <chas> into ls_chasel' that the field symbol is not assigned.
Thanks for your help!It looks like the the original poster didn't completely understand all he was doing. (This is why I always recommend getting an ABAP programmer in for what is, essentially, advanced ABAP programming, rather than someone "kind of familiar" with ABAP trying it - we're often available at very reasonable rates ).
It seems he's using ito_chasel to set the fixed values (which is in fact quite smart!). What isn't required, so far as I can tell without implementing, are any of the statements involving <ls_kyfs> or <ls_chas>.
The following should be sufficient (with the necessary declarations etc. - but really: omit <ls_kyfs> and <ls_chas> - I'm sure they're not needed and they confuse things).
" Go through the data from the flat file
LOOP AT gt_file INTO ls_file.
CLEAR <ls_data>.
" Transfer the characteristics
MOVE-CORRESPONDING ls_file TO <s_chas>.
" Transfer the key figure
MOVE-CORRESPONDING ls_file TO <s_kyfs>.
" Go through the fixed characteristic selections from the package
LOOP AT ito_chasel INTO ls_chasel.
" We only care about the first value (if there is one).
READ TABLE ls_chasel-s_charng INTO ls_charng INDEX 1.
" Check there is a first value and that it is fixed
CHECK sy-subrc IS INITIAL AND ls_charng EQ 'EQ'.
" Get access to that characteristic
FIELD-SYMBOLS <fixed_value> TYPE ANY.
ASSIGN COMPONENT ls_chasel-chanm OF STRUCTURE <s_chas> TO <fixed_value>.
" Make sure that it exists in the data structure
CHECK sy-subrc IS INITIAL.
" Set the value
<fixed_value> = ls_charng-low.
ENDLOOP.
COLLECT <ls_data> INTO <lt_data>.
ENDLOOP.
Maybe you are looking for
-
While working in Pages a folder appeared on my desktop with the Pages icon on it. I don't know how it got there. It will not let me move it on the desktop. I will not let me delete it. It will not let me do anything to it. Any idea what I might have
-
Boot fails after security update
Greetings, In installed the most recent security update this morning, and after restarting, my machine won't boot up. I've followed the existing threads (in case you've also had this problem, the most informative was here: http://discussions.apple.co
-
I have created a scheduling agreement for a material i want to cancel.
i have created a scheduling agreement with a material i want to use the material in a contract with another vendor, is there any way i could use the material or i have to terminate the scheduling agreement and create the contract. in case of cancelin
-
Large file uploads with jersey client
Hello All, I am getting heap spcace iissue while uploading large files via jersey client , the jvm will run out memory Can any one help me in understanding how can i send large file about 300mb via jersy client. code that i have wriiten is: WebResour
-
How to find sql query using hash value
Hi, DBVERSION: 9.2.0.8 I generated statspack report and i want to see total query and i have hash_value here. in v$sql am not able to see all the querys ...pls suggest me other ways.. Thanks, Srini...