To get pop up with alv list
hi experts,
i have a reqiurement where i need to create a fucnction module which takes the input and and give a pop up with alv display. here its ok
not to use is REUSE_ALV_POPUP_TO_SELECT with simple reuse_alv_display
can i change the size to like pop up...
plz help its urgent
a..f,
you can still use the FM REUSE_ALV_GRID_DISPLAY, it has parameter
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
Set the values as desired and it comes up as a popup.
Regards,
Clemens
Similar Messages
-
Hi,
I want to display on TOP of PAGE : X page / Total page with ALV LIST.
here is my code :
FORM eventtab_build USING lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
READ TABLE lt_events WITH KEY name = slis_ev_end_of_list
INTO ls_event.
IF sy-subrc = 0.
MOVE 'END-OF-LIST' TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
ENDFORM. "eventtab_build
FORM top_of_page.
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
DATA : lv_desc(15) TYPE c,
lv_month(2) TYPE c,
lv_year(4) TYPE c.
DATA : pageno(2) TYPE c.
lv_month = sd_augdt-high+4(2).
lv_year = sd_augdt-high(4).
SELECT SINGLE ltx FROM t247 INTO lv_desc WHERE mnr = lv_month
AND spras = sy-langu.
WRITE : /1 sd_bukrs-low.
SKIP 1.
WRITE : 50 'RELEVE DES ACHATS LIVRAISONS FACONS'.
WRITE : /52 '& TRAVAUX EFFECTUES AU MAROC'.
WRITE : /54 'OUVRANT DROIT AU DEDUCTION'.
SKIP 1.
WRITE : /1 'IDENTIFIANT FISCAL :', '1234',135 'REGIME : ENCAISSEMENT'.
SKIP 1.
IF NOT dtab-mwskz IS INITIAL.
WRITE : /54 'Code TVA: ',dtab-mwskz.
ENDIF.
WRITE : 135 'Page No :', sy-pagno RIGHT-JUSTIFIED.
WRITE : /2 'MOIS :',lv_desc,20 lv_year.
SKIP 1.
pageno = sy-pagno.
wa_header-typ = 'H'.
CONCATENATE 'PAGE NO : ' pageno ' of ' '****' INTO
wa_header-info SEPARATED BY space.
APPEND wa_header TO t_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
it_list_commentary = t_header.
ENDFORM. "top_of_page
please, give me a guidance.
Best regards.Hi Please refer this program. You have not written exact problems here. Anyways refer below code:-
REPORT ZRIL_ALVEVENTS .
TYPE-POOLS : SLIS.
DEFINITION OF DATA INTERNAL TABLE
DATA : IT_SFLIGHT TYPE STANDARD TABLE OF SFLIGHT.
DEFINITION OF FIELDCATALOG INTERNAL TABLE
DATA : WA_FCAT TYPE SLIS_FIELDCAT_ALV, "WORK AREA FOR FIELD CATALOG
IT_FCAT TYPE SLIS_T_FIELDCAT_ALV.
DEFINITION FOR EVENT TABLE
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT. "WORK AREA FOR EVENT"
DEFINE THE NAME LIST HEADER
DATA : FORMNAME TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST'.
DEFINE THE TABLE FOR LIST OF ACTION ON EVENT SPECIFIED IN LIST HEADER
DATA : IT_ACTION TYPE SLIS_T_LISTHEADER,
WA_ACTION TYPE SLIS_LISTHEADER. " WORK AREA FOR LIST OF "
*POPULATE DATA FROM SFLIGHT TABLE
SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT.
MAKE THE FIELDCATALOG TABLE FOR SFLIGHT
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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.
GET THE LIST OF EVENTS IN EVENT INTERNAL TABLE
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS
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.
GET THE NAME OF EVENT (TOP-OF-LIST) FROM LIST OF EVENTS IN EVENT TABLE
READ TABLE IT_EVENTS
WITH KEY NAME = SLIS_EV_TOP_OF_LIST
INTO WA_EVENTS.
IF READ OPERATION SUCCESSFUL
MOVE NAME OF LIST HEADER INTO WORK AREA OF EVENTS
AND APPEND THAT WORK AREA TO EVENTS TABLE THAT CONTAINS LIST OF
EVENTS
IF SY-SUBRC = 0.
MOVE FORMNAME TO WA_EVENTS-FORM.
APPEND WA_EVENTS TO IT_EVENTS.
ENDIF.
SPECIFY ONE ACTON ON EVENT IN WORK AREA AND APPEND THAT ACTION TO
TABLE OF ACTION
WA_ACTION-TYP = 'H'.
WA_ACTION-INFO = TEXT-001.
APPEND WA_ACTION TO IT_ACTION.
CLEAR WA_ACTION.
WA_ACTION-TYP = 'S'.
WA_ACTION-KEY = TEXT-002.
WA_ACTION-INFO = TEXT-003.
APPEND WA_ACTION TO IT_ACTION.
CALL THE SUBROUTINE TO DISPLAY THE LIST
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT = IT_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_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.
FUNCTION MODULE THAT WILL BE CALLED AUTOMATICALLY WHEN THE
TOP-OF-LIST EVENT IS TRIGGERED.
FORM TOP_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_ACTION
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
Regards
Abhii..
Edited by: Abhii on Nov 10, 2009 1:00 PM -
Hi friends,
I have created one program with alv list, but i am unable to add one header and footer, also i have to add one logo to the program. Plese some one tell me a easy procedure to add a header, footer and also a logo. If you can show me one with example that would be very helpful.
This is my program, plz add the necessary parts.
*& Report Y_BOM2_ALV
REPORT y_bom2_alv LINE-SIZE 350 LINE-COUNT 350.
*& Include YINCLUDE1
TABLES : mast, stko, stpo.
TYPE-POOLS : slis.
DATA : BEGIN OF iall OCCURS 10,
matnr LIKE mast-matnr,
werks LIKE mast-werks,
stlan LIKE mast-stlan,
stlal LIKE mast-stlal,
stlst LIKE stko-stlst,
posnr LIKE stpo-posnr,
idnrk LIKE stpo-idnrk,
menge LIKE stpo-menge,
meins LIKE stpo-meins,
ausch LIKE stpo-ausch,
lgort LIKE stpo-lgort,
END OF iall.
DATA : i_repid LIKE sy-repid,
i_lines LIKE sy-tabix.
DATA : int_fcat TYPE slis_t_fieldcat_alv.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE title1.
PARAMETER : p_werks LIKE mast-werks.
SELECT-OPTIONS : s_matnr FOR mast-matnr.
SELECTION-SCREEN END OF BLOCK a1.
INITIALIZATION.
title1(50) = ' Bill Of Material Input Screen '.
*& Include YINCLUDE2
START-OF-SELECTION.
SELECT mastmatnr mastwerks maststlan maststlal stko~stlst
stpoposnr stpoidnrk stpomenge stpomeins stpo~ausch
stpo~lgort INTO TABLE iall FROM stpo INNER JOIN stko ON
stpostlnr = stkostlnr INNER JOIN mast ON
stpostlnr = maststlnr WHERE mast~werks EQ
p_werks AND mast~matnr IN s_matnr.
IF sy-subrc <> 0 OR p_werks EQ ' ' OR s_matnr EQ ' '.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = 'ERROR MESSAGE ( INPUT ERROR / WRONG INPUT ) '
textline1 = ' PLANT / MATERIAL Invalid or Empty '
textline2 = ' Plese enter plant no / material no again '
start_column = 20
start_row = 5.
EXIT.
ENDIF.
CLEAR i_lines.
DESCRIBE TABLE iall LINES i_lines.
IF i_lines LT 1.
WRITE: /
'No materials found.'.
EXIT.
ENDIF.
END-OF-SELECTION.
i_repid = sy-repid.
*& Include YINCLUDE3
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'IALL'
i_inclname = i_repid
CHANGING
ct_fieldcat = int_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = i_repid
it_fieldcat = int_fcat
i_save = 'A'
TABLES
t_outtab = iall
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.Hi Tapodipta,
See below example and modify ur code according to ur requirement..
REPORT ZTEST_ALV_CHECK .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT type slis_layout_alv,
x_events type slis_alv_event,
it_events type SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
x_events-NAME = SLIS_EV_END_OF_PAGE.
x_events-FORM = 'END_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
x_events-NAME = SLIS_EV_TOP_OF_PAGE.
x_events-FORM = 'TOP_OF_PAGE'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
x_events-NAME = slis_ev_end_of_list.
x_events-FORM = 'END_OF_LIST'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM TOP_OF_PAGE.
* BREAK-POINT.
WRITE: / 'TOP_OF_PAGE'.
ENDFORM.
FORM END_OF_LIST.
* BREAK-POINT.
"here you can use this for footer
WRITE: / 'FOR FOOTER'.
ENDFORM.
FORM END_OF_PAGE.
* BREAK-POINT.
WRITE: / 'END_OF_PAGE'.
ENDFORM.
Go through the link as well..
Re: ALV Footer
Hope it will solve ur problem..
<b>Reward points if useful..</b>
Thanks & Regards
ilesh 24x7 -
How to get subtotal value in ALV list display
Hi all,
How to give condition on the value of subtotal line in ALV list display,
i.e.if value of subtotal of plan quantity = actual quantity (in red oval) it should show the message
'ON TIME DELIVERY' else it should not show messagee.In my case(shown in red oval) its
showing for each subtotal value. I know how to change the subtotal text but i want to change
with respect to value of the subtotal.(plz refer attachment)
Any input regard to this will be achieved great.
Many thanks in advance.
samadhan shinde.Hi Samadhan,
I am awaiting for solution for this problem.....but as i think dynamically displaying sub total based on
matching actual quantity and planned quantity is bit complicated.
My idea is to display matched quantities in one block and unmatched quantities in another. I mean using blocked list.
awaiting suggestions.
regards, -
Hi all,
Can anyone tell me if it is possible to display LOGO while using ALV list i.e with 'REUSE_ALV_BLOCK_LIST_APPEND'
& 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
If it is possible, how can I do it? I had tried COMMENTRY_WRITE in Top Of Page, I am able to display the text but not the logo.
If it is not possible what could be other possible way to do it?
Thanks in advance,
VimalHi Vimal,
Welcome to SDN.
In case you want to change your program using Grid, then refer the link for Logo upload.
Re: How do I insert a logo in ALV using Function Modules?
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
Reward points if this Helps.
Manish -
Hi,
I am Using ALV list to display data,In that when itry to display currency field it is giving run time error.
Following is the code i am using
lf_fcat-fieldname = 'SALARYE'.
lf_fcat-tabname = 'IT_EMPLOYEE'.
lf_fcat-col_pos = l_cnt.
lf_fcat-emphasize = 'X'.
lf_fcat-outputlen = 15.
lf_fcat-ref_tabname = 'PA0008'. "<--- Ref table
lf_fcat-ref_fieldname = 'ANCUR'. "<-----ref field
lf_fcat-decimals_out = 2.
lf_fcat-seltext_l = text-061.
append lf_fcat to it_fcat.
clear lf_fcat.Hi,
Please check in the internal table 'IT_EMPLOYEE' , the relevant currency field as it should type compatible with your reference table field.
Thanks,
Dhruv Kumar Malhotra -
How to update a table with ALV list reocrds
Dear All,
I have a requirement to display records in ALV list and these records
should get updated in a table and I should also be able to insert new
records in an ALV list.
Could any body please let me know how to do this. This is an urgent requirement.You can use Table Control instead. Check the following examples in SE38
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at
RSDEMO_TABLE_CONTROL
Regards
Gopi -
Error messages pop up in ALV list (OOPS)
Hi All,
I want to display error messages in ALV list using OOPS. I am using methods 'ADD_PROTOCOL_ENTRY' and 'DISPLAY_PROTOCOL' of class 'CL_ALV_CHANGED_DATA_PROTOCOL' to display messages but the problem is that n the pop up, field name is not coming.
Actually this method returns the name of the field in which some data is changed but my requirement is to display a field name which may or may not change. Like if anything in the list is changed and we press a button on application toolbar, it should check for a specific field's value. If value is not filled, it should display error messages for all the rows in which value is not filled. Currently I am using above methods but this field name is not coming.
Please tell me how to do this.
Thanks and regards,
RidhimaDoes anyone have solution to this, I am facing same problem!!!!
-
How to print header lines at the top of every page with Alv list display?
Dear all,
I need a requirement with printing issue. A program list should be printed with the function reuse_alv_list_display.
The list has several pages and then can be printed but the header lines appear only first page when they printed. The other pages don't have header lines, they continue with the next record of the list remaining from previous page. I use the alv parameters as below:
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_pf_status_set = 'ALV_PF_STATUS'
is_layout = ls_layo
it_fieldcat = lt_fcat
i_default = 'X'
i_save = 'A'
is_variant = ls_variant
it_events = lt_events
TABLES
t_outtab = lt_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
and lt_events as below:
ls_event-name = 'END_OF_LIST'.
ls_event-form = 'ALV_END_OF_LIST'.
APPEND ls_event TO lt_events.
ls_event-name = 'END_OF_PAGE'.
ls_event-form = 'ALV_END_OF_PAGE'.
APPEND ls_event TO lt_events.
ls_event-name = 'TOP_OF_LIST'.
ls_event-form = 'ALV_TOP_OF_LIST'.
APPEND ls_event TO lt_events.
ls_event-name = 'TOP_OF_PAGE'.
ls_event-form = 'ALV_TOP_OF_PAGE'.
APPEND ls_event TO lt_events.
So, how can I print header lines for every page?
Best Regards,Hello Saba,
Your point might be very close to solution.
Because in the selection screen of the program there are two radio buttons, one of them visits 'REUSE_ALV_COMMENTARY_WRITE' function and the other doesn't. The one which visits has a problem with header liens in every page when printing. But I couldn't find out the solution yet.
reuse_alv_list_display uses 4 event and of course I call subroutine. There are end_of_list, end_of_page, top_of_list and top_of_page. I use in the subroutine for top_of_page:
CALL FUNCTION 'LVC_TRANSFER_TO_SLIS'
EXPORTING
it_fieldcat_lvc = gt_fcat
IMPORTING
et_fieldcat_alv = lt_fcat
EXCEPTIONS
it_data_missing = 1
it_fieldcat_lvc_missing = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_LIST_WIDTH_GET'
EXPORTING
it_fieldcat = lt_fcat
IMPORTING
e_width = l_width.
WRITE l_reptx TO l_reptx CENTERED.
NEW-LINE.
WRITE: AT (l_width) l_reptx CENTERED.
SUBTRACT 10 FROM l_width.
WRITE: AT l_width sy-pagno RIGHT-JUSTIFIED.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_header
I_LOGO =
I_END_OF_LIST_GRID =
Do you have other suggestions ? -
How to get checkboxes in dynamic ALV list generation
hi ,
below is the code in which two lists we wll be displayed in one layout dynamically(i.e after entering the table name two lists wll be displayed in one layout) from two different clients(i.e. source and target).
TYPE-POOLS *
TYPE-POOLS: slis.
*-- Tables Declaration
TABLES: dd02l, t000.
*-- Constants Declaration
CONSTANTS: lc_z TYPE char1 VALUE 'Z',
lc_y TYPE char1 VALUE 'Y'.
DATA: ok_code TYPE sy-ucomm.
*--Internal table and Work Area Declaration
DATA: lines LIKE sy-dbcnt VALUE 0.
DATA: icursor TYPE cursor.
*DATA: icursor1 TYPE cursor.
DATA: lv_count TYPE i.
DATA: lv_table_var1 TYPE char1.
DATA: lv_ans TYPE char1.
DATA : gd_tabname TYPE tabname.
*for check boxes
DATA:l_pos TYPE i VALUE 1.
*field catalog for source client
DATA: c_cont1 TYPE REF TO cl_gui_custom_container,
c_alv1 TYPE REF TO cl_gui_alv_grid,
it_fieldcat1 TYPE lvc_t_fcat ,
ty_fieldcat1 TYPE lvc_s_fcat ,
struc_desc1 TYPE REF TO cl_abap_structdescr,
ls_fieldcatalogue1 TYPE slis_fieldcat_alv,
lt_fieldcatalogue1 TYPE slis_t_fieldcat_alv,
l_structure1 TYPE REF TO data,
l_table1 TYPE REF TO data.
for check boxes for source client
DATA: ls_edit TYPE lvc_s_styl,
lt_edit TYPE lvc_t_styl.
*field catalog for target client
DATA: c_cont2 TYPE REF TO cl_gui_custom_container,
c_alv2 TYPE REF TO cl_gui_alv_grid,
it_fieldcat2 TYPE lvc_t_fcat ,
ty_fieldcat2 TYPE lvc_s_fcat ,
struc_desc2 TYPE REF TO cl_abap_structdescr,
ls_fieldcatalogue2 TYPE slis_fieldcat_alv,
lt_fieldcatalogue2 TYPE slis_t_fieldcat_alv,
l_structure2 TYPE REF TO data,
l_table2 TYPE REF TO data.
*for source client
TYPES: BEGIN OF itab,
t_name TYPE tabname,
t_ref TYPE REF TO data,
*for checkboxes.
check(1),
style TYPE lvc_t_styl,
END OF itab.
*for target client
TYPES: BEGIN OF itab1,
t_name1 TYPE tabname,
t_ref1 TYPE REF TO data,
END OF itab1.
*-- Field Symbol declaration for Dynamic Internal Table for source client
FIELD-SYMBOLS: <tab> TYPE table.
FIELD-SYMBOLS: <tab1> TYPE ANY.
FIELD-SYMBOLS: <l_mandt>.
FIELD-SYMBOLS: <str_comp1> TYPE abap_compdescr,
<dyn_str1> TYPE ANY.
*--Field Symbol declaration for Dynamic Internal Table for target client
FIELD-SYMBOLS <tab2> TYPE table.
FIELD-SYMBOLS <tab3> TYPE ANY.
FIELD-SYMBOLS: <l_mandt1>.
FIELD-SYMBOLS: <str_comp2> TYPE abap_compdescr,
<dyn_str2> TYPE ANY.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_table LIKE dd02l-tabname,
p_mdt_fm LIKE t000-mandt DEFAULT sy-mandt,
p_mdt_to LIKE t000-mandt DEFAULT '910'.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON p_table.
lv_table_var1 = p_table+0(1).
*-- Validation for Standard tables
IF ( lv_table_var1 NE lc_z ) AND ( lv_table_var1 NE lc_y ).
MESSAGE e001(00) WITH text-002.
ENDIF.
*-- Start of Selection
START-OF-SELECTION.
--for source client--
DATA itab2 TYPE itab.
DATA t_ref1 TYPE REF TO data.
itab2-t_name = p_table.
--for target client--
DATA itab3 TYPE itab1.
DATA t_ref2 TYPE REF TO data.
itab3-t_name1 = p_table.
*-- Create Dynamic Internal table for source client
CREATE DATA itab2-t_ref TYPE TABLE OF (itab2-t_name) .
ASSIGN itab2-t_ref->* TO <tab>.
CREATE DATA t_ref1 LIKE LINE OF <tab>.
ASSIGN t_ref1->* TO <tab1>.
*-- Create Dynamic Internal table for target client
CREATE DATA itab3-t_ref1 TYPE TABLE OF (itab3-t_name1) .
ASSIGN itab3-t_ref1->* TO <tab2>.
CREATE DATA t_ref2 LIKE LINE OF <tab2>.
ASSIGN t_ref2->* TO <tab3>.
*-- get the number of entries in table
SELECT COUNT(*) FROM dd03l INTO lv_count
WHERE tabname = p_table
AND fieldname = 'MANDT'.
Check MANDT field the the table, if not exists through an error message
IF lv_count = 0.
MESSAGE i000(8i) WITH text-001 space space.
EXIT.
ELSE.
*-- Delete the Table Entries in the target system
DELETE FROM (p_table) CLIENT SPECIFIED
WHERE mandt = p_mdt_to.
COMMIT WORK.
*-- Open cursor
OPEN CURSOR WITH HOLD icursor FOR
SELECT * FROM (p_table) CLIENT SPECIFIED
WHERE mandt = p_mdt_fm.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH text-001.
ENDIF.
DO.
FETCH NEXT CURSOR icursor INTO TABLE <tab> PACKAGE SIZE 1000.
IF sy-subrc <> 0.
CLOSE CURSOR icursor.
EXIT.
ENDIF.
*-- Modify Field 'MANDT' with the Target Client no.
LOOP AT <tab> ASSIGNING <tab1>.
ASSIGN COMPONENT: 'MANDT' OF STRUCTURE <tab1> TO <l_mandt>.
<l_mandt> = p_mdt_to.
MODIFY <tab> FROM <tab1>.
lines = lines + 1.
ENDLOOP.
*-- Insert records into target table
INSERT (p_table) CLIENT SPECIFIED FROM TABLE <tab>.
*-- Close the cursor
CALL FUNCTION 'DB_COMMIT'.
ENDDO.
ENDIF.
for target client
*-- Open cursor
OPEN CURSOR WITH HOLD icursor FOR
SELECT * FROM (p_table) CLIENT SPECIFIED
WHERE mandt = p_mdt_to.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH text-001.
ENDIF.
DO.
FETCH NEXT CURSOR icursor INTO TABLE <tab2> PACKAGE SIZE 1000.
IF sy-subrc <> 0.
CLOSE CURSOR icursor.
EXIT.
ENDIF.
*-- Close the cursor
CALL FUNCTION 'DB_COMMIT'.
ENDDO.
ENDIF.
CALL SCREEN 3000.
*& Module STATUS_3000 OUTPUT
text
MODULE status_3000 OUTPUT.
SET PF-STATUS 'ZTESTMENU'.
SET TITLEBAR 'xxx'.
For Source client
IF c_alv1 IS INITIAL.
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CONTAINER_SOURCE'.
IF sy-subrc = 0.
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
ENDIF.
IF sy-subrc EQ 0.
PERFORM field_cat1.
ENDIF.
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
i_buffer_active =
i_bypassing_buffer =
i_consistency_check =
i_structure_name =
is_variant =
i_save =
i_default = 'x'
is_layout =
is_print =
it_special_groups =
it_toolbar_excluding =
it_hyperlink =
it_alv_graphics =
it_except_qinfo =
ir_salv_adapter =
CHANGING
it_outtab = <tab>
it_fieldcatalog = it_fieldcat1
it_sort =
it_filter =
EXCEPTIONS
valid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
For Target client
IF c_alv2 IS INITIAL.
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CONTAINER_TARGET'.
IF sy-subrc = 0.
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
ENDIF.
IF sy-subrc EQ 0.
PERFORM field_cat2.
ENDIF.
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
i_buffer_active =
i_bypassing_buffer =
i_consistency_check =
i_structure_name =
is_variant =
i_save =
i_default = 'x'
is_layout =
is_print =
it_special_groups =
it_toolbar_excluding =
it_hyperlink =
it_alv_graphics =
it_except_qinfo =
ir_salv_adapter =
CHANGING
it_outtab = <tab2>
it_fieldcatalog = it_fieldcat2
it_sort =
it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_3000 OUTPUT
*& Module USER_COMMAND_3000 INPUT
text
MODULE user_command_3000 INPUT.
CASE ok_code.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_3000 INPUT
*& Form field_cat1
text
--> p1 text
<-- p2 text
FORM field_cat1 .
Dynamic creation of a structure
CREATE DATA l_structure1 TYPE (p_table).
ASSIGN l_structure1->* TO <dyn_str1>.
Fields Structure
struc_desc1 ?= cl_abap_typedescr=>describe_by_data( <dyn_str1> ).
LOOP AT struc_desc1->components ASSIGNING <str_comp1>.
Build Fieldcatalog
ty_fieldcat1-fieldname = <str_comp1>-name.
ty_fieldcat1-ref_table = p_table.
CLEAR: l_pos.
*l_pos = l_pos + 1.
*ty_fieldcat1-seltext = 'CHECK'.
*ty_fieldcat1-fieldname = 'CHECK'.
*ty_fieldcat1-tabname = 'ITAB'.
*ty_fieldcat1-col_pos = l_pos.
*ty_fieldcat1-checkbox = 'X'.
*ty_fieldcat1-edit = 'X'.
*ty_fieldcat1-outputlen = '5'.
APPEND ty_fieldcat1 TO it_fieldcat1.
Build Fieldcatalog
ls_fieldcatalogue1-fieldname = <str_comp1>-name.
ls_fieldcatalogue1-ref_tabname = p_table.
APPEND ls_fieldcatalogue1 TO lt_fieldcatalogue1.
ENDLOOP.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = it_fieldcat1
i_length_in_byte =
IMPORTING
ep_table = l_table1
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 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.
ASSIGN l_table1->* TO <tab>.
Read data from the table selected.
SELECT * FROM (p_table)
CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE <tab>
WHERE mandt = p_mdt_fm.
ENDFORM. " field_cat1
*& Form field_cat2
text
--> p1 text
<-- p2 text
FORM field_cat2 .
CREATE DATA l_structure2 TYPE (p_table).
ASSIGN l_structure2->* TO <dyn_str2>.
Fields Structure
struc_desc2 ?= cl_abap_typedescr=>describe_by_data( <dyn_str2> ).
LOOP AT struc_desc2->components ASSIGNING <str_comp2>.
Build Fieldcatalog
ty_fieldcat2-fieldname = <str_comp2>-name.
ty_fieldcat2-ref_table = p_table.
APPEND ty_fieldcat2 TO it_fieldcat2.
Build Fieldcatalog
ls_fieldcatalogue2-fieldname = <str_comp2>-name.
ls_fieldcatalogue2-ref_tabname = p_table.
APPEND ls_fieldcatalogue2 TO lt_fieldcatalogue2.
ENDLOOP.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = it_fieldcat2
i_length_in_byte =
IMPORTING
ep_table = l_table2
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 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.
ASSIGN l_table2->* TO <tab2>.
Read data from the table selected.
SELECT * FROM (p_table) CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE <tab2>
WHERE mandt = p_mdt_to.
ENDFORM. " field_cat2
*FOR THE ABOVE CODE I NEED CHECKBOXES IN THE FIRST LIST AND I HAVE TRIED MANY WAYS BUT I HAVENT GOT THE SOLUTION. SO, PLZ CAN U EXPLAIN BY MENTIONING THE PIECE OF CODE IN ABOVE CODE.
PLZ DO THE NEED FUL.
thanks in advance.hi ,
below is the code in which two lists we wll be displayed in one layout dynamically(i.e after entering the table name two lists wll be displayed in one layout) from two different clients(i.e. source and target).
TYPE-POOLS *
TYPE-POOLS: slis.
*-- Tables Declaration
TABLES: dd02l, t000.
*-- Constants Declaration
CONSTANTS: lc_z TYPE char1 VALUE 'Z',
lc_y TYPE char1 VALUE 'Y'.
DATA: ok_code TYPE sy-ucomm.
*--Internal table and Work Area Declaration
DATA: lines LIKE sy-dbcnt VALUE 0.
DATA: icursor TYPE cursor.
*DATA: icursor1 TYPE cursor.
DATA: lv_count TYPE i.
DATA: lv_table_var1 TYPE char1.
DATA: lv_ans TYPE char1.
DATA : gd_tabname TYPE tabname.
*for check boxes
DATA:l_pos TYPE i VALUE 1.
*field catalog for source client
DATA: c_cont1 TYPE REF TO cl_gui_custom_container,
c_alv1 TYPE REF TO cl_gui_alv_grid,
it_fieldcat1 TYPE lvc_t_fcat ,
ty_fieldcat1 TYPE lvc_s_fcat ,
struc_desc1 TYPE REF TO cl_abap_structdescr,
ls_fieldcatalogue1 TYPE slis_fieldcat_alv,
lt_fieldcatalogue1 TYPE slis_t_fieldcat_alv,
l_structure1 TYPE REF TO data,
l_table1 TYPE REF TO data.
for check boxes for source client
DATA: ls_edit TYPE lvc_s_styl,
lt_edit TYPE lvc_t_styl.
*field catalog for target client
DATA: c_cont2 TYPE REF TO cl_gui_custom_container,
c_alv2 TYPE REF TO cl_gui_alv_grid,
it_fieldcat2 TYPE lvc_t_fcat ,
ty_fieldcat2 TYPE lvc_s_fcat ,
struc_desc2 TYPE REF TO cl_abap_structdescr,
ls_fieldcatalogue2 TYPE slis_fieldcat_alv,
lt_fieldcatalogue2 TYPE slis_t_fieldcat_alv,
l_structure2 TYPE REF TO data,
l_table2 TYPE REF TO data.
*for source client
TYPES: BEGIN OF itab,
t_name TYPE tabname,
t_ref TYPE REF TO data,
*for checkboxes.
check(1),
style TYPE lvc_t_styl,
END OF itab.
*for target client
TYPES: BEGIN OF itab1,
t_name1 TYPE tabname,
t_ref1 TYPE REF TO data,
END OF itab1.
*-- Field Symbol declaration for Dynamic Internal Table for source client
FIELD-SYMBOLS: <tab> TYPE table.
FIELD-SYMBOLS: <tab1> TYPE ANY.
FIELD-SYMBOLS: <l_mandt>.
FIELD-SYMBOLS: <str_comp1> TYPE abap_compdescr,
<dyn_str1> TYPE ANY.
*--Field Symbol declaration for Dynamic Internal Table for target client
FIELD-SYMBOLS <tab2> TYPE table.
FIELD-SYMBOLS <tab3> TYPE ANY.
FIELD-SYMBOLS: <l_mandt1>.
FIELD-SYMBOLS: <str_comp2> TYPE abap_compdescr,
<dyn_str2> TYPE ANY.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_table LIKE dd02l-tabname,
p_mdt_fm LIKE t000-mandt DEFAULT sy-mandt,
p_mdt_to LIKE t000-mandt DEFAULT '910'.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON p_table.
lv_table_var1 = p_table+0(1).
*-- Validation for Standard tables
IF ( lv_table_var1 NE lc_z ) AND ( lv_table_var1 NE lc_y ).
MESSAGE e001(00) WITH text-002.
ENDIF.
*-- Start of Selection
START-OF-SELECTION.
--for source client--
DATA itab2 TYPE itab.
DATA t_ref1 TYPE REF TO data.
itab2-t_name = p_table.
--for target client--
DATA itab3 TYPE itab1.
DATA t_ref2 TYPE REF TO data.
itab3-t_name1 = p_table.
*-- Create Dynamic Internal table for source client
CREATE DATA itab2-t_ref TYPE TABLE OF (itab2-t_name) .
ASSIGN itab2-t_ref->* TO <tab>.
CREATE DATA t_ref1 LIKE LINE OF <tab>.
ASSIGN t_ref1->* TO <tab1>.
*-- Create Dynamic Internal table for target client
CREATE DATA itab3-t_ref1 TYPE TABLE OF (itab3-t_name1) .
ASSIGN itab3-t_ref1->* TO <tab2>.
CREATE DATA t_ref2 LIKE LINE OF <tab2>.
ASSIGN t_ref2->* TO <tab3>.
*-- get the number of entries in table
SELECT COUNT(*) FROM dd03l INTO lv_count
WHERE tabname = p_table
AND fieldname = 'MANDT'.
Check MANDT field the the table, if not exists through an error message
IF lv_count = 0.
MESSAGE i000(8i) WITH text-001 space space.
EXIT.
ELSE.
*-- Delete the Table Entries in the target system
DELETE FROM (p_table) CLIENT SPECIFIED
WHERE mandt = p_mdt_to.
COMMIT WORK.
*-- Open cursor
OPEN CURSOR WITH HOLD icursor FOR
SELECT * FROM (p_table) CLIENT SPECIFIED
WHERE mandt = p_mdt_fm.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH text-001.
ENDIF.
DO.
FETCH NEXT CURSOR icursor INTO TABLE <tab> PACKAGE SIZE 1000.
IF sy-subrc <> 0.
CLOSE CURSOR icursor.
EXIT.
ENDIF.
*-- Modify Field 'MANDT' with the Target Client no.
LOOP AT <tab> ASSIGNING <tab1>.
ASSIGN COMPONENT: 'MANDT' OF STRUCTURE <tab1> TO <l_mandt>.
<l_mandt> = p_mdt_to.
MODIFY <tab> FROM <tab1>.
lines = lines + 1.
ENDLOOP.
*-- Insert records into target table
INSERT (p_table) CLIENT SPECIFIED FROM TABLE <tab>.
*-- Close the cursor
CALL FUNCTION 'DB_COMMIT'.
ENDDO.
ENDIF.
for target client
*-- Open cursor
OPEN CURSOR WITH HOLD icursor FOR
SELECT * FROM (p_table) CLIENT SPECIFIED
WHERE mandt = p_mdt_to.
IF sy-subrc <> 0.
MESSAGE e000(8i) WITH text-001.
ENDIF.
DO.
FETCH NEXT CURSOR icursor INTO TABLE <tab2> PACKAGE SIZE 1000.
IF sy-subrc <> 0.
CLOSE CURSOR icursor.
EXIT.
ENDIF.
*-- Close the cursor
CALL FUNCTION 'DB_COMMIT'.
ENDDO.
ENDIF.
CALL SCREEN 3000.
*& Module STATUS_3000 OUTPUT
text
MODULE status_3000 OUTPUT.
SET PF-STATUS 'ZTESTMENU'.
SET TITLEBAR 'xxx'.
For Source client
IF c_alv1 IS INITIAL.
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CONTAINER_SOURCE'.
IF sy-subrc = 0.
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
ENDIF.
IF sy-subrc EQ 0.
PERFORM field_cat1.
ENDIF.
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
i_buffer_active =
i_bypassing_buffer =
i_consistency_check =
i_structure_name =
is_variant =
i_save =
i_default = 'x'
is_layout =
is_print =
it_special_groups =
it_toolbar_excluding =
it_hyperlink =
it_alv_graphics =
it_except_qinfo =
ir_salv_adapter =
CHANGING
it_outtab = <tab>
it_fieldcatalog = it_fieldcat1
it_sort =
it_filter =
EXCEPTIONS
valid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
For Target client
IF c_alv2 IS INITIAL.
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CONTAINER_TARGET'.
IF sy-subrc = 0.
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
ENDIF.
IF sy-subrc EQ 0.
PERFORM field_cat2.
ENDIF.
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
i_buffer_active =
i_bypassing_buffer =
i_consistency_check =
i_structure_name =
is_variant =
i_save =
i_default = 'x'
is_layout =
is_print =
it_special_groups =
it_toolbar_excluding =
it_hyperlink =
it_alv_graphics =
it_except_qinfo =
ir_salv_adapter =
CHANGING
it_outtab = <tab2>
it_fieldcatalog = it_fieldcat2
it_sort =
it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_3000 OUTPUT
*& Module USER_COMMAND_3000 INPUT
text
MODULE user_command_3000 INPUT.
CASE ok_code.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_3000 INPUT
*& Form field_cat1
text
--> p1 text
<-- p2 text
FORM field_cat1 .
Dynamic creation of a structure
CREATE DATA l_structure1 TYPE (p_table).
ASSIGN l_structure1->* TO <dyn_str1>.
Fields Structure
struc_desc1 ?= cl_abap_typedescr=>describe_by_data( <dyn_str1> ).
LOOP AT struc_desc1->components ASSIGNING <str_comp1>.
Build Fieldcatalog
ty_fieldcat1-fieldname = <str_comp1>-name.
ty_fieldcat1-ref_table = p_table.
CLEAR: l_pos.
*l_pos = l_pos + 1.
*ty_fieldcat1-seltext = 'CHECK'.
*ty_fieldcat1-fieldname = 'CHECK'.
*ty_fieldcat1-tabname = 'ITAB'.
*ty_fieldcat1-col_pos = l_pos.
*ty_fieldcat1-checkbox = 'X'.
*ty_fieldcat1-edit = 'X'.
*ty_fieldcat1-outputlen = '5'.
APPEND ty_fieldcat1 TO it_fieldcat1.
Build Fieldcatalog
ls_fieldcatalogue1-fieldname = <str_comp1>-name.
ls_fieldcatalogue1-ref_tabname = p_table.
APPEND ls_fieldcatalogue1 TO lt_fieldcatalogue1.
ENDLOOP.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = it_fieldcat1
i_length_in_byte =
IMPORTING
ep_table = l_table1
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 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.
ASSIGN l_table1->* TO <tab>.
Read data from the table selected.
SELECT * FROM (p_table)
CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE <tab>
WHERE mandt = p_mdt_fm.
ENDFORM. " field_cat1
*& Form field_cat2
text
--> p1 text
<-- p2 text
FORM field_cat2 .
CREATE DATA l_structure2 TYPE (p_table).
ASSIGN l_structure2->* TO <dyn_str2>.
Fields Structure
struc_desc2 ?= cl_abap_typedescr=>describe_by_data( <dyn_str2> ).
LOOP AT struc_desc2->components ASSIGNING <str_comp2>.
Build Fieldcatalog
ty_fieldcat2-fieldname = <str_comp2>-name.
ty_fieldcat2-ref_table = p_table.
APPEND ty_fieldcat2 TO it_fieldcat2.
Build Fieldcatalog
ls_fieldcatalogue2-fieldname = <str_comp2>-name.
ls_fieldcatalogue2-ref_tabname = p_table.
APPEND ls_fieldcatalogue2 TO lt_fieldcatalogue2.
ENDLOOP.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = it_fieldcat2
i_length_in_byte =
IMPORTING
ep_table = l_table2
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 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.
ASSIGN l_table2->* TO <tab2>.
Read data from the table selected.
SELECT * FROM (p_table) CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE <tab2>
WHERE mandt = p_mdt_to.
ENDFORM. " field_cat2
*FOR THE ABOVE CODE I NEED CHECKBOXES IN THE FIRST LIST AND I HAVE TRIED MANY WAYS BUT I HAVENT GOT THE SOLUTION. SO, PLZ CAN U EXPLAIN BY MENTIONING THE PIECE OF CODE IN ABOVE CODE.
PLZ DO THE NEED FUL.
thanks in advance. -
How to get sub totals in alv list
Hi all,
i have a data in internal table which need to display by alv lis display, but i need to display
sub totals, like sub total by customer, subtotal by state, and complete total amount. In alv we have standard function
buttons , by i need by default it is displayed when i exe my report, hope to achieve that.
Please help me to know.
thanks,
rajeshhi Rajesh,
Check these threads out
http://www.sap-basis-abap.com/sapalv.htm
http://help.sap.com/saphelp_nw04/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
<b>GS_SORT-SUBTOT = 'X'.</b>
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
Regards,
Santosh -
Hello experts,
When i call the funcation module for REUSE_ALV_LIST_DISPLAY to display for than 5 field columns , then it gives dump saying field symbol not assigned, but the same thing using REUSE_ALV_GRID_DISPLAY works fine for any number of columns.
Kindly help how should this be done??Hi,
Here is the code using 'REUSE_ALV_LIST_DISPLAY'
just check this out...
tables: mara.
type-pools:slis.
data: itab type standard table of mara.
data: fcat type slis_t_fieldcat_alv.
data i_repid like sy-repid.
select * from mara into table itab.
i_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = i_repid
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME = 'MARA'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 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_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT = fcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab.
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks & Regards
Ashu Singh -
ALV List with two rows of heading
Hi All,
I am working on ALV list display. I have six columns of heading in my ALV. Out of the six columns i need to display five columns in the first row and the sixth heading will be in the second row first column.
Ex:
A B C D E F
G
I need to display a row of values for Column G for every row of A,B,C,D,E,F.
How is this possible with ALV list display.
Ex.
A B C D E F
G
v1A v1B v1C v1D v1E v1F
v1G
v2A v2B v2C v2D v2E v2F
v2G
v3A v3B v3C v3D v3E v3F
v3G
Looking forward to ur reply.
Regards
RamananHi,
You can use a hierachial list to display your output as required.
You can check the example program BCALV_TEST_HIERSEQ_LIST.
Regards,
Ankur Parab
Edited by: Ankur Parab on Jun 15, 2009 12:33 PM -
Hi,
I am using ALV List and ALV grid in one of my custom reports.
There is no issue with ALV List when I print the report after running the program.
But when I use ALV Grid , the report runs good and when I try to print the report I get short dump "OBJECTS_NOT_CHARLIKE" in program "LKKBLF99" of the main program "SAPLKKBL".
I am using the function module "REUSE_ALV_GRID_DISPLAY" to run the report using ALV Grid and I get the above short dump when I try to print the report.
Can anyone help me please?
Thanks,
Ashok.Hai Ashok
Try with the following Code
*& Report ZALV_GRID *
REPORT ZALV_GRID .
TABLES: MARA.
TYPE-POOLS : SLIS.
Data declaration
DATA: BEGIN OF I_MARA OCCURS 0.
INCLUDE STRUCTURE MARA.
DATA: END OF I_MARA.
DATA: V_REPID LIKE SY-REPID.
selection-screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
SELECTION-SCREEN END OF BLOCK B1.
initialisation
INITIALIZATION.
S_MATNR-LOW = '1400'.
S_MATNR-HIGH = '1500'.
APPEND S_MATNR.
V_REPID = SY-REPID.
start-of-selection
START-OF-SELECTION.
SELECT * FROM MARA
INTO TABLE I_MARA
WHERE MATNR IN S_MATNR AND
MTART = P_MTART.
CHECK SY-SUBRC = 0.
end of selection
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'MARA'
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_MARA
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 & Regards
Sreenivasulu P -
ALV list -Runtime error using the Spreadsheet button(CTRL+SHIFT+F7)
Hi,
We are on ECC6.0.When ever I try to use the button 'Spreadsheet' (CTRLSHIFTF7) it gives me the following runtime error.It works fine if I use the export button.Also it works for ALV grid.Issue is only with ALV list.
Can you pelase advise waht could be the issue.
Thanks
Venkat
Runtime Errors GETWA_NOT_ASSIGNED
Date and Time 08.06.2009 16:02:22
Short text
Field symbol has not yet been assigned.
What happened?
Error in the ABAP Application Program
The current ABAP program "CL_SALV_BS_TT_RESULT_TABLE====CP" had to be
terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
You attempted to access an unassigned field symbol
(data segment 32781).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
Trigger Location of Runtime Error
Program CL_SALV_BS_TT_RESULT_TABLE====CP
Include CL_SALV_BS_TT_RESULT_TABLE====CM00L
Row 165
Module type (METHOD)
Module Name GET_CELL_VALUE
Source Code Extract
Line
SourceCde
135
call method cl_alv_xslt_transform=>get_days_since_1900
136
exporting
137
i_date = l_date
138
receiving
139
e_num = attribute01.
140
141
elseif ls_attribute-s_dfies-inttype eq cl_abap_typedescr=>typekind_time. "Time
142
data:
143
l_time type t.
144
145
l_time = <l_data>.
146
147
call method cl_alv_xslt_transform=>get_isotime_from_inttime
148
exporting
149
i_value = l_time
150
receiving
151
e_value = value.
152
153
*... fill attribute01 with percent value of actual day
154
call method cl_alv_xslt_transform=>get_percent_of_act_day
155
exporting
156
i_time = l_time
157
receiving
158
e_num = attribute01.
159
160
elseif ls_attribute-s_dfies-inttype ca if_salv_bs_log_exp_operand=>c_numeric and
161
ls_attribute-s_dfies-convexit is initial.
162
case ls_attribute-s_dfies-reference_field_type.
163
when if_salv_bs_c_data=>reffieldtype_curr.
164
*... get iso value for currency value
>>>>>
call method cl_alv_xslt_transform=>get_isonum_from_intnum
166
exporting
167
i_value = <l_data>
168
i_currency = <l_reference>
169
i_decimals = ls_attribute-s_dfies-decimals
170
importing
171
e_value = l_isovalue.
172
173
when if_salv_bs_c_data=>reffieldtype_quan.
174
*... get iso value for quantity value
175
call method cl_alv_xslt_transform=>get_isonum_from_intnum
176
exporting
177
i_value = <l_data>
178
i_unit = <l_reference>
179
i_decimals = ls_attribute-s_dfies-decimals
180
importing
181
e_value = l_isovalue.
182
183
when others.
184
*... get iso value for valueHi Pinaki,
Thanks for your reply.
below is my code.
data: t_fieldcat type slis_t_fieldcat_alv,
w_fieldcat like line of t_fieldcat,
w_layout type slis_layout_alv,
t_sort type slis_t_sortinfo_alv,
w_sort like line of t_sort,
t_events type slis_t_event,
w_events like line of t_events.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'ZSD_ORDERS'
i_bypassing_buffer = 'X'
changing
ct_fieldcat = t_fieldcat.
data: l_lines_fieldcat type i.
describe table t_fieldcat lines l_lines_fieldcat.
clear: w_fieldcat.:
w_fieldcat-col_pos = l_lines_fieldcat + 1.
w_fieldcat-datatype = 'QUAN'.
w_fieldcat-just = ' '.
w_fieldcat-do_sum = ' '.
w_fieldcat-fieldname = 'ZZSCLQTY'.
w_fieldcat-tabname = 'T_DATA'.
w_fieldcat-qfieldname = 'VRKME'.
w_fieldcat-seltext_s = text-a01.
w_fieldcat-seltext_m = text-a01.
w_fieldcat-seltext_l = text-a01.
append w_fieldcat to t_fieldcat.
Modify column headings
loop at t_fieldcat into w_fieldcat.
case w_fieldcat-fieldname.
when 'MATNR'.
w_fieldcat-no_zero = 'X'.
when 'ZZPRICECHECK'.
w_fieldcat-reptext_ddic = text-l01.
when 'KZWI5'.
w_fieldcat-reptext_ddic = text-l02.
when 'VBELN'.
w_fieldcat-hotspot = 'X'.
when 'BMENG'.
w_fieldcat-do_sum = 'X'.
when 'COUNTER'.
w_fieldcat-do_sum = 'X'.
w_fieldcat-reptext_ddic = text-l03.
when 'OBJDE'.
w_fieldcat-reptext_ddic = 'Obj ID'.
endcase.
modify t_fieldcat from w_fieldcat.
endloop.
Format output options
clear w_layout.
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
w_layout-get_selinfos = 'X'.
w_layout-detail_initial_lines = 'X'.
w_layout-group_change_edit = 'X'.
Specify list processing events
w_events-name = 'TOP_OF_PAGE'.
w_events-form = 'TOP_OF_PAGE'.
append w_events to t_events.
Fit Add List Variant from Selection Screen "003
clear: w_variant.
w_variant-report = sy-repid.
w_variant-variant = sp_vari.
end Fit02
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = w_repid
is_layout = w_layout
it_sort = t_sort
i_callback_user_command = 'USER_COMMAND'
is_variant = w_variant
i_save = 'A'
it_fieldcat = t_fieldcat[]
it_events = t_events[]
tables
t_outtab = t_data.
endform.
Maybe you are looking for
-
I can't take screen shots of dvds
i've tried with both 'preview' and 'grab' applications, as well as with every keyboard shortcut to take screen captures from dvds that i'm watching, and every time the capture is blank. does anyone know whats up with this? any help is appreciated. th
-
THE MENU OF CHANNELS ARE ALL THE ONES I CAN'T WATCH !!!
DON'T SEND ME A LIST OF CHANNELS THAT I CAN'T WATCH BECAUSE I DON'T HAVE THAT BUNDLE OR I HAVE TO PAY TO VIEW THEM. THE COMPUTER SHOULD SEND ME JUST THE CHANNELS I PAY FOR, IN A LIST, AND THEN THE EXTRAS IN ANOTHER SECTION. I WOULD BE WILLING TO P
-
Hi, I am trying to edit an OLE2 object (word document) in a report. whatever i do the i cannot select the object to edit. The object is contained in a repeating frame. Please help...
-
How Can I change Soldtoparty to Shiptoparty?
Hi, I raed some where like, We can't change sold to party to ship to party but change is possible ship to party to sold to party. If Yes, How Can I configure that in SAP. Thank you
-
Is there an upcoming update that will add 1080p h.264 encoding support, fix the HD DVD nonworking menu problem, and Fix the HD DVD h.264/.ac3 playback problems?