How to implement facade class
I am suppose to retrive multiple rows data from a table having multiple columns in response to a user query. It is required that I use a facade class which provides an abstraction layer between execution of query and display of table data using jsp.How do I implement this?
Had is been direct exceution of the query on the jsp I would have used the result set object directly to display the table data.
Also It is required that I use stored functions(Oracle 8i) to execute the query.The problem in this while oracle can return an table type object which class is corresponding mapping in JDBC to catch this return type.
Please Help
...It is required...By whom, and why are you asking us instead of them?
Similar Messages
-
Please help me...how to implement a class DateAndTime.java
I have a class named DateAndTime.java How should I implement a method which allows me to check if the date entered by user is valid or not?. Also when the hour continues to a next day, how should I implement a method for a nextDay()? Thank you
class DateAndTime
private int hour, minute, second, month, day, year;
Constructor to initialize DateAndTime.
Default DateAndTime 0:0:0 1/1/1
public DateAndTime()
{ month = 1;
day =1;
year =1;
Constructor to set DateAndTime to specific values.
Calls member function setDate and setTime to set variables.
@param h hour of the DateAndTime
@param m minute of the DateAndTime
@param s second of the DateAndTime
@param mo month of the DateAndTime
@param d day of the DateAndTime
@param y year of the DateAndTime
public DateAndTime(int h, int m, int s, int mo, int d, int y)// CONSTRUCTOR
{ if (isValidDate(mo, d, y)) //if date entered is valid, the date and time will be set
setDate(mo, d, y);
setTime(h, m, s);
else
System.out.println("Invalid Date :" + mo + "/" + d + "/" + y);
setDate(1,1,1);
Set the values of hour, minute, and second.
@param h hour of the DateAndTime
@param m minute of the DateAndTime
@param s second of the DateAndTime
public void setTime( int h, int m, int s ) //DEFINING SETTERS, SETTING time,hour,minute,and second,
setHour( h );
setMinute( m );
setSecond( s );
Set the hour if valid or to default 0.********************SET HOUR
public void setHour( int h )
{ hour = ( h >= 0 && h < 24 ) ? h : 0; }
Set the minute if valid or to default 0.******************SET MINUTE
public void setMinute( int m )
{ minute = ( m >= 0 && m < 60 ) ? m : 0; }
Set the hour if valid or to default 0. ******************SET SECOND
public void setSecond( int s )
{ second = ( s >= 0 && s < 60 ) ? s : 0; }
Set the values of month, day, and year.
@param mo month of the DateAndTime
@param d day of the DateAndTime
@param y year of the DateAndTime
public void setDate(int mo, int d, int y)//DEFINING SETTERS, SETTING DATE FOR month,day,and Year
setMonth(mo);
setDay(d,mo,y);
setYear(y);
Set the month if valid or to default 1. ****************SET MONTH
public void setMonth(int mo)
{ month = (mo >= 1 && mo <= 12)? mo : 1; }
Set the day if valid or to default 1. ****************SET DAY
public void setDay(int d, int mo, int y) // ?????
{ day = (isValidDate(mo,d,y))? d : 1; }
Set the year if valid or to default 1. ****************SET YEAR
public void setYear(int y)
{ year = (y >=1)? y : 1; }
Get the hour value.
@return int
public int getHour() { return hour; } //DEFINING GETTERS get hour, minute, second
Get the minute value.
@return int
public int getMinute() { return minute; }
Get the second value.
@return int
public int getSecond() { return second; }
Get the month value.
@return int
public int getMonth() { return month; } //DEFINING GETTERS get month, day, and year
Get the day value.
@return int
public int getDay() { return day; }
Get the year value.
@return int
public int getYear() { return year; }
Finds whether a given date is a valid date in A.D..
@param mo month of the DateAndTime.
@param d day of the DateAndTime.
@param y year of the DateAndTime.
@return boolean valid or not
public static boolean isValidDate(int mo, int d, int y)
//your code goes here
return true;
Print time DateAndTime in military format.
public void printMilitary()
System.out.println( month + "/" + day + "/" + year + "\t"
+ ( hour < 10 ? "0" : "" ) + hour + ":"
+ ( minute < 10 ? "0" : "" ) + minute);
Formats DateAndTime for printing.
@return String
public String toString()
return ( month + "/" + day + "/" + year + "\t"
+ (( hour == 0 || hour == 12 ) ? 12 : hour % 12)
+ ":" + ( minute < 10 ? "0" : "" ) + minute
+ ":" + ( second < 10 ? "0" : "" ) + second
+ ( hour < 12 ? " AM" : " PM" ));
Increments DateAndTime by one second.
Hint: calls nextDay() if tick() results in going in to next day.
public void tick()
//Your code goes here
second++;
if (second >59)
second = 0;
minute++;
if (minute > 59)
minute = 0;
hour++;
if(hour >23)
// hour = 0;
nextDay();
Increments DateAndTime by one day.
public void nextDay()
day++;
//your code goes here
}//end classSee java.util.Calendar
and java.util.GregorianCalendar
You can do all types of date validation with those classes. -
How to implement Startup class for OC4J
I'm in the process of converting my current J2EE application from weblogic 5.1 to OC4J.
I have startup class that would set application specific properties by reading property file. In addition, this class would also check for certain resource availability (like database) during weblogic startup. I could not find similar option in OC4J.
Any help to convert this startup class for OC4J would be highly appreciated.
Thanks
Sankaran.Hi Sankaran,
Your eMail address suggests you work for Oracle. Do you? Can't someone
at Oracle help you?
I imagine that Oracle would have some kind of agreement with Ironflare
as well. Can't someone at Ironflare help you?
But remember, with application servers (as with RDBMSs), no two are the
same. Each one offers the same functionality, but using different methods
to achieve that functionality. I don't know how to do it, but I'm sure
you can check database availability when starting up OC4J -- just not
the same way you do it in Weblogic.
Good Luck,
Avi. -
dear friends
i use forms6i server and oracle 9i server edition,under windows 2000 server
i try to implement a java class for a bean area. i do the following :
from the property palette i write the class name in implementaion class property . the class name is 'arc.class' and it is located in <oracle_home>/forms60/java
but the fellowing error appears
frm-13008 cannot find javabean with name 'arc.class'
would any one help pleaseDear Grant Ronald
thank you very much for helping me . now i undersatand how to implement a class. but i have another question ,and i wish you ccould help me .
i try to import a java class, i do the following:
From the program menue i choose Import Java Class
but the following error appears
(pde-uji001 faild to create JVM)
by the way i use forms6i server and oracle 9i server under windows 2000 server
thanks in advance
tarek -
Problems implementing abstract classes
hello.
this is james mcfadden. I am developing a multiplayer BlackJack card game in Java. the game consists of three programs: BlackJack.java, BlackJackServer.java and BlackJackClient.java (three 3 programs are shown below). i don't know how to implement abstract classes. i am trying to get the BlackJack.java program working with the BlackJackServer.java program. there should be "extends BlackJackServer" somewhere in the BlackJack.java program, but i don't know where.
import javax.swing.*;
public class BlackJack extends JPanel{
public BlackJack(){
//FlowLayout is default layout manager for a JPanel
add(new JButton("Hit"));
add(new JButton("Stay"));
add(new JButton("New Game"));
public static void main(String[] args){
JFrame frame=new JFrame("BlackJack");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500,500);
frame.setLocation(200,200);
BlackJack bj=new BlackJack();
frame.setContentPane(bj);
frame.setVisible(true);
import java.io.*;//Provides for system input and output through data streams, serialization and the file system
import java.net.*;//Provides the classes for implementing networking applications
import java.util.*;//Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes
import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
public class BlackJackServer extends JFrame{
private JTextArea jta=new JTextArea();//a text area for displaying text
public static void main(String[] args){
new BlackJackServer();//invokes the constructor BlackJackServer()
}//end main
public BlackJackServer(){
setLayout(new BorderLayout());//places the text area on the frame
add(new JScrollPane(jta),BorderLayout.CENTER);//lays out a text area, arranging and resizing its components to fit in the centre region;and provides a scrollable view of a lightweight component
setTitle("BlackJack Server");//Sets the title for this frame to the specified string
setSize(500,300);//Resizes this component so that it has a width and a height
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//Sets the operation that will happen by default when the user closes this frame
setVisible(true);//shows the frame
try{
ServerSocket serverSocket=new ServerSocket(8000);//creates a server socket
jta.append("Server started at "+new Date()+'\n');//displays the current date in the text area
Socket socket=serverSocket.accept();//listens for a connection request
DataInputStream inputFromClient=new DataInputStream(socket.getInputStream());//creates a data input stream
DataOutputStream outputToClient=new DataOutputStream(socket.getOutputStream());//creates a data output stream
while(true){
float bet=inputFromClient.readFloat();//receives bet from the client
float doublebet=bet+bet;//computes double the bet
outputToClient.writeFloat(doublebet);//sends double the bet back to the client
jta.append("Bet received from client: "+bet+'\n');//displays the bet in the text area
jta.append("Double the bet found: "+doublebet+'\n');//displays double the bet in the text area
}//end while
}//end try
catch(IOException ex){
System.err.println(ex);//displays an error message
}//end catch
}//end constructor
}//end class BlackJackServer
import java.io.*;//Provides for system input and output through data streams, serialization and the file system
import java.net.*;//Provides the classes for implementing networking applications
import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
import java.awt.event.*;//Provides interfaces and classes for dealing with different types of events fired by AWT components
import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
public class BlackJackClient extends JFrame{
private JTextField jtf=new JTextField();//a text field for receiving text
private JTextArea jta=new JTextArea();//a text area for displaying text
private DataOutputStream toServer;//output stream
private DataInputStream fromServer;//input stream
public static void main(String[] args){
new BlackJackClient();//invokes the constructor BlackJackClient()
public BlackJackClient(){
JPanel p=new JPanel();//holds the label and text field
p.setLayout(new BorderLayout());//sets the layout of the content pane of this component by default
p.add(new JLabel("Enter bet"),BorderLayout.WEST);//displays the bet and lays out a JLabel, arranging and resizing its components to fit in the western region
p.add(jtf,BorderLayout.CENTER);//lays out the text field, arranging and resizing its components to fit in the centre region
jtf.setHorizontalAlignment(JTextField.RIGHT);//Sets the horizontal alignment of the text to the right
setLayout(new BorderLayout());//places the text area on the frame
add(p,BorderLayout.NORTH);//lays out the text field, arranging and resizing its components to fit in the northern region
add(new JScrollPane(jta),BorderLayout.CENTER);//lays out a text area, arranging and resizing its components to fit in the centre region;and provides a scrollable view of a lightweight component
jtf.addActionListener(new ButtonListener());//invokes the ButtonListener class
setTitle("BlackJack Client");//Sets the title for this frame to the specified string
setSize(500,300);//Resizes this component so that it has a width and a height
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//Sets the operation that will happen by default when the user closes this frame
setVisible(true);//shows the frame
try{
Socket socket=new Socket("localhost",8000);//creates a socket to connect to the server
fromServer=new DataInputStream(socket.getInputStream());//creates an input stream to receive data from the server
toServer=new DataOutputStream(socket.getOutputStream());//creates an output stream to send data to the server
}//end try
catch(IOException ex){
jta.append(ex.toString()+'\n');//displays an error message
}//end catch
private class ButtonListener implements ActionListener{
public void actionPerformed(ActionEvent e){
try{
float bet=Float.parseFloat(jtf.getText().trim());//gets the bet from the text field
toServer.writeFloat(bet);//Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream
toServer.flush();//Flushes this output stream and forces any buffered output bytes to be written out
float doublebet=fromServer.readFloat();//gets double the bet from the server
jta.append("Bet is "+bet+"\n");//displays the bet in the text area
jta.append("Double the bet received from the server is "+doublebet+'\n');//displays double the bet in the text area
}//end try
catch(IOException ex){
System.err.println(ex);//displays an error message
}//end catch
}//end method
}//end class
}//end class BlackJackClientthere should be "extends BlackJackServer" somewhere in the BlackJack.java programI very much doubt that.
It's possible you might need to create a BlackJackServer object or something like that. But I don't see the point in subclassing it. -
Dear Sir,
How to implement Graphics Class in an Constructor in an Application Program.
for Example
In Applet
public void init(){
Graphics g;
Dimension d;
Font f;
FontMetrics fm;
g = getGraphics();
d = size();
f=new Font("Dialog",Font.PLAIN,12);
g. setFont(f);
fm = g.getFontMetrics();
standalone Application program
Words(){
Graphics g;
Dimension d;
Font f;
FontMetrics fm;
g = getGraphics();
d = size();
f=new Font("Dialog",Font.PLAIN,12);
g. setFont(f);
fm = g.getFontMetrics();
when we try to implement in an standlone Application program it gives
Null Pointer Exception how to implement Grapics Class in an constructor of standlone Application program.I think this is an appropriate reply for this...
-
How to implement a java class in my form .
Hi All ,
I'm trying to create a Button or a Bean Area Item and Implement a class to it on the ( IMPLEMENTATION CLASS ) property such as ( oracle.forms.demos.RoundedButton ) class . but it doesn't work ... please tell me how to implement such a class to my button .
Thanx a lot for your help.
AIN
nullhi [email protected]
tell me my friend .. how can i extend
the standard Forms button in Java ? ... what is the tool for that ... can you explain more please .. or can you give me a full example ... i don't have any expereience on that .. i'm waiting for your reply .
Thanx a lot for your cooperation .
Ali
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by [email protected]:
Henrik, the Java importer lets you call Java classes on the app server side - I think what Ali is trying to do is integrate on the client side.
If you want to add your own button then if you extend the standard Forms button in Java and then use this class name in the implementation class property then the Java for your button will be used instead of the standard Forms button. And since it has extended the basic Forms button it has all the standard button functionality.
There is a white paper on OTN about this and we have created a new white paper which will be out in a couple of months (I think).
Regards
Grant Ronald<HR></BLOCKQUOTE>
null -
How to implement classes with alv's
hi
how to implement classes with alv'sHi Jyotsna,
check this example codes.
*"Table declarations...................................................
TABLES:
EKKO, " Purchasing Document Header
CDHDR, " Change document header
SSCRFIELDS. " Fields on selection screens
*"Selection screen elements............................................
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
S_EKGRP FOR EKKO-EKGRP, " Purchasing group
S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
S_UDATE FOR CDHDR-UDATE. " Creation date of the change
" document
*" Data declarations...................................................
Field String to hold Purchase Document Number *
DATA:
BEGIN OF FS_EBELN,
EBELN(90) TYPE C, " Purchase Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
" the Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EBELN,
Field String to hold Purchase Document Header *
BEGIN OF FS_EKKO,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EKKO,
Field String to hold Account Number and name of the Vendor *
BEGIN OF FS_LFA1,
LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
NAME1 TYPE LFA1-NAME1, " Name1
END OF FS_LFA1,
Field String to hold Change date and the name of the user *
BEGIN OF FS_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
OBJECTID TYPE CDHDR-OBJECTID, " Object value
CHANGENR TYPE CDHDR-CHANGENR, " Document change number
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
END OF FS_CDHDR,
Field String to hold Change document items *
BEGIN OF FS_CDPOS,
OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
OBJECTID(10) TYPE C, " Object Value
CHANGENR TYPE CDPOS-CHANGENR, " Document change number
TABNAME TYPE CDPOS-TABNAME, " Table Name
FNAME TYPE CDPOS-FNAME, " Field Name
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_CDPOS,
Field String to hold Date Element Name *
BEGIN OF FS_DATAELE,
TABNAME TYPE DD03L-TABNAME, " Table Name
FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
END OF FS_DATAELE,
Field String to hold Short Text of the Date Element *
BEGIN OF FS_TEXT,
ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
END OF FS_TEXT,
Field String to hold data to be displayed on the ALV grid *
BEGIN OF FS_OUTTAB,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
WERKS TYPE LFA1-WERKS, " Plant
NAME1 TYPE LFA1-NAME1, " Name1
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_OUTTAB,
Internal table to hold Purchase Document Number *
T_EBELN LIKE STANDARD TABLE
OF FS_EBELN,
Internal table to hold Purchase Document Header *
T_EKKO LIKE STANDARD TABLE
OF FS_EKKO,
Temp Internal table to hold Purchase Document Header *
T_EKKO_TEMP LIKE STANDARD TABLE
OF FS_EKKO,
Internal table to hold Account number and Name of the Vendor *
T_LFA1 LIKE STANDARD TABLE
OF FS_LFA1,
Internal Table to hold Change date and the name of the user *
T_CDHDR LIKE STANDARD TABLE
OF FS_CDHDR,
Internal Table to hold Change document items *
T_CDPOS LIKE STANDARD TABLE
OF FS_CDPOS,
Temp. Internal Table to hold Change document items *
T_CDPOS_TEMP LIKE STANDARD TABLE
OF FS_CDPOS,
Internal Table to hold Data Element Name *
T_DATAELE LIKE STANDARD TABLE
OF FS_DATAELE,
Temp. Internal Table to hold Data Element Name *
T_DATAELE_TEMP LIKE STANDARD TABLE
OF FS_DATAELE,
Internal Table to hold Short Text of the Date Element *
T_TEXT LIKE STANDARD TABLE
OF FS_TEXT,
Internal Table to hold data to be displayed on the ALV grid *
T_OUTTAB LIKE STANDARD TABLE
OF FS_OUTTAB.
C L A S S D E F I N I T I O N *
CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
*" Data declarations...................................................
Work variables *
DATA:
W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
W_VALUE TYPE EKKO-EBELN, " Reflected Value
W_SPACE VALUE ' ', " Space
W_FLAG TYPE I, " Flag Variable
W_VARIANT TYPE DISVARIANT, " Variant
ALV Grid
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
Event Handler
W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
Field catalog table
T_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN ON S_EBELN.
Subroutine to validate Purchase Document Number.
PERFORM VALIDATE_PD_NUM.
AT SELECTION-SCREEN ON S_LIFNR.
Subroutine to validate Vendor Number.
PERFORM VALIDATE_VEN_NUM.
AT SELECTION-SCREEN ON S_EKGRP.
Subroutine to validate Purchase Group.
PERFORM VALIDATE_PUR_GRP.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
Subroutine to select all Purchase orders.
PERFORM SELECT_PO.
CHECK W_FLAG EQ 0.
Subroutine to select Object values.
PERFORM SELECT_OBJ_ID.
CHECK W_FLAG EQ 0.
Subroutine to select Changed values.
PERFORM SELECT_CHANGED_VALUE.
CHECK W_FLAG EQ 0.
Subroutine to Select Purchase Orders.
PERFORM SELECT_PUR_DOC.
Subroutine to select Vendor Details.
PERFORM SELECT_VENDOR.
Subroutine to select Text for the Changed values.
PERFORM DESCRIPTION.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
IF NOT T_EKKO IS INITIAL.
Subroutine to populate the Output Table.
PERFORM FILL_OUTTAB.
Subroutine to build Field Catalog.
PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
CALL SCREEN 100.
ENDIF. " IF NOT T_EKKO...
CLASS LCL_EVENT_HANDLER DEFINITION
Defining Class which handles events
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION
Implementing the Class which can handle events
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*---Handle Double Click
METHOD HANDLE_HOTSPOT_CLICK .
Subroutine to get the HotSpot Cell information.
PERFORM GET_CELL_INFO.
SET PARAMETER ID 'BES' FIELD W_VALUE.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. " HANDLE_HOTSPOT_CLICK
ENDCLASS. " LCL_EVENT_HANDLER
*& Module STATUS_0100 OUTPUT
PBO Event
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'OOPS'.
SET TITLEBAR 'TIT'.
Subroutine to fill the Variant Structure
PERFORM FILL_VARIANT.
IF W_GRID IS INITIAL.
CREATE OBJECT W_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CL_GUI_CONTAINER=>SCREEN0
I_APPL_EVENTS =
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. " IF SY-SUBRC 0
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT = W_VARIANT
I_SAVE = 'A'
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 = T_OUTTAB
IT_FIELDCATALOG = T_FIELDCAT
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. " IF SY-SUBRC 0.
ENDIF. " IF W_GRID IS INITIAL
CREATE OBJECT W_EVENT_CLICK.
SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI Event
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form PREPARE_FIELD_CATALOG
Subroutine to build the Field catalog
<--P_T_FIELDCAT Field Catalog Table
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
DATA LS_FCAT TYPE LVC_S_FCAT.
Purchasing group...
LS_FCAT-FIELDNAME = 'EKGRP'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Number...
LS_FCAT-FIELDNAME = 'EBELN'.
LS_FCAT-REF_TABLE = 'EKKO' .
LS_FCAT-EMPHASIZE = 'C411'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-HOTSPOT = 'X'.
APPEND LS_FCAT TO PT_FIELDCAT .
CLEAR LS_FCAT .
Name of Person who Created the Object...
LS_FCAT-FIELDNAME = 'ERNAM'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-OUTPUTLEN = '15' .
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Date...
LS_FCAT-FIELDNAME = 'BEDAT'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Vendor's account number...
LS_FCAT-FIELDNAME = 'LIFNR'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Account Number of Vendor or Creditor...
LS_FCAT-FIELDNAME = 'NAME1'.
LS_FCAT-REF_TABLE = 'LFA1'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Vendor Name'(001).
LS_FCAT-SELTEXT = 'Vendor Name'(001).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Creation date of the change document...
LS_FCAT-FIELDNAME = 'UDATE'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Change Date'(002).
LS_FCAT-SELTEXT = 'Change Date'(002).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
User name of the person responsible in change document...
LS_FCAT-FIELDNAME = 'USERNAME'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Modified by'(003).
LS_FCAT-SELTEXT = 'Modified by'(003).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Short Text Describing R/3 Repository Objects...
LS_FCAT-FIELDNAME = 'DDTEXT'.
LS_FCAT-REF_TABLE = 'DD04T'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Old contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_OLD'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
New contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_NEW'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form SELECT_PO
Subroutine to select all the Purchase Orders
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PO .
SELECT EBELN " Purchasing Document Number
ERNAM " Name of Person who Created
" the Object
LIFNR " Vendor's account number
EKGRP " Purchasing group
BEDAT " Purchasing Document Date
FROM EKKO
PACKAGE SIZE 10000
APPENDING TABLE T_EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S401(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " SELECT_PO
*& Form SELECT_OBJ_ID
Subroutine to select Object ID
There are no interface parameters to be passed to this subroutine.
FORM SELECT_OBJ_ID .
IF NOT T_EBELN IS INITIAL.
SELECT OBJECTCLAS " Object Class
OBJECTID " Object value
CHANGENR " Document change number
USERNAME " User name
UDATE " Creation date
FROM CDHDR
INTO TABLE T_CDHDR
FOR ALL ENTRIES IN T_EBELN
WHERE OBJECTID EQ T_EBELN-EBELN
AND UDATE IN S_UDATE
AND TCODE IN ('ME21N','ME22N','ME23N').
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Header Not Found'(031).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EBELN IS INITIAL
ENDFORM. " SELECT_OBJ_ID
*& Form SELECT_CHANGED_VALUE
Subroutine to select Changed Values
There are no interface parameters to be passed to this subroutine.
FORM SELECT_CHANGED_VALUE .
IF NOT T_CDHDR IS INITIAL.
SELECT OBJECTCLAS " Object class
OBJECTID " Object value
CHANGENR " Document change number
TABNAME " Table Name
FNAME " Field Name
VALUE_NEW " New contents of changed field
VALUE_OLD " Old contents of changed field
FROM CDPOS
PACKAGE SIZE 10000
APPENDING TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
AND OBJECTID EQ T_CDHDR-OBJECTID
AND CHANGENR EQ T_CDHDR-CHANGENR.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Item Not Found'(032).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_CDHDR IS INITIAL
T_CDPOS_TEMP] = T_CDPOS[.
ENDFORM. " SELECT_CHANGED_VALUE
*& Form SELECT_PUR_DOC
Subroutine to select Purchase Order Details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PUR_DOC .
IF NOT T_CDPOS IS INITIAL.
SORT T_EBELN BY EBELN.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
FS_CDPOS-OBJECTID BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE TABLE T_EBELN FROM FS_EBELN.
ENDIF. " IF SY-SUBRC NE 0.
ENDLOOP. " LOOP AT T_CDPOS...
LOOP AT T_EBELN INTO FS_EBELN.
MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
APPEND FS_EKKO TO T_EKKO.
ENDLOOP. " LOOP AT T_EBELN...
T_EKKO_TEMP] = T_EKKO[.
ENDIF. " IF NOT T_CDPOS IS INITIAL
ENDFORM. " SELECT_PUR_DOC
*& Form SELECT_VENDOR
Subroutine to select Vendor details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_VENDOR .
IF NOT T_EKKO IS INITIAL.
SORT T_EKKO_TEMP BY LIFNR.
DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
SELECT LIFNR " Account Number of Vendor or
" Creditor
NAME1 " Name 1
FROM LFA1
INTO TABLE T_LFA1
FOR ALL ENTRIES IN T_EKKO_TEMP
WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
IF SY-SUBRC NE 0.
MESSAGE S002(M8) WITH 'Master Details'(033).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EKKO IS INITIAL
ENDFORM. " SELECT_VENDOR
*& Form DESCRIPTION
Subroutine to get the description
There are no interface parameters to be passed to this subroutine.
FORM DESCRIPTION .
IF NOT T_CDPOS IS INITIAL.
SORT T_CDPOS_TEMP BY TABNAME FNAME.
DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
SELECT TABNAME " Table Name
FIELDNAME " Field Name
ROLLNAME " Data element
FROM DD03L
INTO TABLE T_DATAELE
FOR ALL ENTRIES IN T_CDPOS_TEMP
WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
IF NOT T_DATAELE IS INITIAL.
T_DATAELE_TEMP] = T_DATAELE[.
SORT T_DATAELE_TEMP BY ROLLNAME.
DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
SELECT ROLLNAME " Data element
DDTEXT " Short Text Describing R/3
" Repository Objects
FROM DD04T
INTO TABLE T_TEXT
FOR ALL ENTRIES IN T_DATAELE_TEMP
WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
AND DDLANGUAGE EQ SY-LANGU.
IF SY-SUBRC NE 0.
EXIT.
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_DATAELE IS INITIAL.
ENDIF. " IF NOT T_CDPOS IS INITIAL.
ENDFORM. " DESCRIPTION
*& Form FILL_OUTTAB
Subroutine to populate the Outtab
There are no interface parameters to be passed to this subroutine.
FORM FILL_OUTTAB .
SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
SORT T_EKKO BY EBELN.
SORT T_LFA1 BY LIFNR.
SORT T_DATAELE BY TABNAME FIELDNAME.
SORT T_TEXT BY ROLLNAME.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
OBJECTCLAS = FS_CDPOS-OBJECTCLAS
OBJECTID = FS_CDPOS-OBJECTID
CHANGENR = FS_CDPOS-CHANGENR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
READ TABLE T_EKKO INTO FS_EKKO WITH KEY
EBELN = FS_CDHDR-OBJECTID
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
LIFNR = FS_EKKO-LIFNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
TABNAME = FS_CDPOS-TABNAME
FIELDNAME = FS_CDPOS-FNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE T_TEXT INTO FS_TEXT WITH KEY
ROLLNAME = FS_DATAELE-ROLLNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
APPEND FS_OUTTAB TO T_OUTTAB.
CLEAR FS_OUTTAB.
ENDLOOP.
ENDFORM. " FILL_OUTTAB
*& Form GET_CELL_INFO
Subroutine to get the Cell Information
--> W_VALUE Holds the value of Hotspot clicked
FORM GET_CELL_INFO .
CALL METHOD W_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW =
E_VALUE = W_VALUE
E_COL =
ES_ROW_ID =
ES_COL_ID =
ES_ROW_NO =
ENDFORM. " GET_CELL_INFO
*& Form VALIDATE_PD_NUM
Subroutine to validate Purchase Document Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PD_NUM .
IF NOT S_EBELN[] IS INITIAL.
SELECT EBELN " Purchase Document Number
FROM EKKO
INTO W_EBELN
UP TO 1 ROWS
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E717(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EBELN[]...
ENDFORM. " VALIDATE_PD_NUM
*& Form VALIDATE_VEN_NUM
Subroutine to validate Vendor Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_VEN_NUM .
IF NOT S_LIFNR[] IS INITIAL.
SELECT LIFNR " Vendor Number
FROM LFA1
INTO W_LIFNR
UP TO 1 ROWS
WHERE LIFNR IN S_LIFNR.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E002(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_LIFNR[]...
ENDFORM. " VALIDATE_VEN_NUM
*& Form VALIDATE_PUR_GRP
Subroutine to validate the Purchase Group
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PUR_GRP .
IF NOT S_EKGRP[] IS INITIAL.
SELECT EKGRP " Purchase Group
FROM T024
INTO W_EKGRP
UP TO 1 ROWS
WHERE EKGRP IN S_EKGRP.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E622(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EKFRP[]...
ENDFORM. " VALIDATE_PUR_GRP
*& Form FILL_VARIANT
Subroutine to fill the Variant Structure
There are no interface parameters to be passed to this subroutine
FORM FILL_VARIANT .
Filling the Variant structure
W_VARIANT-REPORT = SY-REPID.
W_VARIANT-USERNAME = SY-UNAME.
ENDFORM. " FILL_VARIANT
REPORT YMS_HIERSEQLISTDISPLAY .
Program with FM REUSE_ALV_HIERSEQ_LIST_DISPLAY *
Author : Michel PIOUD *
Email : mpioudyahoo.fr HomePage : http://www.geocities.com/mpioud *
TYPE-POOLS: slis. " ALV Global types
CONSTANTS :
c_x VALUE 'X',
c_gt_vbap TYPE SLIS_TABNAME VALUE 'GT_VBAP',
c_gt_vbak TYPE SLIS_TABNAME VALUE 'GT_VBAK'.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(02) TYPE n DEFAULT '10' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_2 FOR FIELD p_expand. "#EC NEEDED
PARAMETERS p_expand AS CHECKBOX DEFAULT c_x.
SELECTION-SCREEN END OF LINE.
TYPES :
1st Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
kunnr TYPE vbak-kunnr, " Sold-to party
netwr TYPE vbak-netwr, " Net Value of the Sales Order
erdat TYPE vbak-erdat, " Creation date
waerk TYPE vbak-waerk, " SD document currency
expand TYPE xfeld,
END OF ty_vbak,
2nd Table
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document
matnr TYPE vbap-matnr, " Material number
netwr TYPE vbap-netwr, " Net Value of the Sales Order
waerk TYPE vbap-waerk, " SD document currency
END OF ty_vbap.
DATA :
1st Table
gt_vbak TYPE TABLE OF ty_vbak,
2nd Table
gt_vbap TYPE TABLE OF ty_vbap.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
v_2 = 'With ''EXPAND'' field'.
START-OF-SELECTION.
Read Sales Document: Header Data
SELECT vbeln kunnr netwr waerk erdat
FROM vbak
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_vbak.
IF NOT gt_vbak[] IS INITIAL.
Read Sales Document: Item Data
SELECT vbeln posnr matnr netwr waerk
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE gt_vbap
FOR ALL ENTRIES IN gt_vbak
WHERE vbeln = gt_vbak-vbeln.
ENDIF.
PERFORM f_display.
Form F_DISPLAY
FORM f_display.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-tabname = &1.
ls_fieldcat-fieldname = &2.
ls_fieldcat-ref_tabname = &3.
ls_fieldcat-cfieldname = &4. " Field with currency unit
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-tabname = &1.
ls_sort-fieldname = &2.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_layout TYPE slis_layout_alv,
ls_keyinfo TYPE slis_keyinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv," Sort table
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog
ls_layout-group_change_edit = c_x.
ls_layout-colwidth_optimize = c_x.
ls_layout-zebra = c_x.
ls_layout-detail_popup = c_x.
ls_layout-get_selinfos = c_x.
IF p_expand = c_x.
ls_layout-expand_fieldname = 'EXPAND'.
ENDIF.
Build field catalog and sort table
m_fieldcat c_gt_vbak 'VBELN' 'VBAK' ''.
m_fieldcat c_gt_vbak 'KUNNR' 'VBAK' ''.
m_fieldcat c_gt_vbak 'NETWR' 'VBAK' 'WAERK'.
m_fieldcat c_gt_vbak 'WAERK' 'VBAK' ''.
m_fieldcat c_gt_vbak 'ERDAT' 'VBAK' ''.
m_fieldcat c_gt_vbap 'POSNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'MATNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'NETWR' 'VBAP' 'WAERK'.
m_fieldcat c_gt_vbap 'WAERK' 'VBAP' ''.
m_sort c_gt_vbak 'KUNNR'.
m_sort c_gt_vbap 'NETWR'.
ls_keyinfo-header01 = 'VBELN'.
ls_keyinfo-item01 = 'VBELN'.
ls_keyinfo-item02 = 'POSNR'.
Dipslay Hierarchical list
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
i_tabname_header = c_gt_vbak
i_tabname_item = c_gt_vbap
is_keyinfo = ls_keyinfo
TABLES
t_outtab_header = gt_vbak
t_outtab_item = gt_vbap
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " F_LIST_DISPLAY
Form USER_COMMAND *
FORM user_command USING i_ucomm TYPE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
DATA ls_vbak TYPE ty_vbak.
CASE i_ucomm.
WHEN '&IC1'. " Pick
CASE is_selfield-tabname.
WHEN c_gt_vbap.
WHEN c_gt_vbak.
READ TABLE gt_vbak INDEX is_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
Sales order number
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
Display Sales Order
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND
Kindly Reward Points If You Found The Reply Helpful,
Cheers,
Chaitanya. -
How to implement classes and methods in badi's ?
how to implement classes and methods in badi's? and where i have to write the code based on the requirement?can anyone explain me briefly?
Hi
Every BADI by default Implements an INTERFACE which already contains some methods with parameters.
So you have to find the relavenet method based on the related paramters (by checking the fields in that paramters) you have to double click on the method and to write the code.
see the doc
DEFINING THE BADI
1) execute Tcode SE18.
2) Specify a definition Name : ZBADI_SPFLI
3) Press create
4) Choose the attribute tab. Specify short desc for badi.. and specify the type :
multiple use.
5) Choose the interface tab
6) Specify interface name: ZIF_EX_BADI_SPFLI and save.
7) Dbl clk on interface name to start class builder . specify a method name (name,
level, desc).
Method level desc
Linese;ection instance methos some desc
8) place the cursor on the method name desc its parameters to define the interface.
Parameter type refe field desc
I_carrid import spfli-carrid some
I_connid import spefi-connid some
9) save , check and activate adapter class proposed by system is
ZCL_IM_IM_LINESEL is genereated.
IMPLEMENTATION OF BADI DEFINITION
1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.
2) Specify aname for implementation ZIM_LINESEL
3) Specify short desc.
4) Choose interface tab. System proposes a name fo the implementation class.
ZCL_IM_IMLINESEL which is already generarted.
5) Specify short desc for method
6) Dbl clk on method to insert code..(check the code in AAA).
7) Save , check and activate the code.
Some useful URL
http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf
http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm
http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
Now write a sample program to use this badi method..
Look for BBB sample program.
AAA
data : wa_flights type sflight,
it_flights type table of sflight.
format color col_heading.
write:/ 'Flight info of:', i_carrid, i_connid.
format color col_normal.
select * from sflight
into corresponding fields of table it_flights
where carrid = i_carrid
and connid = i_connid.
loop at it_flights into wa_flights.
write:/ wa_flights-fldate,
wa_flights-planetype,
wa_flights-price currency wa_flights-currency,
wa_flights-seatsmax,
wa_flights-seatsocc.
endloop.
BBB
*& Report ZBADI_TEST *
REPORT ZBADI_TEST .
tables: spfli.
data: wa_spfli type spfli,
it_spfli type table of spfli with key carrid connid.
*Initialise the object of the interface.
data: exit_ref type ref to ZCL_IM_IM_LINESEL,
exit_ref1 type ref to ZIF_EX_BADISPFLI1.
selection-screen begin of block b1.
select-options: s_carr for spfli-carrid.
selection-screen end of block b1.
start-of-selection.
select * from spfli into corresponding fields of table it_spfli
where carrid in s_carr.
end-of-selection.
loop at it_spfli into wa_spfli.
write:/ wa_spfli-carrid,
wa_spfli-connid,
wa_spfli-cityfrom,
wa_spfli-deptime,
wa_spfli-arrtime.
hide: wa_spfli-carrid, wa_spfli-connid.
endloop.
at line-selection.
check not wa_spfli-carrid is initial.
create object exit_ref.
exit_ref1 = exit_ref.
call method exit_ref1->lineselection
EXPORTING
i_carrid = wa_spfli-carrid
i_connid = wa_spfli-connid.
clear wa_spfli.
Reward points for useful Answers
Regards
Anji
Message was edited by:
Anji Reddy Vangala -
How to implement class interfaces
Hi all,
We are getting the below error message
Error message is Interfacemethod "IF_EX_LE_SHP_DELIVERY_PROC~SAVE_AND_PUBLISH_BEFORE has not yet been implemented".
Could somebody tell me how can i implement a class interface.
Class interface: ZCL_IM_ATP_WM
Appreicate your help.Hi,
while double clicking on the method IF_EX_LE_SHP_DELIVERY_PROC~SAVE_AND_PUBLISH_
BEFORE
Error message is Interfacemethod "IF_EX_LE_SHP_DELIVERY_PROC~SAVE_AND_PUBLISH_BEFORE has not yet been implemented".
It is not opening to write my code.
Any suggestion.
Thank you
Mamatha -
Implementing Note 836401. How to create message class 'Z'?
Hello Experts,
I'm trying to implement SAP Note 836401 -" FBCJ: Receipt print with display not allowed " In SAP ERP 6.0. Could somebody help me please with action in this note:
"You must then adjust the error class 'Z' to your error class and replace the error number '000' with the error number of the message you created." I have some misunderstanding - What I must to do here? In SE91 i can't find message class 'Z' and I can't to create it there, because of the rule: name of message class must minimum 2 characters.
In correction of object :"R3TR REPS MFCJ0F01" of this note, in source code I'm facing strings:
ID 'BEGRU' FIELD ls_tcj_c_journals-begru.
CHECK sy-subrc NE 0.
AUTHORITY-CHECK OBJECT 'F_FBCJ'
ID 'ACTVT' FIELD '32' "Save
ID 'BEGRU' FIELD ls_tcj_c_journals-begru.
CHECK sy-subrc NE 0.
ld_no_auth = 'X'. "no authorization
MESSAGE ID 'Z' TYPE 'I' NUMBER 000.
* Sie haben keine Berechtigung, Quittungen zu drucken.
ENDIF. "begru initial?
ENDFORM.
How to create the error class'Z'?
How to adjust error class 'Z' to my error class?
Best regards,
Pavel Bogomolov.Hello Pavel
The SAP note says that you should look for an appropriate Z-message class having a message (i.e. number) with the required text.
Alternatively, you may use the following approach:
CHECK sy-subrc NE 0.
ld_no_auth = 'X'. "no authorization
MESSAGE ID '00' TYPE 'I' NUMBER 208 WITH 'Sie haben keine Berechtigung, Quittungen zu drucken'.
" MESSAGE ID 'Z' TYPE 'I' NUMBER 000.
"* Sie haben keine Berechtigung, Quittungen zu drucken.
ENDIF. "begru initial?
ENDFORM.
Regards
Uwe -
I'm new with Java and am so confused! I need help with the following exercise.
Implement a class Employee. An employee has a name (a string) and a salary (a double). Write a default constructor, a constructor with two parameters (name and salary), and methods to return the name and salary. Write a program that tests your class. How do I do this?
I can't figure out how to do this!!!!! Please show me an example!public class Employee {
private String name;
private double salary;
public static void main(String[] args) {
Employee employee = new Employee("Max Just", 64000);
System.out.println(employee.getName() + "\nsalary: " + employee.getSalary());
public Employee() {
name = null;
salary = null;
public Employee(String name, double salary) {
this.name = name;
this.salary = salary;
public String getName() {
return name;
public double getSalary {
return salary; -
How to implement a server side SOAP invokeable class????
Here is my class
public class ABCImpl
public String exceute (String msg) { ...}
ABCImpl.execute(...) requires a string parameter and return a string in XML
format. It is invoked throught SOAP-RPC call by a remote client. How do I
integrate class ABCImpl into WebLogic 8.1?? What additional steps are
needed??
thanks.Hi Stephen,
See servicegen:
http://edocs.bea.com/wls/docs81/webserv/anttasks.html#1063540
"The servicegen Ant task takes as input an EJB JAR file or list of Java
classes, and creates all the needed WebService components and packages
them into a deployable EAR file."
Hope this helps,
Bruce
Stephen Kong wrote:
>
Here is my class
public class ABCImpl
public String exceute (String msg) { ...}
ABCImpl.execute(...) requires a string parameter and return a string in XML
format. It is invoked throught SOAP-RPC call by a remote client. How do I
integrate class ABCImpl into WebLogic 8.1?? What additional steps are
needed??
thanks. -
Can't Figure Out How To Implement IEnumerable T
I have no problem implementing IEnumerable but can't figure out how to implement IEnumerable<T>. Using the non-generic ArrayList, I have this code:
class PeopleCollection : IEnumerable
ArrayList people = new ArrayList();
public PeopleCollection() { }
public IEnumerator GetEnumerator()
return people.GetEnumerator();
class Program
static void Main(string[] args)
PeopleCollection collection = new PeopleCollection();
foreach (Person p in collection)
Console.WriteLine(p);
I'm trying to do the same thing (using a List<Person> as the member variable instead of ArrayList) but get compile errors involving improper return types on my GetEnumerator() method. I start out with this:
class PeopleCollection : IEnumerable<Person>
List<Person> myPeople = new List<Person>();
public PeopleCollection() { }
public IEnumerator<Person> GetEnumerator()
throw new NotImplementedException();
IEnumerator IEnumerable.GetEnumerator()
throw new NotImplementedException();
class Program
static void Main(string[] args)
// Create a PeopleCollection object.
PeopleCollection peopleCollection = new PeopleCollection();
// Iterate over the collection.
foreach (Person p in peopleCollection)
Console.WriteLine(p);
Console.ReadLine();
That code compiles (basically because I haven't really done anything yet), but I get compile errors when I try to implement the GetEnumerator() methods.The List<T> class implements the IEnumerable<T> interface, so your enumerator can return the GetEnumerator call from the list.
class PeopleCollection : IEnumerable<Person>
List<Person> myPeople = new List<Person>();
public PeopleCollection() { }
public IEnumerator<Person> GetEnumerator()
return myPeople.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
return myPeople.GetEnumerator();
class Program
static void Main(string[] args)
// Create a PeopleCollection object.
PeopleCollection peopleCollection = new PeopleCollection();
// Iterate over the collection.
foreach (Person p in peopleCollection)
Console.WriteLine(p);
Console.ReadLine(); -
How to import a class from a package at the same level
Hello friends,
i have a class as Plaf.java
as
package org.vaibhav.swing.plaf;
import java.awt.*;
import javax.swing.*;
public class Plaf {
other code
}as you see, this is in org.vaibhav.swing.plaf package.
I have one more class as
package org.vaibhav.swing.frames;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class StartFrame extends JFrame implements ActionListener {
other code
}and this class is in package org.vaibhav.swing.frames
Please hlp me how to use the class Plaf in StartFrame.java. Rather what import statement should i use in StartFrame.java.
please help.
thank you
Message was edited by:
vaibhavpinglebut it then gives me this error
StartFrame.java:11: package org.vaibhav.swing.plaf
does not exist
import org.vaibhav.swing.plaf.*;
Have you first compiled Plaf.java and saved it in this directory strucuture
/org/vaibhav/swing/plaf/
And also have you set your classpath to the parent directory of org folder.
Message was edited by:
qUesT_foR_knOwLeDge
Maybe you are looking for
-
Hi all. Maybe a simple question but, I haven't done yet. In BPEL, when I need to get a node, I use getVariableData XPath function, for example: count(bpws:getVariableData('MtlSystemItemsBESB_OutputVariable','MtlSystemItemsBCollection','/ns7:MtlSystem
-
Problem with loading fact table in OWB3i
Hi, I have a problem while trying to load a fact table using OWB 3i. Let me explain the situation : I have 2 dimensions: Customer, Product say. I have loaded the dimension tables separately, successfully using different mappings from source tables. N
-
I just finished importing some 80 odd songs in Apple Lossless format. All files have accepted artwork but one. When I highlight it it says "Album Artwork Not Modifiable." Why?
-
Upgraded to iphoto 11 version 9.4.3, how can i get my old photos back?
I need help recovering my photos, have lots of photos of my late father.....Before going any further, I have clean my drive app....could i be able to recover my photos back? please let me know how and if possible please.....Thank you.
-
Hi, I am using version 11.1.1.5.0; I am facing an issue with a commandLink held in a table column and it's actionListener not firing ahead of the selectionListener of the table. The selectionListener of the table call a method in the backing bean to