ALV program with Field Catalog
Hi ,
Can any body please provide me sample ALV programs with Field Catalog and GRID DISPLAY. and also please give me the steps for writing the program.
Thanks in advance.
KP
Hi,
For ALV GRID DISPLAY (using <b>OOPS</b>),
1)Create an object of the <b>container</b>(an instance of a class like cl_gui_custom_container).
2)Create an object of the <b>ALV using class cl_gui_alv_grid</b> and give the CONTAINER name that you define in your screen layout as the parent of the ALV.
3)Call the method <b>SET_TABLE_FOR_FIRST_DISPLAY</b> of the class cl_gui_alv_grid.
4)<b>Field catalog</b> is used when you want a variation of the standard structure to be displayed on your ALV.A variable of table type <b>LVC_T_FCAT</b> is defined and variations can be made as per the requirements.The variable is then passed in the method SET_TABLE_FOR_FIRST_DISPLAY.
<b>A SAMPLE PROGRAM:</b>
REPORT SAMPLE:
*-- GLOBAL DATA DECLARATIONS FOR ALV
<b>DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.</b>
DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
<b>DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.</b>
DATA gt_fieldcat TYPE lvc_t_fcat.
Data:i_spfli type table of spfli.
*The value CC_ALV is given to the custom container in the screen layout
START-OF-SELECTION.
select * from spfli into table i_spfli.
Call screen 100.
MODULE STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
*Create container
<b>CREATE OBJECT gr_ccontainer
EXPORTING container_name = gc_custom_control_name.</b>
*Create ALV
<b>CREATE OBJECT gr_alvgrid
EXPORTING i_parent = gr_ccontainer.</b>
*field catalog
<b>PERFORM prepare_field_catalog CHANGING gt_fieldcat.</b>
*to display the ALV
<b>CALL METHOD gr_alvgrid->set_table_for_first_display</b>
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
CHANGING
it_outtab = i_spfli[]
it_fieldcatalog = gt_fieldcat.
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.
ENDIF.
ENDMODULE.
*& Form prepare_field_catalog
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-ref_table = 'SPFLI'.
ls_fcat-fieldname = 'CARRID'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'CONNID'.
ls_fcat-ref_table = 'SPFLI'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'DEPTIME'.
ls_fcat-ref_table = 'SPFLI'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'ARRTIME'.
ls_fcat-ref_table = 'SPFLI'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
endform.
<b>For more sample programs refer:</b>http://www.geocities.com/victorav15/sapr3/abap_ood.html#d_grid
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
<b>-->download the PDF from following link.</b>
www.abap4.it/download/ALV.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
<b>Some more:</b>
http://www.sap-hefte.de/download/dateien/1025/087_leseprobe.pdf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
http://www.alvgmbh.de/dwnload/gonio_t.pdfhttp://
<b>You can get all demo programs for ALV:</b>Go to se38 and type BCALV* and press F4 for all demo porgrams.
Regards,
Beejal
**Reward if this helps
Similar Messages
-
How to download alv grid output(with field catalog) into excel file format
Hi all,
How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
Please help.
Regards,
Satya.Hi,
On list where alv is displayed, select export icon( green color -> ),select spread sheet.
This will display records in Excel sheet. -
Refresh REUSE_ALV_GRID_DISPLAY with Field Catalog
Hi Gurus.
Basicly : How can I refresh my ALV grid via field catalog?
Detail : I want refresh my ALV Grid (I am using Reuse_Alv_Grid_Display) with field catalog. Our end users want show/hide some columns. I have been adding a button at toolbar. If user click this. My ALV grid going refresh and show/hide columns. I have a global variable for this. If user click this I set its value X or ''. I set my catalog
Wa_cat-No_out = p_show
p_show will be 'X' or ''.
Perform Create_Alv_Catalog.
Perform ALVDisplay Tables IRapor.
If I re execute this lines. It is open another grid. It is not working clearlyHi Mehmet,
1. Due to some reasons, this
technique DOES NOT WORK.
2. However, we have a WORKAROUND
and it works FANTASTIC.
3. the key is
slis_selfield-EXIT = 'X'.
(in the call back FORM)
4. In the call back form,
do the following things :
a) reconstruct field catalogue,
b) show alv AGAIN
c) slis_selfield-EXIT = 'X'.
5. just copy paste this code in new program
a) it will show t001 (company info)
b) on double-clicking,
it will HIDE company text.
6.
REPORT abc.
TYPE-POOLS : slis.
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvwa TYPE slis_fieldcat_alv.
Select
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
i_callback_user_command = 'ITAB_USER_COMMAND'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
LOOP AT alvfc INTO alvwa.
IF alvwa-fieldname = 'BUTXT'.
alvwa-no_out = 'X'.
MODIFY alvfc FROM alvwa.
ENDIF.
ENDLOOP.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
i_callback_user_command = 'ITAB_USER_COMMAND'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IMPORTANT.
IMPORTANT.
whatrow-exit = 'X'.
ENDFORM. "itab_user_command
regards,
amit m. -
Hi ,
Can we create ALV tree in Field catalog and expand output table depending on the click on tree.
Regards,
SatyaDid you look at SLIS Dev. Class.
There are many samples in ALV.
ibrahim -
Hi,
I am trying to create a condition table for inventory management. I require it at material group / movement type level. I added the fields ZZMATKL (type MATKL) and ZZBWART (type BWART) in the structure KOMPBZ2 (which is present in in the include of structure KOMPBME).
I also added the two above custom fields in table V_T161F. But when I try to create a condition table I dont find the above two fields in the field catalog.
Please help.
Am I using an incorrect structure?
Thanks!!
AroopHi Friend,
Looking at your code, I found that you have not the fieldcatalog at all.
You need to fill the fieldcatalog with all the fields you want to display in the alv.
Check the following links regarding field catalog:
http://abap-gallery.blogspot.com/2007/07/field-catalog-in-alv.html
Check this link for sample program:
http://www.****************/Tutorials/ALV/SampleALVGridProgram.htm
Hope this helps you.
Any queries, get back to me.
Regards,
Chandra Sekhar -
ALV Grid: Alternate Field Catalog per Line Type possible?
I'm using the ALV Grid Classes: Is it possible to change the Field Catalog per line type? I have two different line types: 1) Interspersed headers and 2) data lines. The Interspersed headers should have no_zero = 'x' and the data lines no_zero = space.
It can be done by REUSE_ALV_HIERSEQ_LIST_DISPLAY in classic ALV .
Alternately, it can be done by ALV object model. Try SALV* and look into sample programs. -
Problem with field catalog after upgrade from 4.0
Hi experts,
We have recently upgraded from CRM 4.0 to 5.2.
I am now experiencing a problem with generation of a transport request for field catalog in transaction CTFC_CRM. I can generate the field catalog without errors.
The problem is that when I want to create the transport request in our dev system a pop up appears saying "Create object directory entry". Here I have to enter a package for some of the fields in the field catalog. The special thing is that the fields are not custom fields but rather SAP standard fields (using standard data elements). For example field BZIRK.
These are SAP standard fields but they are not standard in the field catalog. In 4.0 I did not get this prompt but this has apparently changed from 5.0.
What do I do? I guess if I need to create the objects I will need to use an SAP standard package. But how do I know what package to use?
Any comments or suggestions will be highly appreciated.
Best regards,
AndersHi,
If you did just install database, then you use Embed PL/SQL Gateway.
See this guide
Upgrading Oracle Application Express in Oracle Database Express Edition
I think you have not run step 5 script apxldimg.sql
Regards,
Jari -
Radio button in ALV without using field catalog
Hi All,
My requirement is i want to create a RFC function module to display the header table.
while executing the function module the output is of alv grid format.
i have used the structure for this.
i didnt create a layout and fieldcatalog.
now i need to add a radio button in that alv grid display.
how to create the radio button without using field catalog.
Thank in Advance.Hi Aishwarya,
You need to use the field catalog for displaying a field as a radio button in ALV grid.
Please refer to this link for doing so. [Radio buttons in ALV Grid|http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT]
You can use LVC_FIELDCATALOG_MERGE wherein you can use your structure and the Icon for Radiobutton.
Refer to this link -[Radiobuttons in ALV Grid 2|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a02535ce-9eaf-2910-ae8c-f2f2afc1c8e7?quicklink=index&overridelayout=true]
Best Regards,
Sharmila
Edited by: Sharmila Subramanian on Mar 18, 2011 12:34 PM -
ALV Grid Control -- Field Catalog
Hi ,
In the filed catalog for ALV grid control ( LVC_T_FCAT) ,there is a field called CHECKTABLE , can i use this to validate the value entered in that cell of a editable ALV.
If yes then what are the perquisites of using it.
Regards
ArunHi Arun,
look the help.sap.com documentation, all the field of the field catalog are describe and explain.
Regards
Frédéric -
ALV Reporting with Field Headings
Hi ,
Can anyone tell..
Can we Display Field heading with Some Common Heading for a group in ALV grid Reporting.
Below is the format...
GROSS Block DEP RESEREVE
GL CODES SAP register Unit`s Trial Check GL CODES SAP register Unit`s Trial Check
311100 38810062.33 38810062.33 0 0.00 0.00 0 0
311200 0 0 0 0.00 0.00 0 0Hi ,
Can anyone tell..
Can we Display Field heading with Some Common Heading for a group in ALV grid Reporting.
Below is the format...
GROSS Block DEP RESEREVE
GL CODES SAP register Unit`s Trial Check GL CODES SAP register Unit`s Trial Check
311100 38810062.33 38810062.33 0 0.00 0.00 0 0
311200 0 0 0 0.00 0.00 0 0 -
Create a ALV report with fields editable and entry to be saved in ztable
Hello Experts,
I have created the ALV report which has two of the fields editable. Now whenever user puts an entry in the ALV it has to be saved in the ZTABLE.
The report is displayed with editable fields but i'm not sure what has to be written in the 'USER COMMAND' subroutine to save the entries in ztable.
Please see my code belwo:-
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'ALV_USER_COMM'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
TABLES
t_outtab = it_bg2
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
Thanks,
Naveen
Edited by: jaikrishna on Sep 4, 2010 8:13 AMHi,
I have worked on similar requirement. You can do that on sy-ucomm value only and you have to call a FM and a method. For that end user has to click on a button which you need to create in the application toolbar. Say that button function code is 'SAVE'. Write the following code in your user command :
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
*Code to reflect the changes done in the internal table
DATA : REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C.
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
ENDIF.
CASE SY-UCOMM.
WHEN 'SAVE'.
*Data will come with the edited values from ALV
*Here you write your code to save entries into Z table
ENDCASE.
ENDFORM. "USER_COMMAND
Thanks & Regards,
Rock. -
Hi All,
We used the class CL_GUI_ALV_TREE for display.
We need to do the field editable, is it possible? How?
Thank you.This question has been asked and answered many times - please search.
matt -
URGENT ISSUE ! PLS SEE IT ( related to cureency field in field catalog)
Hi Gurus,
I have populated the field catalog inf like this.
is_FIELDCATALOG-FIELDNAME = 'W_EXT_AMOUNT'.
is_FIELDCATALOG-SELTEXT_M = 'Extended Amount'.
is_FIELDCATALOG-COL_POS = 4.
IS_FIELDCATALOG-OUTPUTLEN = 16.
is_FIELDCATALOG-REF_FIELDNAME = 'WAERS'.
is_FIELDCATALOG-REF_TABNAME = 'T001'.
IS_FIELDCATALOG-CFIELDNAME = 'DMBTR'.
is_fieldcatalog-ctabname = 'BSIS'.
APPEND IS_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR IS_FIELDCATALOG.
Data : W_EXT_AMOUNT type DMBTR.
I calculated it using
W_EXT_AMOUNT = IS_ERROR-AMOUNT * P_NETAMT.( amount is of type
DMBTR)
in the out put Amount is displayed with value 0,00
W_EXT_AMOUNT displayed as blank
when i print it for spool generation, its giving following dump
DUMP analysis.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLKKBL" had to be terminated because
come across a statement that unfortunately cannot be executed.
You attempted to access an unassigned field symbol
(data segment 95).
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.
SourceCde
2785 case gs_out-field_colcount.
2786 when 001.
2787 if gs_out_flags-slave ne 'X'.
2788 assign <fm01> to <field>.
2789 gs_fc = gs_mfc01.
2790 else.
2791 assign <fs01> to <field>.
2792 gs_fc = gs_sfc01.
2793 endif.
2794 when 002.
2795 if gs_out_flags-slave ne 'X'.
2796 assign <fm02> to <field>.
2797 gs_fc = gs_mfc02.
2798 else.
2799 assign <fs02> to <field>.
2800 gs_fc = gs_sfc02.
2801 endif.
2802 when 003.
2803 if gs_out_flags-slave ne 'X'.
2804 assign <fm03> to <field>.
2805 gs_fc = gs_mfc03.
2806 else.
2807 assign <fs03> to <field>.
2808 gs_fc = gs_sfc03.
2809 endif.
2810 when 004.
2811 if gs_out_flags-slave ne 'X'.
>>>> assign <fm04> to <field>.2813 gs_fc = gs_mfc04.
2814 else.
2815 assign <fs04> to <field>.
2816 gs_fc = gs_sfc04.
2817 endif.
Note : problem may be with field catalog population since if i remove W_EXT_AMOUNT it is working fine, not giving any dump.
Pls see.
Thanks & Regards
Srinivas RaoHi see this code and try again.
REPORT zn_alv_complex .
TABLES : vbrk .
TYPE-POOLS : slis .
CONSTANTS : gc_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
TYPES : BEGIN OF ty_vbrk ,
vbeln TYPE vbrk-vbeln ,
vkorg TYPE vbrk-vkorg,
vtweg TYPE vbrk-vtweg,
kunrg TYPE vbrk-kunrg,
END OF ty_vbrk,
BEGIN OF ty_vbrp,
vbeln TYPE vbrp-vbeln,
posnr TYPE vbrp-posnr,
matnr TYPE vbrp-matnr,
netwr TYPE vbrp-netwr,
END OF ty_vbrp,
BEGIN OF ty_final,
vbeln TYPE vbrk-vbeln ,
posnr TYPE vbrp-posnr,
matnr TYPE vbrp-matnr,
netwr TYPE vbrp-netwr,
vkorg TYPE vbrk-vkorg,
vtweg TYPE vbrk-vtweg,
kunrg TYPE vbrk-kunrg,
END OF ty_final .
DATA : it_vbrk TYPE TABLE OF ty_vbrk,
it_vbrp TYPE TABLE OF ty_vbrp,
it_final TYPE TABLE OF ty_final ,
wa_vbrk TYPE ty_vbrk,
wa_vbrp TYPE ty_vbrp,
wa_final TYPE ty_final ,
git_event TYPE slis_t_event,
git_layout TYPE slis_layout_alv,
git_fieldcat TYPE slis_t_fieldcat_alv,
gwa_fieldcat TYPE slis_fieldcat_alv.
SELECT-OPTIONS : s_vbeln FOR vbrk-vbeln,
s_vkorg FOR vbrk-vkorg,
s_vtweg FOR vbrk-vtweg.
START-OF-SELECTION .
SELECT vbeln vkorg vtweg kunrg
FROM vbrk
INTO TABLE it_vbrk
WHERE vbeln IN s_vbeln
AND vkorg IN s_vkorg
AND vtweg IN s_vtweg .
SELECT vbeln posnr matnr netwr
FROM vbrp
INTO TABLE it_vbrp
FOR ALL ENTRIES IN it_vbrk
WHERE vbeln = it_vbrk-vbeln .
LOOP AT it_vbrp INTO wa_vbrp .
READ TABLE it_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbrp-vbeln .
wa_final-vbeln = wa_vbrk-vbeln.
wa_final-posnr = wa_vbrp-posnr.
wa_final-netwr = wa_vbrp-netwr.
wa_final-matnr = wa_vbrp-matnr.
wa_final-vkorg = wa_vbrk-vkorg.
wa_final-vtweg = wa_vbrk-vkorg.
wa_final-kunrg = wa_vbrk-kunrg.
APPEND wa_final TO it_final.
CLEAR : wa_vbrk , wa_vbrp , wa_final .
ENDLOOP .
PERFORM sub_fieldcatalog.
PERFORM sub_layout_init CHANGING git_layout.
PERFORM sub_build_event USING git_event[] .
PERFORM sub_alv_display.
*& Form SUB_FIELDCATALOG
text
FORM sub_fieldcatalog.
REFRESH git_fieldcat.
gwa_fieldcat-col_pos = 0.
gwa_fieldcat-fieldname = 'VBELN'.
gwa_fieldcat-tabname = 'IT_FINAL'.
gwa_fieldcat-outputlen = 14.
gwa_fieldcat-seltext_l = 'Billing Doc.' .
gwa_fieldcat-seltext_m = 'Billing Doc.' .
gwa_fieldcat-seltext_s = 'Billing Doc.' .
APPEND gwa_fieldcat TO git_fieldcat .
gwa_fieldcat-col_pos = 1.
gwa_fieldcat-fieldname = 'POSNR'.
gwa_fieldcat-tabname = 'IT_FINAL'.
gwa_fieldcat-outputlen = 5.
gwa_fieldcat-seltext_l = 'Item.' .
gwa_fieldcat-seltext_m = 'Item' .
gwa_fieldcat-seltext_s = 'Item' .
APPEND gwa_fieldcat TO git_fieldcat .
gwa_fieldcat-col_pos = 2.
gwa_fieldcat-fieldname = 'VKORG'.
gwa_fieldcat-tabname = 'IT_FINAL'.
gwa_fieldcat-outputlen = 14.
gwa_fieldcat-seltext_l = 'Sales Org' .
gwa_fieldcat-seltext_m = 'Sales Org' .
gwa_fieldcat-seltext_s = 'Sales Org' .
APPEND gwa_fieldcat TO git_fieldcat .
gwa_fieldcat-col_pos = 3.
gwa_fieldcat-fieldname = 'VTWEG'.
gwa_fieldcat-tabname = 'IT_FINAL'.
gwa_fieldcat-outputlen = 14.
gwa_fieldcat-seltext_l = 'Dist. Ch.' .
gwa_fieldcat-seltext_m = 'Dist. Ch.' .
gwa_fieldcat-seltext_s = 'Dist. Ch.' .
APPEND gwa_fieldcat TO git_fieldcat .
gwa_fieldcat-col_pos = 4.
gwa_fieldcat-fieldname = 'MATNR'.
gwa_fieldcat-tabname = 'IT_FINAL'.
gwa_fieldcat-outputlen = 18.
gwa_fieldcat-seltext_l = 'Material' .
gwa_fieldcat-seltext_m = 'Material' .
gwa_fieldcat-seltext_s = 'Material' .
APPEND gwa_fieldcat TO git_fieldcat .
gwa_fieldcat-col_pos = 5.
gwa_fieldcat-fieldname = 'NETWR'.
gwa_fieldcat-tabname = 'IT_FINAL'.
gwa_fieldcat-outputlen = 14.
gwa_fieldcat-seltext_l = 'Price' .
gwa_fieldcat-seltext_m = 'Price' .
gwa_fieldcat-seltext_s = 'Price' .
gwa_fieldcat-do_sum = 'X' .
APPEND gwa_fieldcat TO git_fieldcat .
ENDFORM . "SUB_FIELDCATALOG
*& Form sub_alv_display
text
FORM sub_alv_display .
DATA : gv_repid TYPE sy-repid .
gv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repid
i_callback_user_command = 'USER-COMMAND'
is_layout = git_layout
it_fieldcat = git_fieldcat
i_save = 'A'
it_events = git_event[]
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM . "sub_alv_display
*& Form
text
FORM sub_layout_init CHANGING xyt_layout TYPE slis_layout_alv.
CLEAR xyt_layout .
xyt_layout-colwidth_optimize = 'X'.
xyt_layout-zebra = 'X' .
ENDFORM. "SUB_LAYOUT_INIT
*& Form SUB_BUILD_EVENT
text
-->XT_EVENT text
FORM sub_build_event USING xt_event TYPE slis_t_event .
DATA : lwa_event TYPE slis_alv_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = xt_event
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
READ TABLE xt_event WITH KEY name = slis_ev_top_of_page INTO
lwa_event.
lwa_event-form = gc_top_of_page.
IF sy-subrc EQ 0 .
MODIFY xt_event FROM lwa_event TRANSPORTING form WHERE name =
gc_top_of_page.
ENDIF.
ENDFORM. "SUB_BUILD_EVENT
*& Form TOP_OF_PAGE
text
FORM top_of_page .
CONSTANTS : lc_s TYPE char01 VALUE 'S'.
DATA : lv_ecfld(250) TYPE c ,
lwa_header TYPE slis_listheader ,
lv_date(10) TYPE c,
lv_user(10) TYPE c,
lit_alv_header TYPE slis_t_listheader .
CLEAR : lv_user , lv_date .
CLEAR : lwa_header .
lwa_header-typ = 'S'.
lv_ecfld = 'User'.
lwa_header-key = lv_ecfld .
lwa_header-info = sy-uname.
APPEND lwa_header TO lit_alv_header .
CLEAR : lwa_header .
lwa_header-typ = 'S'.
lv_ecfld = 'Date'.
lwa_header-key = lv_ecfld .
lwa_header-info = sy-datum .
APPEND lwa_header TO lit_alv_header .
CLEAR : lwa_header .
lwa_header-typ = 'S'.
APPEND lwa_header TO lit_alv_header .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lit_alv_header.
ENDFORM . "TOP_OF_PAGE
Regards,
Nihar Swain . -
New Field Addition in Allowed Field Catalogs -Pricing.
*Hi,
We have requirement of having Material Description field in the Allowed Field Catalogs in SPRO --> SD --> Basic Functions --> Pricing --> Pricing Controls --> Define Condition tables --> Allowed Field Catalogs in order to fetch the same for Pricing Condition Table creation with Mtrl Description as Key Combination.
Hence, as a first step, have added the MAKTX field inside the "ZStructure" (which was created before) inside Main Structure KOMP and activated the same. Then i have added the same field MAKTX in Allowed Field Catologs of Pricing using New Entries.
Now i have tried to create a new Pricing Condition Table with field catalog of Material Description (the added field), but there is no such field is available for selection.
Is there anything i missed to do, so that the newly added field is available during New Condition Table Creation with key combination of the added field.
Appreciate your promot response.*
Rgds,Hi,
Thanks for your response.
Have added the required field in Structure KOMG now and it is available for selection in Condition Table Field Catalogs. However, am allowed to select this field only when creating a New Condition Table and if i want to add this field in the already created condition table in change mode, it thows an error message - "Function Code cannot be selected".
How to proceed further.
Rgds, -
Dynamic select with field symbols
Hi guys,
I have 2 tables.
First table is the popup fields using fm popup_get_values:
tab1-tabname
tab1-fieldname
tab1-value
Second table is the input fields to be displayed in the popup box:
tab2-transactno
tab2-docno
tab2-customer
tab2-postdate
etc... (it has many fields)
Let's say currently i loop at tab2 and assign each value of the individual fields to a variable each:
loop at tab2
v_transactno = tab2-transactno
v_docno = tab2-docno
etc...
endloop.
My question is how do i assign each variable to the popup fields according to the fieldname so that it can get its corresponding value correctly?
How can this be done dynamically?
Can the loop above be done dynamically as well coz it has alot of fields to cater for?
Please help me solve this problem. Futher similar examples would be much appreciated as well.
Thank you very much!Hi
see the concept of field sysmbols and do accordingly
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
check the below links u will get the answers for your questions
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect
You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Regards
Anji
Maybe you are looking for
-
Problem printing PDF in B&W with Safari?
Hi, here is my printing challenge: when I download PDF from Safari (now on Mountain Lion) and I try to print it black and white it keeps printing in color. To print I am using the "new" translucent save and print menu that appears at the bottom of t
-
The windows 8 button at the bottom of the screen has stopped responding although it gives a little vibration when touched nothing happens wheras it used to return you to the metro home screen whenever it was touched. I assume that the button works be
-
Socket connection between Java and C
I want to establish socket connection between Java client and C server (on Unix). Can anybody tell how to do it? Will the socket created in client be available in server. I tried out but there was no response from the server.
-
Document Security in web service.
Hi all, I am trying to implement document security in the web service. here for that i have create a Ejb and exposed it as web service. now that i have enabled the Document security for the SOAP message. i want to know that which certificate (Keys) a
-
Lens correction and my Sony DSLR-A700
Lightroom 3 doesn't recognize my camera or my Sigma 70mm Macro. My other lens isn't imcluded yet but my Sigma lens and camera is. Why doesn't Ligtroom recognize them? Is it me or Lightroom?