Plz help me in my code
Hi all Plz tell me why 2D lines are not drawn here by clicking on "make connection" JButton and then on required JButtons to make connection between them........................................................................................................
Plz tell me the reason .......................................... I don't know why u all silent....................................... here is code.....................................................
..................................................plz be hurry in replying.....................................
...................................................thanx in advance..........................................
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Line2D;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.MouseInputAdapter;
public class Connections3
ConnectionsPanel connectionsPanel;
public Connections3()
connectionsPanel = new ConnectionsPanel();
JFrame f = new JFrame("Connection");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(getUIPanel(), "North");
f.getContentPane().add(connectionsPanel);
f.setSize(400,300);
f.setLocation(200,200);
f.setVisible(true);
private Box getUIPanel()
JButton connect = new JButton("make connection");
connect.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
connectionsPanel.selectingButtonsForConnection = true;
Box box = Box.createHorizontalBox();
box.setBorder(BorderFactory.createEmptyBorder(2,0,2,0));
box.add(Box.createHorizontalGlue());
box.add(connect);
box.add(Box.createHorizontalGlue());
box.add(Box.createHorizontalGlue());
return box;
public static void main(String[] args)
new Connections3();
class ConnectionsPanel extends JPanel
{ ButtonMover mover;
JButton button1, button2, button3,button4;
JButton[] buttons;
Component selectedButton;
//int offsetX, offsetY;
boolean dragging, selectingButtonsForConnection;
Point start;
List<Component[]> connections;
public ConnectionsPanel()
{ mover=new ButtonMover(this);
dragging = false;
selectingButtonsForConnection = false;
connections = new ArrayList<Component[]>();
setOpaque(false);
setLayout(null);
addButtons();
addMouseListener(new ButtonSelector());
addMouseMotionListener(mover);
public void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Color.blue);
for(int j = 0; j < connections.size(); j++)
Component[] pair = connections.get(j);
Point p1 = getCenter(pair[0]);
Point p2 = getCenter(pair[1]);
g2.draw(new Line2D.Double(p1.x, p1.y, p2.x, p2.y));
private Point getCenter(Component c)
Rectangle r = c.getBounds();
return new Point((int)r.getCenterX(), (int)r.getCenterY());
private class ButtonSelector extends MouseAdapter
Component[] components;
boolean haveSelection;
public ButtonSelector()
haveSelection = false;
public void mousePressed(MouseEvent e)
Point p = e.getPoint();
for(int j = 0; j < buttons.length; j++)
Rectangle r = buttons[j].getBounds();
if(r.contains(p))
if(selectingButtonsForConnection)
if(!haveSelection)
components = new Component[2];
components[0] = buttons[j];
else
components[1] = buttons[j];
if(components[0] != components[1])
connections.add(components);
selectingButtonsForConnection = false;
repaint();
haveSelection = !haveSelection;
else // selecting for dragging
selectedButton = buttons[j];
/* selectedButton = (JButton)e.getSource();
start = e.getPoint();*/
dragging = true;
/* offsetX = p.x - r.x;
offsetY = p.y - r.y;
dragging = true;*/
break;
public void mouseReleased(MouseEvent e)
dragging = false;
class ButtonMover extends MouseInputAdapter
ConnectionsPanel connectionPanel;
public ButtonMover(ConnectionsPanel cp)
connectionPanel = cp;
dragging = false;
public void mousePressed(MouseEvent e)
selectedButton = (JButton)e.getSource();
start = e.getPoint();
dragging = true;
public void mouseReleased(MouseEvent e)
dragging = false;
public void mouseDragged(MouseEvent e)
if(dragging)
Point end = e.getPoint();
int x = selectedButton.getX() + end.x - start.x;
int y = selectedButton.getY() + end.y - start.y;
Rectangle r = selectedButton.getBounds();
selectedButton.setBounds(x, y,r.width,r.height);
repaint();
private void addButtons()
int w = 125;
int h = 25;
Border border = BorderFactory.createEtchedBorder();
button1 = new JButton("Button 1");
button2 = new JButton("Button 2");
button3 = new JButton("Button 3");
button4 = new JButton("Button 4");
buttons = new JButton[4];
buttons[0] = button1;
buttons[1] = button2;
buttons[2] = button3;
buttons[3] = button4;
for(int j = 0; j < buttons.length; j++)
buttons[j].setBorder(border);
buttons[j].setOpaque(true);
// buttons[j].setBackground(Color.white);
buttons[j].addMouseListener(mover);
buttons[j]. addMouseMotionListener(mover);
add(buttons[j]);
// buttons[j].addActionListener()
button1.setBounds(40, 40, w, h);
button2.setBounds(215, 40, w, h);
button3.setBounds(40, 200, w, h);
button4.setBounds(215, 200, w, h);
}
Hey im not quite shure what you mean, do you want to press make connection then press 2 buttons to make a connection between them? you might wanna clear it up, some people are to lazy to corrrect your code. but i did waht i could and here it is. but holy crap if that is what your doing, its a mess of code. i would suggest taking another shot at it, sometimes if it doesnt go good the first time try again. good luck.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Line2D;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.MouseInputAdapter;
public class Connections3
ConnectionsPanel connectionsPanel;
public Connections3()
connectionsPanel = new ConnectionsPanel();
JFrame f = new JFrame("Connection");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(getUIPanel(), "North");
f.getContentPane().add(connectionsPanel);
f.setSize(400,300);
f.setLocation(200,200);
f.setVisible(true);
private Box getUIPanel()
JButton connect = new JButton("make connection");
connect.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
connectionsPanel.selectingButtonsForConnection = true;
Box box = Box.createHorizontalBox();
box.setBorder(BorderFactory.createEmptyBorder(2,0,2,0));
box.add(Box.createHorizontalGlue());
box.add(connect);
box.add(Box.createHorizontalGlue());
box.add(Box.createHorizontalGlue());
return box;
public static void main(String[] args)
new Connections3();
class ConnectionsPanel extends JPanel
ButtonMover mover;
JButton button1, button2, button3,button4;
JButton[] buttons;
Component selectedButton;
//int offsetX, offsetY;
boolean dragging, selectingButtonsForConnection;
Point start;
ArrayList connections;
public ConnectionsPanel()
mover=new ButtonMover(this);
dragging = false;
selectingButtonsForConnection = false;
connections = new ArrayList();
setOpaque(false);
setLayout(null);
addButtons();
addMouseListener(new ButtonSelector());
addMouseMotionListener(mover);
public void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Color.blue);
/* Fixed some Errors with your Component[], converting regular to array
Not possible, also your loop would go from 0 - list.size and you are accesing
j through j+1, so your gonna get a index out of bounds */
Component pair;
for(int j = 0; j < connections.size()-1; j++)
pair = (Component)connections.get(j);
Point p1 = getCenter(pair);
pair = (Component)connections.get(j+1);
Point p2 = getCenter(pair);
g2.draw(new Line2D.Double(p1.x, p1.y, p2.x, p2.y));
private Point getCenter(Component c)
Rectangle r = c.getBounds();
return new Point((int)r.getCenterX(), (int)r.getCenterY());
private class ButtonSelector extends MouseAdapter
Component[] components;
boolean haveSelection;
public ButtonSelector()
haveSelection = false;
public void mousePressed(MouseEvent e)
Point p = e.getPoint();
for(int j = 0; j < buttons.length; j++)
Rectangle r = buttons[j].getBounds();
if(r.contains(p))
if(selectingButtonsForConnection)
if(!haveSelection)
components = new Component[2];
components[0] = buttons[j];
else
components[1] = buttons[j];
if(components[0] != components[1])
connections.add(components);
selectingButtonsForConnection = false;
repaint();
haveSelection = !haveSelection;
else // selecting for dragging
selectedButton = buttons[j];
/* selectedButton = (JButton)e.getSource();
start = e.getPoint();*/
dragging = true;
/* offsetX = p.x - r.x;
offsetY = p.y - r.y;
dragging = true;*/
break;
public void mouseReleased(MouseEvent e)
dragging = false;
class ButtonMover extends MouseInputAdapter
ConnectionsPanel connectionPanel;
public ButtonMover(ConnectionsPanel cp)
connectionPanel = cp;
dragging = false;
public void mousePressed(MouseEvent e)
selectedButton = (JButton)e.getSource();
start = e.getPoint();
dragging = true;
public void mouseReleased(MouseEvent e)
dragging = false;
public void mouseDragged(MouseEvent e)
if(dragging)
Point end = e.getPoint();
int x = selectedButton.getX() + end.x - start.x;
int y = selectedButton.getY() + end.y - start.y;
Rectangle r = selectedButton.getBounds();
selectedButton.setBounds(x, y,r.width,r.height);
repaint();
private void addButtons()
int w = 125;
int h = 25;
Border border = BorderFactory.createEtchedBorder();
button1 = new JButton("Button 1");
button2 = new JButton("Button 2");
button3 = new JButton("Button 3");
button4 = new JButton("Button 4");
buttons = new JButton[4];
buttons[0] = button1;
buttons[1] = button2;
buttons[2] = button3;
buttons[3] = button4;
for(int j = 0; j < buttons.length; j++)
buttons[j].setBorder(border);
buttons[j].setOpaque(true);
// buttons[j].setBackground(Color.white);
buttons[j].addMouseListener(mover);
buttons[j]. addMouseMotionListener(mover);
add(buttons[j]);
// buttons[j].addActionListener()
button1.setBounds(40, 40, w, h);
button2.setBounds(215, 40, w, h);
button3.setBounds(40, 200, w, h);
button4.setBounds(215, 200, w, h);
}
Similar Messages
-
Plz and plz help me with restriction code
hello to all i have nokia 6288 but when i enter any sim card it want restriction code plz help me thanks allot
tottiThe reason you are being asked for a code is because the phone is network locked.
You need to contact the network that it's locked to for the unlock code. -
I want to add BWART field from AUFM table to the DS:2LIS_04_P_COMP.
The AUFM table has key fields as :MBLNR,MJAHR and ZEILE.Can someone plz help with the code to put in the existing function module.I see that both 2LIS_04_P_COMP and AUFM have common field AUFNR process order.
Plz help ASAP.I want to add BWART field from AUFM table to the DS:2LIS_04_P_COMP.
The AUFM table has key fields as :MBLNR,MJAHR and ZEILE.Can someone plz help with the code to put in the existing function module.I see that both 2LIS_04_P_COMP and AUFM have common field AUFNR process order.
Plz help ASAP. -
import java.util.Date;
import java.net.*;
public class DateTest{
public static void main(String arr[]){
try{
URL url = new URL("http://www.google.com");
HttpURLConnection url1 = (HttpURLConnection)url.openConnection();
// System.out.println(url1.getExpiration());
System.out.println((new Date(url1.getExpiration())).toString());
catch(Exception e){
System.out.println(e);
IS MY EXPIRATION DATE LOGICALLY A CORRECT ONE im a beginner help me in this codehere's the output of your code:
dt: Wed Jun 08 10:47:12 CST 2005
Thu Jan 01 08:00:00 CST 1970
the first line is the sysdate of my pc
and the second line is the date of the expiration date
as you can see it isn't correct to be expired at that time because the web or url isn't well established at that time -
Unable to print TOP_OF_PAGE in ALV Using OOPS??plz help me in my code
*&--data declaration
TYPE-POOLS : slis.
TYPES : BEGIN OF type_vbak,
vbeln LIKE vbak-vbeln, "SD Order
ernam LIKE vbak-ernam, "Name of the person who created
audat LIKE vbak-audat, "Document Date
vbtyp LIKE vbak-vbtyp, "SD Document Category
auart LIKE vbak-auart, "Type of Order
netwr LIKE vbak-netwr,
"Net value in sales current doc currency
waerk LIKE vbak-waerk, "SD Document Currency
vkorg LIKE vbak-vkorg, "Sales Organization
vtweg LIKE vbak-vtweg, "Distribution Chanel
spart LIKE vbak-spart, "Division
END OF type_vbak.
TYPES : BEGIN OF type_vbap,
vbeln LIKE vbap-vbeln, "SD Order
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Component
charg LIKE vbap-charg, "Batch Number
matkl LIKE vbap-matkl, "Material Group
arktx LIKE vbap-arktx, "Short Text for Sales Order Item
kwmeng LIKE vbap-kwmeng,
"cumulative order quantity in sales unit
vrkme LIKE vbap-vrkme, "Sales Unit
netpr LIKE vbap-netpr, "Net Price
END OF type_vbap.
TYPES : type_t_vbak TYPE type_vbak,
type_t_vbap TYPE type_vbap.
DATA : it_vbak TYPE STANDARD TABLE OF type_t_vbak,
it_vbap TYPE STANDARD TABLE OF type_t_vbap.
DATA : wa_vbak TYPE type_t_vbak,
wa_vbap TYPE type_t_vbap.
DATA : d_vbeln LIKE vbak-vbeln,
d_audat LIKE vbak-audat,
lv_vbeln TYPE vbak-vbeln.
*&---Internal table for event catalog
DATA :it_event TYPE slis_t_event,
Internal table for Header printing
i_header TYPE slis_t_listheader,
*&---Work area for event catalog
wa_event TYPE slis_alv_event,
*&---Work area for report layout
wa_layout TYPE slis_layout_alv,
Workarea for Header printing
wa_header TYPE slis_listheader.
*&---cc1 is refering to the global class 'cl_gui_custom_container'
DATA : cc1 TYPE REF TO cl_gui_custom_container.
*&----alv1 is refering to the global class 'cl_gui_alv_grid'
DATA : alv1 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog1 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog1 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0101 LIKE sy-ucomm.
*&---cc2 is refering to the global class 'cl_gui_custom_container'
DATA : cc2 TYPE REF TO cl_gui_custom_container.
*&----alv2 is refering to the global class 'cl_gui_alv_grid'
DATA : alv2 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog2 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog2 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0102 LIKE sy-ucomm.
*&--defining the selection screen
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_vbeln FOR d_vbeln OBLIGATORY, "SD Order
s_audat FOR d_audat. "Document Date
SELECTION-SCREEN END OF BLOCK bl1.
AT SELECTION-SCREEN ON s_vbeln.
IF s_vbeln[] IS INITIAL.
SET CURSOR FIELD 'S_VBELN-LOW'.
MESSAGE e001 WITH text-001.
ELSE.
SELECT SINGLE vbeln INTO wa_vbak-vbeln
FROM vbak
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_VBELN-LOW'.
MESSAGE e002 WITH text-002.
ENDIF.
ENDIF.
DATA : wa_row_id TYPE lvc_s_row.
CLASS lcl_event_reciver DEFINITION
CLASS lcl_event_reciver DEFINITION.
PUBLIC SECTION.
&--defining the method for each event
METHODS : handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
handle_top_of_page FOR EVENT TOP_OF_PAGE OF cl_gui_alv_grid
IMPORTING e_dyndoc_id.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS. "lcl_event_reciver DEFINITION
CLASS lcl_event_reciver IMPLEMENTATION
CLASS lcl_event_reciver IMPLEMENTATION.
*&--implement the event handler methods for hot spot click.
METHOD handle_hotspot_click.
CLEAR lv_vbeln.
READ TABLE it_vbak INTO wa_vbak INDEX e_row_id.
lv_vbeln = wa_vbak-vbeln.
**&--for freeing the instance which was created alv2.
perform free_previous_object.
*CALL METHOD alv2->free
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*&--fetching the data
*perform fetch_data_alv2 usinr lv_vbeln.
SELECT vbeln "SD Order
posnr "Sales Document Item
matnr "Component
charg "Batch Number
matkl "Material Group
arktx "Short Text for Sales Order Item
kwmeng "cumulative order quantity in sales unit
vrkme "Sales Unit
netpr "Net Price
INTO TABLE it_vbap
FROM vbap
WHERE vbeln = lv_vbeln.
IF sy-subrc <> 0.
MESSAGE e004 WITH text-004.
ENDIF.
*&---populating the second alv
*perform populate_fieldcatalog2.
*&-POPULATING THE FIELD VBELN
wa_fieldcatalog2-col_pos = 1. "position of the column
wa_fieldcatalog2-fieldname = 'VBELN'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
*wa_fieldcatalog2-hotspot = 'X'.
wa_fieldcatalog2-outputlen = 10. "output length of the field.
wa_fieldcatalog2-seltext = 'SD ORDER NUMBER'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD POSNR
wa_fieldcatalog2-col_pos = 2. "position of the column
wa_fieldcatalog2-fieldname = 'POSNR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SD ITEM'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATNR
wa_fieldcatalog2-col_pos = 3. "position of the column
wa_fieldcatalog2-fieldname = 'MATNR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'COMPONENT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD CHARG
wa_fieldcatalog2-col_pos = 4. "position of the column
wa_fieldcatalog2-fieldname = 'CHARG'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'BATCH NUMBER'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATKL
wa_fieldcatalog2-col_pos = 5. "position of the column
wa_fieldcatalog2-fieldname = 'MATKL'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'MATERIAL GROUP'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD ARKTX
wa_fieldcatalog2-col_pos = 6. "position of the column
wa_fieldcatalog2-fieldname = 'ARKTX'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SHORT TEXT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD KWMENG
wa_fieldcatalog2-col_pos = 7. "position of the column
wa_fieldcatalog2-fieldname = 'KEMENG'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SALES QUANTITY'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD VRKME
wa_fieldcatalog2-col_pos = 8. "position of the column
wa_fieldcatalog2-fieldname = 'VRKME'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SALES UNIT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD NETPR
wa_fieldcatalog2-col_pos = 9. "position of the column
wa_fieldcatalog2-fieldname = 'NETPR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'NET PRICE'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&--display the alv2
*perform display_alv2.
CREATE OBJECT cc2
EXPORTING
PARENT =
container_name = 'CUSTOMCONTROL2'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT alv2
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = cc2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD alv2->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = it_vbap
it_fieldcatalog = it_fieldcatalog2
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMETHOD. "handle_hotspot_click
*&--implement the event handler methods for top of page
method handle_top_of_page.
CALL METHOD e_dyndoc_id->display_document
EXPORTING parent = cc1.
*write:/5 'Desc :' , 'Sales Document Header & Items'.
*write:/5 'Date :' , sy-datum.
*write:/5 'Page no :' , sy-pagno.
endmethod.
ENDCLASS. "lcl_event_reciver IMPLEMENTATION
*&--data for event handler in hot spot click
DATA: event_handler TYPE REF TO lcl_event_reciver,
*&--data for event handler in top of page
o_dd_doc TYPE REF TO cl_dd_document.
*&--main logic
START-OF-SELECTION.
*&--vbak.
SELECT vbeln "SD Order
ernam "Name of the person who created
audat "Document Date
vbtyp "SD Document Category
auart "Type of Order
netwr "Net value in sales current doc currency
waerk "SD Document Currency
vkorg "Sales Organization
vtweg "Distribution Chanel
spart "Division
INTO TABLE it_vbak
FROM vbak
WHERE vbeln IN s_vbeln AND
audat IN s_audat.
IF sy-subrc <> 0.
MESSAGE e003 WITH text-003.
ENDIF.
CLEAR wa_fieldcatalog1 .
REFRESH it_fieldcatalog1 .
*&-POPULATING THE FIELD VBELN
wa_fieldcatalog1-col_pos = 1. "position of the column
wa_fieldcatalog1-fieldname = 'VBELN'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-hotspot = 'X'.
wa_fieldcatalog1-outputlen = 10. "output length of the field.
wa_fieldcatalog1-seltext = 'SD ORDER NUMBER'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD ERNAM
wa_fieldcatalog1-col_pos = 2. "position of the column
wa_fieldcatalog1-fieldname = 'ERNAM'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 12. "output length of the field.
wa_fieldcatalog1-seltext = 'NAME OF THE PERSON WHO CREATED'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUDAT
wa_fieldcatalog1-col_pos = 3. "position of the column
wa_fieldcatalog1-fieldname = 'AUDAT'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 8. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT DATE'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VBTYP
wa_fieldcatalog1-col_pos = 4. "position of the column
wa_fieldcatalog1-fieldname = 'VBTYP'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 1. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT CATEGORY'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUART
wa_fieldcatalog1-col_pos = 5. "position of the column
wa_fieldcatalog1-fieldname = 'AUART'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 4. "output length of the field.
wa_fieldcatalog1-seltext = 'TYPE OF THE ORDER'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD NETWR
wa_fieldcatalog1-col_pos = 6. "position of the column
wa_fieldcatalog1-fieldname = 'NETWR'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 15. "output length of the field.
wa_fieldcatalog1-seltext = 'NET VALUE'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD WAERK
wa_fieldcatalog1-col_pos = 7. "position of the column
wa_fieldcatalog1-fieldname = 'WAERK'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 5. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT CURRENCY'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VKORG
wa_fieldcatalog1-col_pos = 8. "position of the column
wa_fieldcatalog1-fieldname = 'VKORG'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 4. "output length of the field.
wa_fieldcatalog1-seltext = 'SALES ORG'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VTWEG
wa_fieldcatalog1-col_pos = 9. "position of the column
wa_fieldcatalog1-fieldname = 'VTWEG'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 2. "output length of the field.
wa_fieldcatalog1-seltext = 'DISTRIBUTION CHANEL'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD SPART
wa_fieldcatalog1-col_pos = 10. "position of the column
wa_fieldcatalog1-fieldname = 'SPART'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 2. "output length of the field.
wa_fieldcatalog1-seltext = 'DIVISION'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
CREATE OBJECT cc1
EXPORTING
PARENT =
container_name = 'CUSTOMCONTROL1'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT alv1
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = cc1
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT event_handler.
*&---set handler for hot spot click
SET HANDLER: event_handler->handle_hotspot_click FOR alv1,
*&---set handler for top of page
event_handler->handle_top_of_page for alv1.
CALL METHOD alv1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = it_vbak
it_fieldcatalog = it_fieldcatalog1
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&--for hot spot click
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = alv1.
*&--for top of page
CALL METHOD alv1->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
I_DYNDOC_ID = o_dd_doc
IS_SUBTOTTXT_INFO =
IP_SUBTOT_LINE =
I_TABLE_INDEX =
CHANGING
C_SUBTOTTXT =
CALL SCREEN 0101.
*& Module STATUS_0101 OUTPUT
text
MODULE status_0101 OUTPUT.
SET PF-STATUS 'Z9D_MENU1_ALV'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0101 OUTPUT
*& Module USER_COMMAND_0101 INPUT
text
MODULE user_command_0101 INPUT.
CASE ok_code_0101.
WHEN 'BCK1'.
LEAVE PROGRAM.
ENDCASE.*&--data declaration
TYPE-POOLS : slis.
TYPES : BEGIN OF type_vbak,
vbeln LIKE vbak-vbeln, "SD Order
ernam LIKE vbak-ernam, "Name of the person who created
audat LIKE vbak-audat, "Document Date
vbtyp LIKE vbak-vbtyp, "SD Document Category
auart LIKE vbak-auart, "Type of Order
netwr LIKE vbak-netwr,
"Net value in sales current doc currency
waerk LIKE vbak-waerk, "SD Document Currency
vkorg LIKE vbak-vkorg, "Sales Organization
vtweg LIKE vbak-vtweg, "Distribution Chanel
spart LIKE vbak-spart, "Division
END OF type_vbak.
TYPES : BEGIN OF type_vbap,
vbeln LIKE vbap-vbeln, "SD Order
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Component
charg LIKE vbap-charg, "Batch Number
matkl LIKE vbap-matkl, "Material Group
arktx LIKE vbap-arktx, "Short Text for Sales Order Item
kwmeng LIKE vbap-kwmeng,
"cumulative order quantity in sales unit
vrkme LIKE vbap-vrkme, "Sales Unit
netpr LIKE vbap-netpr, "Net Price
END OF type_vbap.
TYPES : type_t_vbak TYPE type_vbak,
type_t_vbap TYPE type_vbap.
DATA : it_vbak TYPE STANDARD TABLE OF type_t_vbak,
it_vbap TYPE STANDARD TABLE OF type_t_vbap.
DATA : wa_vbak TYPE type_t_vbak,
wa_vbap TYPE type_t_vbap.
DATA : d_vbeln LIKE vbak-vbeln,
d_audat LIKE vbak-audat,
lv_vbeln TYPE vbak-vbeln.
*&---Internal table for event catalog
DATA :it_event TYPE slis_t_event,
Internal table for Header printing
i_header TYPE slis_t_listheader,
*&---Work area for event catalog
wa_event TYPE slis_alv_event,
*&---Work area for report layout
wa_layout TYPE slis_layout_alv,
Workarea for Header printing
wa_header TYPE slis_listheader.
*&---cc1 is refering to the global class 'cl_gui_custom_container'
DATA : cc1 TYPE REF TO cl_gui_custom_container.
*&----alv1 is refering to the global class 'cl_gui_alv_grid'
DATA : alv1 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog1 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog1 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0101 LIKE sy-ucomm.
*&---cc2 is refering to the global class 'cl_gui_custom_container'
DATA : cc2 TYPE REF TO cl_gui_custom_container.
*&----alv2 is refering to the global class 'cl_gui_alv_grid'
DATA : alv2 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog2 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog2 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0102 LIKE sy-ucomm.
*&--defining the selection screen
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_vbeln FOR d_vbeln OBLIGATORY, "SD Order
s_audat FOR d_audat. "Document Date
SELECTION-SCREEN END OF BLOCK bl1.
AT SELECTION-SCREEN ON s_vbeln.
IF s_vbeln[] IS INITIAL.
SET CURSOR FIELD 'S_VBELN-LOW'.
MESSAGE e001 WITH text-001.
ELSE.
SELECT SINGLE vbeln INTO wa_vbak-vbeln
FROM vbak
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_VBELN-LOW'.
MESSAGE e002 WITH text-002.
ENDIF.
ENDIF.
DATA : wa_row_id TYPE lvc_s_row,
<b>ls_print type lvc_s_prnt.</b>
CLASS lcl_event_reciver DEFINITION
CLASS lcl_event_reciver DEFINITION.
PUBLIC SECTION.
&--defining the method for each event
METHODS : handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
handle_top_of_page FOR EVENT TOP_OF_PAGE OF cl_gui_alv_grid
IMPORTING e_dyndoc_id.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS. "lcl_event_reciver DEFINITION
CLASS lcl_event_reciver IMPLEMENTATION
CLASS lcl_event_reciver IMPLEMENTATION.
*&--implement the event handler methods for hot spot click.
METHOD handle_hotspot_click.
CLEAR lv_vbeln.
READ TABLE it_vbak INTO wa_vbak INDEX e_row_id.
lv_vbeln = wa_vbak-vbeln.
**&--for freeing the instance which was created alv2.
perform free_previous_object.
*CALL METHOD alv2->free
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*&--fetching the data
*perform fetch_data_alv2 usinr lv_vbeln.
SELECT vbeln "SD Order
posnr "Sales Document Item
matnr "Component
charg "Batch Number
matkl "Material Group
arktx "Short Text for Sales Order Item
kwmeng "cumulative order quantity in sales unit
vrkme "Sales Unit
netpr "Net Price
INTO TABLE it_vbap
FROM vbap
WHERE vbeln = lv_vbeln.
IF sy-subrc <> 0.
MESSAGE e004 WITH text-004.
ENDIF.
*&---populating the second alv
*perform populate_fieldcatalog2.
*&-POPULATING THE FIELD VBELN
wa_fieldcatalog2-col_pos = 1. "position of the column
wa_fieldcatalog2-fieldname = 'VBELN'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
*wa_fieldcatalog2-hotspot = 'X'.
wa_fieldcatalog2-outputlen = 10. "output length of the field.
wa_fieldcatalog2-seltext = 'SD ORDER NUMBER'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD POSNR
wa_fieldcatalog2-col_pos = 2. "position of the column
wa_fieldcatalog2-fieldname = 'POSNR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SD ITEM'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATNR
wa_fieldcatalog2-col_pos = 3. "position of the column
wa_fieldcatalog2-fieldname = 'MATNR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'COMPONENT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD CHARG
wa_fieldcatalog2-col_pos = 4. "position of the column
wa_fieldcatalog2-fieldname = 'CHARG'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'BATCH NUMBER'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATKL
wa_fieldcatalog2-col_pos = 5. "position of the column
wa_fieldcatalog2-fieldname = 'MATKL'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'MATERIAL GROUP'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD ARKTX
wa_fieldcatalog2-col_pos = 6. "position of the column
wa_fieldcatalog2-fieldname = 'ARKTX'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SHORT TEXT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD KWMENG
wa_fieldcatalog2-col_pos = 7. "position of the column
wa_fieldcatalog2-fieldname = 'KEMENG'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SALES QUANTITY'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD VRKME
wa_fieldcatalog2-col_pos = 8. "position of the column
wa_fieldcatalog2-fieldname = 'VRKME'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SALES UNIT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD NETPR
wa_fieldcatalog2-col_pos = 9. "position of the column
wa_fieldcatalog2-fieldname = 'NETPR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'NET PRICE'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&--display the alv2
*perform display_alv2.
CREATE OBJECT cc2
EXPORTING
PARENT =
container_name = 'CUSTOMCONTROL2'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT alv2
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = cc2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD alv2->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = it_vbap
it_fieldcatalog = it_fieldcatalog2
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMETHOD. "handle_hotspot_click
*&--implement the event handler methods for top of page
method handle_top_of_page.
CALL METHOD e_dyndoc_id->display_document
EXPORTING parent = cc1.
*write:/5 'Desc :' , 'Sales Document Header & Items'.
*write:/5 'Date :' , sy-datum.
*write:/5 'Page no :' , sy-pagno.
endmethod.
ENDCLASS. "lcl_event_reciver IMPLEMENTATION
*&--data for event handler in hot spot click
DATA: event_handler TYPE REF TO lcl_event_reciver,
*&--data for event handler in top of page
o_dd_doc TYPE REF TO cl_dd_document.
*&--main logic
START-OF-SELECTION.
*&--vbak.
SELECT vbeln "SD Order
ernam "Name of the person who created
audat "Document Date
vbtyp "SD Document Category
auart "Type of Order
netwr "Net value in sales current doc currency
waerk "SD Document Currency
vkorg "Sales Organization
vtweg "Distribution Chanel
spart "Division
INTO TABLE it_vbak
FROM vbak
WHERE vbeln IN s_vbeln AND
audat IN s_audat.
IF sy-subrc <> 0.
MESSAGE e003 WITH text-003.
ENDIF.
CLEAR wa_fieldcatalog1 .
REFRESH it_fieldcatalog1 .
*&-POPULATING THE FIELD VBELN
wa_fieldcatalog1-col_pos = 1. "position of the column
wa_fieldcatalog1-fieldname = 'VBELN'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-hotspot = 'X'.
wa_fieldcatalog1-outputlen = 10. "output length of the field.
wa_fieldcatalog1-seltext = 'SD ORDER NUMBER'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD ERNAM
wa_fieldcatalog1-col_pos = 2. "position of the column
wa_fieldcatalog1-fieldname = 'ERNAM'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 12. "output length of the field.
wa_fieldcatalog1-seltext = 'NAME OF THE PERSON WHO CREATED'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUDAT
wa_fieldcatalog1-col_pos = 3. "position of the column
wa_fieldcatalog1-fieldname = 'AUDAT'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 8. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT DATE'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VBTYP
wa_fieldcatalog1-col_pos = 4. "position of the column
wa_fieldcatalog1-fieldname = 'VBTYP'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 1. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT CATEGORY'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUART
wa_fieldcatalog1-col_pos = 5. "position of the column
wa_fieldcatalog1-fieldname = 'AUART'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 4. "output length of the field.
wa_fieldcatalog1-seltext = 'TYPE OF THE ORDER'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD NETWR
wa_fieldcatalog1-col_pos = 6. "position of the column
wa_fieldcatalog1-fieldname = 'NETWR'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 15. "output length of the field.
wa_fieldcatalog1-seltext = 'NET VALUE'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD WAERK
wa_fieldcatalog1-col_pos = 7. "position of the column
wa_fieldcatalog1-fieldname = 'WAERK'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 5. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT CURRENCY'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VKORG
wa_fieldcatalog1-col_pos = 8. "position of the column
wa_fieldcatalog1-fieldname = 'VKORG'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 4. "output length of the field.
wa_fieldcatalog1-seltext = 'SALES ORG'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VTWEG
wa_fieldcatalog1-col_pos = 9. "position of the column
wa_fieldcatalog1-fieldname = 'VTWEG'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 2. "output length of the field.
wa_fieldcatalog1-seltext = 'DISTRIBUTION CHANEL'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD SPART
wa_fieldcatalog1-col_pos = 10. "position of the column
wa_fieldcatalog1-fieldname = 'SPART'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 2. "output length of the field.
wa_fieldcatalog1-seltext = 'DIVISION'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
CREATE OBJECT cc1
EXPORTING
PARENT =
container_name = 'CUSTOMCONTROL1'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT alv1
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = cc1
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT event_handler.
*&---set handler for hot spot click
SET HANDLER: event_handler->handle_hotspot_click FOR alv1,
*&---set handler for top of page
event_handler->handle_top_of_page for alv1.
<b>LS_PRINT-RESERVELNS = '3'.</b>
CALL METHOD alv1->set_table_for_first_display
<b> EXPORTING</b>
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
<b>IS_PRINT = ls_print</b>
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = it_vbak
it_fieldcatalog = it_fieldcatalog1
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&--for hot spot click
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = alv1.
*&--for top of page
CALL METHOD alv1->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
I_DYNDOC_ID = o_dd_doc
IS_SUBTOTTXT_INFO =
IP_SUBTOT_LINE =
I_TABLE_INDEX =
CHANGING
C_SUBTOTTXT =
CALL SCREEN 0101.
*& Module STATUS_0101 OUTPUT
text
MODULE status_0101 OUTPUT.
SET PF-STATUS 'Z9D_MENU1_ALV'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0101 OUTPUT
*& Module USER_COMMAND_0101 INPUT
text
MODULE user_command_0101 INPUT.
CASE ok_code_0101.
WHEN 'BCK1'.
LEAVE PROGRAM.
ENDCASE.
i have made the changes and bolded the changes in ur program. pls check .
note: u can see the top of page only in print preview. -
Plz help me in writing code to assign functionality to any function keys
How to assign function(F1,F2...) keys or ctrl, shift keys for any
functionality?
For eg: If we click F1 while the cursor is in any text box, it should be
able to retrieve some data from database and it should display the
retrevied data in the dropdown form in the text box, so that we can
select one value among them....(JSP/Servlets).That would be happening on the client. And the servlets run on the server. In other words hot-keys have nothing to do with servlets. Perhaps there is some Javascript way of doing that.
-
RECORDING WITH F-32 ......ITS URGENT SO PLZ HELP
HI
WISH EVERYTHING IS GOING ON WELL FOR YOU PELOPE
I GOT AN ASSIGNMENT IN FI AND I AM VERY MUCH NEW TO FI SO PLZ HELP TO SOLVE THIS PROBLEM
REQUIREMENT IS SOMETHING LIKE THIS
I HAVE TO TAKE THE START DATE AND THE END DATE AS INPUT.
I HAVE TO DO THE RECORDING IN F-32 WHICH IS FOR CLEAR CUSTOMER.
SO AS PRE THE DATE VALUE I HAVE TO SELECT ALL THE REQUIRED VALUE FROM THE DATA BASE TABLE AND I HAVE TO CLEAR THEM .
I HAVE DONE THE WORK TILL SELECTION SCREEN AND THE SELECT STAMENT,BUT I AM NOT ABLE TO DO THE RECORDING AS I AM NOT GETTING SOME APPROPRIATE DATA.
SO IF ANYBODY HAVE GONE THROUGH SUCH KIND OF PROBLEM THAN PLZ HELP ME OUT WITH CODE ,ITS RGENT FOR ME.
THANKS A LOT TO ALL
MRUTYUNHi
Trx F-32 is the trx to clear documents of customers, there's a general trx to do this: FB05.
This one is supported by b.i. std RFBIBL00.
Max -
JTable problem plz help me urgent
sir
i carefully read the swing tutorial for JTable for the purpose
of rendring specially header rendring.
first u see the code
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.util.*;
import javax.swing.table.*;
public class Myscrollpane extends JScrollPane
ImageIcon icon=new ImageIcon("images/beach1.jpg");
Image img;
int w,h,wi,hi;
TableColumn column = null;
/*Vector cols=new Vector();
cols.addElement("Company Code");
cols.addElement("Company Name");
String[] names = {"Company Code", "Company Name"};
DefaultTableModel model=new DefaultTableModel(names,0);
JTable table=new JTable(model);
LogoViewport vp;//custom class extends with JViewport
Myscrollpane(int width,int height)
vp= new LogoViewport(width,height);
setOpaque(false);
setMinimumSize(new Dimension(width,height));
setPreferredSize(new Dimension(width,height));
setSize(350,125);
///////////here r the table methods to control /////////////////////
table.setPreferredScrollableViewportSize(new Dimension(width,height));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF );
table.getTableHeader().setReorderingAllowed(false);
table.setBackground(new Color(245,235,237));
table.setForeground(Color.black);
table.setOpaque(true);
table.setEnabled(false);
table.setFont(new java.awt.Font("Dialog", Font.ITALIC, 12));
table.setGridColor(Color.pink);
table.setRowHeight(22);
table.setSelectionBackground(Color.lightGray);
DefaultTableCellRenderer renderer=new DefaultTableCellRenderer();
TableColumn code=table.getColumnModel().getColumn(0);
renderer.setBackground(Color.red);
????//if i use the setIcon method then the data comes from the database
????//is not shown because the icon paint above the data.
code.setCellRenderer(renderer);
TableCellRenderer headerRenderer = table.getTableHeade.().getDefaultRenderer();
TableColumn column1=null;
???//i use this to change the color of header column but it is not work
for (int j = 0; j < 2; j++) {
column1 = table.getColumnModel().getColumn(j);
Component comp = headerRenderer.getTableCellRendererComponent(
null, column1.getHeaderValue(),
false, false, 0, 0);
comp.setBackground(Color.red);
???//if i use following it also not work
TableCellRenderer headerRenderer = table.getTableHeader().
getDefaultRenderer();
if (headerRenderer instanceof DefaultTableCellRenderer) {
((DefaultTableCellRenderer)headerRenderer).setBackground(Color.red);}
for (int i = 0; i <=1; i++)
column = table.getColumnModel().getColumn(i);
if (i == 0) {
column.setPreferredWidth(100);
else
column.setPreferredWidth(225);
vp.setView(table);
this.setViewport(vp);
plz help me with the code.
i also want to draw the image on the table with the use of DefaultTabel
Model and data set from the data base.Initally no row is shown.
plz help me
shown(???) are the quesstion which i am unable to solve.
thanks in advance.Formatting the code makes it easier to read, which means more people may attempt to read your code and answer your questions. Click on the "Help" link at the top of the page.
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableHeader extends JFrame
public TableHeader()
JTable table = new JTable(5, 5);
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
table.getTableHeader().setBackground( Color.red );
public static void main(String[] args)
TableHeader frame = new TableHeader();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible(true);
} -
JTable problem plz help me urgent withDefault TableModel
sir
i carefully read the swing tutorial for JTable for the purpose
of rendring specially header rendring.
first u see the code
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.util.*;
import javax.swing.table.*;
public class Myscrollpane extends JScrollPane {
ImageIcon icon=new ImageIcon("images/beach1.jpg");
Image img;
int w,h,wi,hi;
TableColumn column = null;
String[] names = {"Company Code", "Company Name"};
DefaultTableModel model=new DefaultTableModel(names,0);
JTable table=new JTable(model);
LogoViewport vp;//user class extends with JViewport
Myscrollpane(int width,int height){
vp= new LogoViewport(width,height);
setOpaque(false);
setMinimumSize(new Dimension(width,height));
setPreferredSize(new Dimension(width,height));
setSize(350,125);
///////////here r the table methods tocontrol /////////////////////
table.setPreferredScrollableViewportSize(new Dimension width,height));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF );
table.getTableHeader().setReorderingAllowed(false);
table.setBackground(new Color(245,235,237));
table.setForeground(Color.black);
table.setOpaque(true);
table.setEnabled(false);
table.setFont(new java.awt.Font("Dialog", Font.ITALIC, 12));
table.setGridColor(Color.pink);
table.setRowHeight(22);
table.setSelectionBackground(Color.lightGray);
DefaultTableCellRenderer renderer=new DefaultTableCellRenderer();
TableColumn code=table.getColumnModel().getColumn(0);
renderer.setBackground(Color.red);
//if i use the setIcon method then the data comes from the database is
//not shown because the icon paint above the data.Iwant to paint the
//image on the table dynamically means as table populated the image is
//paint on the table means no fix no of rows.How can i
//do.
code.setCellRenderer(renderer);
TableCellRenderer headerRenderer = table.getTableHeade.().getDefaultRenderer();
TableColumn column1=null;
//i use this to change the color and paste icon of header column
//but it is not work
for (int j = 0; j < 2; j++) {
column1 = table.getColumnModel().getColumn(j);
Component comp = headerRenderer.getTableCellRendererComponent(null, column1.getHeaderValue(), false, false, 0, 0);
comp.setBackground(Color.red);
comp.setIcon(new ImageIcon("myimage.gif")); }
//if i use following it also not work
TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer();
if (headerRenderer instanceof DefaultTableCellRenderer) {((DefaultTableCellRenderer)headerRenderer).setBackground(Color.red);} vp.setView(table);
this.setViewport(vp);
}plz help me with the code.
stated as above i also want to draw the image on the table with the use of DefaultTabel
Model and data set from the data base.Initally no row is shown.
plz help me
thanks in advanceimport java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableHeader extends JFrame
public TableHeader()
Object[] columnNames =
new ImageIcon("copy16.gif"),
"Some Text",
new ImageIcon("add16.gif")
// Columns headings are cast to a String when created automatically.
// We want Icons, so use a special renderer and create the columns manually
JTable table = new JTable();
table.getTableHeader().setDefaultRenderer( new HeaderRenderer() );
for (int i = 0; i < columnNames.length; i++)
TableColumn newColumn = new TableColumn(i);
newColumn.setHeaderValue( columnNames[i] );
table.addColumn(newColumn);
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
class HeaderRenderer extends DefaultTableCellRenderer
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
setHorizontalAlignment(CENTER);
// color each cell
if (col == 1)
setBackground( Color.yellow );
else
setBackground( Color.green );
// display text or icon
if (value instanceof Icon)
setIcon( (Icon)value );
setText( "" );
else
setIcon( null );
setText((value == null) ? "" : value.toString());
return this;
public static void main(String[] args)
TableHeader frame = new TableHeader();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible(true);
} -
When i try to log in to the log in link at the site https://efp.bpcl.in the log in page does not open but the firefox wants to ask with which program the firefox should open the file and when we give firefox or internet explorer than it opens the source code.Plz help...
Those files are send as application/octet-stream and that makes Firefox display a download dialog.
http://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types -
How to write code for this logic, plz help me very urgent
Hi All,
i am new to sap-abap, i got this work and i m working on this can any body help me in writing code, plz help me, this is very very urgent.
here i m giving my logic, can anybody send me the code related to this logic.
this is very urgent .
this program o/p should be in ALV format and need to create one commond 'SAVE" on this o/t list if user clicks save processedon and processedby fields in ZFIBUE should be updated automatically.
i am creating one custom table zfibue having fields: (serialno, bukrs, matnr,prdha,hkont,gsber,wrbtr,budat, credate, cretime,processed, processedon, processedby,mapped)
fields of zfibue:
serailno = numc
bukrs = char
matnr = char
prdha = char
hkont = char
gsber = char
wrbtr = char
budat = date
credate = date
cretime = time
processed= char
processedon = date
processedby = char
mapped = char are belongs to above type data types
and seelct-optionfields: s_bukrs for bseg-bukrs
s_hkont for bseg-hkont,
s_budat for bkpf-budat,
s_processed for zfibue-processed,
s_processedon for zfibue-processedon,
s_mapped. for zfibue-mapped
parameters: p_chk1 as checkbox,
p_chk2 as checkbox.
p_filepath type rlgrap-filename.
1.1 Validate the user inputs (S_BUKRS and S_HKONT) against respective check tables (T001 and SKB1). If the validation fails, provide respective error message. Eg: Invalid input for Company Code.
1.2 Fetch SERIALNO, BUKRS, MATNR, PRDHA, HKONT, GSBER, WRBTR, BUDAT, CREDATE, CRETIME, PROCESSED, PROCESSEDON, PROCESSEDBY, MAPPED from table ZFIBUE into internal table GT_ZFIBUE where BUKRS IN S_BUKRS, HKONT IN S_HKONT, BUDAT IN S_BUDAT, PROCESSED IN S_PROCESSED, PROCESSEDON IN S_PROCESSEDON, and MAPPED IN S_MAPPED.
1.3 If P_CHK2 = X, go to step 1.11. Else continue.
1.4 If P_CHK1 = X, continue. Else go to step 1.9
1.5 Fetch MATNR, PRDHA from MARA into GT_MARA for all entries in GT_ZFIBUE where MATNR = GT_ZFIBUE-MATNR.
1.6 Sort and delete adjacent duplicates from GT_MARA based on MATNR.
1.7 Loop through GT_ZFIBUE where PRDHA = blank.
Read Table GT_MARA based on MATNR = GT_ZFIBUE-MATNR.
IF sy-subrc = 0.
Move GT_MARA-PRDHA to GT_ZFIBUE-PRDHA.
Modify Table GT_ZFIBUE. Update Product Hierarchy
Endif.
Fetch PRDHA, GSBER from ZFIBU into GT_ZFIBU for all entries in GT_ZFIBUE where PRDHA = GT_ZFIBUE-PRDHA.
Read Table GT_ZFIBU based on PRDHA = GT_ZFIBUE-PRDHA.
IF sy-subrc = 0.
Move GT_ZFIBU-GSBER to GT_ZFIBUE-GSBER.
Move X to GT_ZFIBUE-MAPPED.
Modify Table GT_ZFIBUE.
Endif.
Endloop.
1.8 Modify database table ZFIBUE from GT_ZFIBUE.
1.9 Fill the field catalog table GT_FIELDCAT using the details of output fields listed in section Inputs/Outputs (above).
Eg: LWA_ FIELDCAT -SELTEXT_L = 'Serial Number.
LWA_ FIELDCAT -DATATYPE = NUMC.
LWA_ FIELDCAT -OUTPUTLEN = 9.
LWA_ FIELDCAT -TABNAME = 'GT_ZFIBUE'.
LWA_ FIELDCAT-FIELDNAME = 'SERIALNO'.
Append LWA_FIELDCAT to GT_FIELDCAT
Note: a) The output field GT_ZFIBUE-PROCESSED will be editable marking INPUT = X in field catalog (GT_FIELDCAT).
b) The standard ALV functionality will be used to give the user option for selecting all or blocks of entries at a time.
c) The PF-STATUS STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN will be copied to the program and modified to include a SAVE button.
1.10 Call the function module REUSE_ALV_GRID_DISPLAY passing output table GT_ZFIBUE and field catalog GT_FIELDCAT. Additional parameters like I_CALLBACK_PF_STATUS_SET (= ZFIBUESTAT) and I_CALLBACK_USER_COMMAND (=HANDLE_USER_ACTION) will also be passed to handle user events. Go to 2.14.
1.11 Download the file to P_FILEPATH using function module GUI_DOWNLOAD passing GT_ZFIBUE.
1.12 Exit Program.
Logic to be implemented in routine Handle_User_Action
This routine will have the following interface:
FORM Handle_User_Action USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM.
Following logic will be implemented in this routine:
1. If r_ucomm = SAVE, continue. Else exit.
2. Loop through GT_ZFIBUE where SEL_ROW = X. Row is selected
a. IF GT_ZFIBUE-PROCESSED = X.
i. GT_ZFIBUE-PROCESSEDON = SY-DATUM.
ii. GT_ZFIBUE-PROCESSEDBY = SY-UNAME.
iii. MODIFY ZFIBUE FROM work area GT_ZFIBUE.
Endif.
Endloop.Hi Swathi,
If it's very very urgent then you better get on with it, don't waste time on the web. Chop chop. -
How to specify the target name while deploying a code in OSB-- Plz Help
Hi all,
Am working in creating a cluster environment. For my testing i created a new managed server(OSB_Server) in 9001 port in the admin console itself and that server started running. The default managed server(Admin_Server) is in 7001 port. So when i deploy a code in 7001 sb console the WSDL gets exposed in 7001 because the default admin server port is 7001. While deploying a code in service bus admin console we are not specifying the target name. So how to specify the target name while deploying the code in service bus admin console. Plz help me.
Regards
PrabhuHi Prabhu,
There are three kind of server architecture possible for OSB -
1. Single server - Everything gets deployed on Admin server itself
2. Admin Server + Single Managed Server for OSB -- OSB configuration gets deployed on OSB managed server. OSB resources (proxy service, WSDL, Schema) will remain available on OSB managed server port only and NOT on admin server port
3. Admin Server + OSB cluster -- OSB configuration gets deployed on OSB cluster. OSB resources (proxy service, WSDL, Schema) will remain available on OSB Cluster port(s) only and NOT on admin server port
Converting one type of server architecture to any other type, requires a manual tedious process, so it is suggested that you create domain accordingly i.e. if you need clusters then while creating domain itself, create OSB cluster, so that all OSB applications gets deployed to OSB cluster. I will suggest you to create a clustered domain from scratch and import the configuration from your existing domian to this new clustered domain.
You may refer-
http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15022/toc.htm
Regards,
Anuj -
Abap code.........Plz help me
Hi all,
My requirement is
1. Users will be using the file upload Tcode in BW ( This TCode access will be authorized to specifi users)
2. ABAP Program need to place the file in the specified folder. Use the Z_FLATFILE_UPLOAD as a start. Copy to New program and work witht he New program
3. The ABAP program should be able to sent Trigger event after placingt he file to start the Process Chain, in which The flat file should be able to load to the ODS.
4. On Successful completion of the Process chain, the specific user group should be able to recive the email Message that the uploaded file has been loaded and avaible for reporting.
The ABAP program should be able to handle the follwing:
1. If the File Format is not correct the user should get an error message that the file is not in the expected format.
2. Once the File upload complete, user should see the message that the file uploaded correctly.
3. on Successful completion of the FileUpload, The program should trigger event.
and the program Z_FLATFILE_UPLOAD is given below
REPORT Z_FLATFILE_UPLOAD message-id zx .
PARAMETERS: FILE_NM LIKE RLGRAP-FILENAME obligatory.
PARAMETERS: P2 LIKE RLGRAP-FILENAME
DEFAULT '/Userdata/IFIN/0557'.
DATA: INRECORD_COUNT TYPE i,
OUTRECORD_COUNT TYPE i.
DATA : MASK(20) TYPE C VALUE ',. ,..'.
DATA: BEGIN OF ITAB OCCURS 0,
RECORD(3000),
END OF ITAB.
AT selection screen help and F4 statements
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE_NM.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = FILE_NM
MASK = MASK
MODE = 'O'
TITLE = 'File Select'
IMPORTING
FILENAME = FILE_NM
EXCEPTIONS
INV_WINSYS = 04
NO_BATCH = 08
SELECTION_CANCEL = 12
SELECTION_ERROR = 16.
IF FILE_NM = ' ' AND SY-SUBRC = 12.
SET CURSOR FIELD 'FILE_NM'.
MESSAGE I000(ZX) with 'File Selection cancelled.'
'Please select a valid file to proceed'.
ELSEIF SY-SUBRC NE 0.
MESSAGE E000(ZX) WITH FILE_NM.
EXIT.
ENDIF.
START-OF-SELECTION.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = FILE_NM
TABLES
DATA_TAB = ITAB.
if sy-subrc <> 0.
message i000(ZX) with 'Upload Failed'.
LEAVE LIST-PROCESSING.
endif.
*editor-call for input_rec.
OPEN DATASET P2 FOR output IN text mode encoding default.
IF SY-SUBRC <> 0.
message i000(ZX) with 'COULD NOT OPEN THE FILE'.
LEAVE LIST-PROCESSING.
ENDIF.
INRECORD_COUNT = 0.
OUTRECORD_COUNT = 0.
LOOP AT ITAB. .
INRECORD_COUNT = INRECORD_COUNT + 1.
TRANSFER ITAB-RECORD TO P2.
OUTRECORD_COUNT = OUTRECORD_COUNT + 1.
ENDLOOP. "itab
END-OF-SELECTION.
CLOSE DATASET P2.
IF SY-SUBRC <> 0.
message e000(ZX) with 'COULD NOT OPEN THE FILE'.
ENDIF.
WRITE: / '# of records read ', INRECORD_COUNT,
/ '# of records transfered', OUTRECORD_COUNT.
WRITE:/ 'upload filename', FILE_NM.
WRITE:/ ' aix filename', P2.
after this code i need to trigger my event can any onle tell me the steps after this program and the code also please
thanks in advance
Sri
points will be assignedHey,
This forum is used to get some ideas/tips when you stcuk at some point during the development. This is not a place to send your work & expecting somebody to do it for you.
see similar funny thread
plz help me -
Scroll Bar code in Awt Required Plz Help me
Hi,
My requirment is to add Vertical Scrollbar to the table.There are 12 rows in a table like from January to December.
I am able to see data of rows as jan,feb,mar,apr only .
i want to see the data of rows of next months by adding vertical scroll bar using Awt code.
I added vertical scroll bar using awt code. When i click on that Vertical scroll bar event is going to below method.
public void adjustmentValueChanged(AdjustmentEvent e) {
I tried with some logic inside above method but it is not working.what is the code i have to write inside the above method inorder to scroll the next months.
Plz Help me.
Thanks In Advance.........But i want to do this code In Using Awt only......Well, a JTable is a Swing component so I have no idea what you are talking about.
To control the size of the table you can use:
table.setPreferredScrollableViewportSize(???);
JScrollPane scrollPane = new JScrollPane( table ); -
A javaScript code that runs fine in IE but not in other plz help
Hello friends,
plese help me in getting the code for Opera and Mozilla browsers. The following code runs fine in IE but not in other browsers. it show titlebar in other browsers. What to do disable titlebar in other browsers? plz help
<html>
<head>
<script>
//Frameless Banner Popup
// Set the url of the banner popup window page
//var theURL = "index.htm";
var theURL = "/cgi-bin/login";
// Set the title of the popup window
var title = "Login"
// Set the size of the popup window
var windowWidth = 350; // cannot be less than 100
var windowHeight = 350; // cannot be less than 100
//var windowWidth = window.screen.width; // cannot be less than 100
//var windowHeight = window.screen.height; // cannot be less than 100
// Set the position of the popup window
var windowX = ((window.screen.width/2) - 175);
var windowY = ((window.screen.height/2) - 175);
// Set true to auto-center (positions will be ignored)
var autocenter = false;
// Set true for popup to close when launch page does
var autoclose = false;
var s="width="+windowWidth+",height="+windowHeight;
var beIE=document.all?true:false;
var done=new Object("no");
if(autocenter){
windowX = (window.screen.width-windowWidth)/2;
windowY = (window.screen.height-windowHeight)/2;
function doAgilePopup(){
if (beIE){
agilePopper = window.open("","popAgile","fullscreen,"+s);
agilePopper.blur();
window.focus();
agilePopper.resizeTo(windowWidth,windowHeight);
agilePopper.moveTo(windowX,windowY);
var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+theURL+"' scrolling=no>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
agilePopper.document.open();
agilePopper.document.write(frameString);
agilePopper.document.close();
}else{
agilePopper=window.open(theURL,"popAgile","scrollbars=no,"+s);
agilePopper.blur();
window.focus();
agilePopper.resizeTo(windowWidth,windowHeight);
agilePopper.moveTo(windowX,windowY);
agilePopper.blur();
if (autoclose){
window.onunload = function(){agilePopper.close();}
done="okay";
</script>
</head>
<BODY onLoad="doAgilePopup(),top.window.close()">
</body>
</html>missing semicolon in end of the variable frameString ,
better write the string in single line thats easy to find the bugs like this.
var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+theURL+"' scrolling=no>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
Maybe you are looking for
-
I want to communicate with MAX1452 in labview on PC serial port. Maxim provides dll file which has functions to communicate with device.It says first two functions should be findcom port and initialization sequence where findcom port returns PC's ser
-
Change in Rejection flag for purchase orders (PO) - Output determination
Hi all, I hope you can help me with this issue: We are using table T166C to specify which fields should be consider when you change them in a PO. That means only that changes should determine output message. However, it seems SAP is always determinin
-
Policy Agent and WebMethods Portal
Hi, Is the PolicyAgent required to authenticate users and control the access to resources ? If yes, can we use the PolicyAgent/AccessManager with any server like for example WebMethods Portal ? Thanks, Adel
-
Music for commercial use?
Hello Folks, I have been searching on the forum about music for commercial DVD and Video projects and the phrase that keeps coming up is: "purchased music is not for commercial use". Are there any Royalty Free music libraries available that CAN be us
-
How to assign "Password Reset AuthN Workflow" to "authNWFRegistered"
I'm finding a way to assign "Password Reset AuthN Workflow" to all users' "AuthN workflow Registered" attribute. I know we can do it with auto register ps script. I'm thinking but is there way to configure inbound sync rule to assign "Password Reset