Two Internal Tables for ALV Grid
Hi Gurus,
I have a little problem here. I have a report to display cost of production. The rows is about 50 displaying amount in dollars (currency fields). I have this in ALV Grid. But my problem is that the last 4 lines of the report are not currency fields like the others, they are quantity fields.
How can i go about to display this last 4 lines in this ALV Grid. They are from different internal tables off course because of the data type.
In short. I just want to display these 2 internal tables in an ALV Grid.
Thanks in Advance.
Hi,
u can use ALV Block list to display 2 ALV.
Reffer to the below code.
DATA: v_layout TYPE slis_layout_alv.
DATA: ls_print TYPE slis_print_alv.
PERFORM build_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = v_layout
it_fieldcat = it_fcat_nlei
i_tabname = 'IT_NLEI_ALV'
it_events = it_event_nlei
* IT_SORT =
* I_TEXT = ' '
TABLES
t_outtab = it_nlei_alv
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = v_layout
it_fieldcat = it_fcat_vbrp
i_tabname = 'IT_VBRP_ALV'
it_events = it_event_vbrp
* IT_SORT =
* I_TEXT = ' '
TABLES
t_outtab = it_vbrp_alv
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
ls_print-no_print_selinfos = 'X'. " Display no selection infos
ls_print-no_print_listinfos = 'X'. " Display no listinfos
ls_print-reserve_lines = 2. " Lines reserved for end of page
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
is_print = ls_print
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
EXCEPTIONS
program_error = 1
OTHERS = 2
Similar Messages
-
Can we get the data from two internal tables in ALV.
hi friends i would like to display the data using two internal tables using alv grid.please guide me.
Hi,
ALV would be having a specific layout say :
MATNR
MAKTX
QTY
Now, if you have two internal tables, then do they have a different structure. If they have different structures, then what kind of ALV layout you expect. The ALV output should be as per the structure of 1st or 2nd internal table.
If both internal table have same layout, then populate the data from 2nd internal table into 1st internal table and pass the 1st internal table ( it will have data of both internal tables) to ALV.
Best regards,
Prashant -
Dynamic internal table for ALV output
Hi,
I am looking for a simple & efficient sample code for an ALV report output with dynamic columns. Can someone please help!
Thanks,
JSHere is a small example. This is pretty old code, and it uses the FM approach.
report zrich_0001.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: it_alvfc type slis_t_fieldcat_alv,
wa_alvfc type slis_fieldcat_alv,
it_fldcat type lvc_t_fcat,
wa_fldcat type lvc_s_fcat.
selection-screen begin of block b1 with frame title text-001.
parameters: p_flds(5) type c.
selection-screen end of block b1.
start-of-selection.
* build the dynamic internal table
perform build_dyn_itab.
* write 5 records to the alv grid
do 5 times.
perform build_report.
enddo.
* call the alv grid.
perform call_alv.
* Build_dyn_itab
form build_dyn_itab.
* Create the dynamic internal table
data: new_table type ref to data,
new_line type ref to data.
* Create fields .
do p_flds times.
clear wa_fldcat.
wa_fldcat-fieldname = sy-index.
wa_fldcat-datatype = 'CHAR'.
wa_fldcat-intlen = 5.
append wa_fldcat to it_fldcat .
enddo.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
* Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
Have to split this code into two postings to keep formatting.
Regards,
Rich Heilman
Edited by: Rich Heilman on Jun 23, 2009 11:59 AM -
Subtotals in dynamic internal table using alv grid
hi experts i have created one dynamic table. The requirement is to display the subtotals in the output using reuse_alv_grid.
Dynamic itab (field-symbols) and ALV event BEFORE_LINE_OUTPUT
the above is the thread related and could any one please provide the sample code for this task.
can any one post the solution for that.
rewards points will be awarded.
khazi* ASSINING STRUCTURE FOR FILD CATLOGS
DATA: DYN_TABLE TYPE REF TO DATA,
DYN_LINE TYPE REF TO DATA,
LS_FIELDCAT TYPE LVC_S_FCAT,
LT_FIELDCAT TYPE LVC_T_FCAT.
LOOP AT LT_DMTAB INTO LS_DMTAB.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = LS_DMTAB-SDATE .
LS_FIELDCAT-DATATYPE = 'DEC'.
LS_FIELDCAT-INTTYPE = 'P'.
LS_FIELDCAT-INTLEN = '16' .
LS_FIELDCAT-DECIMALS = '03'.
LS_FIELDCAT-JUST = 'C'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
ENDLOOP.
*& For grouping the table rows for Under Line
LS_FIELDCAT-FIELDNAME = 'ULFIELD' .
LS_FIELDCAT-DATATYPE = 'INT'.
LS_FIELDCAT-INTTYPE = 'P'.
LS_FIELDCAT-INTLEN = '2' .
LS_FIELDCAT-DECIMALS = ''.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
"* Create dynamic internal table and assign to Field-Symbol
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_FIELDCAT
IMPORTING
EP_TABLE = DYN_TABLE.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN DYN_TABLE->* TO <LT_AREA_F>.
"* Create dynamic work area and assign to Field Symbol
CREATE DATA DYN_LINE LIKE LINE OF <LT_AREA_F>.
ASSIGN DYN_LINE->* TO <LS_AREA_F>.
You check in Field cat level you will get Check Sub total field will exist
Thanks and regards
Jogu -
I have two separate internal tables. However , they have a common field matnr. In the report output, the two internal tables should be joined by this common field. Can this be done with an ALV . The common field Matnr should appear to the extreme left. Followed by itab1 and then itab2 . Its in a sense Matnr is the header , but it shows as rows. Each matnr has several item in both itab1 and itab2 , it is not necessary that total number of item data in itab1 and itab2 will be same .
You can see example program :
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
vbeln TYPE vbeln,
expand,
END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
vbeln TYPE vbeln,
posnr TYPE posnr,
matnr TYPE matnr,
netpr TYPE netpr,
END OF itab1.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'VBELN'.
s_fieldcatalog-outputlen = '12'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'VBELN'.
s_fieldcatalog-outputlen = '12'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'POSNR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'POSNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'MATNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'NETPR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'NETPR'.
s_fieldcatalog-do_sum = 'X'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
DATA: s_layout TYPE slis_layout_alv.
s_layout-subtotals_text = 'SUBTOTAL TEXT'.
s_layout-key_hotspot = 'X'.
s_layout-expand_fieldname = 'EXPAND'.
SELECT vbeln UP TO 100 ROWS
FROM
vbak
INTO TABLE itab.
IF NOT itab[] IS INITIAL.
SELECT vbeln posnr matnr netpr
FROM vbap
INTO TABLE itab1
FOR ALL ENTRIES IN itab
WHERE vbeln = itab-vbeln.
ENDIF.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA: s_keyinfo TYPE slis_keyinfo_alv.
s_keyinfo-header01 = 'VBELN'.
s_keyinfo-item01 = 'VBELN'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = s_layout
it_fieldcat = t_fieldcatalog
i_tabname_header = 'ITAB'
i_tabname_item = 'ITAB1'
is_keyinfo = s_keyinfo
TABLES
t_outtab_header = itab
t_outtab_item = itab1
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.
Thanks
Seshu -
Using for all entries of two internal tables in where clause of the select
Hi experts,
My requirement is, need to select Marc-minbe and wrpl-sobst, for all the entries of the two internal tables it_mara , and it_t001w.
here is the select queries i have used,
select matnr normt from mara into it_mara for all entries in it_data where normt = it_data-normt.
select konnr werks from t001w into it_t001w for all entries in it_data where konnr = it_data-konnr.
now i need to select minbe of marc table and sobse of wrpl table for all the entries of above internal tables, it_mara and it_t001w, using both matnr of it_mara and werks of it_t001w in where condition.
Pls advise how i can do it.
Thanks.
Moderator message: very basic, please work on this yourself first, these forums are not a substitute for ABAP training.
Edited by: Thomas Zloch on Dec 6, 2010 9:38 AMHi
call SE16 with table TFTIT in order to get a full list (it will be long...)
A list of FMs with parameters can be found in table FUNCT.
Finally go to sm37rsdf4
that will give you all the function modules with description
Here is the list:
http://www.erpgenie.com/abap/functions.htm
hope this helps...
Regards
CSM Reddy -
Matching data for two internal Table
hi guru's,
i have two internal table that is ITAB and itab1, and both has more than 2000 records, but MATNR is common field in both, so i want to update itab from itab1 according to matnr. can anyone please help me? actually i was using read table but it was not doing correct.
regards Nitin.dear all,
thanx for reply again...but still same problem. actually i m making a report for material price comparison
purchased in current month and same material if purchased in before months. so i need maintain the final ITAB with including same material if purchased in previus months.
ITAB1 : EBELN BLDAT MATNR WRBTR
100023 20080101 abcd 100.00
100025 20080106 xyzr 250.00
100028 20080102 abcd 100.00
100129 20080117 xyzr 150.00
100159 20080126 uvwx 170.00
ITAB2 : EBELN BLDAT1 MATNR WRBTR1
200026 20080201 abcd 105.00
200024 20080206 xyz_r4 250.00
200023 20080201 abcd 100.00
200129 20080217 xyzrw 150.00
200152 20080225 uvwx 190.00
Final record which i need.
ITAB3: EBELN BLDAT MATNR WRBTR WRBTR1
100023 20080101 abcd 100.00 105.00
100023 20080101 abcd 100.00 105.00
100159 20080126 uvwx 170.00 190.00
please suggest me accordingly...
regards nitin. -
Function module for comparing contents of two internal tables
Hi All,
Is there any function module to compare contents of two internal tables of same structure?
If yes please let me know.
Thanks in advance.
AmolHi
call SE16 with table TFTIT in order to get a full list (it will be long...)
A list of FMs with parameters can be found in table FUNCT.
Finally go to sm37rsdf4
that will give you all the function modules with description
Here is the list:
http://www.erpgenie.com/abap/functions.htm
hope this helps...
Regards
CSM Reddy -
Modifying database table in ALV Grid
Hi all.
I need to be able to modify the database table in ALV Grid. Here's the code. The database table, that is displayed is 'zng_so_head', it's internal table is 'res_tab'. In the program i tried to create a button 'CHANGE' on the ALV-toolbar, but when executing the program there's no such button (why?). What code, screens, screen elements, etc. should be added to this program to provide a possibility of changing data of the database table 'zng_so_head' (i mean changing existing data, adding new lines and saving changes)?
CODE:
& Report ZNG_ALV_TC_EDIT_SIMP&
REPORT ZNG_ALV_TC_EDIT_SIMP.
*-- GLOBAL DATA DECLARATIONS FOR ALV
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.
DATA gt_fieldcat TYPE lvc_t_fcat.
DATA gs_layout TYPE lvc_s_layo.
TABLES: zng_so_head, zng_cust, zng_vendors.
*-- STRUCTURE OF INTERNAL TABLE
TYPES: BEGIN OF in_tab,
so_num TYPE zng_so_head-so_num, "type numc
vend_num TYPE zng_so_head-vend_num, "type numc
cust_num TYPE zng_so_head-cust_num, "type numc
so_date TYPE zng_so_head-so_date, "type dats
END OF in_tab.
*-- INTERNAL TABLE HOLDING LIST DATA
DATA res_tab TYPE TABLE OF in_tab WITH HEADER LINE.
*-- FILLING IN INTERNAL TABLE
SELECT hso_num hvend_num hcust_num hso_date
INTO TABLE res_tab FROM zng_so_head AS h.
*& Form prepare_field_catalog
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-fieldname = 'SO_NUM'.
ls_fcat-inttype = 'N'.
ls_fcat-ref_table = 'zng_so_head'.
ls_fcat-outputlen = '12'.
ls_fcat-coltext = 'SO_NUM'.
ls_fcat-seltext = 'SO_NUM'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'VEND_NUM'.
ls_fcat-inttype = 'N'.
ls_fcat-ref_table = 'zng_so_head'.
ls_fcat-outputlen = '12'.
ls_fcat-coltext = 'VEND_NUM'.
ls_fcat-seltext = 'VEND_NUM'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CUST_NUM'.
ls_fcat-inttype = 'N'.
ls_fcat-ref_table = 'zng_so_head'.
ls_fcat-outputlen = '12'.
ls_fcat-coltext = 'CUST_NUM'.
ls_fcat-seltext = 'CUST_NUM'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'SO_DATE'.
ls_fcat-inttype = 'D'.
ls_fcat-ref_table = 'zng_so_head'.
ls_fcat-outputlen = '12'.
ls_fcat-coltext = 'SO_DATE'.
ls_fcat-seltext = 'SO_DATE'.
APPEND ls_fcat TO pt_fieldcat.
ENDFORM. "prepare_field_catalog
*& Form display_alv
FORM display_alv.
IF gr_alvgrid IS INITIAL.
CREATE OBJECT gr_ccontainer
EXPORTING container_name = gc_custom_control_name.
CREATE OBJECT gr_alvgrid
EXPORTING i_parent = gr_ccontainer.
PERFORM prepare_field_catalog CHANGING gt_fieldcat.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = res_tab[]
it_fieldcatalog = gt_fieldcat.
ELSE.
CALL METHOD gr_alvgrid->refresh_table_display.
ENDIF.
ENDFORM. "display_alv
CLASS lcl_event_handler DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object
e_interactive.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'change' TO ls_toolbar-quickinfo.
MOVE 'change' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_event_handler IMPLEMENTATION
DATA object_ref TYPE REF TO lcl_event_handler.
START-OF-SELECTION.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT
MODULE display_alv OUTPUT.
SET PF-STATUS 'SCREEN_100'.
PERFORM display_alv.
CREATE OBJECT object_ref.
SET HANDLER object_ref->handle_toolbar FOR gr_alvgrid.
ENDMODULE. "display_alv OUTPUT
MODULE USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ELSE.
CALL METHOD object_ref->handle_toolbar.
ENDIF.
ENDMODULE. "status_0100 INPUT
END OF CODE
Thanks all.Hi,
For the button on the toolbar,here is the code:
CLASS lcl_eh IMPLEMENTATION.
*METHOD: HANDLE_TOOLBAR
*DESCRIPTION: This method provides the necessary detail required to
create an extra button in the toolbar.
METHOD handle_toolbar.
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE 0 TO ls_toolbar-butn_type.
MOVE CHANGETO ls_toolbar-text.
MOVE 'ICON_DETAIL' TO ls_toolbar-icon.
MOVE 'CHANGE' TO ls_toolbar-quickinfo.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
Also,if you are using the CHANGE button to record changes in the DB,then in the local class that you have defined,you should use the following method and then write the logic:
*METHOD: HANDLE_USER_COMMAND
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'CHANGE'.
CHECK_CHANGED_DATA
REFRESH_TABLE_DISPLAY
Now call the methods that i have given in my previous post.This function code will be checked at the event you click the button 'CHANGE'.I think you have done this in an ELSE condition in the PAI of the screen.Not too sure if it works in the PAI.
Regards,
Beejal
**Reward if this helps -
How to print to tables in ALV grid
hi all
I have 2 internal tables with some values
i want to display the 2 internal tables in the grid one after another with some title
can anyone tell me how to do it
Thank you.i think in grid you can not do like this (By using function module). But you can do it in OO approach for that just check the se38 with alvgrid* and search. you can findout lot of example there. And one more option is there by using alv block but it is a list display.
Just check this sample program of alv block
TYPE-POOLS : SLIS.
TABLES : EKKO,EKPO.
DATA : BEGIN OF IEKKO OCCURS 0,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
END OF IEKKO.
DATA : BEGIN OF IEKPO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
END OF IEKPO.
DATA : IFIELDCATEKKO TYPE SLIS_T_FIELDCAT_ALV,
IFIELDCATEKPO TYPE SLIS_T_FIELDCAT_ALV,
WFIELDCAT TYPE SLIS_FIELDCAT_ALV,
ILAYOUT TYPE SLIS_LAYOUT_ALV,
IEVENTHEAD TYPE SLIS_T_EVENT,
IEVENTITEM TYPE SLIS_T_EVENT,
WEVENT TYPE SLIS_ALV_EVENT,
ISORT TYPE SLIS_T_SORTINFO_ALV,
WSORT TYPE SLIS_SORTINFO_ALV.
PARAMETERS : P_NUM(3) TYPE N DEFAULT 10.
PERFORM GET_DATA_EKKO.
PERFORM GET_DATA_EKPO.
PERFORM BUILD_FCAT_HEAD.
PERFORM BUILD_FCAT_ITEM.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_EVENT_TAB.
PERFORM DISPLAY_BLOCK.
*& Form GET_DATA_EKKO
* text
* --> p1 text
* <-- p2 text
FORM GET_DATA_EKKO .
SELECT EBELN AEDAT INTO TABLE IEKKO FROM EKKO UP TO P_NUM ROWS WHERE EBELN LIKE '45000057%'.
ENDFORM. " GET_DATA_EKKO
*& Form GET_DATA_EKPO
* text
* --> p1 text
* <-- p2 text
FORM GET_DATA_EKPO .
IF NOT IEKKO[] IS INITIAL.
SELECT EBELN EBELP MATNR MENGE MEINS INTO TABLE IEKPO FROM EKPO FOR ALL ENTRIES IN IEKKO
WHERE EBELN = IEKKO-EBELN.
ENDIF.
ENDFORM. " GET_DATA_EKPO
*& Form DISPLAY_BLOCK
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_BLOCK .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = ILAYOUT
IT_FIELDCAT = IFIELDCATEKKO
I_TABNAME = 'IEKKO'
IT_EVENTS = IEVENTHEAD[]
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IEKKO
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_APPEND'
EXPORTING
IS_LAYOUT = ILAYOUT
IT_FIELDCAT = IFIELDCATEKPO
I_TABNAME = 'IEKPO'
IT_EVENTS = IEVENTITEM
* IT_SORT =
* I_TEXT = ' '
TABLES
T_OUTTAB = IEKPO
* 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'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* IS_PRINT =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
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_BLOCK
*& Form BUILD_FCAT_HEAD
* text
* --> p1 text
* <-- p2 text
FORM BUILD_FCAT_HEAD .
WFIELDCAT-FIELDNAME = 'EBELN'.
WFIELDCAT-TABNAME = 'IEKKO'.
WFIELDCAT-SELTEXT_L = 'Pur. Doc no'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCATEKKO.
CLEAR WFIELDCAT.
WFIELDCAT-FIELDNAME = 'AEDAT'.
WFIELDCAT-TABNAME = 'IEKKO'.
WFIELDCAT-SELTEXT_L = 'Pur. doc date'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCATEKKO.
CLEAR WFIELDCAT.
ENDFORM. " BUILD_FCAT_HEAD
*& Form BUILD_FCAT_ITEM
* text
* --> p1 text
* <-- p2 text
FORM BUILD_FCAT_ITEM .
WFIELDCAT-FIELDNAME = 'EBELN'.
WFIELDCAT-TABNAME = 'IEKPO'.
WFIELDCAT-SELTEXT_L = 'Pur. Doc no'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCATEKPO.
CLEAR WFIELDCAT.
WFIELDCAT-FIELDNAME = 'EBELP'.
WFIELDCAT-TABNAME = 'IEKPO'.
WFIELDCAT-SELTEXT_L = 'Pur. Doc item'.
*wfieldcat-do_sum = 'X'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCATEKPO.
CLEAR WFIELDCAT.
WFIELDCAT-FIELDNAME = 'MATNR'.
WFIELDCAT-TABNAME = 'IEKPO'.
WFIELDCAT-SELTEXT_L = 'Material no'.
WFIELDCAT-OUTPUTLEN = 18.
APPEND WFIELDCAT TO IFIELDCATEKPO.
CLEAR WFIELDCAT.
WFIELDCAT-FIELDNAME = 'MENGE'.
WFIELDCAT-TABNAME = 'IEKPO'.
WFIELDCAT-SELTEXT_L = 'P.O. Qty'.
wfieldcat-do_sum = 'X'.
*WFIELDCAT-DATATYPE = 'QUAN'.
WFIELDCAT-OUTPUTLEN = 15.
APPEND WFIELDCAT TO IFIELDCATEKPO.
CLEAR WFIELDCAT.
WFIELDCAT-FIELDNAME = 'MEINS'.
WFIELDCAT-TABNAME = 'IEKPO'.
WFIELDCAT-SELTEXT_L = 'UOM'.
WFIELDCAT-OUTPUTLEN = 3.
APPEND WFIELDCAT TO IFIELDCATEKPO.
CLEAR WFIELDCAT.
ENDFORM. " BUILD_FCAT_ITEM
*& Form BUILD_LAYOUT
* text
* --> p1 text
* <-- p2 text
FORM BUILD_LAYOUT .
ILAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form BUILD_EVENT_TAB
* text
* --> p1 text
* <-- p2 text
FORM BUILD_EVENT_TAB .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IEVENTHEAD
* EXCEPTIONS
* LIST_TYPE_WRONG = 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.
IEVENTITEM = IEVENTHEAD.
READ TABLE IEVENTHEAD INTO WEVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC = 0.
WEVENT-FORM = 'TOPOFPAGEHEAD'.
MODIFY IEVENTHEAD FROM WEVENT INDEX SY-TABIX.
ENDIF.
READ TABLE IEVENTHEAD INTO WEVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC = 0.
WEVENT-FORM = 'USERCOMMAND'.
MODIFY IEVENTHEAD FROM WEVENT INDEX SY-TABIX.
ENDIF.
READ TABLE IEVENTITEM INTO WEVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC = 0.
WEVENT-FORM = 'TOPOFPAGEITEM'.
MODIFY IEVENTITEM FROM WEVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " BUILD_EVENT_TAB
FORM USERCOMMAND USING PUCOMM LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD.
CASE PUCOMM.
WHEN '&IC1'.
WHEN 'OTHERS'.
ENDCASE.
ENDFORM.
FORM TOPOFPAGEHEAD.
DATA : ILIST TYPE SLIS_T_LISTHEADER,
WLIST TYPE SLIS_LISTHEADER.
WLIST-INFO = 'Header data with P.O. no and creating date'.
WLIST-TYP = 'H'.
APPEND WLIST TO ILIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = ILIST
* I_LOGO =
* I_END_OF_LIST_GRID =
ENDFORM.
FORM TOPOFPAGEITEM.
DATA : ILIST TYPE SLIS_T_LISTHEADER,
WLIST TYPE SLIS_LISTHEADER.
WLIST-INFO = 'Item data with P.O.item material no and qty'.
WLIST-TYP = 'H'.
APPEND WLIST TO ILIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = ILIST
* I_LOGO =
* I_END_OF_LIST_GRID =
ENDFORM.
regards
shiba dutta -
hello friends,
I have two internal tables of different structure.
i have filled those two internal tables using join statements.
But one field is common in both the tables, when i try to append both tables into another new internal table.
i cant get the value for the 2nd tables field.
EX.
vbeln is common in vbuk, vbup, vbap, vbak, likp, lips.
but its sale order number in vbak, vbap.
delivery document in likp,lips.
vbup has both sales order and delivery in the vbeln field.
so, i made a join to between vbak, vbup and lips to see the goods movement status in vbup.
for that the vbeln should be delievery number.
and in other table, i have added vbup and vbak and vbep to get the delievery status.
for that the vbeln should be sale order no.
when i append both the tables into the third internal table that has the structure of both internal tables.
i could not get the vbeln of the second table(sale order no) in the third table.
help me guys.
rewards for helpful solutions.hello,
types:
begin of str,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
end of str.
types:
begin of st1,
lfstk like vbuk-vbeln,
end of st1.
types:
begin of st2,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
lfstk like vbuk-lfstk,
end of st2.
selection-screen: s_order for vbak-vbeln,
s_div for vbak-vtweg.
data: it type table of st with header line,
it1 type table of st1 with header line,
it2 type table of st2 with header line.
select vbeln vkorg vtweg from vbak into table it
where vbeln in s_order and
vkorg in s_div.
select lfstk from vbuk into table it1 for all entries in it
where vbeln = it-vbeln.
it2[] = it[].
append it1-lfstk into it2[].
or
move-corresponding it1 to it2.
" when i execute this code with a grid or list display, i m not able to get the values or entries for the 2nd table it1.
the it2 has the lfstk cloumn blank in the final display.
help me for a remedy.
rewards for useful suggestion. -
Getting runtime Error 'UC_OBJECTS_NOT_CHARLIKE' for ALV grid
Hi,
When I call method SET_TABLE_FOR_FIRST_DISPLAY of ALV I get runtime error 'UC_OBJECTS_NOT_CHARLIKE'.
Actually i have set in the fieldcatalog the field 'CHK' of internal table as checkbox.
wa_fcat-fieldname = 'CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
Field CHK is of type c.
when i dont set the field as checkbox, I stop getting the error.
Please find a solution.
regards,
auroRelevant parts of code are:
Data Declaration:
types: begin of tt_revenue_det,
chk type c,
budat like zefit0006-zefibudat,
racct_txt like skat-txt50,
amount like zefit0006-zefihsl,
pbar_txt like tgsbt-gtext,
sgtxt like zefit0006-zefisgtxt,
costcentertxt like cskt-ktext,
bar_txt like skat-txt50,
doctype like zefit0006-zefiblart,
ch_flag type c,
end of tt_revenue_det,
data: gt_revenue_det type table of tt_revenue_det.
FIELD CATALOG
*& Form set_fieldcatalog_rev_det
text
-->P_LT_FIELDCATALOG text
form set_fieldcatalog_rev_det using p_lt_fieldcatalog type lvc_t_fcat.
data:wa_fcat type lvc_s_fcat.
wa_fcat-fieldname = 'P_GT_REVENUE_DET-CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BUDAT' .
wa_fcat-coltext = 'Posting Date' .
wa_fcat-seltext = 'Posting Date' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'RACCT_TXT' .
wa_fcat-coltext = 'Account Item Text' .
wa_fcat-seltext = 'Account Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'AMOUNT' .
wa_fcat-coltext = 'Amount' .
wa_fcat-seltext = 'Amount' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'PBAR_TXT' .
wa_fcat-coltext = 'Partner Business Area' .
wa_fcat-seltext = 'Partner Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'SGTXT' .
wa_fcat-coltext = 'Item Text' .
wa_fcat-seltext = 'Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'COSTCENTERTXT' .
wa_fcat-coltext = 'Cost Center' .
wa_fcat-seltext = 'Cost Center' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BAR_TXT' .
wa_fcat-coltext = 'Business Area' .
wa_fcat-seltext = 'Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'DOCTYPE' .
wa_fcat-coltext = 'Type' .
wa_fcat-seltext = 'Type' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'CH_FLAG' .
wa_fcat-coltext = 'Split' .
wa_fcat-seltext = 'Split' .
APPEND wa_fcat to p_lt_fieldcatalog .
endform. " set_fieldcatalog_rev_det
CREATE ALV
*& Form create_alv_revenue_det
text
-->P_GT_REVENUE_DET text
form create_alv_revenue_det using p_gt_revenue_det.
ALV related data declaration
DATA: lf_layout TYPE lvc_s_layo, "alv layout
lt_fieldcatalog type table of lvc_s_fcat, "field catalog internal table
wa_fieldcatalog type lvc_s_fcat. "work area for field catalog
create alv only if container is initial
IF G_CUSTOM_CONTAINER_REV_DET IS INITIAL.
lf_layout-no_toolbar = 'X'. " no toolbar
lf_layout-sel_mode = 'B'.
populate field catalog
perform set_fieldcatalog_rev_det using lt_fieldcatalog.
create instance of container class
CREATE OBJECT G_CUSTOM_CONTAINER_REV_DET
EXPORTING CONTAINER_NAME = G_CONTAINER_REV2.
create instance of alv grid class
CREATE OBJECT GR_ALVGRID_REV_DET
EXPORTING I_PARENT = G_CUSTOM_CONTAINER_REV_DET.
call method to display table in alv grid by passing layout and fieldcatalog
CALL METHOD GR_ALVGRID_REV_DET->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
is_layout = lf_layout
CHANGING
IT_OUTTAB = p_gt_revenue_det
IT_FIELDCATALOG = lt_fieldcatalog.
ENDIF.
endform. " create_alv_revenue_det -
Number of entries in the internal table for perticular field value
hi All,
Is this possible to get the count of records from the internal table for a perticular field value.
currently my requirement is to get the entries from the internal table which does not have two records for perticular field value (say a = 123) whose status is active (say b = 'X').
also suggets should use LOOP or DELETE or DESCRIBE for a internal table to ful fill this requirement.
Thanks in advance.
PradeepTry like this..
Create another table itab2 with same structure as itab1 & move the contents of itab1 to itab2
ITAB2[] = ITAB1[].
Then delete entries from itab2
Delete itab2 whete a = '123' and b = 'X'
Then use Describe statement to get the no of entries
Describe table itab2 lines v_lines.
Hope this helps... -
Comparing each value of two internal tables
HI everybody,
i have two internal tables itab1 and itab2 same structure
both r having four fields each and field with values
now i need to compare the two internal tables
and if every value of itab1 matches itab2
then i have to write one select quirie for the following given description
compare past and current shipping point
compare internal_table2 and internal_table3
if entry in internal_table2 and internal table3 match
variable_tknum = internal_table2-tknum
endif.
for each entry that matches:
select vlabdata into zi_vlabdata from vlbl where vbeln = variable_tknum and vlbl-vlabtyp = 'ZIBOOKNO'.
plz give me solution for this
thanks
hridhayanjili.sort : ITAB1 by f1,f2,f3,f4,
ITAB2 by f1,f2,f3,f4.
LOOP AT ITAB1.
READ TABLE ITAB2 WITH KEY F1 = ITAB1-F1
F2 = ITAB1-F2
F3 = ITAB1-F3
F4 = ITAB1-F4 BINARY SEARCH.
IF SY-SUBRC = 0.
*--all the fields of ITAB1 and ITAB2 are matching .
*--write your logic here
ELSE.
*--ITAB1 and ITAB2 records are not matching.
ENDIF.
ENDLOOP.
Regards
Srikanth
Message was edited by: Srikanth Kidambi -
Reg comparison of two internal tables
hi friends,
please help me solving this.
there are two internal tables t_zvs38 and t_value
1.t_value like seahlpres
2.t_zvs38 like zvs38.
values in t_value will be like this.
first line wil contain zmdtype(mandatory document) and second line will contain
zmdtypet (the description for zmdtype).
eg.
D001 -
-zmdtype
internal----
zmdtypet
D002
external
D003
renewal
values in t_zvs38.
for a particular sales.org the zmdtype is filled.
select vkorg zmdtype into corrsponding fields of table t_zvs38
where vkorg = p_vkorg.
Now i want to compare t_value and t_zvs38 with field zmdtype
and delete the contents of t_value which are not in t_zvs38.
i have written like this.
loop at t_value.
read table t_zvs38 with key zmdtype = t_value-string.
if sy-subrc ne 0.
delete t_value. "to delete zmdtype
sy-tabix = sy-tabix + 1.
delete t_value. " to delete zmdtypet
else.
sy-tabix = sy-tabix +2. "to go to next zmdtype.
endif.
endloop.
but it is deleting all the contents of t_value.
points are assured.CLEAR zvs32t.
SELECT zvs32tzmdtype zvs32tzmdtypet
INTO (zvs32t-zmdtype, zvs32t-zmdtypet)
FROM zvs32t
JOIN zvs32
ON zvs32tzmdtype = zvs32zmdtype
WHERE zvs32t~spras = sy-langu
AND zvs32~zfrenewal = space.
WRITE zvs32t-zmdtype TO t_value.
APPEND t_value.
WRITE zvs32t-zmdtypet TO t_value.
APPEND t_value.
ENDSELECT.
SELECT vkorg vkbur zmdtype FROM zvs38 INTO CORRESPONDING FIELDS OF TABLE t_zvs38
WHERE vkorg = p_vkorg
AND vkbur = p_vkbur.
LOOP AT t_value INTO wa_area1.
v_index = sy-tabix.
READ TABLE t_zvs38 INTO wa_area2 WITH KEY zmdtype = wa_area1-string
BINARY SEARCH.
IF sy-subrc NE 0.
IF l_flag IS INITIAL.
DELETE t_value INDEX v_index.
ELSE.
CLEAR l_flag.
ENDIF.
ELSE.
l_flag = 'X'.
ENDIF.
ENDLOOP.
Using this code ,i am unable to ge the correct output.Thank u all for ur help.
Maybe you are looking for
-
I have a few dead spots around the house and I am seeking a good solution without pulling ethernet cable. Reading this community it would seem best if going with Airport Express solution to replace my Netgear and pick up a couple of AXn's. Or perhap
-
Order Settlement and variance booking
I require one clarification. Here one production order was created with a big quantity few months ago and the same has been completed and finished in this month. Because of this the total variance which is very huge has been posted in this month in t
-
Stand-alone data tables, no ODBC drivers
Using only Java, is it possible to create, populate, index and query stand-alone data tables without the use of any ODBC drivers or DBMS? At work we cannot install such software on our workstations. However, I do have JDK2 installed and working fine.
-
How to download and install oracle apps
Hi guys, Am new to oracle apps I want to study oracle apps, is it free to use for learning purpose. can you provide me the link to download and install in windows 7(64 bit).
-
Goods Issue MIGO integration with HR
Hi, Can anybody tell me the process of integration of goods issue with HR personnel numbers, example issue of helmets to employees to be tracked by personnel number regards bala