Display fetched value as heading
Hi Experts,
Please advice if it is possible to display the fetched value as heading in ALV.
Suppose If in dbtab:
OBJECT OBJECT DESCRIPTION CLASS VALUE
OBJ 1 MACHINE 1 A 20
OBJ 2 MACHINE 2 B 30
OBJ 3 MACHINE 3 C 40
OBJ 4 MACHINE 4 D 50
and I want my o/p as
OBJECT OBJECT DESCRIPTION A B C D
OBJ 1 MACHINE 1 20 0 0 0
OBJ 2 MACHINE 2 0 30 0 0
OBJ 3 MACHINE 3 0 0 40 0
OBJ 4 MACHINE 4 0 0 0 50
and if there is extra class called E it should display automatically ....if no then no need
Please advice
Karthik
Edited by: Karthik R on Jul 21, 2009 1:52 PM
Edited by: Karthik R on Jul 21, 2009 1:53 PM
Edited by: Karthik R on Jul 21, 2009 1:53 PM
Edited by: Karthik R on Jul 21, 2009 1:54 PM
Edited by: Karthik R on Jul 21, 2009 1:54 PM
Hi Max,
Thanks a lot for ur kind help,
But I think it does'nt meet my requirment...
Actaully I am doing a report on Equipment History for a particular Plant...For this I need to fetch the initial
details from equi table.
As per my report each Equipment will belong to some class ( klah~class )
and this class will have there own characteristics it may be 1 or more than 1. Characteristics
may vary from class to class.
So as per my requirment I need to display this charcteristics as heading and then displacy
the values below it.
SELECT EQUI~EQUNR
EQUI~EQTYP
EQUI~OBJNR
EQUI~SERGE
EQUI~HERST
EQUI~TYPBZ
FROM EQUI INNER JOIN EQUZ
ON EQUI~EQUNR EQ EQUZ~EQUNR
INTO TABLE IT_EQUI
WHERE EQUI~EQUNR IN S_EQUNR
AND EQUI~EQTYP IN S_EQTYP
AND EQUZ~IWERK IN S_WERKS.
IF NOT IT_EQUI[] IS INITIAL.
SELECT OBJEK
ATINN " this is charcterestic which I need to display as heading
ATWRT
ATFLV
KLART
FROM AUSP INTO TABLE IT_AUSP
FOR ALL ENTRIES IN IT_EQUI
WHERE OBJEK = IT_EQUI-EQUNR
AND KLART EQ '002'.
ENDIF.
there is standard t-code called IE03 which meet my requirement
Please advice
Karthik
Edited by: Karthik R on Jul 21, 2009 3:16 PM
Similar Messages
-
Display attribute value as header line
Hello experts,
We are working with BI 7.0 SAP NetWeaver 2004s. We need to display a attribute value in the workbook header line. The characteristic is as filter in the query and the attribute is in free characteristic area.
Any idea?
Thanks in advanced,
yeberri.You did make it a navigational attribute though, right (otherwise you wouldn't be able to use it as a filter)?
Try using a text variable which references the attribute. -
How to display field value in header text?
Hi Experts,
In va03, the client wants some number in the header text which is stored in vbak. Please tell me:
1. Which method should I use in BADI?
2. How to display in header text?
Regards
ManiHi Kiran,
Thanks for the prompt reply. How can I display some hard code like 'Test' in the header text in va03.
Text name = 0000001252
Language = EN
Text ID = Z001
Text object = VBBK
READ_TEXT is used to get the values from the header text, but how to set the values?
Regards
Mani -
Display constant values in header and items from table in ALV
Hello all,
I have to dispaly the header and Item entires in the output . and the point is header values are all constant and they are not related to item data . item data is to dispalyed from VBAP table .
so how can i achive this .. can i use this FM REUSE_ALV_HIERSEQ_LIST_DISPLAY ...
example of outpput..
Header inforamtions..
name city areacode areazone postzip
abcde xyz 1244 abc 123456
and the item details should be right below the header details
Cnt Vbeln vkorg vtweg matnr etc etc
1 xxx xx xx xxxx xxx xxxx
2 xxx xx xx xxxx xxx xxxx
3 xxx xx xx xxxx xxx xxxx
4 xxx xx xx xxxx xxx xxxx
5 xxx xx xx xxxx xxx xxxx
6 xxx xx xx xxxx xxx xxxx
I am able to dispaly the line items with the FM 'REUSE_ALV_GRID_DISPLAY' plz advice the best solution to achive this
thanks
Raj
Edited by: abaprthree on Oct 28, 2009 12:30 PMHi,
For this you will need to define header for the ALV. Here is a simple example how to do this:
First you need to write one Header form like following:
FORM f004_header USING it_head TYPE slis_t_listheader..
DATA : wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'. " H = Header, S = Selection, A = Action
wa_line-info = 'List of Sales Orders'.
APPEND wa_line TO it_head.
" Here type out all the required data one by one in work are and append it to internal table
ENDFORM. "f004_header
before calling REUSE_ALV_GRID_DISPLAY you need to call following
TO HEADER EVENT
FORM f006_top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header.
ENDFORM.
and for REUSE_ALV_GRID_DISPLAY call as following
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'F006_TOP'
it_fieldcat = t_fieldcatalog[]
TABLES
t_outtab = it_data.
Let me know if any other help is needed. -
Display Currency Value of User POV for Entity & Value in Text Box (Header)
I am looking for a function in Financial Reporting Studio that operates the same as the HsCurrency function in Smart View. This would allow batch reports displaying the currency value of the User POV for Entity based on the User POV for Value. Right now I have to have Member Lists for separate reports and different currencies as I am only able to display the Value dimension in the heading of a given report. Users will not be certain of the currency if the Value dimension is <Entity Curr Total>.
I tried the HFMCurrency text function, however the entity is not defined in a Row / Column / Page reference as the entity is determined by the User's Point of View.
Is there a way to display the currency value of a User's Point of View for Entity based on the User's Point of View for Value?
Reference from Oracle Hyperion Smart View for Office, Fusion Edition, User's Guide:
HsCurrency
Data sources: Financial Management, Hyperion Enterprise
HsCurrency retrieves the currency value of the specified dimension member. Entity and Value are the only valid members for the HsCurrency function.
Syntax
HsCurrency (“Connection,Entity;Value”)
Example
In this example, HsCurrency retrieves the entity currency where the currency for the East Sales entity is USD, and the currency for the UKSales entity is GBR. The EastSales entity displays USD, and UKSales displays GBR.
HsCurrency(“Comma”,”Entity#EastRegion.EastSales;Value#<Entity Currency>.”)
HsCurrency(“Comma”,”Entity#EastRegion.UKSales;Value#<Entity Currency>.”)Question answered in My Oracle Support Community - Hyperion Reporting Products:
communities.oracle.com -
Display variable values selected as header in WAD
Hi All Gurus,
I need to display the variable values entered for running the report as a header to the report being displayed.
I'm using NW2004s BI and standard template 0analysis_pattern. Is there a way I can display the variable values as header info.
Thanks in Advance
SidHi Sid,
You may need to make a copy of this template, or create your own and use the Information Field web item:
http://help.sap.com/saphelp_nw70/helpdata/en/47/96784226d1d242e10000000a1550b0/content.htm
You can set this to display the Variables (VARIABLES_VISIBLE)
Hope this helps... -
Displaying Selection option values in header using alv-factory
Hi all,
I am using alv factory class 'CL_SALV_TABLE'.
I want to display selection-option values on my header.
I have creted grid using class 'CL_SALV_FORM_LAYOUT_GRID' and am displaying other values.
But am facing problem in displaying selection option values.
Any pointer on this will be GR8.
Thanks & Regards.
Yats.Hi,
Use this sample code.
form top_of_the_list_main changing lv_grids type ref to cl_salv_table.
*Creating instances of the clases
data : lv_grid type ref to cl_salv_table,
lv_header type ref to cl_salv_form_element,
lv_layout type ref to cl_salv_form_layout_grid.
move lv_grids to lv_grid.
*Creating the layout object
create object lv_layout.
*Setting the Header Text
lv_layout->create_label(
row = 1
column = 1
text = text-008 ).
lv_header = lv_layout.
lv_grid->set_top_of_list( lv_header ).
endform. " TOP_OF_THE_LIST_MAIN
Loop it and keep changing the row and colom..Pass the selection option to the text field.
Regards
Ansair -
How to display field value only once in REUSE_ALV_GRID_DISPLAY
hi experts,
i am using REUSE_ALV_GRID_DISPLAY, for alv outpur display.but i want one of the field in output ,not to display the value which is of same, it have to be displayed only once, I mean i have a number which contains multiple line items corresponding, here i want to display the field value only once when it is repeating , for the same header number, how can i achieve itHi,
check the sample code,
REPORT Z_ALV.
Database table declaration
TABLES:
sflight.
Typepool declaration
TYPE-POOLS:
slis.
Selection screen elements
SELECTION-SCREEN BEGIN OF BLOCK blk_1 WITH FRAME TITLE text-000.
SELECT-OPTIONS:
s_carrid FOR sflight-carrid.
SELECTION-SCREEN END OF BLOCK blk_1.
Field string to hold sflight data
DATA:
BEGIN OF fs_sflight ,
carrid TYPE sflight-carrid, " Carrier Id
connid TYPE sflight-connid, " Connection No
fldate TYPE sflight-fldate, " Flight date
seatsmax TYPE sflight-seatsmax, " Maximum seats
seatsocc TYPE sflight-seatsocc, " Occupied seats
END OF fs_sflight.
Internal table to hold sflight data
DATA:
t_sflight LIKE
STANDARD TABLE
OF fs_sflight .
Work variables
DATA:
t_fieldcat TYPE slis_t_fieldcat_alv,
fs_fieldcat LIKE
LINE OF t_fieldcat.
*START-OF-SELECTION
START-OF-SELECTION.
PERFORM get_data_sflight. " Getting data for display
PERFORM create_field_cat. " Create field catalog
PERFORM alv_display.
*& Form create_field_cat
Subroutine to create field catalog
There is no interface paramete
FORM create_field_cat .
PERFORM fill_fieldcat USING 'Carrier Id' 'CARRID' '2'.
PERFORM fill_fieldcat USING 'Connection No' 'CONNID' '1'.
PERFORM fill_fieldcat USING 'Flight Date' 'FLDATE' '3'.
PERFORM fill_fieldcat USING 'Maxm.Seats' 'SEATSMAX' '4'.
PERFORM fill_fieldcat USING 'Seats Occ' 'SEATSOCC' '5'.
ENDFORM. "create_field_cat
*& Form fill_fieldcat
Subroutine to fill data to field column
-->p_seltext Column label
-->p_fieldname Fieldname of database table
-->p_col_pos Column position
FORM fill_fieldcat USING
p_seltext LIKE fs_fieldcat-seltext_m
p_fieldname LIKE fs_fieldcat-fieldname
p_col_pos LIKE fs_fieldcat-col_pos.
fs_fieldcat-seltext_m = p_seltext.
fs_fieldcat-fieldname = p_fieldname.
fs_fieldcat-col_pos = p_col_pos.
APPEND fs_fieldcat TO t_fieldcat.
CLEAR fs_fieldcat.
ENDFORM. " fill_fieldcat
*& Form get_data_sflight
Subroutine to fetch data from database table
There is no interface parameter
FORM get_data_sflight .
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO TABLE t_sflight
WHERE carrid IN s_carrid.
ENDFORM. " get_data_sflight
*& Form alv_display
Subroutine for ALV display
There is no interface parameter
FORM alv_display .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = t_fieldcat
TABLES
t_outtab = t_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " alv_display
End of code -
Short Dump while fetching values from a Database view
Hi ALL,
Here is the code that is giving short dump
SELECT * FROM ZVMATLMOVE INTO TABLE I_MATLMOVE
WHERE BUDAT >= V_LASTRUN_DATE
AND WERKS IN S_WERKS
AND LIFNR IN S_LIFNR
AND EBELN IN S_EBELN
AND MATNR IN S_MATNR
AND BWART IN S_BWART
(Please don't say that I am using * in the select query,
I knew that it is not a good way of fetching values)
Declaration of the internal table is:
DATA I_MATLMOVE LIKE ZVMATLMOVE OCCURS 0 WITH HEADER LINE.
The variable V_LASTRUN_DATE is:
DATA V_LASTRUN_DATE LIKE SY-DATUM.
We will be getting the lastrundate value from another table. And it is passing correct value (ex. 20060731)
ZVMATLMOVE is a database view created for MKPF and MSEG table. And I checked both table were consistent.
Dump Analysis:
Runtime errors DBIF_RSQL_SQL_ERROR
Exception CX_SY_OPEN_SQL_DB
Every thing is fine. But I don't know how it is going to dump. Any suggestions?Hi !
It seams that your table is not correct / fully activated.
To check it out you should try the following:
- Go to the SE11
- Give it your table name and go to "Display"
- Check if the table is "active"
- Choose "Utilities->Database Object->Check" and see
if there are any errors
- go back and choose "Utilities->Runtime Object->Check"
and see if there are any errors
If there are any errors - try to activate the table again. You may need the "Utilities->Database Utiliy" for that.
After there are no more errors by checking all these your program should work.
Regards
Rainer
Some points would be nice if thate helped a bit. -
How to display the values stored in the database in the combobox on load?
I am develping one application where in
I wanted to display the values in the combobox which I am taking from the database and in the same form passing that value in same form after selecting it,My program is running fine for the first time but next time it is giving me NullPointerException.
So can anyone tell me please how I should develop the this application to avoid this exception?
Thank You
PraddyThanx a lot for showing interest in answering my query.I am pasting my code for ur reference.Please try to reply ASAP.
Thank You,
Praddy.
CODE:
======
<html>
<head>
<script language="javascript">
function submitthisform(thisForm)
thisForm.submit();
</script>
</head>
<body>
<form method=post name=samepgm>
Select City: <select name=city onChange='submitthisform(samepgm)'><br><br><br>
<option value=''></option>
<option value='All'>All</option>
<%@ page language="java" import="java.sql.*" %>
<%
String scity = request.getParameter("city");
System.out.println(scity);
Connection con = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:property","","");
Statement st = con.createStatement();
ResultSet rs1 = st.executeQuery("select distinct hcity from housefinance");
while(rs1.next())
//String ohname = rs1.getString("hname");
String ocity = rs1.getString("hcity");
//out.println(ohname +"<br>");
out.println(ocity +"<br>");
%>
<br><br><br><option value='<%=ocity%>'><%=ocity%></option><br>
<% }
rs1.close();
if(scity.equals("All"))
ResultSet rs2 = st.executeQuery("select * from housefinance");
while(rs2.next())
String ohname = rs2.getString("hname");
String ohadd1 = rs2.getString("hadd1");
//String ohadd2 = rs2.getString("hadd2");
String ohcity = rs2.getString("hcity");
String ohpcode = rs2.getString("hpcode");
String ohtelno = rs2.getString("htelno");
String ohfaxno = rs2.getString("hfaxno");
String ohemail = rs2.getString("hemail");
String ohmobile = rs2.getString("hmobile");
%>
<pre>
<tr>
<td><p>Company : <%=ohname%> </p></td>
<td><p>Address : <%=ohadd1%></p></td>
<td><p>City : <%=ohcity%> </p></td>
<td><p>Pin : <%=ohpcode%></p></td>
<td><p>Telphone : <%=ohtelno%></p></td>
<td><p>Fax No: : <%=ohfaxno%></p></td>
<td><p>Email : <%=ohemail%></p></td>
<td><p>Mobile No. : <%=ohmobile%></p></td>
</tr>
</pre>
<%
else
ResultSet rs = st.executeQuery("select * from housefinance where hcity like '%"+scity+"%'");
while(rs.next())
String ohname = rs.getString("hname");
String ohadd1 = rs.getString("hadd1");
//String ohadd2 = rs.getString("hadd2");
String ohcity = rs.getString("hcity");
String ohpcode = rs.getString("hpcode");
String ohtelno = rs.getString("htelno");
String ohfaxno = rs.getString("hfaxno");
String ohemail = rs.getString("hemail");
String ohmobile = rs.getString("hmobile");
%>
<tr>
<td><p>Company : <%=ohname%> </p></td>
<td><p>Address : <%=ohadd1%></p></td>
<td><p>City : <%=ohcity%> </p></td>
<td><p>Pin : <%=ohpcode%></p></td>
<td><p>Telphone : <%=ohtelno%></p></td>
<td><p>Fax No: : <%=ohfaxno%></p></td>
<td><p>Email : <%=ohemail%></p></td>
<td><p>Mobile No. : <%=ohmobile%></p></td>
</tr>
<hr>
<% }
%>
</select>
</form>
</body>
</html> -
How to populate right side of Shuttle with display/return values?
Hello,
I know, that the proper way to populate the right side of shuttle is that:
declare
v_list apex_application_global.vc_arr2;
begin
select profile_name return_value
bulk collect
into v_list
from user_profiles
where user_id = :p61_user_id;
return (apex_util.table_to_string (v_list));
end;It is comfortable for the user to see the name of the profile.
However, I need a profile_id as a return value, like I have it on the left side of the shuttle.
The left side of the shuttle is populated with a select list with display/return values, as you know.
I need both sides of the shuttle to return profile_id in order to create a merge.
How is it possible to populate the right side of the Shuttle with display/return values?All you have to do is to use the subset of shuttle query to assign value to the right side shuttle.
http://apex.oracle.com/pls/apex/f?p=50942:95
I have created a dummy page with shuttle query
SELECT ename, empno FROM emp ORDER by 1then I have defined a pl-sql before header process to assign values to shuttle variable
using the code
begin
:P95_SHUTTLE := '7566:219:7900:7782:90';
end;since 90 is not one the result set of the shuttle query it is getting displayed as number, and for others it is displaying the text. Thanks.
--Manish -
Call RFC from ECC and display the values in AET
Hi ALL,
I had an RFC in ECC ( Z_CRM_SPEC_DATA) this should be called into my AET Fields in getter method.
In getter method of tat AET field what code should i write?
Plz help me on this.HI,
1) Call the RFC(Z_CRM_SPEC_DATA) from ECC and display the values as mentioned in below AET fields.
AET FIELDS : zzfld00000M zzfld00000N
Description : Budget Quan Forecast Quan
values : (--5.0)(6.0--
2) (Fetch Budget and Forecast data from ECC ),you would need to pass Material Number(MATNR) as well as Ship to party info to fetch the budget and forecast data as one material may be assigned to 2 or more SH with specific budget and forecast data for each.
Edited by: venkatabharathv on May 23, 2011 2:44 PM
Edited by: venkatabharathv on May 23, 2011 2:49 PM -
Displaying item value on basis of pop up lov value
Hi ,
I have created a form on which i have a pop up lov item whose values are getting displayed on basis of a table column.Now my requirement is that when a user select a value(for ex: say an code i.e 123) from pop up lov then on basis of this value an another value pops up which shows the description related to this code.I have this description in another column of same table from which i have displayed pop up lov values.
I tried to implement this by creating a display only item on form and taking source value of this item from sql query returning single value as code is primary key but I am unable to fetch value.I have written the following query:
select model_code from BL_VEHICLE_ENGINE_NAME where catalog_code=:p9_catalog_code
Here p9_catalog_code is the item displaying pop up lov.
when i am specifying a particular value rather than bind value as (select model_code from BL_VEHICLE_ENGINE_NAME where catalog_code=123) then the description corresponding to this value is getting displayed through display only item.
How can i fetch value from pop up lov and utilize that value to display required description.Is displaying description through display only item correct or is there any other way around through which this description could be displayed more effectively.
Thanks
AbhiHi Abhi,
Instead of pop up lov you can use cascade lov ie when u have data like say if u select code from ur table 123 and it has more than one description then u can use cascade lov it will query upon the first lov what u required.
Or coming to ur problem
for code pageitem say p1_code u are using pop lov (you can try select list instead of pop up lov )
and for description u r using display column.
and give the source as return single query only
select descp from table where code=:P1code.
Hopes this helps you
Thanks & Regards
Srikkanth.M -
OO ALV displaying without Values despite Internal table contains
My below OO ALV displaying without Values despite Internal table contains the values ...
Help please ...
REPORT zsd_concession1 NO STANDARD PAGE HEADING
LINE-SIZE 285
LINE-COUNT 64
MESSAGE-ID zz.
Program Description ******************************
This report is to Calculate consession against Quotations
complying standards for enhanced Performance, Readability &
Maintenance.
Change Log *********************************
Remedy # / Who When Why / What
Transport #
CLASS lcl_event_handler DEFINITION DEFERRED.
*& Data Definitions .
DATA: BEGIN OF vbap_wa,
vbeln TYPE vbak-vbeln, "Quotation#
erdat TYPE vbak-erdat, "Quot date
knumv TYPE vbak-knumv, "Cond Rec#
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF vbap_wa,
BEGIN OF konv_wa,
knumv TYPE konv-knumv, "Cond#
kposn TYPE konv-kposn, "Cond Item#
kappl TYPE konv-kappl, "Applic
kschl TYPE konv-kschl, "Cond Typ
kbetr TYPE konv-kbetr, "Price ZBP1,ZNAA,ZNAX
END OF konv_wa,
BEGIN OF vbpa_wa,
vbeln TYPE vbpa-vbeln, "Quot#
posnr TYPE vbpa-posnr, "Item#
parvw TYPE vbpa-parvw, "Prt Fn
kunnr TYPE vbpa-kunnr, "Cust#
END OF vbpa_wa,
BEGIN OF result_wa,
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF result_wa.
DATA: ikonv LIKE STANDARD TABLE OF konv_wa,
ivbap LIKE STANDARD TABLE OF vbap_wa,
ivbpa LIKE STANDARD TABLE OF vbpa_wa,
iresult LIKE STANDARD TABLE OF result_wa.
*Work storage
DATA: BEGIN OF ws,
vbeln TYPE vbak-vbeln,
ok_code TYPE sy-ucomm,
alv_save TYPE c, "ALV save
alv_variant TYPE disvariant, "ALV Variant
alv_sort TYPE lvc_t_sort, "Sort table
END OF ws.
*Data declarations for ALV Main list
DATA : ty_lay1 TYPE lvc_s_layo,
it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat ,
l_smenu TYPE REF TO cl_ctmenu,
c_alv1 TYPE REF TO cl_gui_alv_grid,
c_cont1 TYPE REF TO cl_gui_custom_container,
e_dclick TYPE REF TO lcl_event_handler.
*Data declarations for ALV Interactive list
DATA : ty_lay2 TYPE lvc_s_layo,
it_fcat TYPE lvc_t_fcat ,
ty_fcat TYPE lvc_s_fcat ,
c_alv2 TYPE REF TO cl_gui_alv_grid,
c_cont2 TYPE REF TO cl_gui_custom_container.
*Field-Symbols
FIELD-SYMBOLS:
<konv> LIKE konv_wa,
<vbap> LIKE vbap_wa.
*Constants
CONSTANTS:
c_end_row TYPE i VALUE 65000.
*CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
ENDCLASS. "lcl_event_handler DEFINITION
*CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
DATA: sec_wa LIKE LINE OF iresult.
*Reading the selected data into a variable
READ TABLE iresult INDEX e_row-index INTO sec_wa.
*Select the field details of the selected table
SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
WHERE tabname EQ ls_dd02l-tabname.
*Calling the ALV containing the field values
CALL SCREEN 101.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_vbeln FOR ws-vbeln DEFAULT '2002354788' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a.
INITIALIZATION.
PERFORM setup_screen_defaults.
START-OF-SELECTION.
PERFORM gather_report_data.
END-OF-SELECTION.
PERFORM create_output.
*& Form initialization
FORM setup_screen_defaults.
CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
REFRESH: ivbpa, ikonv, ivbap, iresult.
ENDFORM. " setup_screen_defaults
*& Form gather_report_data
FORM gather_report_data.
SELECT vbeln posnr parvw kunnr
INTO TABLE ivbpa
FROM vbpa
WHERE vbeln IN s_vbeln
AND ( parvw = 'SP' OR "SoldTO
parvw = 'WE' OR "ShipTo
parvw = 'ZT' ). "Top Parent
SELECT vkvbeln vkerdat vkknumv vpposnr vp~matnr
z1zansicat z1zansigrd z2~zcurrvaltnarea
z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
m1mstav vpkwmeng vp~netpr
INTO CORRESPONDING FIELDS OF TABLE ivbap
FROM vbak AS vk
INNER JOIN vbap AS vp
ON vpvbeln = vkvbeln
INNER JOIN zmarall AS z1
ON z1matnr = vpmatnr
INNER JOIN zco002 AS z2
ON z2matnr = vpmatnr
INNER JOIN zglbprc AS zg
ON zgmatnr = vpmatnr
INNER JOIN mara AS m1
ON m1matnr = vpmatnr
WHERE vk~vbeln IN s_vbeln
AND vk~auart = 'AG'."AG = Quot
SORT ivbap BY posnr matnr.
SELECT kvknumv kvkposn kvkappl kvkschl kv~kbetr
INTO TABLE ikonv
FROM konv AS kv
FOR ALL ENTRIES IN ivbap
WHERE kv~knumv = ivbap-knumv
AND kv~kposn = ivbap-posnr
AND kv~kappl EQ 'V'
AND ( kv~kschl EQ 'ZBP1'
OR kv~kschl EQ 'ZNAX'
OR kv~kschl EQ 'ZNAA' ).
SORT ikonv BY knumv kposn.
LOOP AT ivbap ASSIGNING <vbap>.
CLEAR konv_wa.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZBP1'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-lprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAX'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAA'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
ENDLOOP.
SORT ivbap BY posnr matnr.
LOOP AT ivbap INTO vbap_wa.
MOVE-CORRESPONDING vbap_wa TO result_wa.
APPEND result_wa TO iresult.
CLEAR: vbap_wa, result_wa.
ENDLOOP.
ENDFORM. " gather_report_data
*& Form create_output
FORM create_output.
CALL SCREEN 100.
FREE: iresult.
ENDFORM. " create_output
*& Module PBO_0100 OUTPUT
text
MODULE pbo_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
IF c_cont1 IS INITIAL.
*Creating object of container
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CCONT1'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Alv layout
PERFORM alv_100_layout.
PERFORM save_alv_layout.
*Alv field catalogue
PERFORM alv_100_fieldcat.
*Displaying the ALV grid
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = ty_lay1
i_save = ws-alv_save
is_variant = ws-alv_variant
CHANGING
it_outtab = iresult[]
it_sort = ws-alv_sort
it_fieldcatalog = it_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Create object of the event class
*and setting handler for double click
CREATE OBJECT e_dclick.
SET HANDLER e_dclick->handle_double_click FOR c_alv1.
ENDIF.
ENDMODULE. " PBO_0100 OUTPUT
*& Module PAI_0100 INPUT
text
MODULE pai_0100 INPUT.
ws-ok_code = sy-ucomm.
CASE ws-ok_code.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
CLEAR ws-ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*& Form alv_100_layout
text
--> p1 text
<-- p2 text
FORM alv_100_layout.
ty_lay1-numc_total = 'X'. " Numc total line
ty_lay1-cwidth_opt = 'X'. " Optimal column width
ty_lay1-detailinit = 'X'. " Show values that are initial in
ty_lay1-sel_mode = 'A'. " Column selection mode
ty_lay1-no_merging = 'X'. " No merging while sorting columns
ty_lay1-keyhot = 'X'.
ty_lay1-grid_title = 'SD Concessions'.
ty_lay1-zebra = 'X'.
ty_lay1-no_toolbar = ' '.
ENDFORM. " alv_100_layout
*& Form alv_100_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_100_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 6.
ty_fieldcat-fieldname = 'zcurrcstusd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Cost $'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 7.
ty_fieldcat-fieldname = 'zzbrndnm'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Brand'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 8.
ty_fieldcat-fieldname = 'zqedscgrp'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'QE'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'mstav'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Status'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'kwmeng'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Qty'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 10.
ty_fieldcat-fieldname = 'lprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'List Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 11.
ty_fieldcat-fieldname = 'sprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Discount'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 12.
ty_fieldcat-fieldname = 'netpr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Quot Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 13.
ty_fieldcat-fieldname = 'mrgn'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Margin%'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_100_fieldcat
*& Module PBO_0101 OUTPUT
text
MODULE pbo_0101 OUTPUT.
*Check if the Custom container exists.
IF c_cont2 IS INITIAL.
*Creating container object
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CCONT2'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*creating ALV grid for interactive list
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ALV layout
PERFORM alv_101_layout.
*ALV fieldcatalogue
PERFORM alv_101_fieldcat.
*Sorting the output by field position
SORT iresult BY posnr.
*ALV for display field details
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
is_layout = ty_lay2
CHANGING
it_outtab = iresult[]
it_fieldcatalog = it_fieldcat.
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. " PBO_0101 OUTPUT
*& Module PAI_0101 INPUT
text
MODULE pai_0101 INPUT.
ENDMODULE. " PAI_0101 INPUT
*& Form alv_101_layout
text
--> p1 text
<-- p2 text
FORM alv_101_layout.
ty_lay2-grid_title = 'Line Details'.
ty_lay2-zebra = 'X'.
ty_lay2-no_toolbar = 'X'.
ENDFORM. " alv_101_layout
*& Form alv_101_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_101_fieldcat.
REFRESH it_fieldcat.
REFRESH it_fcat.
CLEAR ty_fcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_101_fieldcat
*& Form save_alv_layout
text
--> p1 text
<-- p2 text
form save_alv_layout.
ws-alv_save = 'A'.
ws-alv_variant-report = sy-repid.
endform. " save_alv_layoutHello
Creating fieldcatalogs manually is one of the major error sources in ALV programming.
There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
Regards
Uwe -
Display Distinct values in LightSwitch browse screen
i have one browse screen which is fetching value from one entity(Attached to SQL datasource), the entity will look like the below snapshot.
ID
EMP ID
Emp Name
Age
Role
1
266
Srikanth
26
Developer
2
266
Srikanth
26
Architect
3
122
Raj
29
Tester
4
122
Raj
29
Manager
So in the browse screen its coming with all row values (1,2,3 and 4) even though i removed the Role field from the screen. I want to display only the distinct Emp ID, Name, Age in the browse screen of this entity. Please
give me some suggestion.i suggest to Create new View Return Only Distinct record from Original Table And Update your DataSource with this view And Create Your Browse Screen Depends on This View
SQL Script
Create View VwEmployeeDistenct
as
select Distinct [EMP ID], [Emp Name],
[Age] from OrginalEmplyeeTable
go
Maybe you are looking for
-
Unable to use SSO with universe connection on top of SAP BW query
Hi, We're creating a universe on top of a SAP BW query by using universe designer. We logon to universe designer by using SAP credential. When creating the connection, we set the option "Use Single Sign On when refreshing reports at view time" in ord
-
I have OS X Lion and the messages beta on my macbook pro. When in messages, if I initiate a video chat there is no audio. I know this must be something on my end because if I'm invited to a video chat it works fine. Please help
-
Last week firfox suddenly stopped working. I have uninstalled and reinstalled but still will not repsond. But when I have tried to uninstall it says it can't because it is running, but in task manager there is no indication in the window firefox is r
-
Our app doesn't show in some regions. Any ideas why?
Hello. Our recently published Windows Phone app doesn't show in some regions. The app is free. During the publishing I have selected "Distribute to all markets at the base tier". But I can't see the app in Lithuanian, Latvian or Russian Windows Phone
-
EM12c - update Oracle DB plugin
I'm trying to install a new update 12.1.0.3 [u130402] Oracle DB plugin for EM12c. During the "Deploy on Management Server" getting the error - 2013-06-26 11:07:17,855 [main] ERROR pluginca.PluginCADriver - EM-04018: Server side Plug-in deployment fai