How to name implementation of an interface
Hi there
is there any standard for naming concrete implementation of interfaces?
So if I have an interface
A
in package "interfaces"
is it sensful to call the concrete implementation of the interface interfaces.A A, too?
class A implements interfaces.A{
}? Or should it be called ConcreteA, or or or....?
Thx for your tips.
Sincerely
Karlheinz Toni
JebeDiAH heres a very interesting reading.
Class and Interface Names
Class names are always nouns, not verbs. Avoid making a noun out of a verb, example DividerClass. If you are having difficulty naming a class then perhaps it is a bad class.
Interface names should always be an adjective (wherever possible) describing the enforced behaviors of the class (noun). Preferably, said adjective should end in "able" following an emerging preference in Java. i.e. Clonable, Versionable, Taggable, etc.
Class, and interface names begin with an uppercase letter, and shoule not be pluralized unless it is a collection class (see below).
Acceptable:
class FoodItem
interface Digestable
UnAcceptable:
class fooditem
class Crackers
interface Eat
Naming collection classes (in the generic sense of collection) can be tricky with respect to pluralization. In general each collection should be identified as a plural item, but not redundantly so. If you are a collection type as part of the class name (List, Map, etc.) it is not necessary to use the plural form in the class name. If you are not using the collection type in the name it is necessary to pluralize the name. If you are extending one of the java colletction class (Map, HashMap, List, ArrayList, Collection, etc.) it is good practice to use the name of the collection type in the class name.
Acceptable:
class FoodItems extends Object
class FoodItemList extends ArrayList
class FoodItemMap extends HashMap
UnAcceptable:
class FoodItem extends ArrayList
class FoodItemsList extends ArrayList
Class names should be descriptive in nature without implying implementation. The internal implementation of an object should be encapsulated and not visible outside the object. Since implementation can change, to imply implementation in the name forces the class name and all references to it to change or else the code can become misleading.
Acceptable:
AbstractManagedPanel
LayeredPanel
UnAcceptable:
PanelLayerArray
When using multiple words in a class name, the words should be concatenated with no separating characters between them. The first letter of each word should be capitalized.
Acceptable:
InverntoryItem
UnAcceptable:
Inverntory_item
Inventoryitem
Other than prefixes, no abbreviations should be used unless it is a well known abbreviation.
Acceptable:
CD=Compact Disc
US=United States
UnAcceptable:
Cust=Customer
DLR=Dealer
I found it at http://www.iwombat.com/standards/JavaStyleGuide.html
Similar Messages
-
EJB3 Stateful Sessionbean how to implement multi business interfaces?
Hi All,
I met up some issue, can't make the session bean implement 2 business interfaces? Please kindly throw me some light! thanks
Business sessionbean
@Stateful
@ConversationScoped
@Named
@Local( { IWizard.class, IRegisterWizard.class })
public class RegisterWizard extends WizardBean {
@Local
public interface IWizard extends Serializable {
public String back();
public boolean hasBack();
public boolean hasNext();
public String next();
public String abort();
@Local
public interface IRegisterWizard{
public String submit();
}error message of glassfish3 below:
Caused by: java.lang.IllegalArgumentException: Not enough type information to resolve ejb for ejb name class wizard.RegisterWizard
at org.glassfish.weld.services.EjbServicesImpl.resolveEjb(EjbServicesImpl.java:121)
at org.jboss.weld.bean.SessionBean.createReference(SessionBean.java:422)
at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.<init>(EnterpriseBeanProxyMethodHandler.java:76)
at org.jboss.weld.bean.SessionBean.create(SessionBean.java:298)
... 53 moreThere does appear to be a bug in the handling of the bean with multiple business interfaces. I filed an issue for it :
https://glassfish.dev.java.net/issues/show_bug.cgi?id=11826. The inheritance is a separate issue. Are you getting the same error or a different one after applying @LocalBean. -
WPF How can I implement the INotifyPropertyChanged in a Three-tier architecture?
I am a student and I am confused on using the INotifyPropertyChanged in a three-tier style of coding. Can you guys help me a bit with these?
I have a solution named MetroAppProject. It is composed of four projects (I omitted the using clauses and references, just imagine they are there and are working fine):
1. MetroApp.BluePrints - a class library composed of the classes in my sql db
An example of my class
namespace MetroApp.BluePrints
public partial class Patient
public long Id { get; set; }
public string PatientNumber { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string AddressLine1 { get; set; }
public Nullable<short> CityId { get; set; }
public string CityName { get; set; }
public Nullable<short> ProvinceId { get; set; }
public string ProvinceName { get; set; }
Then the second project:
2. MetroApp.DataAccess = a class library composed of methods that calls my sql procedures. I used the SqlHelper class which contains the connection strings and other stuffs.
example class
namespace MetroApp.DataAccess
public class PatientDb
public Patient Retrieve(PatientParams parameters)
SqlCommand command = new SqlCommand();
Patient singItem = new Patient();
command.CommandText = "RetrievePatients";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@Id", parameters.Id).Direction = ParameterDirection.Input;
DataTable dt = SqlHelper.GetData(command);
if (dt.Rows.Count > 0)
DataRow row = dt.Rows[0];
singItem.Id = TDefaultValue.GetInt(row["Id"].ToString());
singItem.PatientNumber = TDefaultValue.GetString(row["PatientNumber"].ToString());
singItem.LastName = TDefaultValue.GetString(row["LastName"].ToString());
singItem.FirstName = TDefaultValue.GetString(row["FirstName"].ToString());
singItem.MiddleName = TDefaultValue.GetString(row["MiddleName"].ToString());
singItem.AddressLine1 = TDefaultValue.GetString(row["AddressLine1"].ToString());
singItem.CityId = TDefaultValue.GetShort(row["CityId"].ToString());
singItem.CityName = TDefaultValue.GetString(row["CityName"].ToString());
singItem.ProvinceId = TDefaultValue.GetShort(row["ProvinceId"].ToString());
singItem.ProvinceName = TDefaultValue.GetString(row["ProvinceName"].ToString());
return singItem;
public List<Patient> RetrieveMany(PatientParams parameters)
var items = new List<Patient>();
var command = new SqlCommand();
command.CommandText = "RetrievePatients";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@Id", parameters.Id).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@PatientNumber", parameters.PatientNumber).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@LastName", parameters.LastName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@FirstName", parameters.FirstName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@MiddleName", parameters.MiddleName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@CityId", parameters.CityId).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@ProvinceId", parameters.ProvinceId).Direction = ParameterDirection.Input;
DataTable dt = SqlHelper.GetData(command);
foreach (DataRow row in dt.Rows)
var item = new Patient();
item.Id = TDefaultValue.GetLong(row["Id"].ToString());
item.PatientNumber = (row["PatientNumber"].ToString());
item.LastName = (row["LastName"].ToString());
item.FirstName = (row["FirstName"].ToString());
item.MiddleName = (row["MiddleName"].ToString());
item.AddressLine1 = (row["AddressLine1"].ToString());
item.CityId = (short)row["CityId"].ToString();
item.CityName = (row["CityName"].ToString());
item.ProvinceId = (short)row["ProvinceId"].ToString();
item.ProvinceName = (row["ProvinceName"].ToString());
items.Add(item);
return items;
public bool Insert(Patient entity, int userId, ref bool doesExist)
var command = new SqlCommand();
try
command.CommandText = "AddPatient";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@PatientNumber", entity.PatientNumber).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@LastName", entity.LastName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@FirstName", entity.FirstName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@MiddleName", entity.MiddleName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@AddressLine1", entity.AddressLine1).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@CityId", entity.CityId).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@ProvinceId", entity.ProvinceId).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@Id", entity.Id).Direction = ParameterDirection.Input;
command.Parameters.Add("@DoesExist", SqlDbType.Bit).Direction = ParameterDirection.Output;
int result = SqlHelper.ExecuteNonQuery(command);
doesExist = (bool)(command.Parameters["@DoesExist"].Value);
entity.Id = (int)(command.Parameters["@Id"].Value);
if (result == 0 || doesExist)
return false;
return true;
catch (Exception)
return false;
public bool Update(Patient entity, int userId, ref bool doesExist)
var command = new SqlCommand();
try
command.CommandText = "EditPatient";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@PatientNumber", entity.PatientNumber).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@LastName", entity.LastName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@FirstName", entity.FirstName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@MiddleName", entity.MiddleName).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@AddressLine1", entity.AddressLine1).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@CityId", entity.CityId).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@ProvinceId", entity.ProvinceId).Direction = ParameterDirection.Input;
command.Parameters.AddWithValue("@Id", SqlDbType.Int).Direction = ParameterDirection.Output;
command.Parameters.Add("@DoesExist", SqlDbType.Bit).Direction = ParameterDirection.Output;
doesExist = (bool)(command.Parameters["@DoesExist"].Value);
int result = SqlHelper.ExecuteNonQuery(command);
if (result == 0 || doesExist)
return false;
return true;
catch (Exception)
return false;
Then a business logic
3. MetroApp.BusinessLogic = class libray for calling the methods from DataAccess
namespace MetroApp.BusinessLogic
public class PatientMgr
#region Fields
private readonly PatientDb _db;
#endregion
#region Properties
public Patient Entity { get; set; }
public List<Patient> EntityList { get; set; }
public PatientParams Parameters { get; set; }
#endregion
#region Constructors
public PatientMgr()
_db = new PatientDb();
Entity = new Patient();
EntityList = new List<Patient>();
Parameters = new PatientParams();
#endregion
#region Methods
public Patient Retrieve(PatientParams parameters)
return _db.Retrieve(parameters);
public List<Patient> RetrieveMany(PatientParams parameters)
return _db.RetrieveMany(parameters);
public bool Insert(Patient entity, int userId, ref bool doesExist)
return _db.Insert(entity, userId, ref doesExist);
public bool Update(Patient entity, int userId, ref bool doesExist)
return _db.Update(entity, userId, ref doesExist);
#endregion
Then the last one, the WPF GUI
<UserControl x:Class="MetroDentProject.Pages.PatientDetailsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dims="clr-namespace:MetroAppProject.UserCons"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280">
<Grid x:Name="MainGrid" >
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="0" Grid.Row="1" Grid.RowSpan="7" x:Name="DetailsGroupBox" Header="Patient Details" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="Id: " Grid.Column="1" Grid.Row="0" Visibility="Collapsed"/>
<TextBox x:Name="IdTextBox" Grid.Column="1" Grid.Row="1" Visibility="Collapsed"/>
<TextBlock x:Name="PatientNumberTextBlock" Text="Patient Number: " Grid.Column="0" Grid.Row="0" />
<TextBox x:Name="PatientNumberTextBox" Grid.Column="1" Grid.Row="0" IsReadOnly="True" IsReadOnlyCaretVisible="True"/>
<TextBlock Text="Last Name: " Grid.Column="0" Grid.Row="1" />
<TextBox x:Name="LastNameTextBox" Grid.Column="1" Grid.Row="1" />
<TextBlock Text="First Name: " Grid.Column="0" Grid.Row="2" />
<TextBox x:Name="FirstNameTextBox" Grid.Column="1" Grid.Row="2" />
<TextBlock Text="Middle Name: " Grid.Column="0" Grid.Row="3" />
<TextBox x:Name="MiddleNameTextBox" Grid.Column="1" Grid.Row="3" />
</Grid>
</GroupBox>
<GroupBox x:Name="ContactDetailsGroupBox" Header="Contact Details" Grid.Column="1" Grid.Row="1" Grid.RowSpan="7">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="Address: " Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" />
<TextBlock Text="City: " Grid.Column="0" Grid.Row="2" />
<TextBlock Text="Province: " Grid.Column="0" Grid.Row="3"/>
<TextBox x:Name="AddressTextBox" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2"
TextWrapping="Wrap"
AcceptsReturn="True"
VerticalScrollBarVisibility="Auto"
/>
<ComboBox x:Name="CitiesComboBox" Grid.Column="1" Grid.Row="2" />
<ComboBox x:Name="ProvincesComboBox" Grid.Column="1" Grid.Row="3" />
</Grid>
</GroupBox>
<dims:FunctionButtonsControl x:Name="FunctionButtonsCon" Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2"
ExecuteClick="FunctionButtonsCon_OnExecuteClick"
UndoClick="FunctionButtonsCon_OnUndoClick"
BackClick="FunctionButtonsCon_OnBackClick"
DeleteClick="FunctionButtonsCon_OnDeleteClick"
/>
</Grid>
</UserControl>
I apologize for the long post. As you can see, I don't use binding. Binding requires me to use INotifyPropertyChanged interface which I am not familiar. Can you at least make my project to implement the INotifypropertyChanged?
Here is my sample code for the WPF page:
public partial class PatientDetailsPage
readonly PatientMgr itemMgr = new PatientMgr();
public PatientParams CurrentPar = new PatientParams(); // for undoActionType _action = ActionType.Insert; // this is an enum from another project, ActionType.Insert, ActionType.Update
public ActionType Action
get { return _action; }
set { _action = value; }
public PatientDetailsPage()
InitializeComponent();
BindComboBoxes();
#region Methods
public void OnFragmentNavigation(FragmentNavigationEventArgs e)
public void OnNavigatedFrom(NavigationEventArgs e)
public void OnNavigatedTo(NavigationEventArgs e)
{ Setup();
public void OnNavigatingFrom(NavigatingCancelEventArgs e)
public Patient GetPageEntity()
Patient setEntity = new Patient();
setEntity.Id = (long)IdTextBox.Text;
setEntity.PatientNumber = PatientNumberTextBox.Text;
setEntity.LastName = LastNameTextBox.Text;
setEntity.FirstName = FirstNameTextBox.Text;
setEntity.MiddleName = MiddleNameTextBox.Text;
setEntity.AddressLine1 = AddressTextBox.Text;
setEntity.CityId = (short)CitiesComboBox.SelectedValue);
setEntity.ProvinceId = (short)ProvincesComboBox.SelectedValue;
setEntity.StatusId = true;
return setEntity;
public void Setup()
switch (Action)
case ActionType.Insert:
Clearer(); //clears all textboxes and set all comboboxes to default
this.PatientNumberTextBlock.Visibility = Visibility.Collapsed;
this.PatientNumberTextBox.Visibility = Visibility.Collapsed;
FunctionButtonsCon.ExecuteButton.Content = "Add";
FunctionButtonsCon.DeleteButton.IsEnabled = false;
FunctionButtonsCon.DeleteButton.Visibility = Visibility.Hidden;
break;
//**Setup Update
case ActionType.Update:CurrentPar.Id = (long)IdTextBox.Text;
LoadSingle(CurrentPar);
this.PatientNumberTextBlock.Visibility = Visibility.Visible;
this.PatientNumberTextBox.Visibility = Visibility.Visible;
FunctionButtonsCon.ExecuteButton.Content = "Save";
FunctionButtonsCon.DeleteButton.IsEnabled = true;
FunctionButtonsCon.DeleteButton.Visibility = Visibility.Visible;
break;
LastNameTextBox.CaretIndex = LastNameTextBox.Text.Length;
IsVisibleChanged += AutoFocus;
public void LoadSingle(PatientParams parameters)
var entity = itemMgr.Retrieve(parameters); //calls the BusinessLogic
IdTextBox.Text = (entity.Id);
PatientNumberTextBox.Text = (entity.PatientNumber);
LastNameTextBox.Text = (entity.LastName);
FirstNameTextBox.Text = (entity.FirstName);
MiddleNameTextBox.Text = (entity.MiddleName);
AddressTextBox.Text = (entity.AddressLine1);
CitiesComboBox.SelectedValue = (short)entity.CityId;
ProvincesComboBox.SelectedValue = (short)entity.ProvinceId;
public void Save(ActionType action, int userId)
itemMgr.Entity = GetPageEntity();
bool doesExist = false;
switch (action)
case ActionType.Insert:
if (itemMgr.Insert((itemMgr.Entity), userId, ref doesExist))
System.Windows.Forms.MessageBox.Show("Successfully added a Patient!", "Patient Insertion");
else if (doesExist)
System.Windows.Forms.MessageBox.Show("Item already exists.", "Patient Insertion");
else
System.Windows.Forms.MessageBox.Show("Not all fields were filled in.", "Patient Insertion");
break;
case ActionType.Update:
if (itemMgr.Update(itemMgr.Entity, userId, ref doesExist))
System.Windows.Forms.MessageBox.Show("Successfully updated a Patient!", "Patient Modification");
itemMgr.Parameters.Id = itemMgr.Entity.Id;
Action = ActionType.Update;
Setup();
else if (doesExist)
System.Windows.Forms.MessageBox.Show("Item already exists.", "Patient Modification");
else
System.Windows.Forms.MessageBox.Show("Not all fields were filled in.", "Patient Modification");
break;
public void Clearer()
IdTextBox.Clear();
PatientNumberTextBox.Clear();
LastNameTextBox.Clear();
FirstNameTextBox.Clear();
MiddleNameTextBox.Clear();
CitiesComboBox.SelectedIndex = 0;
ProvincesComboBox.SelectedIndex = 0;
AddressTextBox.Clear();
public void BindComboBoxes()
CitiesComboBox.ItemsSource = new BindingSource(CommonMgr.GetCitiesDropDown(), null);// the CommonMgr is a static class from another project. It works just fine
CitiesComboBox.DisplayMemberPath = "Value";
CitiesComboBox.SelectedValuePath = "Key";
ProvincesComboBox.ItemsSource = new BindingSource(CommonMgr.GetProvincesDropDown(), null);
ProvincesComboBox.DisplayMemberPath = "Value";
ProvincesComboBox.SelectedValuePath = "Key";
CitiesComboBox.SelectedIndex = 0;
ProvincesComboBox.SelectedIndex = 0;
#endregion
#region Events
private void FunctionButtonsCon_OnExecuteClick(object sender, RoutedEventArgs e)
Save(Action, SessionHelper.MyUser.Id); //SessionHelper.MyUser.Id
private void FunctionButtonsCon_OnUndoClick(object sender, RoutedEventArgs e)
if (Action == ActionType.Insert)
Clearer();
return;
private void FunctionButtonsCon_OnBackClick(object sender, RoutedEventArgs e)
Exiter();
private void FunctionButtonsCon_OnDeleteClick(object sender, RoutedEventArgs e)
var ans = System.Windows.Forms.MessageBox.Show("Are you sure you want to delete this entry?", "Patient Deletion", MessageBoxButtons.YesNo);
if (!Equals(ans, System.Windows.Forms.DialogResult.Yes)) return;
Action = ActionType.Delete;
Save(Action, SessionHelper.MyUser.Id);
Exiter();
#endregionHello Kokombads,
I thought you are using MVVM from your title but it seems your project is just a simple WPF project. In that way, please check the following msdn article to know how to Implement Property Change Notification
https://msdn.microsoft.com/en-us/library/ms743695(v=vs.110).aspx
using System.ComponentModel;
namespace SDKSample
// This class implements INotifyPropertyChanged
// to support one-way and two-way bindings
// (such that the UI element updates when the source
// has been changed dynamically)
public class Person : INotifyPropertyChanged
private string name;
// Declare the event
public event PropertyChangedEventHandler PropertyChanged;
public Person()
public Person(string value)
this.name = value;
public string PersonName
get { return name; }
set
name = value;
// Call OnPropertyChanged whenever the property is updated
OnPropertyChanged("PersonName");
// Create the OnPropertyChanged method to raise the event
protected void OnPropertyChanged(string name)
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(name));
It is not so complex, you only need to refer to the interface from here:
https://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx
And understand that you have to do the following:
For change notification to occur in a binding between a bound client and a data source, your bound type should either:
Implement the INotifyPropertyChanged interface (preferred).
Provide a change event for each property of the bound type
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Based from my code, how do I implement an ALV grid using OO concept...
Hello experts,
I am currently practicing ABAP Objects and I would like to use alv in my report. Now, How can I implement ALV in my report in the simplest way possible. Sample codes will be highly appreciated. Thanks guys and take care!
REPORT z_aris_oo_practice_9
NO STANDARD PAGE HEADING
LINE-SIZE 0
LINE-COUNT 0.
TABLES: spfli.
Selection screen
SELECTION-SCREEN BEGIN OF BLOCK box1 WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK box2 WITH FRAME.
PARAMETERS: p_carrid TYPE spfli-carrid,
p_connid TYPE spfli-connid.
SELECTION-SCREEN END OF BLOCK box2.
SELECTION-SCREEN BEGIN OF BLOCK box3 WITH FRAME.
PARAMETERS: p_sumdis AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK box3.
SELECTION-SCREEN END OF BLOCK box1.
INTERFACE status
INTERFACE status.
METHODS write.
ENDINTERFACE. "status
CLASS main DEFINITION
CLASS main DEFINITION.
PUBLIC SECTION.
INTERFACES status.
METHODS: get_data,
combine_data.
CLASS-DATA: counter TYPE i.
PRIVATE SECTION.
TYPES: BEGIN OF t_spfli,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom,
airpfrom TYPE spfli-airpfrom,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto,
airpto TYPE spfli-airpto,
fltime TYPE spfli-fltime,
deptime TYPE spfli-deptime,
arrtime TYPE spfli-arrtime,
END OF t_spfli.
DATA: it_spfli TYPE STANDARD TABLE OF t_spfli.
ENDCLASS. "main DEFINITION
CLASS main IMPLEMENTATION
CLASS main IMPLEMENTATION.
METHOD status~write.
WRITE: / 'The number of records is:', counter.
ENDMETHOD. "status~write
METHOD get_data.
SELECT carrid connid countryfr
cityfrom airpfrom countryto
cityto airpto fltime
deptime arrtime
FROM spfli
INTO TABLE it_spfli
WHERE carrid = p_carrid.
ENDMETHOD. "get_data
METHOD combine_data.
FIELD-SYMBOLS: <fs_spfli> LIKE LINE OF it_spfli.
LOOP AT it_spfli ASSIGNING <fs_spfli>.
ADD 1 TO counter.
WRITE: / <fs_spfli>-carrid,
<fs_spfli>-connid,
<fs_spfli>-countryfr,
<fs_spfli>-cityfrom,
<fs_spfli>-airpfrom,
<fs_spfli>-countryto,
<fs_spfli>-cityto,
<fs_spfli>-airpto,
<fs_spfli>-fltime,
<fs_spfli>-deptime,
<fs_spfli>-arrtime.
ENDLOOP.
ENDMETHOD. "show_data
ENDCLASS. "main IMPLEMENTATION
START-OF-SELECTION.
DATA: main TYPE REF TO main,
status TYPE REF TO status.
CREATE OBJECT main.
CALL METHOD main->get_data.
CALL METHOD main->combine_data.
CALL METHOD main->status~write.Hi,
Check this example..., In this i implemented so many functionalities like top_of_page, drop_down at cell level etc.., also Check the programs BCALVEDIT also
Just check it.
REPORT ZTEST_ALV_OO MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: IT_ROW_NO TYPE LVC_T_ROID,
X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
check,
END OF ITAB.
"The Below Definitions Must.....
DATA:
* Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
* Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
* Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
* Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
* Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
* END_OF_LIST FOR EVENT end_of_list "event handler
* OF CL_GUI_ALV_GRID
* IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
* MESSAGE I000 WITH V_ROW 'clicked'.
CLEAR IT_ROW_NO[].
X_ROW_NO-ROW_ID = V_ROW.
APPEND X_ROW_NO TO IT_ROW_NO .
CALL METHOD G_GRID->SET_SELECTED_ROWS
EXPORTING
IT_ROW_NO = IT_ROW_NO.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
ENDIF.
ENDMETHOD. "handle_double_click
* METHOD END_OF_LIST. "implementation
** Top-of-page event
* PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
* ENDMETHOD. "top_of_page
METHOD TOP_OF_PAGE. "implementation
* Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
describe table itab lines v_lines.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
"this is for top of page
* Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
* Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
* Split the custom_container to two containers and move the reference
* to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
* CALL METHOD DG_SPLITTER->GET_CONTAINER
* EXPORTING
* ROW = 2
* COLUMN = 1
* RECEIVING
* CONTAINER = DG_PARENT_HTML.
* CALL METHOD DG_SPLITTER->GET_CONTAINER
* EXPORTING
* ROW = 1
* COLUMN = 1
* RECEIVING
* CONTAINER = DG_PARENT_GRID.
"you can set the height of it
* Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
* SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
"do these..{
* Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
* Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Check'.
X_FIELDCAT-FIELDNAME = 'CHECK'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-CHECKbox = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '1'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form SET_DRDN_TABLE
* text
FORM SET_DRDN_TABLE.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT ITAB .
* First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ITAB-POSNR.
LS_DRAL-INT_VALUE = ITAB-POSNR.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for Reason Code
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM. " set_drdn_table
*& Form EVENT_TOP_OF_PAGE
* text
* -->DG_DYNDOC_ID text
FORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
"this is more clear.....check it
"first add text, then pass it to comentry write fm
DATA : DL_TEXT(255) TYPE C. "Text
* Populating header to top-of-page
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = 'Test Report'
SAP_STYLE = CL_DD_AREA=>HEADING.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move program ID
CONCATENATE 'Program Name :' SY-REPID
INTO DL_TEXT SEPARATED BY SPACE.
* Add Program Name to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move User ID
CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
* Add User ID to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move count (no of records).
move v_lines to v_line.
CONCATENATE 'No of records :' v_line INTO DL_TEXT SEPARATED BY SPACE.
* Add Client to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move date
WRITE SY-DATUM TO DL_TEXT.
CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Date to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
CLEAR : DL_TEXT.
* Move time
WRITE SY-UZEIT TO DL_TEXT.
CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Time to Document
PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
CALL METHOD DG_DYNDOC_ID->NEW_LINE.
* Populating data to html control
PERFORM HTML.
ENDFORM. " EVENT_TOP_OF_PAGE
*& Form ADD_TEXT
* To add Text
FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
* Adding text
CALL METHOD DG_DYNDOC_ID->ADD_TEXT
EXPORTING
TEXT = P_TEXT
SAP_EMPHASIS = CL_DD_AREA=>HEADING.
ENDFORM. " ADD_TEXT
*& Form HTML
* text
FORM HTML.
DATA : DL_LENGTH TYPE I, " Length
DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
* Creating html control
IF DG_HTML_CNTRL IS INITIAL.
CREATE OBJECT DG_HTML_CNTRL
EXPORTING
PARENT = DG_PARENT_HTML.
ENDIF.
* Reuse_alv_grid_commentary_set
CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
EXPORTING
DOCUMENT = DG_DYNDOC_ID
BOTTOM = SPACE
IMPORTING
LENGTH = DL_LENGTH.
* Get TOP->HTML_TABLE ready
CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
* Set wallpaper
CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
EXPORTING
PICTURE_ID = DL_BACKGROUND_ID.
* Connect TOP document to HTML-Control
DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
* Display TOP document
CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
EXPORTING
REUSE_CONTROL = 'X'
PARENT = DG_PARENT_HTML
EXCEPTIONS
HTML_DISPLAY_ERROR = 1.
IF SY-SUBRC NE 0.
MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
ENDIF.
ENDFORM. " HTML
Regards
vijay -
Finding implementations of an interface programmatically
Hi... would anyone know how to find programmatically all classes that implement an interface?
Ideally, I would like to query on an interface and end up with a list of Class objects (i.e. the implementations of said interface).
Thanks
Message was edited by:
javaBoycan't be done. this gets asked all the time, and it's impossible. Yes - technically correct.
However, in many contexts where you know what classloaders are at play (and lets face it, many of us do work on projects where we use known classloaders, and dont have some random loading off the net on demand going on), it is possible, useful, and very much do-able - if you accept the limitations and constraints.
So, OP, do a search and you'll probably find something useful to you.
~D -
How can i implement 'Distribute Qty' function in BAPI_GOODSMVT_CREATE
Hi all,
Using MIGO For GR. if more than one Batch or Production Date or Vendor Batch for same Purchase Order Line Item and Deliv date, need to hit Distribute Qty button to split the entry line into multiple lines before enter Production Date and Vendor Batch.
So I want use bapi BAPI_GOODSMVT_CREATE implement MIGO function for a interface. Anyone have some suggestion how can i implement the 'Distribute Qty' function in the bapi.
My email address: [email protected]Hello,
1. Use structure BAPIPAREX for passing custom fields. (There are several blogs/posts on how to make use of this).
2. In the BAPI i noticed there is a BAdI to populate these fields into your business tables.
Call BAdI MB_BAPI_GOODSMVT_CREATE to fill own fields
TRY.
get badi lo_mb_bapi_GOODSMVT_CREATE.
CATCH cx_badi_not_implemented. "#EC NO_HANDLER
ENDTRY.
TRY.
call badi lo_mb_bapi_goodsmvt_create->extensionin_to_matdoc
EXPORTING
EXTENSION_IN = EXTENSIONIN[]
CHANGING
CS_IMKPF = S_IMKPF
CT_IMSEG = T_IMSEG[]
CT_RETURN = return.
CATCH cx_badi_initial_reference. "#EC NO_HANDLER
ENDTRY. -
Change Logical Schema name of an existing interface
How do we change the logical schema name of an existing interface which is pointing to a different logical schema. Note: Both two different logical schema are pointing to the same database schema.
Thanks in advance for your update.
KaustuvI'm not sure it's good to have two different logical schemas pointing to the same physical schema.
Whatever, what do you want to change ?
The logical schema of a source datastore ? Of a target datastore? Of a target temporary interface? Or the staging area ? -
How can I implement Authentication in LDAP
How can I implement Authentication in LDAP.
Hi,
If ur using JAAS, then use NTLoginModule in ur conf file and your own defined CallbackHandler for validating and obtaining the Subject (user connected to your domain).
Remember the user is the one which the code obtains when u login to your Domain based machine.
Apart from this, Apache Http Server also provides you with a popup window asking for the user's credentials when u set the SSPIDomain in the httpd.conf file.
httpd.conf
========
<Location /Seet/servlet/ >
SSPIAuth On
AllowOverride None
Order allow,deny
Allow from all
AuthName "seet190 auth"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
require valid-user
SSPIDomain seet190
</Location>
seet190 is the domain name
Actually so far in the Security Forum, u might refer to some of the replies posted for more help but actual LDAP authentication can be done by passing the user's info too.
HTH,
Seetesh -
How can I implement recipe control concept in SAPME?
Dears,
How can I implement recipe control concept in SAPME?
For example,
We can config the standard temperature setting needs to be between 100~120 degree C for Operation OP1 and Material MA1
So, before user start the SFC of MA1 at OP1, system can display the config values(100~120) for user reference, then, user need to input the real temperature when process the SFC, if it's out of spec, system can warning. System will collect the input data for analysis in future.
Thank you.Thank you for your information.
Since customer prefer to use a custom UI which can communicate with SAPME by web service.
So I can not use SAPME default data collection or work instruction user interface.
I'm considering by using data collection and work instruction config data to develop a web service in MII and poblish to custom UI in which it can display the spec data and reject user's input if out of spec.
Please feel free to inform me if any other good idea, thanks! -
How can I implement data type map?
The getString() method of java.sql.ResultSet interface is not efficient enough.
I want to map any data type to VARCHAR type,then use the getBytes() method to get the value.
How can I implement it.
I know proc can implement it, simply set selda->T[sli] with 1 for any field.Hello,
What's your LabVIEW version ? Do you have a simple example program which demonstrates this behavior ?
I found another discussions related to your issues with Xcontrols:
updating type defs in Xcontrol Facade
No Data Change event generated for a XControl in a Type Def
XControl facede.vi
Hope this helps.
Regards,
Steve M.
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
>> Vidéo-t'chats de l'été : présentations techniques et ingénieurs pour répondre à vos questions -
How can i increase performance of interface
while i am runing interface in odi it takes 5 days.so how can i increase performance of interface.
source contains: 30 crores of records
i want copy 30 crores to target.
source:oracle
target:oracle
i am using lkm:lkm sql to sql
IKM:ikm control append
Edited by: 967609 on 25 Oct, 2012 2:55 AM
Edited by: 967609 on 25-Oct-2012 10:13IT IS CREATED VIEW AND SYNONYM.
MY SERVER NAME IS REPA,
ANTHOER SERVERNAE IS MISREPL
create or replace view REPA.C$_0XX_TR
C1_TJD,
C2_CID,
C3_BOO,
C4_TYPE,
C5_GRP,
C6_POAM,
C7_BALINT,
C8_DUIN2,
C9_CRLMT,
C10_IRN,
C11_TDUE,
C12_CHKHLD,
C13_WDLMT,
C14_ZSBU,
C15_BAL,
C16_MCHG,
C17_LCHG,
C18_ACR,
C19_CR,
C20_DR,
C21_CRCD
) as
select * from (
select
XX.TJD C1_TJD,
XX.CID C2_CID,
XX.BOO C3_BOO,
XX.TYPE C4_TYPE,
XX.GRP C5_GRP,
XX.POAM C6_POAM,
XX.BALINT C7_BALINT,
XX.DUIN2 C8_DUIN2,
XX.CRLMT C9_CRLMT,
XX.IRN C10_IRN,
XX.TDUE C11_TDUE,
XX.CHKHLD C12_CHKHLD,
XX.WDLMT C13_WDLMT,
XX.ZSBU C14_ZSBU,
XX.BAL C15_BAL,
XX.MCHG C16_MCHG,
XX.LCHG C17_LCHG,
XX.ACR C18_ACR,
XX.CR C19_CR,
XX.DR C20_DR,
XX.CRCD C21_CRCD
from REPA.XX@REMOTE XX
where (1=1)
create synonym STG.C$_0XX_TR
for REPA.C$_0XX_TR@remote
insert into STG.XX_TR
TJD,
CID,
BOO,
TYPE,
GRP,
POAM,
BALINT,
DUIN2,
CRLMT,
IRN,
TDUE,
CHKHLD,
WDLMT,
ZSBU,
BAL,
MCHG,
LCHG,
ACR,
CR,
DR,
CRCD
select
TJD, CID,
BOO,
TYPE,
GRP,
POAM,
BALINT,
DUIN2,
CRLMT,
IRN,
TDUE,
CHKHLD,
WDLMT,
ZSBU,
BAL,
MCHG,
LCHG,
ACR,
CR,
DR,
CRCD
FROM (
select
C1_TJD TJD,
C2_CID CID,
C3_BOO BOO,
C4_TYPE TYPE,
C5_GRP GRP,
C6_POAM POAM,
C7_BALINT BALINT,
C8_DUIN2 DUIN2,
C9_CRLMT CRLMT,
C10_IRN IRN,
C11_TDUE TDUE,
C12_CHKHLD CHKHLD,
C13_WDLMT WDLMT,
C14_ZSBU ZSBU,
C15_BAL BAL,
C16_MCHG MCHG,
C17_LCHG LCHG,
C18_ACR ACR,
C19_CR CR,
C20_DR DR,
C21_CRCD CRCD
from STG.C$_0XX_TR
where (1=1)
) ODI_GET_FROM
i am getting following error
ODI-1228: Task INT_DBLINK (Integration) fails on the target ORACLE connection STG.
Caused By: java.sql.SQLException: ORA-12154: TNS:could not resolve the connect identifier specified
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1115)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3954)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1539)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662) -
How to manually implement the correction instructions 846826?
Hi Experts:
I happened DDIC_ACTIVATION error when used spam to implement support package SAPKB70007 ... SAPKW70012, The correction instruction no is 846826, the content as follows:
TADIR Entries
Object Description TADIR Entry
Program ID Object Type Object Name Program ID Object Type Object Name
LIMU REPS RADTBCHK R3TR PROG RADTBCHK
$$----
$$
$ Correction Inst. 0120061532 0000846826 $
$----$
$ Valid for : $
$ Software Component SAP_BASIS SAP Basis component $
$ Release 700 To SAPKB70011 $
$$----
$$
*& Object REPS RADTBCHK
*& Object Header PROG RADTBCHK
*& FORM CHK_TABLENAME
clear rclist. clear rc.
Check name-space for tablename
if tablenamec-existsname <> ' '.
*>>>> START OF DELETION <<<<<
call function 'DD_CHECK_NAME_SPACE'
exporting
*>>>> END OF DELETION <<<<<<<
*>>>> START OF INSERTION <<<<
"<KH> 20070108 active_only set to 'X' so that only
"active objects prevent activation (necessary for type
"change with still existing version of old type in N/L )
call function 'DD_CHECK_NAME_SPACE'
exporting
active_only = 'X'
*>>>> END OF INSERTION <<<<<<
How do I implement it? Thanks a lot.Hi!
You don´t need to apply this change manually. You can do it directly in transaction SNOTE with the Note Assistant. You will need to download the Note from this transaction and then apply it.
Remember you will also need to apply some manual changes, apart from the source code correction.Follow the steps mentioned on the Note:
Call Transaction SE51. Enter the following parameters on the initial screen:
Program: SAPVF040
Screen number: 1002
Subobject: Layout Editor
Press the "Change" button.
Double-click the field BSEG-SGTXT. On the screen "Screen Painter: Attributes", change the defined length field attribute to 50. Save and activate the change.
Regards
Antonio -
How would you implement equals ()
For complex classes with many data members, my dilema is:
1. equals should return true only if all fields of the two objects are
equals.
2. equals should return true if the key(s) of the two objets are equal.
For instance, we have the Class Person, that contains dozens of
data: ID, name, age, job, salary, children, more 1000 items.
Person is like a record in a DB table. There can not be two persons
with the same ID.
In this case, how would you implement equals, and why?
thanksWhat I'm trying to say is: what is equality foryou?
Two objects are equal if all there contents areequals
or is it enough
to compare their keys?
In the latter case, there can happen, by somereason,
that we can end
up with two objects with the same keys, but all the
rest of
the contents different.i think you meant to say that:
In the latter case, there can happen, by somereason,
that we can end
up with two objects with different keys, but
all the rest of the contents the same.and the answer is, and listen carefully, it totally
depends on the application you are writing. there
is no hard definition of equality where custom classes
are concerned... that is the answer.If this question arises, you should revisit your design.
If two entities have equal keys, they should be considered to be equal. Otherwise the attributes you call keys are in the fact normal attributes and no keys. -
How can I implement logical deletes?
Hello:
I understand that ejbRemove() will remove the actual row of data in the underlying table.
I would like to instead do a logical delete; there's a status flag that will be changed to reflect the fact that it was deleted.
Can somebody tell me how I can implement this logical delete in a CMP-driven EJB?
Thanks.
venkiYou can update the status field by having a home business method if you want
to update the status of many entities that can be deleted. If its only one
entity then you may want to expose update method from component interface .
Hope that helps.
<Venkat Venkataramanan> wrote in message
news:[email protected]..
Hello:
I understand that ejbRemove() will remove the actual row of data in the
underlying table.
I would like to instead do a logical delete; there's a status flag that
will be changed to reflect the fact that it was deleted.
Can somebody tell me how I can implement this logical delete in a
CMP-driven EJB?
Thanks.
venki -
How sessions are implemented on server
Hi All,
Can anyone please tell me how sessions are implemented on server like JRun, WebLogic, WebSphere or in general ?
Thanks & Regards,
Kumar.A common way to implement sessions in web servers would be something along the lines of...:
1) When a browser accesses the webserver, the webserver sends a cookie with a session id to
the browser.
2) The webserver creates an instance of some proprietary class that implements the
javax.servlet.http.HttpSession interface (comes with J2EE)
3) The webserver stores the session instance in a java.util.Map instance using the session id as the key.
4) When the browser hits the web server again, the cookie containing the session id is also sent, and
the web server knows which session instance to use when processing this request.
5) If the browser doesn't have cookies enabled, URL rewriting can be used. URL rewriting means that
the webserver adds the session id as a parameter to every link in the web application. Thus, whenever
the browser accesses the server again, the session id will be part of the URL, and the web server will
know what session instance to use when processing the request.
6) The webserver has a thread checking the session instances regularly to see if they are still valid,
meaning if their timeout limit hasn't been passed since the last request. If a session has expired it will
be removed. If a browser accesses a server with an old session id, the server will send a new cookie
with a new session id to the browser.
7) If the web server is part of a cluster, the session instance must be stored in a central database so all
web servers can access it, or the session must be replicated from the current server to all other servers in the cluster, whenever the values in the session instance changes.
Though I'm not an expert on Java web servers, I believe the, or variations of the above of course, will be how it's done.
Hope this gives you an idea.
Jakob Jenkov
www.jenkov.com
Maybe you are looking for
-
WebServices over SSL - 403 Forbidden error
Hello all, I am able to successfully communicate with a SSL enabled .NET webservice using apache-axis in my java code. however, when i try the same with weblogic based libs [%bea_home%\server\lib\webserviceclient+ssl.jar] - assume the other jars are
-
SAP PM or MM Which will be better
Hello Everyone. I m Yash From Guj. I had done B.E.(I.T.) And workign in IT industry as a Software engg. I want to do SAP ,My programming level is not so good so in Technical I choose either BI/ Basis.. But i heard in BI does not have a lot opening an
-
No enterprise mode option, IE is at correct version level
Hello. Has anyone seen an issue before where iexplore.exe is at version 11.0.9600.17420 (or even higher), which should allow for the enabling of Enterprise Mode, but the Enterprise Mode option is not listed as an option under Tools? We've checked reg
-
Hi, I'm sorry for crossposting this question to three different groups, but I have security and personalization related problem with commerce server, so I couldn't decide where to post... I'm designing LDAP-schema for a company piloting Commerce Serv
-
How do i change it back to the grey color?