ALV grafix in report
hai experts,
currently i am using ECC 5.0.
I want to call graphic as ALV grafix instead of SAP business grafix.
I couldn't able to modify the chart in sap business grafix.
report transsaction is MCPO
How to do these.
My requirement is , to cal ALV grafix in MCPO.
thanks
Bhuvanesh
hai experts,
currently i am using ECC 5.0.
I want to call graphic as ALV grafix instead of SAP business grafix.
I couldn't able to modify the chart in sap business grafix.
report transsaction is MCPO
How to do these.
My requirement is , to cal ALV grafix in MCPO.
thanks
Bhuvanesh
Similar Messages
-
Can i use classes or grid control (alv) in normal report
Hai,
Can i use Grid control or classes in normal report.If yes what are the steps that i have to go for.
thanks
kiranSure... here is a sample of an ALV in a report. All you need to do is call a screen. I believe that there is also a way to do it without having to create a screen.
REPORT ZRICH_0001.
DATA: BEGIN OF I_ALV OCCURS 0,
MATNR TYPE MARA-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF I_ALV.
DATA: ALV_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: ALV_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: LAYOUT TYPE LVC_S_LAYO.
DATA: FIELDCAT TYPE LVC_T_FCAT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_MATNR FOR i_ALV-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA.
CALL SCREEN 100.
* Module status_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
DATA: VARIANT TYPE DISVARIANT.
VARIANT-REPORT = SY-REPID.
VARIANT-USERNAME = SY-UNAME.
* Create Controls
CREATE OBJECT ALV_CONTAINER
EXPORTING
CONTAINER_NAME = 'ALV_CONTAINER'.
CREATE OBJECT ALV_GRID
EXPORTING
I_PARENT = ALV_CONTAINER.
* ALV Specific. Data selection.
* Populate Field Catalog
PERFORM GET_FIELDCATALOG.
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LAYOUT
IS_VARIANT = VARIANT
I_SAVE = 'U'
I_STRUCTURE_NAME = 'I_ALV'
CHANGING
IT_OUTTAB = I_ALV[]
IT_FIELDCATALOG = FIELDCAT[].
ENDMODULE.
* Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK' OR 'CANC'.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
IF SY-SUBRC = 0.
SET SCREEN 0.
LEAVE SCREEN.
ELSE.
LEAVE PROGRAM.
ENDIF.
WHEN 'EXIT'.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
* FORM GET_DATA
FORM GET_DATA.
SELECT * INTO CORRESPONDING FIELDS OF TABLE I_ALV
FROM MARA
INNER JOIN MAKT
ON MARA~MATNR = MAKT~MATNR
WHERE MARA~MATNR IN S_MATNR
AND MAKT~SPRAS = SY-LANGU.
SORT I_ALV ASCENDING BY MATNR.
ENDFORM.
* Form Get_Fieldcatalog - Set Up Columns/Headers
FORM GET_FIELDCATALOG.
DATA: LS_FCAT TYPE LVC_S_FCAT.
REFRESH: FIELDCAT.
CLEAR: LS_FCAT.
LS_FCAT-REPTEXT = 'Material Number'.
LS_FCAT-COLTEXT = 'Material Number'.
LS_FCAT-FIELDNAME = 'MATNR'.
LS_FCAT-REF_TABLE = 'I_ALV'.
LS_FCAT-OUTPUTLEN = '18'.
LS_FCAT-COL_POS = 1.
APPEND LS_FCAT TO FIELDCAT.
CLEAR: LS_FCAT.
LS_FCAT-REPTEXT = 'Material Description'.
LS_FCAT-COLTEXT = 'Material Description'.
LS_FCAT-FIELDNAME = 'MAKTX'.
LS_FCAT-REF_TABLE = 'I_ALV'.
LS_FCAT-OUTPUTLEN = '40'.
LS_FCAT-COL_POS = 2.
APPEND LS_FCAT TO FIELDCAT.
ENDFORM.
Regards,
Rich Heilman -
Hiding fields in ALV DRILLED DOWN REPORT
Hi
My scenario is like this i created a alv drilled down report , in that once the user executes it ,it will displays the header contents of the purchase order.
If the user double clicks on any of the header line item it will displays the item detials of the particular header data..
My probelm is if i double click it i am getting the header details added with the item fields..i want to hide the header detials if i want to c the item level details..
Can any suggest me some better ways to hide the header contents ??
Arun Josephhi,
check ur field cat...
R u using same name?
If possible paste ur code here... -
Alv show in report but when see in spool (after run background job) there i
my program have some error when i run result alv show in report but when see in spool (after run background job) there is no data, (other program can see result in spool)
Please help
here is some example of my program
********************************declare internal table*****************************
internal table output for BDC
data : begin of t_output occurs 0,
bukrs type anla-bukrs,
anln1 type anla-anln1,
anln2 type anla-anln2,
zugdt type anla-zugdt,
result(70) type c,
end of t_output.
*****get data from loop********************************
loop at t_anla.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = t_anla-anln1
IMPORTING
OUTPUT = t_anla-anln1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = t_anla-anln2
IMPORTING
OUTPUT = t_anla-anln2.
check record is correct or not
select single bukrs anln1 anln2 zugdt
into w_output
from anla
where bukrs = t_anla-bukrs and
anln1 = t_anla-anln1 and
anln2 = t_anla-anln2
zugdt = '00000000'
if record is correct
if sy-subrc = 0 and w_output-zugdt = '00000000'.
w_output-bukrs = t_anla-bukrs.
w_output-anln1 = t_anla-anln1.
w_output-anln2 = t_anla-anln2.
w_output-result = 'Yes : this asset can delete'.
append w_output to t_output.
if record is not correct
elseif sy-subrc = 0 and w_output-zugdt <> '00000000'.
there is error record this asset have value already
v_have_error = 'X'.
w_output-bukrs = t_anla-bukrs.
w_output-anln1 = t_anla-anln1.
w_output-anln2 = t_anla-anln2.
w_output-result = 'Error : this asset have value already'.
append w_output to t_output.
else.
there is error record this asset donot exist in table anla
v_have_error = 'X'.
w_output-bukrs = t_anla-bukrs.
w_output-anln1 = t_anla-anln1.
w_output-anln2 = t_anla-anln2.
w_output-result = 'Error : this asset doest not exist'.
append w_output to t_output.
endif.
*end of check record is correct or not
clear w_output.
endloop.
******************************show data in ALV***************************************************
show data from file in ALV
perform display_report_ALV.
*& Form display_report_ALV
form display_report_ALV.
DATA: LT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
LT_EVENTS TYPE SLIS_T_EVENT,
LV_REPID LIKE SY-REPID.
PERFORM ALV_DEFINE_FIELD_CAT USING LT_FIELD_CAT.
PERFORM ALV_HEADER_BUILD USING T_LIST_TOP_OF_PAGE[].
PERFORM ALV_EVENTTAB_BUILD USING LT_EVENTS[].
LV_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = LV_REPID
IT_FIELDCAT = LT_FIELD_CAT
I_SAVE = 'A'
IT_EVENTS = LT_EVENTS[]
TABLES
T_OUTTAB = t_output
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
WRITE: / 'Return Code : ', SY-SUBRC,
'from FUNCTION REUSE_ALV_GRID_DISPLAY'.
ENDIF.
endform.
*& Form alv_define_field_cat
text
-->P_LT_FIELD_CAT text
FORM ALV_DEFINE_FIELD_CAT USING TB_FCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: WA_FIELDCAT LIKE LINE OF TB_FCAT,
LV_COL_POS TYPE I.
DEFINE FIELD_CAT.
CLEAR WA_FIELDCAT.
ADD 1 TO LV_COL_POS.
WA_FIELDCAT-FIELDNAME = &1.
WA_FIELDCAT-REF_TABNAME = &2.
WA_FIELDCAT-COL_POS = LV_COL_POS.
WA_FIELDCAT-KEY = &3.
WA_FIELDCAT-NO_OUT = &4.
WA_FIELDCAT-REF_FIELDNAME = &5.
WA_FIELDCAT-DDICTXT = 'M'.
IF NOT &6 IS INITIAL.
WA_FIELDCAT-SELTEXT_L = &6.
WA_FIELDCAT-SELTEXT_M = &6.
WA_FIELDCAT-SELTEXT_S = &6.
ENDIF.
WA_FIELDCAT-DO_SUM = &7.
WA_FIELDCAT-OUTPUTLEN = &8.
APPEND WA_FIELDCAT TO TB_FCAT.
END-OF-DEFINITION.
FIELD_CAT 'BUKRS' 'ANLA' 'X' '' 'BUKRS' 'Company Code' '' ''.
FIELD_CAT 'ANLN1' 'ANLA' 'X' '' 'ANLN1' 'Asset Number' '' ''.
FIELD_CAT 'ANLN2' 'ANLA' 'X' '' 'ANLN2' 'Asset Sub Number' '' ''.
FIELD_CAT 'ATEXT' 'T5EAE' 'X' '' 'ATEXT' 'Result' '' ''.
FIELD_CAT 'RESULT' '' 'X' '' 'RESULT' 'RESULT' '' ''.
ENDFORM. " alv_define_field_catHi,
Check this code..
FORM display_report_alv.
DATA: lt_field_cat TYPE slis_t_fieldcat_alv,
lt_events TYPE slis_t_event,
lv_repid LIKE sy-repid.
PERFORM alv_define_field_cat USING lt_field_cat.
PERFORM alv_header_build USING t_list_top_of_page[].
PERFORM alv_eventtab_build USING lt_events[].
lv_repid = sy-repid.
IF sy-batch EQ 'X'. ----> " System Field for Backgroud..if Background use list display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = lv_repid
it_fieldcat = lt_field_cat
i_save = 'A'
it_events = lt_events[]
TABLES
t_outtab = t_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ELSE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
it_fieldcat = lt_field_cat
i_save = 'A'
it_events = lt_events[]
TABLES
t_outtab = t_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDIF.
IF sy-subrc NE 0.
WRITE: / 'Return Code : ', sy-subrc,
'from FUNCTION REUSE_ALV_GRID_DISPLAY'.
ENDIF.
ENDFORM. "display_report_ALV -
ALV and Crystal Reports challenge
Hi there Gurus.
I already have posted this question in the Crystal section.
Maybe some of you ABAP Guys knows the answer here.
Our Customer have Crystal Reports Template includet so that the user can choose to display ALV in a nice Crystal Report.
We have made changes to the Template, and have included a logo in the top right corner of the Report Header Section.
When the report is started from ALV , a new Report Header Section is made.. and my old Report Header Section is pushed down.
The result is that the Logo no longer is in the top right corner.
The new section is made from ABAP maybe, and has Report Title and some information about which parameters has been used.
I am familiar in Crystal, but not so much in ABAP.
Any suggestions on how to solve this ?
We want the logo to be in the top right corner of the report.
Best Regards
IngridSerdar Simsekler , you seem to know a lot about ALV and what is happening there.
Do you know anything on where the logic is hidden, in what is passed on to Crystal form ALV?
And where it is placed in the report. ?
Best Regards Ingrid -
Reg. alv and interactive reports
Hi Friends,
What is the difference between alv and interactive reports?.
rewards are helpful answers.Hi,
ABAP List Viewer
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
Using ALV, we can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
Interactive Reports
As the name suggests, the user can Interact with the report. We can have a drill down into the report data.
Purpose
Interactive report provides you with comfortable functions for navigating through your data.
Use
Interactive report are used to display multiple list in one single report
It has basic list and then you can navigate to one or other screens in one single report
Enhance the efficiency & transparency of Business Processes
Example : Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details.
Advantage of ALV over Interactive:--
1> Graphic Can be added
2> Less Amount Of coding
Reward If Helpful -
ALV Block list report FILTERING
Hello All,
I am Working on ALV Block List Report. In that report i am having two Blocks.
if i set a filter for one block it is filtering that block.
My requirment is like this if iam setting a filter for one block, in the second block also have the same field, then filter should be setted to the second block aslo.
Is this possible, Can any one Help me out form this issue.
Thanks,
Feroz.Hello All,
I am Working on ALV Block List Report. In that report i am having two Blocks.
if i set a filter for one block it is filtering that block.
My requirment is like this if iam setting a filter for one block, in the second block also have the same field, then filter should be setted to the second block aslo.
Is this possible, Can any one Help me out form this issue.
Thanks,
Feroz. -
Send the list ouput of ALV or normal report to e-mail
how to send the list ouput of ALV or normal report to e-mail?
Already SAP is providing the option to send output to email
For ALV
Go to Print Preview> list> send to --> mail receipient
if it is normal list
list> Save/Send> office
a® -
Folder in alv grid display report
Hi Experts,
I have a requirement to generate the folder in alv grid display, to display the multiple line items where ever we have.
Actually I am displaying the material details and production order details.
If the material is having the multiple production order details , in that case we need to place all the production order details in one folder, and if you open that folder arrow, we have to display the production order details.
I am using REUSE_ALV_GRID_DISPLAY function module to develope this application. Here Hierseq list is recommended to use for this application, why because folder option is already available in grid display. that we can observe in CL6AN.
Is it possible to implement it through function modules or through OOABAP.
Actually, I have to generate the report which we can see in CL6AN Transaction code,,
Your valuable suggestions surely will attract the benifits.
Thanks in advance.
Ramesh.Hi ramesh,
Hierseq list is not supported in the grid display. You could do this using an OO tree display but this could be rather complicated. What about displaying one field per material line with the number of production orders. At double-click on that field, open a second grid display (possibly as popup) to show the production order details.
Regards,
Clemens -
How to get the 'hand' cursor on an ALV drill down report?
I have a drill down on PO # going to trans ME23N that is working great.
But I have noticed on my other drill downs (E.G for billing doc VF03) that when the report is displayed the drill down field value is a) underlined and b) has a 'Hand' appear when you place the cursor over the billing document field.
This does not happen on my PO # - it is not highlighted with an underscore, nor do you get the small hand - but it does work when you double click the field.
The field I am using on the ALV report is RSEG-EBELN. This is not a KEY field in the table - perhaps that is why it does not have the underscore and the 'hand'.
Thanks!
ScottHere it is.
When you build your field cat use the below code.
DATA : x_fieldcat TYPE slis_fieldcat_alv.
* Single click on the field will trigger double click event.Also, a hand
* will appear when the cursor navigates to the field
X_FIELDCAT-HOTSPOT = 'X'.
Regards,
ARS -
Can I download a spool file from ALV payroll recon report in Fixed Ascii?
We have a process that imports the spool files from our various nightly payroll recon reports but have recently upgraded to ECC 6.0 and the ALV formatted report does not appear to create a fixed format spool file - the width of the columns changes from spool to spool based on the contents.
Does anyone know how to accomplish our need?
Thanks,
DeWayneDoes the printer show up in the Windows Printers folder? We've used PDF995 or Cute pdfwriter for years. All of these create virtual windows printers. When you print to them, a dialog box pops up asking for the filename for the pdf. If you have Activex calls to Excel in order to open a file, you should be able to make ActiveX calls to print it to a print driver such as this. I don't know if any of these drives have a way to bypass the filename dialog box. That may take some research and experimentation. I don't know where the postscript file comes into play in the scenario you are describing.
-
ALV and Interactive Reports in SAP ABAP?
Hi All,
What type of reports we can generate in SAP ABAP using ALV & Interactive in real time Scenario? Do SAP provides some Standard reports? Plz give some examples?
Thanks in Advance.Hi Mohnish,
You can refer the following ALV sample code :
TYPE-POOLS: slis.
TABLES : afko,afpo .
+-- Data declarations--+
DATA : BEGIN OF it_afpo OCCURS 0,
AUFNR LIKE afpo-AUFNR,
PSMNG LIKE afpo-PSMNG,
WEMNG LIKE afpo-WEMNG,
PWERK LIKE afpo-PWERK,
DAUAT LIKE afpo-DAUAT,
END OF it_afpo.
DATA : BEGIN OF it_afko OCCURS 0,
AUFNR LIKE afko-AUFNR,
GSTRP LIKE afko-GSTRP,
GSTRS LIKE afko-GSTRS,
GSTRI LIKE afko-GSTRI,
GSUZI LIKE afko-GSUZI,
PLNBEZ LIKE AFKO-PLNBEZ,
END OF it_afko.
DATA : BEGIN OF it_makt OCCURS 0,
matnr TYPE matnr,
maktx TYPE maktx,
END OF it_makt.
DATA : BEGIN OF it_output OCCURS 0,
AUFNR LIKE afpo-AUFNR,
PSMNG LIKE afpo-PSMNG,
WEMNG LIKE afpo-WEMNG,
DAUAT LIKE afpo-DAUAT,
GSTRP LIKE afko-GSTRP,
GSTRS LIKE afko-GSTRS,
GSTRI LIKE afko-GSTRI,
GSUZI LIKE afko-GSUZI,
PLNBEZ LIKE AFKO-PLNBEZ,
matnr LIKE makt-matnr,
maktx LIKE makt-maktx,
END OF it_output.
DATA: wa_output LIKE it_output,
wa_afpo LIKE it_afpo,
wa_afko LIKE it_afko,
wa_makt like it_makt.
DATA : wk_date1(10) TYPE c,
wk_date2(10) TYPE c,
wk_datehead TYPE string.
+--Selection screen parameters--+
INITIALIZATION.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_matnr FOR afpo-matnr.
PARAMETERS : p_pwerk type afpo-pwerk OBLIGATORY.
SELECT-OPTIONS: s_dauat for afpo-dauat OBLIGATORY,
s_gstrp for afko-GSTRP OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
--internal tables for alv--
DATA : gt_fieldcat TYPE slis_t_fieldcat_alv, "catalog for alv
gt_heading TYPE slis_t_listheader, "list for header1
gt_sort TYPE slis_t_sortinfo_alv, "Sorting of the
gt_event TYPE slis_t_event,
gt_selfield TYPE slis_selfield,
gv_alv_event TYPE slis_alv_event,
gv_repname TYPE sy-repid,
gs_layout TYPE slis_layout_alv,
gv_save TYPE c.
CONSTANTS gc_forname_top_of_page TYPE slis_formname VALUE
'TOP-OF-PAGE'.
START-OF-SELECTION.
PERFORM get_data.
PERFORM output_data.
PERFORM build_comment USING gt_heading[].
PERFORM eventstab.
PERFORM sub_t_sort_build.
PERFORM build_field_catalog.
PERFORM display_data.
--Data selection--
*& Form get_data
text
--> p1 text
<-- p2 text
FORM get_data.
select AUFNR
PSMNG
WEMNG
MATNR
PWERK
DAUAT
from afpo CLIENT SPECIFIED
INTO TABLE it_afpo
WHERE mandt = sy-mandt
AND matnr IN s_matnr
and pwerk = p_pwerk
and dauat in s_dauat.
select AUFNR
GSTRP
GSTRS
GSTRI
GSUZI
PLNBEZ
from afko CLIENT SPECIFIED
INTO table it_afko
FOR ALL ENTRIES IN it_afpo
WHERE mandt = sy-mandt
AND aufnr = it_afpo-aufnr
and gstrp in s_gstrp.
SELECT matnr
maktx
FROM makt
INTO table it_makt
FOR ALL ENTRIES IN it_afKo
WHERE matnr = it_afKo-PLNBEZ.
ENDFORM. " get_data
*& Form output_data
text
--> p1 text
<-- p2 text
FORM output_data.
loop at it_afko into wa_afko.
LOOP AT it_afpo into wa_afpo
WHERE aufnr = wa_afKo-aufnr.
wa_output-AUFNR = wa_afpo-AUFNR.
wa_output-PSMNG = wa_afpo-PSMNG.
wa_output-WEMNG = wa_afpo-WEMNG.
wa_output-DAUAT = wa_afpo-DAUAT.
ENDLOOP.
loop at it_makt into wa_makt
where matnr = wa_afKo-PLNBEZ.
wa_output-matnr = wa_makt-matnr.
wa_output-maktx = wa_makt-maktx.
endloop.
wa_output-GSTRP = wa_afko-GSTRP.
wa_output-GSTRS = wa_afko-GSTRS.
wa_output-GSTRI = wa_afko-GSTRI.
wa_output-GSUZI = wa_afko-GSUZI.
APPEND wa_output TO it_output.
ENDLOOP.
CLEAR wa_afpo.
CLEAR wa_afko.
CLEAR wa_output.
SORT IT_OUTPUT BY GSTRP GSUZI.
ENDFORM. " output_data
--Header for ALV--
*& Form build_comment
text
-->P_GT_HEADING[] text
FORM build_comment USING p_heading TYPE slis_t_listheader.
DATA : ls_header TYPE slis_listheader.
*--poputale the report header info
ls_header-typ = 'H'.
MOVE : text-002 TO ls_header-info.
APPEND ls_header TO p_heading.
CLEAR ls_header.
ls_header-typ = 'S'.
ls_header-key = text-013 .
"'User:'
ls_header-info = sy-uname.
APPEND ls_header TO p_heading.
CLEAR: ls_header.
ENDFORM. " build_comment
*& Form eventstab
text
--> p1 text
<-- p2 text
FORM eventstab.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_event
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.
READ TABLE gt_event
WITH KEY name = slis_ev_top_of_page
INTO gv_alv_event.
IF sy-subrc EQ 0.
MOVE gc_forname_top_of_page TO gv_alv_event-form.
APPEND gv_alv_event TO gt_event.
ENDIF.
ENDFORM. " eventstab
*& Form build_field_catalog
text
--> p1 text
<-- p2 text
FORM build_field_catalog.
DATA ls_fieldcat TYPE slis_fieldcat_alv.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 1.
ls_fieldcat-fieldname = 'DAUAT'.
ls_fieldcat-outputlen = 12.
ls_fieldcat-tabname = 'it_output'.
ls_fieldcat-seltext_l = 'Order Type'.
ls_fieldcat-KEY = 'X'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 2.
ls_fieldcat-fieldname = 'AUFNR'.
ls_fieldcat-outputlen = 10.
ls_fieldcat-tabname = 'it_output'.
ls_fieldcat-seltext_l = 'Order Number'.
APPEND ls_fieldcat TO gt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = 3.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-outputlen = 12.
ls_fieldcat-tabname = 'it_output'.
ls_fieldcat-seltext_l = 'Material Number'.
APPEND ls_fieldcat TO gt_fieldcat.
----you can add fields as per your requirement.*----
ENDFORM. " build_field_catalog
*-- Form top of page
FORM top-of-page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_heading.
ENDFORM. "TOP-OF-PAGE
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data.
gv_save = 'A'.
gv_repname = sy-repid.
gs_layout-colwidth_optimize = 'X'.
gs_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repname
is_layout = gs_layout
it_sort = gt_sort[]
it_fieldcat = gt_fieldcat[]
i_default = 'X'
i_save = gv_save
it_events = gt_event[]
TABLES
t_outtab = it_output
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_data
*& Form sub_t_sort_build
text
--> p1 text
<-- p2 text
FORM sub_t_sort_build.
DATA ls_sort TYPE slis_sortinfo_alv.
ls_sort-spos = 1.
ls_sort-tabname = 'it_output'.
ls_sort-fieldname = 'DAUAT'.
ls_sort-subtot = 'X'.
ls_sort-up = 'X'.
ls_sort-group = '*'.
APPEND ls_sort TO gt_sort.
ENDFORM. " sub_t_sort_build
Reward points, if helpful
Regards,
Ramneet -
hi experts,
I have a requirement which is
I have to select the first 10 fields of any database table which will be given in the selection screen except the first field 'MANDT' .
after selection the report should be displayed in ALV.
then in the report which is generated if i select any one record the details of that particular record should be vertically displayed in a pop up.
if multiple records are selected the data should be displayed horizontally in a pop up.
if any sample code is there pls send me ASAP.
the requirement is very urgent.
Thanks in advanceHi Krithika,
Check this code. this might help in solving your problem.
>********************************************************************
This report displays data from SAP tables (like SE16) *
FM : REUSE_ALV_GRID_DISPLAY
DATA:
g_mandt TYPE mandt.
SELECTION-SCREEN :
BEGIN OF LINE, COMMENT 6(33) v_1 FOR FIELD p_table. "#EC NEEDED
PARAMETERS p_table TYPE dd03l-tabname OBLIGATORY MEMORY ID dtb.
SELECTION-SCREEN : END OF LINE, SKIP.
SELECTION-SCREEN :
BEGIN OF LINE, COMMENT 6(30) v_2 FOR FIELD s_mandt. "#EC NEEDED
SELECT-OPTIONS s_mandt FOR g_mandt DEFAULT sy-mandt
MATCHCODE OBJECT ddsef4clnt.
SELECTION-SCREEN : END OF LINE, SKIP.
SELECTION-SCREEN :
SKIP , BEGIN OF LINE, COMMENT 6(33) v_3 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(3) TYPE n DEFAULT '200' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
AT SELECTION-SCREEN.
PERFORM f_check_table.
INITIALIZATION.
v_1 = 'Table'.
v_2 = 'Client'.
v_3 = 'Maximum of records'.
START-OF-SELECTION.
PERFORM f_display_data.
Form F_DISPLAY_DATA
FORM f_display_data.
TYPE-POOLS: slis. " ALV Global Types
DATA:
lp_table TYPE REF TO data, " Pointer to dynamic table
ls_layout TYPE slis_layout_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
FIELD-SYMBOLS :
<lt_data> TYPE STANDARD TABLE. " Data to display
Create internal table
CREATE DATA lp_table TYPE STANDARD TABLE OF (p_table)
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN lp_table->* TO <lt_data>.
Field MANDT exists ?
SELECT SINGLE tabname
INTO p_table
FROM dd03l
WHERE tabname = p_table
AND fieldname = 'MANDT'
AND as4local = 'A'
AND as4vers = '0000'
AND position = '0001'
AND rollname = 'MANDT'.
IF sy-subrc EQ 0.
Read data
SELECT * UP TO p_max ROWS
FROM (p_table) CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE <lt_data>
WHERE mandt IN s_mandt
ORDER BY PRIMARY KEY.
ELSE.
Field CLIENT exists ?
SELECT SINGLE tabname
INTO p_table
FROM dd03l
WHERE tabname = p_table
AND fieldname = 'CLIENT'
AND as4local = 'A'
AND as4vers = '0000'
AND position = '0001'
AND rollname = 'MANDT'.
IF sy-subrc EQ 0.
Read data
SELECT * UP TO p_max ROWS
FROM (p_table) CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE <lt_data>
WHERE client IN s_mandt
ORDER BY PRIMARY KEY.
ELSE.
Read data
SELECT * UP TO p_max ROWS
FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE <lt_data>
ORDER BY PRIMARY KEY.
ENDIF.
ENDIF.
IF <lt_data>[] IS INITIAL.
No table entries found for specified key
MESSAGE i429(mo).
EXIT.
ENDIF.
Build Field catalog
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table
i_client_never_display = ''
CHANGING
ct_fieldcat = lt_fieldcat
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.
ls_layout-zebra = 'X'.
ls_layout-colwidth_optimize = 'X'.
Display ALV List
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <lt_data>.
ENDFORM. " F_DISPLAY_DATA
Form F_CHECK_TABLE
FORM f_check_table.
DATA :
l_tabclass TYPE tabclass, " Table category
l_viewclass TYPE viewclass. " View Type
Read table category
SELECT SINGLE tabclass viewclass
INTO (l_tabclass, l_viewclass)
FROM dd02l
WHERE tabname = p_table
AND as4local = 'A'
AND as4vers = '0000'.
IF sy-subrc NE 0.
Table & is not active in the Dictionary
MESSAGE e402(mo) WITH p_table.
ELSEIF l_tabclass = 'INTTAB'.
& is a structure, not a table
MESSAGE e403(mo) WITH p_table.
ELSEIF l_tabclass = 'VIEW' AND l_viewclass NE 'D'.
Only use views of type "Maintenance view"
MESSAGE e309(sv).
ENDIF.
ENDFORM. " F_CHECK_TABLE
Reward Points, if useful.
Regards,
Manoj Kumar -
How to get the SAVE Layout ICON on ALV Grid display report
Hi,
I am using the standard ALV Layout, and I do not get the SAVE LAYOUT Icon on the Menubar, where I could save the report Layout.I am using the layout routine as,
FORM layout_build USING u_lf_layout TYPE slis_layout_alv.
u_lf_layout-box_fieldname = 'SELK'. " Checkbox
u_lf_layout-zebra = 'X'.
u_lf_layout-colwidth_optimize = 'X'.
u_lf_layout-confirmation_prompt = 'X'.
u_lf_layout-get_selinfos = 'X'.
u_lf_layout-f2code = '&ETA' .
u_lf_layout-detail_titlebar = 'Delivery Due List'.
u_lf_layout-key_hotspot = 'X'.
u_lf_layout-info_fieldname = 'COL'.
ENDFORM. " layout_build
Is there anything that I am missing. Please suggest.Many thanks for your help.
Regards,
MiraHi,
i think you've forgotten param. <b>i_save</b>
x_save = 'X'.
gs_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'ZTAB01'
IS_VARIANT = gs_variant
IS_layout = lay
I_SAVE = x_save
TABLES
T_OUTTAB = gridtab
EXCEPTIONS
OTHERS = 1.
regards Andreas -
Perform setting OOP ALV for multiple reports using Field Symbols
Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc) for 2 different reports. this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
*&this report experimental how to print into ONE alv
*&with 2 diffrent structure internal table
REPORT zfiroopalv.
SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
PARAMETERS r_kpi RADIOBUTTON GROUP mode.
SELECTION-SCREEN END OF BLOCK mode.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-DATA: md_wbs TYPE c LENGTH 1.
METHODS: process,
write.
DATA: mdo_data TYPE REF TO data.
TYPES: BEGIN OF st_wbs,
rsnum TYPE zmeime002a-rsnum,
rspos TYPE zmeime002a-rspos,
a TYPE zmmgitab01-menge,
b TYPE zmeime002a-bdmng,
c TYPE zmeime002a-bdmng,
d TYPE zmeime002a-bdmng,
e TYPE zmeime002a-bdmng,
f TYPE zmmgitab01-menge,
g TYPE zmmgitab01-menge,
END OF st_wbs.
TYPES: BEGIN OF st_kpi,
regio TYPE zmeime002a-regio,
gsber TYPE zmeime002a-gsber,
gtext TYPE zmeime002a-gtext,
x TYPE zmmgitab01-menge,
y TYPE zmmgitab01-menge,
z TYPE zmmgitab01-menge,
END OF st_kpi.
CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
wa_wbs LIKE LINE OF it_wbs.
CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
wa_kpi LIKE LINE OF it_kpi.
PRIVATE SECTION.
DATA: set_display_setting TYPE REF TO cl_salv_table.
DATA: display_settings TYPE REF TO cl_salv_display_settings.
DATA: salv_table TYPE REF TO cl_salv_table.
DATA: error TYPE REF TO cx_root.
DATA: errtext TYPE string.
ENDCLASS.
CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_kpi.
PRIVATE SECTION.
ENDCLASS.
* C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_wbs.
PRIVATE SECTION.
ENDCLASS.
* m.a.i.n. .p.r.o.g.r.a.m.
START-OF-SELECTION.
DATA: o_main TYPE REF TO lcl_main.
DATA: p_wbs TYPE c.
CREATE OBJECT o_main.
CASE 'X'.
WHEN r_wbs.
o_main->md_wbs = 'X'.
WHEN r_kpi.
o_main->md_wbs = ' '.
ENDCASE.
o_main->process( ).
o_main->write( ).
CLASS lcl_main IMPLEMENTATION.
*ENDMETHOD.
METHOD process. " NOTE: public method
DATA: o_main TYPE REF TO lcl_main,
o_wbs TYPE REF TO lcl_wbs,
o_kpi TYPE REF TO lcl_kpi.
CREATE OBJECT: o_wbs,o_kpi.
IF ( me->md_wbs = 'X' ).
CALL METHOD o_wbs->process_wbs( ). " NOTE: private method
GET REFERENCE OF me->it_wbs INTO me->mdo_data.
ELSE.
CALL METHOD o_kpi->process_kpi( ). " NOTE: private method
GET REFERENCE OF me->it_kpi INTO me->mdo_data.
ENDIF.
ENDMETHOD.
METHOD write.
FIELD-SYMBOLS:
<lt_outtab> TYPE table.
ASSIGN me->mdo_data->* TO <lt_outtab>.
cl_salv_table=>factory(
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = salv_table
CHANGING
t_table = <lt_outtab>
salv_table->display( ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_kpi IMPLEMENTATION.
METHOD process_kpi.
*********** run some select statement into it_kpi*******
ENDMETHOD.
ENDCLASS.
CLASS lcl_wbs IMPLEMENTATION.
METHOD process_wbs.
*********** run some select statement into it_wbs*******
ENDMETHOD.
ENDCLASS.Hi,
I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
MODULE USER_COMMAND_9003 INPUT.
CASE OK_CODE.
WHEN 'DETAIL'.
GV_RPT = OK_CODE.
PERFORM F_GET_DETAIL_DATA.
WHEN 'REPORT'.
GV_RPT = OK_CODE.
PERFORM F_GET_REPT_DATA.
ENDCASE.
ENDMODULE. " USER_COMMAND_9003 INPUT
2. Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
MODULE DISPLAY_ALV OUTPUT.
IF GV_RPT EQ 'DETAIL'.
PERFORM F_FIELDCAT_DETAIL.
PERFORM F_LAYOUT_DETAIL.
PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
PERFORM F_DISPLAY_ALV_DETAIL.
ELSEIF GV_RPT EQ 'REPORT'.
PERFORM F_FIELDCAT_REPT.
PERFORM F_LAYOUT_REPT.
PERFORM F_EXCLUDE_TOOLBAR_REPT.
PERFORM F_DISPLAY_ALV_REPT.
ENDIF.
ENDMODULE. " DISPLAY_ALV OUTPUT
3. Before displaying ALV you need to free the container and ALV.
FORM F_DISPLAY_ALV_DETAIL .
IF GC_CONTAINER_ES IS NOT INITIAL.
CALL METHOD GC_CONTAINER_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
IF GC_ALV_GRID_ES IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
IF GC_CONTAINER_TB IS NOT INITIAL.
CALL METHOD GC_CONTAINER_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
IF GC_ALV_GRID_TB IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
CREATE OBJECT GC_CONTAINER_ES
EXPORTING
CONTAINER_NAME = 'CC_9003'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6.
CREATE OBJECT GC_ALV_GRID_ES
EXPORTING
I_PARENT = GC_CONTAINER_ES
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = GS_LAYOUT_ES
IT_TOOLBAR_EXCLUDING = GT_TOOLBAR_ES
CHANGING
IT_OUTTAB = GT_ES_REPT
IT_FIELDCATALOG = GT_FIELDCAT_ES
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ENDFORM. " F_DISPLAY_ALV_DETAIL
Similarly define the FORM F_DISPLAY_ALV_REPT.
Hope this will be useful for you. If you have any more queries let me know.
Maybe you are looking for
-
Req: Example of report sending a printer escape code
Hello, I have a batch report that prints student transcripts. After a transcript, I need to tell the printer to staple. Please point me to an example of sending a printer escape code. By the way I'm printing from Win98 to a Konica 7055 using the post
-
I am having severe performance issue using ADF. Queries run very quickly, however, the framework will "hang" for up to 18 sec during "Resolving" step. Also, $$added root$$ appears to take at least 5 sec. Thus, a total of over 23 sec is added to the t
-
SQL server 2012 Import and Export Wizard missing Flat File Options
When using either the 32 or 64 bit Import & Export wizard selecting data source "flat file source" no options appear, compared to excel import , sql or another data source ? tried uninstalling etc, build a VM 2008 Server works fine options appear
-
Display Japanese characters on Applet
Hi All, I am able to display Japanese Characters on my Applet locally(Windows 2000 - US) by overwriting the font.properties content with the one in font.properties.ja found in JRE/LIB directory of my Jdeveloper JDK. When I deploy the applet on 9ias s
-
Key Press Anyone? SImple Q?
Hi, and thanks in Advance!!! So i have a button that needs to be activated from the key board. Does anyone have a completed script that will allow the user to activate this button that has sound attached to it from hitting the letter "A" ? Also, the