TCP chat filtering by listbox multiline, is it possible?
Hey, would you help me
so, i have a TCP chat one-way. and i need to filter every chat which will be forward to end-devices, this is a scenario:
client 1, client 2, client 3, etc -----> Filter -----> end devices.
my problem is in Filter, i have listbox which receive chat from any client, and of course i dont limit the client 1 line, so they can chat with 2 or more line. In filter (listbox), it only can be seen 1 line not 2 or more line. now, what if the client write
long or more than one line?
and this is my code :
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Threading.Tasks
Imports System.IO
Public Class ServerForm
Private _Listener As TcpListener
Private _Connections As New List(Of ConnectionInfo)
Private _ConnectionMontior As Task
Private Sub StartStopButton_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles StartStopButton.CheckedChanged
If StartStopButton.Checked Then
StartStopButton.Text = "Stop"
StartStopButton.Image = My.Resources.Resources.StopServer
_Listener = New TcpListener(IPAddress.Any, CInt(PortTextBox.Text))
_Listener.Start()
Dim monitor As New MonitorInfo(_Listener, _Connections)
ListenForClient(monitor)
_ConnectionMontior = Task.Factory.StartNew(AddressOf DoMonitorConnections, monitor, TaskCreationOptions.LongRunning)
Else
StartStopButton.Text = "Start"
StartStopButton.Image = My.Resources.Resources.StartServer
CType(_ConnectionMontior.AsyncState, MonitorInfo).Cancel = True
_Listener.Stop()
_Listener = Nothing
End If
End Sub
Private Sub PortTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PortTextBox.Validating
Dim deltaPort As Integer
If Not Integer.TryParse(PortTextBox.Text, deltaPort) OrElse deltaPort < 1 OrElse deltaPort > 65535 Then
MessageBox.Show("Port number must be an integer between 1 and 65535.", "Invalid Port Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
PortTextBox.SelectAll()
e.Cancel = True
End If
End Sub
Private Sub ListenForClient(monitor As MonitorInfo)
Dim info As New ConnectionInfo(monitor)
_Listener.BeginAcceptTcpClient(AddressOf DoAcceptClient, info)
End Sub
Private Sub DoAcceptClient(result As IAsyncResult)
Dim monitorInfo As MonitorInfo = CType(_ConnectionMontior.AsyncState, MonitorInfo)
If monitorInfo.Listener IsNot Nothing AndAlso Not monitorInfo.Cancel Then
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
monitorInfo.Connections.Add(info)
info.AcceptClient(result)
ListenForClient(monitorInfo)
info.AwaitData()
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Invoke(doUpdateConnectionCountLabel)
End If
End Sub
Private Sub DoMonitorConnections()
Dim doAppendOutput As New Action(Of String)(AddressOf AppendOutput)
Dim doUpdateConnectionCountLabel As New Action(AddressOf UpdateConnectionCountLabel)
Dim monitorInfo As MonitorInfo = CType(_ConnectionMontior.AsyncState, MonitorInfo)
Me.Invoke(doAppendOutput, "# Monitor Started.")
Do
Dim lostCount As Integer = 0
For index As Integer = monitorInfo.Connections.Count - 1 To 0 Step -1
Dim info As ConnectionInfo = monitorInfo.Connections(index)
If info.Client.Connected Then
If info.DataQueue.Count > 0 Then
Dim messageBytes As New List(Of Byte)
While info.DataQueue.Count > 0
Dim value As Byte
If info.DataQueue.TryDequeue(value) Then
messageBytes.Add(value)
End If
End While
Me.Invoke(doAppendOutput, System.Text.Encoding.ASCII.GetString(messageBytes.ToArray))
End If
Else
monitorInfo.Connections.Remove(info)
lostCount += 1
End If
Next
If lostCount > 0 Then
Invoke(doUpdateConnectionCountLabel)
End If
_ConnectionMontior.Wait(1)
Loop While Not monitorInfo.Cancel
For Each info As ConnectionInfo In monitorInfo.Connections
info.Client.Close()
Next
monitorInfo.Connections.Clear()
Invoke(doUpdateConnectionCountLabel)
Me.Invoke(doAppendOutput, "# Monitor Stopped.")
End Sub
Private Sub AppendOutput(message As String)
If RichTextBox1.TextLength > 0 Then
RichTextBox1.AppendText(ControlChars.NewLine)
RichTextBox1.AppendText(ControlChars.NewLine)
End If
RichTextBox1.AppendText(message)
RichTextBox1.ScrollToCaret()
ListBox1.Items.Add(message.Remove(0, 37))
End Sub
Private Sub UpdateConnectionCountLabel()
ConnectionCountLabel.Text = String.Format("{0} Connections", _Connections.Count)
End Sub
Private Sub ServerForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Not ListBox1.SelectedItem Is Nothing AndAlso ListBox1.SelectedItem.ToString() <> "" Then
ListBox2.Items.Add(ListBox1.SelectedItem)
If Not ClientForm.ServerTextBox.Text = "" Then
ClientForm.InputTextBox.Text = ListBox1.SelectedItem
ClientForm.SendButton_Click(sender, e)
End If
If ClientFormExtra.ServerTextBox.Text = "" Then
ClientFormExtra.InputTextBox.Text = ListBox1.SelectedItem
ClientFormExtra.SendButton_Click(sender, e)
End If
ListBox1.Items.Remove(ListBox1.SelectedItem)
End If
IO.File.WriteAllText("LOG.txt", RichTextBox1.Text.Replace(Chr(10), Environment.NewLine))
Using writer1 = New StreamWriter(Application.StartupPath + "\LOG1.txt")
For Each o1 As Object In ListBox1.Items
writer1.WriteLine(o1)
Next
End Using
Using writer2 = New StreamWriter(Application.StartupPath + "\LOG2.txt")
For Each o2 As Object In ListBox2.Items
writer2.WriteLine(o2)
Next
End Using
Using writer3 = New StreamWriter(Application.StartupPath + "\LOG3.txt")
For Each o3 As Object In ListBox3.Items
writer3.WriteLine(o3)
Next
End Using
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ListBox3.Items.Add(ListBox1.SelectedItem)
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Me.Hide()
Dim isi As String = ""
isi = InputBox("Security code", "Configure")
If isi = "12" Then
ClientForm.Show()
ClientFormExtra.Show()
Me.Show()
Else
MsgBox("FAILED TO LOAD : please contact our admin", MsgBoxStyle.Exclamation, "permission is required to change default")
Me.Show()
End If
End Sub
End Class
Public Class MonitorInfo
Public Property Cancel As Boolean
Private _Connections As List(Of ConnectionInfo)
Public ReadOnly Property Connections As List(Of ConnectionInfo)
Get
Return _Connections
End Get
End Property
Private _Listener As TcpListener
Public ReadOnly Property Listener As TcpListener
Get
Return _Listener
End Get
End Property
Public Sub New(tcpListener As TcpListener, connectionInfoList As List(Of ConnectionInfo))
_Listener = tcpListener
_Connections = connectionInfoList
End Sub
End Class
Public Class ConnectionInfo
Private _Monitor As MonitorInfo
Public ReadOnly Property Monitor As MonitorInfo
Get
Return _Monitor
End Get
End Property
Private _Client As TcpClient
Public ReadOnly Property Client As TcpClient
Get
Return _Client
End Get
End Property
Private _Stream As NetworkStream
Public ReadOnly Property Stream As NetworkStream
Get
Return _Stream
End Get
End Property
Private _DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Public ReadOnly Property DataQueue As System.Collections.Concurrent.ConcurrentQueue(Of Byte)
Get
Return _DataQueue
End Get
End Property
Private _LastReadLength As Integer
Public ReadOnly Property LastReadLength As Integer
Get
Return _LastReadLength
End Get
End Property
Private _Buffer(63) As Byte
Public Sub New(monitor As MonitorInfo)
_Monitor = monitor
_DataQueue = New System.Collections.Concurrent.ConcurrentQueue(Of Byte)
End Sub
Public Sub AcceptClient(result As IAsyncResult)
_Client = _Monitor.Listener.EndAcceptTcpClient(result)
If _Client IsNot Nothing AndAlso _Client.Connected Then
_Stream = _Client.GetStream
End If
End Sub
Public Sub AwaitData()
_Stream.BeginRead(_Buffer, 0, _Buffer.Length, AddressOf DoReadData, Me)
End Sub
Private Sub DoReadData(result As IAsyncResult)
Dim info As ConnectionInfo = CType(result.AsyncState, ConnectionInfo)
Try
If info.Stream IsNot Nothing AndAlso info.Stream.CanRead Then
info._LastReadLength = info.Stream.EndRead(result)
For index As Integer = 0 To _LastReadLength - 1
info._DataQueue.Enqueue(info._Buffer(index))
Next
info.SendMessage("Received " & info._LastReadLength & " Bytes")
For Each otherInfo As ConnectionInfo In info.Monitor.Connections
If Not otherInfo Is info Then
otherInfo.SendMessage(System.Text.Encoding.ASCII.GetString(info._Buffer))
End If
Next
info.AwaitData()
Else
info.Client.Close()
End If
Catch ex As Exception
info._LastReadLength = -1
End Try
End Sub
Private Sub SendMessage(message As String)
If _Stream IsNot Nothing Then
Dim messageData() As Byte = System.Text.Encoding.ASCII.GetBytes(message)
Stream.Write(messageData, 0, messageData.Length)
End If
End Sub
End Class
any solution ? or alternate?
thanks.
Hi blackkynit,
you could open different form, then communicate with each one with different form. when you select different comboBox item. Use SelectChanged event handle of comboBox.
Similar Messages
-
Simple TCP Chat program behid router
Hello, I've been reading some of the examples from http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html, and understand how these examples work well enough to fool around with it...
I have it working inside my local network (behind a router), but when I try to have someone from outside my network connect to my server, they are unable to connect. I used IPchicken to determine which IP to give them.
What do I need to do to get this working behind routers?
Thanks for any time taken.DeshBanks wrote:
I figured it out, it looks like.
I had to login to my router and configure virtual routing (or something like that - I think it is basically port forwarding) on a specific port to my machine on the private network. I then had to 'allow' this port in my firewall.Hence my advice in reply 1 to google for port forwarding and check out your router's manual. -
Simple TCP chat application half duplex not working for me
I m having a problem in TCP application working half duplex
My friend runs client program who is in near by city and i run the server program in my system
Let my ip address is 116.x.y.z
My server program is
import java.net.*;
import java.io.*;
public class tcpserver
public static void main(String args[]) throws IOException
ServerSocket s1=null;
try
s1=new ServerSocket(98);
catch(IOException e)
System.err.println("Could not find port 98");
System.exit(1);
Socket c=null;
try
c=s1.accept();
System.out.println("Connection from"+c);
catch(IOException e)
System.out.println("Accept failed");
System.exit(1);
PrintWriter out=new PrintWriter(c.getOutputStream(),true);
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("I am ready,type now");
String l=in.readLine();
while(l!=null)
out.println(l);
out.close();
in.close();
c.close();
s1.close();
}The Client program is which my friend executes is
import java.net.*;
import java.io.*;
public class tcpclient
public static void main(String arg[]) throws IOException
Socket s=null;
BufferedReader b=null;
try
s=new Socket(InetAddress.getByName("116.x.y.z"),98);
b=new BufferedReader(new InputStreamReader(s.getInputStream()));
catch(UnknownHostException u)
System.err.println("I dont know host");
System.exit(0);
String inp;
while((inp=b.readLine())!=null)
System.out.println(inp);
break;
b.close();
s.close();
}Important Note: When i run this program specifying within my system its working ( i mean running the program in two different windows(terminals) its working for me)
When i give the client program to my friend its getting compiling for him but not running for him
Its showing him unknownhost exception and main method not found like this.
Please correct the above code or else just what kind of strategy we should follow in order to get rid of this problem
When i normally run this program in my system
the output when i run in my own system is
Output for running tcpserver.java
~\JDK2~1.0\bin>java tcpserver
Connection fromSocket[addr=/116.x.y.z,port=1930,localport=98] // in output i edit the ip address text
I am ready,type now
this is test text
Output for running tcpclient.java
~\JDK2~1.0\bin>java tcpclient
this is test text
My problem is its working in my system when it exceeds out the output is not available for me
Help me Please !!!String l=in.readLine();
while(l!=null)
out.println(l);
}That will print the same thing forever. Make it the same as the loop in the client.
Important Note: When i run this program specifying within my system its working ( i mean running the program in two different windows(terminals) its working for me)Looping forever might be what you call 'working'. I don't.
Its showing him unknownhost exception and main method not found like this.Change this:
new Socket(InetAddress.getByName("116.x.y.z"),98)to this:
new Socket("116.x.y.z",98)although your friend may then run into connectivity problems ... -
Once and for all: is video/audio chat from Mac to PC using MSN possible?
I've read all the posts, and all the jabber guides, and Mercury stuff, and it all seems like a huge hassle. I have a friend overseas who uses MSN (like EVERYONE overseas). he has a pc (again, like everyone overseas since Macs are 2x as expensive over there) with a webcam. I have AIM, MSN, and Yahoo accounts. I run Adium, and I can text with him but no vid or audio options are there. so, simply put, why is this so darn difficult? I suppose if we both had skype, that would be one solution. here are my questions:
- why is there no audio or video in adium? (if there's a post on their site that I should have read, forgive me)
- why doesn't MSN messenger for the Mac support audio and video?
- does jabber really allow AV chat using the MSN protocol? (once the 15 or so setup steps are completed)?
- is there, or will there be, a simple solution to this?
I have many, many friends both in the US and overseas, and all my friends overseas have PCs and MSN and webcams, and I have a very advanced MacBook, and I can't communicate with them the way I should be able to.
thanks! and I apologize if any of this has been covered in other posts, but I wanted to get it all down in one place.Hi
i would say use Skype http://www.skype.com/intl/en-gb/download/skype/macosx/
aMSN and Mercury only do video no audio, these are the only 2 progams that do video on the MSN network. -
How can I copy filters between accounts?
I seem to remember, back when I first switched my email to Thunderbird about two years ago, that I could duplicate message filters between email accounts rather than recreating them manually. Now I cannot find any way to do this. I'm reinstalling everything on my system, and while I copied my Thunderbird folder in its entirety from my backup, the filters carried over on only my primary account; my other accounts have no filters attached to them.
I have nine different email accounts set up in Thunderbird (and no, I cannot consolidate them or forward some of them into another, as these need to remain separate for a variety of reasons), and about half of my filters should run on all nine accounts (they apply color-coded tags based on source and keywords). I tried a filter import-export extension, but it wouldn't import anything. And I really don't want to manually recreate two dozen filters across nine accounts, one filter at a time.
If I can't copy or duplicate the filters from within Thunderbird, is it possible to go into the file system and copy individual files within the Thunderbird folder to accomplish the same result? I haven't identified anything in that folder that would allow this, but that doesn't mean it's not there—only that I don't know how filters are stored.
Suggestion for a future revision: Change filter management so that multiple accounts can use the same filter without having to duplicate anything. You can have a master filter list where you set up the actual filters, and each email account has a window where you choose which filters that account uses and what order they run in for that account. I can envision exactly how it should look and work, but I don't have the programming skills to write it myself, either as an extension or for inclusion into the main codebase. (I'm not even sure the way I would want this to work can be done as an extension, as it seems to me it would require a deep under-the-hood change in how filters and accounts are matched.) I'd be happy to provide interface mock-ups and detailed descriptions of the desired functionality, if there's someone interested in doing the actual coding.Yes you can,
The filter-files are in your "profile"\mail\"account"\
and in "profile"\imapmail\"account"\ and are named msgFilterRules.dat
You can open it in a texteditor (Notetab) and edit or you can copy from one account to next. Be a bit careful so you dont use filters where you dont want to. -
Chnaging the count of doucments on filtering
Hi I have this report which I have created which also gives the count of distinct documnets at the top-of page, on filtering that number dosent and wont change as that comes from the internal table , I need to show the count of actual number of documents in teh output after the filetring is done alos which will change as per the filtering is done . Is it possible to show a column or somewhere in teh out like the actual document number on top somewhere which will refrlet the actual number of documents in teh output after filter is done based on any of teh selection.
REPORT zztest MESSAGE-ID zsd NO STANDARD PAGE HEADING.
* For ALV usage
TYPE-POOLS: slis.
DATA: gs_layout TYPE slis_layout_alv,
tp_print TYPE slis_print_alv,
gt_sort TYPE slis_t_sortinfo_alv,
gt_events TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
repid TYPE syrepid, " ABAP Program.
gt_list_top_of_page TYPE slis_t_listheader, " Top of page text.
gs_list_top_of_page type slis_listheader,
alv_variant TYPE disvariant. " Customize Disp. Variant
DATA: w_field TYPE slis_fieldcat_alv.
DATA: count type i.
DATA: count1 type i.
TABLES: vbak, vbap, vbpa, knvv.
* Definition of selection screen *
* By plant, storage location, sold-to customers, material and *
* posting date of the sales orders *
SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY MEMORY ID VKO,"DEVK906677
p_vtweg TYPE vtweg OBLIGATORY DEFAULT '01',
p_spart TYPE spart OBLIGATORY DEFAULT '01'.
SELECT-OPTIONS: s_vkbur for vbak-vkbur, " Sales Office "DEVK906677
s_kunnr FOR vbak-kunnr. " Sold-to customer number.
SELECT-OPTIONS: s_shipto FOR vbap-oid_ship, " Ship-to customer number.
s_billto FOR vbpa-kunnr, " bill-to from S.O. header.
s_load FOR vbpa-kunnr, " Load confirmation contact.
s_truck FOR vbap-oid_extbol. " Trucking ticket number.
SELECT-OPTIONS: s_werks FOR vbap-werks OBLIGATORY NO INTERVALS. " Plant.
SELECT-OPTIONS: s_lgort FOR vbap-lgort. " Storage location.
SELECT-OPTIONS: s_matnr FOR vbap-matnr. " Material number.
SELECT-OPTIONS: s_konda FOR knvv-konda. " price group
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_vdatu FOR vbak-vdatu DEFAULT sy-datum.
SELECTION-SCREEN END OF BLOCK one.
* ALV display layout
SELECTION-SCREEN BEGIN OF BLOCK layout WITH FRAME TITLE text-003.
PARAMETERS: pa_vari TYPE slis_vari DEFAULT ' '. " Display variant.
SELECTION-SCREEN END OF BLOCK layout.
SELECTION-SCREEN BEGIN OF BLOCK two WITH FRAME TITLE text-028.
selection-screen comment: /1(79) text-029.
selection-screen comment: /1(79) text-030.
selection-screen comment: /1(79) text-031.
selection-screen comment: /1(79) text-032.
selection-screen comment: /1(79) text-033.
selection-screen comment: /1(79) text-034.
selection-screen comment: /1(79) text-035.
selection-screen comment: /1(79) text-036.
SELECTION-SCREEN END OF BLOCK two.
* Data Definitions *
* Storing Extracted Info.
TYPES: BEGIN OF t_extract,
vbeln TYPE vbeln_va, " Sales order number.
augru TYPE augru, " order reason
vdatu TYPE edatu_vbak, " Requested delivery date.
kunnr TYPE kunag, " Sold-to customer number.
soldto_name TYPE name1_gp, " Sold-to name.
posnr TYPE posnr_va, " Item number.
matnr TYPE matnr, " Material number.
vrkme TYPE vrkme, " Sales UoM.
mseh3 TYPE mseh3, " UoM text.
netwr TYPE netwr_ap, " Net value of the order item.
kwmeng TYPE p LENGTH 13 DECIMALS 1, " Quantity.
werks TYPE werks_d, " Plant.
lgort TYPE lgort_d, " Storage location.
oid_extbol TYPE oid_extbol, " External BOL or truck ticker header.
maktx TYPE maktx, " Material description.
oid_ship TYPE kunwe, " Ship-to customer number.
shipto_name TYPE name1_gp, " Ship-to name.
billto TYPE kunre, " Bill-to customer number.
billto_name TYPE name1_gp, " Bill-to name.
load_contact TYPE kunnr, " Load confirmation contact.
load_name TYPE name1_gp, " Load confirmation contact name.
truck TYPE kunnr, " Truck company number.
truck_name TYPE name1_gp, " Truck company name.
bstkd TYPE bstkd, " PO number.
ihrez TYPE ihrez, " AFE number per the contract/sales order.
delivery TYPE vbeln_vl, " Delivery number.
posnr_vl TYPE posnr_vl, " Delivery item number.
bill_vbeln TYPE vbeln_vf, " Invoice number.
bill_posnr TYPE posnr_vf, " Invoice item number.
bill_netwr TYPE netwr_fp, " Invoice net value.
statu TYPE stats, " Document status.
auart TYPE auart, " order type
vkorg TYPE vkorg, " sales org.
vtweg TYPE vtweg, " distrbtn channel
spart TYPE spart, " division
vkbur like vbak-vkbur, " Sales Office DEVK906677
konda TYPE konda, " price group
tdline TYPE tdline, " text for customer account reference
count TYPE I,
END OF t_extract.
DATA : it_extract TYPE TABLE OF t_extract WITH HEADER LINE,
it_extract2 TYPE TABLE OF t_extract WITH HEADER LINE.
DATA: it_text TYPE TABLE OF tline WITH HEADER LINE.
DATA: w_index type sy-index,
w_tdname type TDOBNAME.
CONSTANTS: c_minus1 type netwr_ap value '1.00-'.
*RANGES: r_auart FOR vbak-auart.
Data: r_auart TYPE range of t_extract-auart,
r_auart_line like line of r_auart.
* initialization
INITIALIZATION.
gs_layout-colwidth_optimize = 'X'.
tp_print-no_print_listinfos = 'X'.
tp_print-no_coverpage = 'X'.
PERFORM set_fieldcat.
PERFORM alv_eventtab_build USING:
** Event name Form to execute Event internal table
'TOP_OF_PAGE' 'TOP_OF_PAGE' gt_events[].
* changed to exclude following order types
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZEQ'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* credit memo
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZPRC'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* debit memo
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZPRD'.
clear r_auart_line-high.
append r_auart_line to r_auart.
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZDR'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* Industry sales order correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZSOC'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* oilfield FF correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZOCF'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* oilfield WP correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZOCW'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* Dropdown list for all created ALV layouts, global or user-specific
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.
PERFORM alv_variant_f4 CHANGING pa_vari.
* Main BODY of processing logic
START-OF-SELECTION.
PERFORM extract_data.
END-OF-SELECTION.
IF NOT it_extract[] IS INITIAL.
* Build headings for report.
PERFORM build_top_of_page USING gt_list_top_of_page[].
PERFORM call_alv.
ENDIF.
*& Form EXTRACT_KEY_DATA
* Retreive the data for the report.
FORM extract_data.
CLEAR: it_extract. REFRESH: it_extract.
* orders
SELECT vbak~vbeln vbak~auart vbak~augru vbak~vkorg vbak~vtweg
vbak~spart vbak~vdatu vbak~kunnr vbak~vkbur
vbap~posnr vbap~matnr vbap~vrkme vbap~netwr vbap~kwmeng
vbap~werks vbap~lgort vbap~oid_extbol vbap~oid_ship
INTO CORRESPONDING FIELDS OF TABLE it_extract
FROM vbak INNER JOIN vbap
ON vbak~mandt = vbap~mandt
AND vbak~vbeln = vbap~vbeln WHERE
vbak~auart NOT IN r_auart AND
vbak~vkorg EQ p_vkorg AND
vbak~vtweg EQ p_vtweg AND
vbak~spart EQ p_spart AND
vbak~vkbur in s_vkbur and "DEVK906677
vbak~vdatu IN s_vdatu AND
vbak~kunnr IN s_kunnr AND
vbap~matnr IN s_matnr AND
vbap~werks IN s_werks AND
vbap~lgort IN s_lgort AND
vbap~oid_extbol IN s_truck AND
vbap~oid_ship IN s_shipto.
IF sy-subrc <> 0.
MESSAGE i000 WITH text-002 ' ' ' ' ' '.
ENDIF.
SORT it_extract BY vbeln.
CHECK sy-subrc = 0.
LOOP AT it_extract.
* Retrieve and select by load confirmation contacts from header
SELECT SINGLE kunnr FROM vbpa INTO it_extract-load_contact
WHERE vbeln = it_extract-vbeln
AND posnr = '000000'
AND parvw = 'ZB'.
IF it_extract-load_contact IN s_load.
it_extract-load_name = zcl_kna1=>get_name1( it_extract-load_contact ).
ELSE.
DELETE it_extract.
CONTINUE.
ENDIF.
* Retrieve and select by sales order bill-to on header level
* as well as lookup bill-to customer name/description
SELECT SINGLE kunnr FROM vbpa INTO it_extract-billto
WHERE vbeln = it_extract-vbeln
AND posnr = '000000'
AND parvw = 'RE'.
IF sy-subrc = 0.
if s_billto is initial.
it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
else.
if it_extract-billto in s_billto.
it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
else.
DELETE it_extract.
CONTINUE.
endif.
endif.
ELSE.
* Newalta - always has bill-to, following will not occur but included
* as good programming practice.
it_extract-billto_name = it_extract-billto.
ENDIF.
* Retrieve and select by price group of sold-to
SELECT SINGLE konda FROM knvv INTO it_extract-konda
WHERE kunnr = it_extract-kunnr
AND vkorg = it_extract-vkorg
AND vtweg = it_extract-vtweg
AND spart = it_extract-spart.
IF sy-subrc = 0.
IF NOT ( it_extract-konda IN s_konda ).
DELETE it_extract.
CONTINUE.
ENDIF.
ENDIF.
* Retrieve trucking company customer
SELECT SINGLE kunnr FROM vbpa INTO it_extract-truck WHERE
vbeln = it_extract-vbeln AND
posnr = '000000' AND
parvw = 'ZT'.
IF sy-subrc = 0.
it_extract-truck_name = zcl_kna1=>get_name1( it_extract-truck ).
ENDIF.
* Retrieve sold-to name
it_extract-soldto_name = zcl_kna1=>get_name1( it_extract-kunnr ).
* Retrieve ship-to name
it_extract-shipto_name = zcl_kna1=>get_name1( it_extract-oid_ship ).
* lookup P.O.
SELECT SINGLE bstkd ihrez FROM vbkd INTO (it_extract-bstkd, it_extract-ihrez)
WHERE vbeln = it_extract-vbeln
AND posnr = '000000'.
* Retreive the material description.
it_extract-maktx = zcl_material=>get_maktx( it_extract-matnr ).
* cosmetic change of material number, donot display leading zeros.
SHIFT it_extract-matnr LEFT DELETING LEADING '0'.
* translate unit of measure
it_extract-mseh3 = it_extract-vrkme.
SELECT SINGLE mseh3 FROM t006a INTO it_extract-mseh3
WHERE spras = sy-langu
AND msehi = it_extract-vrkme.
w_tdname = it_extract-vbeln.
* read customer account reference which is under 'text'
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'Z010'
LANGUAGE = sy-langu
NAME = w_tdname
OBJECT = 'VBBK'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = it_text
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
read table it_text index 1.
if sy-subrc = 0.
it_extract-tdline = it_text-tdline.
else.
clear it_extract-tdline.
endif.
ELSE.
clear it_extract-tdline.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get the delivery item.
CALL METHOD zcl_vbap=>get_delivery
EXPORTING
itp_vbeln = it_extract-vbeln
itp_posnr = it_extract-posnr
IMPORTING
etp_vbeln = it_extract-delivery
etp_posnr = it_extract-posnr_vl.
IF it_extract-delivery IS NOT INITIAL.
PERFORM process_deliveries.
ELSE.
PERFORM invoice_process.
ENDIF.
it_extract-count = 1 .
MOVE-CORRESPONDING it_extract TO it_extract2.
APPEND it_extract2.
AT NEW vbeln.
count1 = count1 + 1.
ENDAT.
CALL FUNCTION 'REUSE_ALV_EVENT_NAMES_GET'
* EXPORTING
* I_LIST_TYPE = 0
TABLES
T_EVENT_NAMES = it_extract2
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
ENDFORM. " EXTRACT_DATA
*& Form SET_FIELDCAT
* Create the field catalogue.
FORM set_fieldcat .
CLEAR w_field.
CLEAR t_fieldcat. REFRESH t_fieldcat.
w_field-col_pos = 1 .
w_field-fieldname = 'VBELN'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Document.Nbr'.
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
APPEND w_field TO t_fieldcat.
CLEAR w_field.
w_field-col_pos = 2 .
w_field-fieldname = 'POSNR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Item'(023).
APPEND w_field TO t_fieldcat.
CLEAR w_field.
w_field-col_pos = 3 .
w_field-fieldname = 'VDATU'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Req. Del. Date'(005).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 4. "DEVK909658
w_field-fieldname = 'KUNNR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Sold-to.'(038).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 5 .
w_field-fieldname = 'SOLDTO_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Sold-to'(006).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 6 .
w_field-fieldname = 'MATNR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Material'(007).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 7 .
w_field-fieldname = 'KWMENG'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Quantity'(008).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 8.
w_field-fieldname = 'MSEH3'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'UOM'(009).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 9 .
w_field-fieldname = 'BILL_VBELN'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Invoice #'(010).
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
APPEND w_field TO t_fieldcat.
CLEAR w_field.
w_field-col_pos = 10 .
w_field-fieldname = 'BILL_NETWR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Values'(011).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 11.
w_field-fieldname = 'WERKS'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Plant'(012).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 12.
w_field-fieldname = 'LGORT'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Storage Loc'(013).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 13 .
w_field-fieldname = 'MAKTX'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Description'(014).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 14. "DEVK909658
w_field-fieldname = 'OID_SHIP'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Ship-to.'(039).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 15 .
w_field-fieldname = 'SHIPTO_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Ship-to'(015).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 16. "DEVK909658
w_field-fieldname = 'BILLTO'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Bill-to .'(040).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 17 .
w_field-fieldname = 'BILLTO_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Bill-to'(016).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 18 .
w_field-fieldname = 'LOAD_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Load Contact'(017).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 19 .
w_field-fieldname = 'TRUCK_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Truck Comp.'(018).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 20 .
w_field-fieldname = 'BSTKD'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'P.O.'(019).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 21 .
w_field-fieldname = 'IHREZ'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'AFE Nbr'(020).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 22 .
w_field-fieldname = 'OID_EXTBOL'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Truck Ticket'(021).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 23.
w_field-fieldname = 'STATU'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Status'(022).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 24.
w_field-fieldname = 'AUGRU'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Ord.Reason'(024).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 25.
w_field-fieldname = 'TDLINE'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'cstmr.acct.ref.'(027).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 26 . "DEVK906678
w_field-fieldname = 'VKBUR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Sales Office'(037).
APPEND w_field TO t_fieldcat.
w_field-col_pos = 27. "DEVK909658
w_field-fieldname = 'COUNT'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Count'(041).
w_field-do_sum = 'X'.
APPEND w_field TO t_fieldcat.
ENDFORM. " SET_FIELDCAT
*& Form CALL_ALV
* Call the ALV Grid function.
FORM call_alv .
SORT it_extract BY lgort vbeln.
* repid is necessary since the ALV F.M. does not work properly with
* sy-repid.
repid = sy-repid.
alv_variant-variant = pa_vari.
alv_variant-report = sy-repid.
alv_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
it_sort = gt_sort[]
i_default = 'X'
i_save = 'A'
is_variant = alv_variant
it_events = gt_events[]
is_print = tp_print
TABLES
t_outtab = it_extract2
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE w000 WITH text-004 ' ' ' ' ' '.
ENDIF.
ENDFORM. " CALL_ALV
*& Form build_top_of_page
* Build heading for report. *
* -->P_GT_LIST_TOP_OF_PAGE[] Header stuff for report
FORM build_top_of_page USING e04_lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader. "Header table for top of page
* construct 'top of page' info. to display. In this case, one line.
DATA: w_selections(40) TYPE c,
w_date_from(10) TYPE c,
w_date_to(10) TYPE c.
WRITE: s_vdatu-low TO w_date_from DD/MM/YYYY.
IF s_vdatu-high IS NOT INITIAL.
WRITE: s_vdatu-high TO w_date_to DD/MM/YYYY.
CLEAR w_selections.
CONCATENATE 'Del.Req.Date: ' w_date_from 'To' w_date_to
INTO w_selections SEPARATED BY space.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
APPEND ls_line TO e04_lt_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = ' Total Number of Sales Documents'.
append gs_list_top_of_page to gt_list_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = count1.
append gs_list_top_of_page to gt_list_top_of_page.
ELSE.
CLEAR w_date_to.
CONCATENATE 'Del.Req.Date: ' w_date_from
INTO w_selections SEPARATED BY space.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
APPEND ls_line TO e04_lt_top_of_page.
ENDIF.
ENDFORM. " build_top_of_page
*& Form alv_eventtab_build
* Pass list of events to be triggered by the ALV function module
FORM alv_eventtab_build USING u_name TYPE slis_alv_event-name
u_form TYPE slis_alv_event-form
alv_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event. " structure for event handling
ls_event-name = u_name.
ls_event-form = u_form.
APPEND ls_event TO alv_lt_events.
ENDFORM. " alv_eventtab_build
* FORM TOP_OF_PAGE *
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'NEWALTA_LOGO'
it_list_commentary = gt_list_top_of_page.
ENDFORM. " TOP_OF_PAGE
*& Form process_deliveries
* Process the delivery related records.
FORM process_deliveries .
DATA:
ltp_date TYPE wadat_ist, " Goods movement date.
ltp_vbtyp TYPE vbtyp_n,
ltp_mtart TYPE mtart, " Material type.
w_lfimg TYPE lfimg, " Actual quantity delivered (in sales units).
w_vrkme TYPE vrkme. " Sales unit of measure.
* Read delivery quantity and uom.
SELECT SINGLE lfimg vrkme INTO (w_lfimg, w_vrkme)
FROM lips WHERE
vbeln = it_extract-delivery AND
posnr = it_extract-posnr_vl.
* these fields have values from vbap. override with lips values
IF sy-subrc = 0.
it_extract-kwmeng = w_lfimg.
it_extract-vrkme = w_vrkme.
* translate unit of measure
it_extract-mseh3 = it_extract-vrkme.
SELECT SINGLE mseh3 FROM t006a INTO it_extract-mseh3
WHERE spras = sy-langu
AND msehi = it_extract-vrkme.
ENDIF.
* Determine STATUS by reading 'service confirmation', R (goods movemt)
* it is possible to have multiple 'service confirmation' records for
* one item. ie. delivery 80010390 in PRD.
* As long as there is at least one 'service confirmation' record,
* status is considered 'complete'.
* Validate the created on date of the goods movement or service confirmation.
ltp_mtart = zcl_material=>get_mtart( it_extract-matnr ).
* ltp_date = zcl_lips=>get_goods_movement_date( itp_vbeln = it_extract-delivery
* itp_posnr = it_extract-posnr_vl itp_mtart = ltp_mtart ).
CALL METHOD zcl_lips=>get_goods_mvt_info
EXPORTING
itp_vbeln = it_extract-delivery
itp_posnr = it_extract-posnr_vl
itp_mtart = ltp_mtart
IMPORTING
rtp_date = ltp_date
rtp_vbtyp = ltp_vbtyp.
* 'h' is cancel goods issue
IF ltp_vbtyp = 'h'.
it_extract-statu = 'Incomplete'(025).
ELSE.
IF ltp_date IS NOT INITIAL.
it_extract-statu = 'COMPLETE'(026).
ENDIF.
ENDIF.
* Retrieve the invoice/billing document item.
CALL METHOD zcl_lips=>get_invoice
EXPORTING
itp_vbeln = it_extract-delivery
itp_posnr = it_extract-posnr_vl
IMPORTING
rtp_vbeln = it_extract-bill_vbeln
rtp_posnr = it_extract-bill_posnr.
IF it_extract-bill_vbeln IS NOT INITIAL.
* retrieve net value from the invoice.
CLEAR it_extract-bill_netwr.
SELECT SINGLE netwr INTO it_extract-bill_netwr FROM vbrp
WHERE vbeln = it_extract-bill_vbeln
AND posnr = it_extract-bill_posnr.
ELSE.
it_extract-bill_netwr = it_extract-netwr. " Use order net value.
ENDIF.
ENDFORM. " process_deliveries
*& Form user_command
* Process the user command.
* -->R_UCOMM User command
* -->RS_SELFIELD Field selected
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: ltp_vbeln TYPE vbeln. " Sales document number.
CASE r_ucomm.
WHEN '&IC1'.
IF ( rs_selfield-fieldname = 'VBELN'
OR rs_selfield-fieldname = 'BILL_VBELN' )
AND rs_selfield-value IS NOT INITIAL. " Display sales document.
ltp_vbeln = rs_selfield-value.
zcl_sales_doc=>display( ltp_vbeln ).
ENDIF.
ENDCASE.
ENDFORM. "user_command
*& Form invoice_process
* Process for orders without deliveries. *
FORM invoice_process .
* Translate unit of measure.
SELECT SINGLE mseh3 FROM t006a INTO it_extract-mseh3
WHERE spras = sy-langu
AND msehi = it_extract-vrkme.
* Retrieve the invoice/billing document item.
CALL METHOD zcl_vbap=>get_invoice
EXPORTING
itp_vbeln = it_extract-vbeln
itp_posnr = it_extract-posnr
IMPORTING
rtp_vbeln = it_extract-bill_vbeln
rtp_posnr = it_extract-bill_posnr.
IF it_extract-bill_vbeln IS NOT INITIAL.
* retrieve net value from the invoice.
CLEAR it_extract-bill_netwr.
SELECT SINGLE netwr INTO it_extract-bill_netwr FROM vbrp
WHERE vbeln = it_extract-bill_vbeln
AND posnr = it_extract-bill_posnr.
ELSE. " If no Invoice, then status becomes 'incomplete'.
it_extract-bill_netwr = it_extract-netwr. " Use order net value.
it_extract-statu = 'Incomplete'(025).
ENDIF.
ENDFORM. " invoice_process
*& Form alv_variant_f4
* Get the display variant.
* <--CTP_VARI Variant name
FORM alv_variant_f4 CHANGING ctp_vari TYPE slis_vari.
alv_variant-report = sy-repid. " Report ID
alv_variant-username = sy-uname. " User ID
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = alv_variant
i_save = 'A'
IMPORTING
es_variant = alv_variant
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
ctp_vari = alv_variant-variant.
ENDIF.
ENDFORM. " alv_variant_f4
Kind help will be greatly appreciated.
Thanks
AaravAarav,
when you call the ALV you need to set the event exit details for filter:
*Set callback after filter
REFRESH T_EVENT_EXIT.
CLEAR WA_EVENT_EXIT.
WA_EVENT_EXIT-UCOMM = '&ILT'.
WA_EVENT_EXIT-AFTER = 'X'.
APPEND WA_EVENT_EXIT TO T_EVENT_EXIT.
Then call the ALV as per usual with the event exit details:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'Z_OWDR_MONTH_END_01'
I_CALLBACK_PF_STATUS_SET = Z_PF_STATUS_SET
I_CALLBACK_USER_COMMAND = 'CALLBACK_USER_COMMAND'
I_BACKGROUND_ID = 'ALV_BACKGROUND'
IS_LAYOUT = Z_IS_LAYOUT
IT_FIELDCAT = T_FIELDCAT2
IT_FILTER = T_FILTER
I_SAVE = 'A'
IS_VARIANT = Z_VARIANT
IT_EVENT_EXIT = T_EVENT_EXIT
TABLES
T_OUTTAB = T_OUT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
Then in the 'callback_user_command' insert some code to read the filter settings when the filter function is selected using function 'REUSE_ALV_GRID_LAYOUT_INFO_GET':
FORM CALLBACK_USER_COMMAND USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE UCOMM.
WHEN '&ILT'.
PERFORM 99_STORE_FILTERS.
ENDCASE.
FORM 99_STORE_FILTERS.
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
IMPORTING
ET_FILTER = T_FILTER
ET_FILTERED_ENTRIES = T_FILTERED
EXCEPTIONS
NO_INFOS = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " 99_STORE_FILTERS
Hope that makes it clear - worked for me.
Claire -
Can I use the second TCP / IP port on my cRIO to drive a meter Agilent
I would like to use the second TCP / IP port of my NI cRIO-9024 to control my Agilent 33210A pulse generator with VISA TCP/IP.
My Agilent has only TCP/IP and GPIB ports.
Is it possible?
cordiallyAll the MACs (from my old 2006 PPC Mini) will auto detect ethernet crossover and straight through and rollover cables correctly. They should be Auto-MDIX.
Having said that, the FW800 (via TB) and Ethernet should be very close in terms of performance. -
Inserting an image in a column of a multicolumn listbox
Hi,
How can I insert an image in a column and row of a multicolumn listbox? Is it possible?
Thanks,
ToNi.To change any property of a cell, you must first select it using the Active Cell Property node, a cluster of row and column indexes. Setting the indexes values to -2 select the entire row/column/table, including the headers, setting the indexes to -1 select only the headers.
Changing a column foreground color without affecting the header color is therefore a 3 steps operation :
- set the active cell property to -1, n (n being he column index); read the foreground color
- set the active cell property to -2, n; write the new foreground color
- set the active cell property to -1; write back the previously read foreground color
Since you cannot change programmatically the images in a ring, the pict ring array cannot be used if you want to load new images at run time.
Use instead a picture array, as shown in the attached vi. I still use a pict ring, but that's just as a convenient image source. Replace it with your own source (file dialog for instance...)
CC
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...
Attachments:
ListBox & Picts.vi 1 KB -
How to make a private chat look in another window
hi
iam new to flex
and now what my question is when i double click on the particular user present in the chat room
i should get chat open in new window
is this possible please help out in this issuehi
thanks for urs replys its helping a lot
and now i wnt some information from u abt private chat
see wt my doubt is iam getting user name and uid when i click on the user in the userlist with that iam creating an instance to the class "ChatMessageDescriptor" and with that iam sending msgs to the user clicked by the property recipient
and iam initiating that private chat in seperate label privatechat space and now wt the problem is when i click on the username
for example iam the user A and i clicked on user B the window gets open for userA and user A can send msgs to user B directly
but where as in place of User B the window doesnot get open, only when he clicks on User A he is able to send msgs to User A and he can chat w User A directly from there on words
so wt i want is how to intiate him that chat is open with User A so click him in the userlist or directly open him a window as soon as User A clicks
User B is this possible plz refer my code u will get clearly understood the problem
<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute"
xmlns:mx="http://www.adobe.com/2006/mxml"
applicationComplete="init()"
xmlns:rtc="AfcsNameSpace">
<mx:Script>
<![CDATA[
import com.adobe.rtc.pods.simpleChatClasses.ChatMessageDescriptor;
import com.adobe.coreUI.controls.WhiteBoard;
import com.adobe.rtc.sharedModel.SharedCollection;
import com.adobe.rtc.sharedManagers.UserManager;
import com.adobe.rtc.sharedManagers.descriptors.UserDescriptor;
import mx.controls.listClasses.IListItemRenderer;
import mx.controls.listClasses.ListBaseSelectionData;
import mx.collections.IList;
import mx.events.ItemClickEvent;
import mx.controls.Alert;
import com.adobe.rtc.events.AuthenticationEvent;
import com.adobe.rtc.events.ConnectSessionEvent;
import com.adobe.rtc.events.SessionEvent;
import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;
import flash.net.*;
import mx.collections.ArrayCollection;
import com.adobe.rtc.pods.simpleChatClasses.SimpleChatModel;
import com.adobe.rtc.events.ChatEvent;
private const applicationTitle:String = "AFCS Sample Application";
[Bindable]
public var chatModel:SimpleChatModel;
public var clickeduser:UserDescriptor = new UserDescriptor;
public var userwnt:String=new String;
public var clickusername:String=new String;
public var selindex:int;
public var count:int;
private function init():void
sess.addEventListener(SessionEvent.ERROR, onEventNotification);
sess.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onEventNotification);
auth.addEventListener(AuthenticationEvent.AUTHENTICATION_FAILURE, onEventNotification);
auth.addEventListener(AuthenticationEvent.AUTHENTICATION_SUCCESS, onEventNotification);
popup(loginWindow);
private function popup(window:IFlexDisplayObject):void
PopUpManager.addPopUp(window, this, true);
PopUpManager.centerPopUp(window);
window.visible = true;
* Process AFCS Events
private function onEventNotification(p_event:Event):void
if (p_event.type == SessionEvent.SYNCHRONIZATION_CHANGE) {
if (sess.isSynchronized) {
// isSyncronized==true : we are connected to the room
panel.title = "Connected to room " + sess.roomURL;
PopUpManager.removePopUp(loginWindow);
} else {
// isSyncronized==false : we are disconnected from the room
panel.title = applicationTitle;
sess.roomURL = null;
notificationMessage.text = "";
popup(loginWindow);
else if (p_event.type == AuthenticationEvent.AUTHENTICATION_SUCCESS) {
// Authentication succeeded
notificationMessage.text = "Authentication Succeeded";
else if (p_event.type == AuthenticationEvent.AUTHENTICATION_FAILURE) {
// Authentication failed : bad password or invalid username
notificationMessage.text = "Authentication Failed";
else if (p_event.type == SessionEvent.ERROR) {
// Generic session error, but this can happen if you mispell the account/room names
// (sError.error.name == "INVALID_INSTANCE" and sError.error.message == "Invalid Instance")
var sError:SessionEvent = p_event as SessionEvent;
notificationMessage.text = sError.error.message;
else
notificationMessage.text = "Got event " + p_event;
private function login():void
notificationMessage.text = "";
auth.userName = username.text;
auth.password = passwordBox.visible ? password.text : null; // password==null : the user is a guest
userwnt=username.text;
sess.roomURL = roomURL.text;
sess.login();
protected function buildModel():void
// Create the model: just calling the constructor won't create the collection node or pass the messages.
// Call subscribe and give it a shared ID while creating the model.
// The shared ID becomes the name of the collection node.
if(clickusername==userwnt)
Alert.show(clickusername);
viewStack.selectedChild=white;
chatModel = new SimpleChatModel();
chatModel.sharedID = "myChat_SimpleChatModel";
chatModel.subscribe();
chatModel.addEventListener(ChatEvent.HISTORY_CHANGE, onChatMsg);
this.addEventListener(KeyboardEvent.KEY_UP, onKeyStroke);
public var cmd:ChatMessageDescriptor = new ChatMessageDescriptor();
public function userclick(bharath):void
count=0;
selindex=bharath;
clickeduser= sess.userManager.userCollection[bharath] as UserDescriptor;
var orignaluser:UserDescriptor = sess.userManager.userCollection[0] as UserDescriptor;
var username=orignaluser.displayName;
clickusername=clickeduser.displayName;
cmd= new ChatMessageDescriptor();
cmd.recipient=clickeduser.userID;
cmd.recipientDisplayName=clickusername;
cmd.msg="hi";
viewStack.selectedChild=white;
buildModel();
chatModel.sendMessage(cmd);
protected function clearChat():void
chat_mesg_area.text = "";
chatModel.clear();
protected function submitChat(str:String):void
if(count==0)
clearChat();
count=1;
var clickeduser:UserDescriptor = sess.userManager.userCollection[selindex] as UserDescriptor;
var clickusername=clickeduser.displayName;
cmd= new ChatMessageDescriptor();
cmd.recipient=clickeduser.userID;
cmd.recipientDisplayName=clickusername;
cmd.msg=chat_mesg_input.text;
chatModel.sendMessage(cmd);
chat_mesg_input.text = "";
protected function onChatMsg(p_evt:ChatEvent):void
if(p_evt.message != null && p_evt.message.msg != null && p_evt.message.displayName != null)
chat_mesg_area.text += "\r\n" + p_evt.message.displayName + ": " + p_evt.message.msg;
else
chat_mesg_area.text = "";
protected function onKeyStroke(p_evt:KeyboardEvent):void
if(p_evt.keyCode == Keyboard.ENTER) {
submitChat(chat_mesg_input.text);
]]>
</mx:Script>
<rtc:AdobeHSAuthenticator id="auth"/>
<rtc:RoomSettings id="settings" autoPromote="true"/>
<mx:Panel id="panel" title="{applicationTitle}" width="100%" height="100%" paddingLeft="5" paddingTop="5" paddingRight="5" paddingBottom="5">
<!--
| Login Dialog Box
-->
<mx:TitleWindow id="loginWindow" title="Connect to Room" visible="false">
<mx:VBox>
<mx:HBox>
<mx:Label text="Room URL:" width="70"/>
<mx:TextInput id="roomURL" width="295" tabIndex="1">
<mx:text>http://connect.acrobat.com/exampleURL/exampleroom</mx:text>
</mx:TextInput>
</mx:HBox>
<mx:HBox>
<mx:Label text="Username:" width="70"/>
<mx:TextInput id="username" tabIndex="2">
<mx:text>guest</mx:text>
</mx:TextInput>
<mx:Button label="Login" click="login()" width="126" tabIndex="4"/>
</mx:HBox>
<mx:HBox>
<mx:HBox id="passwordBox">
<mx:Label text="Password:" width="70"/>
<mx:TextInput id="password" displayAsPassword="true" tabIndex="3"/>
</mx:HBox>
<mx:RadioButton label="User" selected="true" click="passwordBox.visible = true"/>
<mx:RadioButton label="Guest" click="passwordBox.visible = false"/>
</mx:HBox>
<mx:Text id="notificationMessage" text=""/>
</mx:VBox>
</mx:TitleWindow>
<!--
| AFCS application UI wrapped in ConnectSession
-->
<rtc:ConnectSessionContainer
id="sess"
authenticator="{auth}"
initialRoomSettings="{settings}"
autoLogin="false" width="100%" height="100%" >
<mx:HBox width="100%" height="100%" horizontalGap="0">
<mx:VBox>
<mx:TabBar dataProvider="viewStack" direction="vertical" width="100" verticalGap="0"/>
<!--mx:Button label="Disconnect" click="sess.close()"/-->
</mx:VBox>
<mx:ViewStack id="viewStack" width="100%" height="100%" borderSides="left top right bottom" borderStyle="solid" borderThickness="2">
<!--
| Chat pod and roster
-->
<mx:HBox label="Chat" width="100%" height="100%">
<rtc:SimpleChat width="40%" height="100%"/>
<rtc:WebCamera left="0" right="0" top="0" bottom="0" width="40%" height="100%"/>
<mx:List alternatingItemColors="[#DFDFDF,#EEEEEE]" dataProvider="{sess.userManager.userCollection}" width="10%" height="100%" labelField="displayName" id="abc" click="userclick(abc.selectedIndex)"/>
</mx:HBox>
<mx:Canvas id="white" label="privatechat" width="100%" height="100%" creationComplete="buildModel()">
<mx:VBox id="chatBox">
<rtc:WebCamera id="webcam" width="400" height="223"/>
<mx:TextArea width="398" height="140" id="chat_mesg_area"/>
<mx:HBox>
</mx:HBox>
</mx:VBox>
<mx:TextInput width="400" id="chat_mesg_input" y="370"/>
<mx:Button label="Submit Chat" click="submitChat(chat_mesg_input.text)" y="398"/>
</mx:Canvas>
<!--
| Fileshare pod
-->
<mx:Canvas label="FileShare" width="100%" height="100%">
<rtc:FileShare left="0" right="0" top="0" bottom="0"/>
</mx:Canvas>
</mx:ViewStack>
</mx:HBox>
</rtc:ConnectSessionContainer>
</mx:Panel>
</mx:Application> -
Clearing GL Accounts filtering on Profit Center
Hi Experts,
i have a query, i want to clear GL accounts by filtering on Profit Center, is it possible?
i am not able to find any layout in F-03 where the Profit Center field is available to choose.
What setting is required to be done to get the Profit Center field either on the main screen or from the layout inside.
Sankalp.There is no such options in front screen or at line layout level . Try to use reference no as base.(O7Z4) Before that all profit centers should be entered in reference field.
Srinivas -
Can we add search filters to CV04N?
Hi,
What i am being asked to do is add different search filters to CV04N. Is it possible to add a search field at CV04N?
My customers case: "We use CV04N to track vehicle software editions. What we need is a screen that we can track software edition documents according to vehicle and date and filter them. I have to be able to give a report like this:
___Vehicle type | Vehicle code | Document Type | Document | Output date__ | From date | etc..___
_______A______|A001_______ | SFT__________ | S001____ | DD/MM/YY_ | DD/MM/YY| etc.._
_______A______|A001_______ | SFT__________ | S002____ | DD/MM/YY_ | DD/MM/YY| etc.._
_______A______|A002_______ | SFT__________ | S001____ | DD/MM/YY_ | DD/MM/YY| etc.._
_______B______|B001_______ | SFT__________ | S002____ | DD/MM/YY_ | DD/MM/YY| etc.._
When i double click to the document field at the report, i can reach Vehicle code (Equipment master column) at Object Links tab. But i have to double click and see the vehicle code then go back and see the date etc."
- Is it possible to add Vehicle type and vehicle code to the basic report of CV04N?
- Or what i have to do is create another report with a Z tcode?
Thanks in advance.Hai...
Your requirement is very genuine it is already availabale with SAP standards it self, but you have to do little bit configuration,
you can follow the following steps
1) create a class with the tcode CL02, should have all the attributres like Vehical code, vehical type etc, by choosing proper characteristics.
2) Attached this class to that document type in the configuration part.
3) Then you will see Additional Tab in the cv01n, CV02N, CV03N & CV04N screen as soon as you select that document type.
4) Automatically it will come in the output of CV04N.
5) Create you own screen variant for that output
you object will fulfill. Revert if any problem exists.
Cheers
KHS -
Chat program in release 4.7c
hi guys,
I was wondering how one can create a chat program in abap. As its possible in Java & .Net why an abaper under estimate himself. Now here imagine a simple chat program where one can send some text from his SAP GUI which will appear on others SAP GUI and viceversa. Dont think about some messangers like yahoo or gtalk.(dont over estimate being an abaper)
So i developed two programs one to send text & other to receive text. Send prg. is module pool and receive prg. is a simple report which has timer class which gets data from table every second so user dont have to press any button to receive the message.
To start chat you have to run both programs in your GUI where from send program you enter your name in one text field and your message in other text field by pressing enter it gets update in table field(not every time it insert new record, it simply update previous so table size would not increase). As the person with whoem you are chatting is also running both programs, your message appears in 2nd program on his GUI & yours also. followed by your name.
Both chat programs works fine with more then two users also. i tried to combine both program in one screen so user can send & receive chat from one screen. but due to timer class used, its not possible as receive program keeps refreshing for every 1 second.
so i am wondering is thier any way to run one modulepool program & one report in a single screen. some thing like screen splitting or docking???
you are welcome to share your ideas regarding chat in ABAP/4(release 4.7)
Regards,
SUDHIR MANJAREKARYes, thats right. There are few ABAP codes which you can find in the net and can improvise on that.
The program displays list of all users who are currently active on a list.
You can select user and select press button on the application tool bar to send a message.
Concerns here are: 1. The receiver cannot reply from the same popup. He has to run the program, select the user who has send message and reply. 2. You will not be able to see the entire message log.
For logging messages you can try creating standard text for tracking dialog between any two user and something of that sort.
regards,
S. Chandramouli. -
Creating a ListBox on "change" event
I am using Designer 7 and the Script Editor and wish to create a list box when a "change" event occurs. Is this possible?
For instance, I have a large list of items that go into a list box. I want the user to be able to type into a text box and while they are typing, the list box is displayed with possible suggestions for what it thinks are typing. The user can either keep typing or arrow down to one of the choices. Right now I have a textbox and a hidden listbox. This listbox displays with the possible choices when the user is typing in the textbox. If they click one of the choices it will display in the textbox, but I would like them to be able to scroll down to the listbox from the textbox.
Here is an example: http://www.google.com/webhp?complete=1&hl=en
Any help would be greatly appreciated. Thanks. -
VBA Project Export Resource data vith TimeScaleData ON FILTERED TASK
Hello,
I have been using the common code you can find at the following website to export resources data using the TimeScaleData function :
http://zo-d.com/blog/archives/programming/analyze-microsoft-project-resource-usage-data-in-excel.html
It works fine. Now, I need to do the same export but at the same time, I need to filter some tasks by a specific value in the Text1 column for example. Thus, I would like to extract the resources data, not on the all tasks, but only on filtered tasks.
How is it possible ?
I tried to setup a filter by VBA, but the filter is not take in account. The TimeScaleData retrieved the value of the all tasks and not only of the filtered tasks.
FilterEdit Name:="Filtre 3", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Texte1", Test:="Égal à", Value:="TITI", ShowInMenu:=True, ShowSummaryTasks:=False
FilterApply Name:="Filtre 3"
Can you help me ?
So sorry for bad English.
Thank you.
EmmanuelEmmanuel,
Jack's macro loops through all the resources but your filter is a task filter, so even though you may see the filtered Gantt Chart view, the macro still exports all resource data. What exactly do you want to do?
John -
I've got a free 7 days Group Video Chat trial, and received a email that confirmed the trial.
But, don't know why, I just can't use the group video call!
Every time skype says that i have to use a premium account in order to use the group video call.
Does anyone know what i have to do?
Thanks in advance.Because one-on-one chat works correctly for you, it is possible that you, and / or one of the participants you were trying to connect with, do not have enough bandwidth to support best multi-party video. All participants must meet all the requirements, so all of you who are having problems should consider all of the following suggestions:
If any of you are using wireless connections to the internet, connecting via ethernet instead might help.
Also, check Making a group video call (Mac).
You can check the actual speed available to you by using Speedtest.net. Do not have any other internet connected apps (like email, etc.) connected while you do the test.
If you have not restarted your entire system for a long time, shutting down everything and then restarting your modem, router, wireless access point (if it is a separate device), and computer sometimes helps improve communication speed. Let every device complete its power-on self-test before restarting the next device in turn.
If the problem continues after you restart your system, Skype's comprehensive support system should best be able to help you use their product with your system.
You can also search or post for help with your problem in Skype's dedicated Skype Discussions for Mac. The Skype users who post there may have already solved the same problem.
If nothing else works, you can sign in and ask for email help directly from Skype's Technical Support people.
Message was edited by: EZ Jim
Mac OSX 10.8.4
Maybe you are looking for
-
[X300] Mouse Wheel Scroll Lines Setting does not stick
I often use an external mouse (no additional driver needed). After every reboot, the setting "Mouse Wheel Scroll Lines" in Control-Panel -> Mouse -> Wheel is reset to 1 (I am using Vista). This is really annoying because it slows down scrolling extre
-
0crm_mktattr_attr - delta only once per day possible?
Hi all, we want to use delta functionality for 0crm_mktattr_attr. The problem is, that only once a day the delta for a business partner is beeing transfered to the bw. If you have done another change on the same business partner, no delta is being ge
-
Duplex backup: getting one copy to complete
Using Oracle 10g R2. I am trying to set up a tape backup with 2 copies in a highly available environment. The media management software (IBM TDP for Oracle) is configured so that the copies are written to separate tape libraries. If one of the librar
-
Weblogic Error on settings update & deployments: FileNotFound config_bak
Hiyas, I am having a problem with WebLogic 10.3 where I keep getting the following error message when trying to deploy applications or update configurations in the console: An error occurred during activation of changes, please see the log for detail
-
Running Mac OS X Leopard Server on iMac
Hi, I am totally new in Apple World, Can I run Mac OS X Leopard Server on intel iMac? Simon Zarate