Structure of a return method
Hello Again
I am having trouble understanding the structure of a method which returns a value, i know that a void method looks like
public static void methodName (parameters){
//code
}but if u wish for the function to return a value (removing the void) what must u do? i keep having attempts at doing ti myself but keep having trouble.
Thanks
Dom
To be honest, I'm surprised that you're handling JScrollPanes, but do not know how to write a method that returns anything...
Similar Messages
-
Pass the structure name and return the description fields.
Hi experts!!,
I would like to know a class and the method that I pass the structure name and return all the description fields.
Thanks a lotHello Ana
Have a look at class CL_ABAP_STRUCTDESCR.
DATA: ls_knb1 TYPE knb1.
DATA: lo_typedescr TYPE REF TO cl_abap_typedescr.
DATA: lo_strucdescr TYPE REF TO cl_abap_structdescr.
DATA: lt_dfies TYPE ddfields.
lo_typedescr = cl_abap_structdescr=>describe_by_data( ls_knb1 ).
lo_structdescr ?= lo_typedescr.
lt_dfies = lo_structdescr->get_ddic_field_list( ).
" Or check public attribute: lo_structdescr->components for non-DDIC structures
Other useful RTTI classes are:
CL_ABAP_DATADESCR
CL_ABAP_TYPEDESCR
CL_ABAP_TABLEDESCR
CL_ABAP_CLASSDESCR
Regards
Uwe -
Void Methods and Value Returning Methods in Java
Hello,
I'm new here so please let me know if I overstep any of the rules or expectations. I merely want to learn more about Java Programming efficiently, and easily. I can ask and discuss these topics with my online prof, but she doesn't have much time.
So right now I'm trying to solve a problem. It's a typical college level computing problem which I've already turned in. So I'm not looking for someone to do my homework for me or something. It's just that the program didn't work. Even though I probably won't get a very good grade for it, I want to
make it work! I'm kind of slow when it comes to java so just bear with me.
The prof wanted us to write an algorithm that reads a student's name and 6 exam scores. Then it computes the average score for each student, assigns a letter grade, using a rating scale:
90 and above = A
80 - 89 = B
70 ? 79 = C
60 - 69 = D
Less then 60 ? F
We had to use a void method to determine the average score for each student, a loop inside the method to read the and sum the 6 scores but without outputting the average score. The sum and average had to be returned in and output in void main.
Then we had to use a value-returning method CalculateGrade to determine and return the grade for each student. But it can't output the grade because that must be done in void main.
Finally the class average must be output.
Our prof gave us a list of student names with their 6 scores.
Ward 100 54 98 65 35 100
Burris 89 65 87 84 15 32
Harris 54 21 55 87 70 54
Bettis 43 55 68 54 15 25
Staley 87 54 98 45 54 56
Randle 54 87 54 98 65 15
Maddox 56 14 40 50 40 50
Roth 30 40 54 78 24 19
Holmes 14 87 98 34 55 57
So all the data had to be read from a file and the results output to a file. Also we couldn't use 'global variables'. We had to use the appropriate parameters to pass values to and from methods.
Question 1: What does she mean by 'no global variables'? Maybe she means: don't use "*double test1, test2, test3, test4, test5*;"
Anyway because I'm a slow learner with Java, I end up looking for sample programs that seem to do a similar job as the problem posed. So with this program I decided to adapt a program called Comparison of Class Averages.
//Program: Comparison of Class Averages.
import java.io.*;
import java.util.*;
import java.text.DecimalFormat;
public class DataComparison
public static void main (String[] args) throws
FileNotFoundException, IOException
//Step 1
String courseId1; //course ID for group 1
String courseId2; //course ID for group 2
int numberOfCourses;
DoubleClass avg1 = new DoubleClass(); //average for a course
//in group 1
DoubleClass avg2 = new DoubleClass(); //average for a course
//in group 2
double avgGroup1; //average group 1
double avgGroup2; //average group 2
String inputGroup1;
String inputGroup2;
StringTokenizer tokenizer1 = null;
StringTokenizer tokenizer2 = null;
//Step 2 Open input and output files
BufferedReader group1 =
new BufferedReader(new FileReader("a:\\group1.txt"));
BufferedReader group2 =
new BufferedReader(new FileReader("a:\\group2.txt"));
PrintWriter outfile =
new PrintWriter(new FileWriter("a:\\student.out"));
DecimalFormat twoDecimal =
new DecimalFormat("0.00"); //Step 3
avgGroup1 = 0.0; //Step 4
avgGroup2 = 0.0; //Step 5
numberOfCourses = 0; //Step 6
//print heading: Step 7
outfile.println("Course No Group No Course Average");
inputGroup1 = group1.readLine(); //Step 8
inputGroup2 = group2.readLine(); //Step 9
while((inputGroup1 != null) &&
(inputGroup2 != null)) //Step 10
tokenizer1 = new StringTokenizer(inputGroup1);
courseId1 = tokenizer1.nextToken(); //Step 10a
tokenizer2 = new StringTokenizer(inputGroup2);
courseId2 = tokenizer2.nextToken(); //Step 10b
if(!courseId1.equals(courseId2)) //Step 10c
System.out.println("Data error: Course IDs "
+ "do not match.");
System.out.println("Program terminates.");
outfile.println("Data error: Course IDs "
+ "do not match.");
outfile.println("Program terminates.");
outfile.close();
return;
else //Step 10d
calculateAverage(group1, tokenizer1, avg1); //Step 10d.i
calculateAverage(group2, tokenizer2, avg2); //Step 10d.ii
printResult(outfile,courseId1,1,avg1); //Step 10d.iii
printResult(outfile,courseId2,2,avg2); //Step 10d.iv
avgGroup1 = avgGroup1 + avg1.getNum(); //Step 10d.v
avgGroup2 = avgGroup2 + avg2.getNum(); //Step 10d.vi
outfile.println();
numberOfCourses++; //Step 10d.vii
inputGroup1 = group1.readLine(); //Step 10e
inputGroup2 = group2.readLine(); //Step 10f
}//end while
if((inputGroup1 != null) && (inputGroup2 == null)) //Step 11a
System.out.println("Ran out of data for group 2 "
+ "before group 1.");
else //Step 11b
if((inputGroup1 == null) && (inputGroup1 != null))
System.out.println("Ran out of data for "
+ "group 1 before group 2.");
else //Step 11c
outfile.println("Avg for group 1: " +
twoDecimal.format(avgGroup1 / numberOfCourses));
outfile.println("Avg for group 2: " +
twoDecimal.format(avgGroup2 / numberOfCourses));
outfile.close(); //Step 12
public static void calculateAverage(BufferedReader inp,
StringTokenizer tok,
DoubleClass courseAvg)
throws IOException
double totalScore = 0.0;
int numberOfStudents = 0;
int score = 0;
if(!tok.hasMoreTokens())
tok = new StringTokenizer(inp.readLine());
score = Integer.parseInt(tok.nextToken());
while(score != -999)
totalScore = totalScore + score;
numberOfStudents++;
if(!tok.hasMoreTokens())
tok = new StringTokenizer(inp.readLine());
score = Integer.parseInt(tok.nextToken());
}//end while
courseAvg.setNum(totalScore / numberOfStudents);
}//end calculate Average
public static void printResult(PrintWriter outp,
String courseId,
int groupNo, DoubleClass avg)
DecimalFormat twoDecimal =
new DecimalFormat("0.00");
if(groupNo == 1)
outp.print(" " + courseId + " ");
else
outp.print(" ");
outp.println("\t" + groupNo + "\t "
+ twoDecimal.format(avg.getNum()));
So my adaptation turned out like this:
//Program: Compute individual and class averages from input file.
import java.io.*;
import java.util.*;
public class Exams
public static void main (String[] args)
throws FileNotFoundException
//Step 1
String nameId; //student name ID for list
int numberOfStudents;
DoubleClass avg = new DoubleClass(); //average for a student
//in list
double avgList; //average for list
//Step 2 Open the input and output files
Scanner group1 = new Scanner(new FileReader("c:\\list.txt"));
PrintWriter outfile = new PrintWriter("c:\\student.out");
avgList = 0.0; //Step 3
numberOfStudents = 0; //Step 5
//print heading: Step 6
outfile.println("NameID List Student Average");
calculateAverage(list, avg); //Step 7d.i
printResult(outfile,nameID, avg); //Step 7d.iii
avgList = avgList + avgList.getNum(); //Step 7d.v
outfile.println();
numberOfStudents++; //Step 7d.vii
outfile.printf("Avg for List: %.2f %n",
(avgList / numberOfStudents));
public static void calculateAverage(Scanner inp,
DoubleClass courseAvg)
double totalScore = 0.0;
int numberOfStudents = 0;
int score = 0;
score = inp.nextInt();
courseAvg.setNum(totalScore / numberOfStudents);
}//end calculate Average
public static void printResult(PrintWriter outp,
String nameId,
int groupNo, DoubleClass avg)
if (list == list)
outp.print(" " + nameId + " ");
else
outp.print(" ");
outp.printf("%9d %15.2f%n", list, avg.getNum());
I guess I was trying to find a shortcut that ended up being a long cut. Here's the algorithm I wrote.
Algorithm
1.) Initialize the variables
2.) Get the student name and his/her accompanying 6 exam scores, limiting the number of scores to 6.
3a.) Calculate score of 6 exams for each student using void method called CalculateAverage.
3b.) Use a loop inside the method to read and sum the six scores.
4.) Use value-returning method CalculateGrade to determine and return each student's grade.
5.) Output each student's grade in void main.
6.) Calculate the average score for all students
7.) Output entire class average
And now I'm trying to piece together code to match each step of the algorithm starting from scratch.
So I got the code for outputting each students grade in void:
public static void printGrade(double testScore)
System.out.print("Line 10: Your grade for "
+ "the course is ");
if (testScore >= 90)
System.out.println("A");
else if (testScore >= 80)
System.out.println("B");
else if (testScore >= 70)
System.out.println("C");
else if (testScore >= 60)
System.out.println("D");
else
System.out.println("F");
This code can read the the file with the scores:
Scanner inFile =
new Scanner(new FileReader("a:\\studentlist.txt"));
PrintWriter outFile =
new PrintWriter("a:\\avg.out");
courseGrade = inFile.nextDouble();
studentName=inFile.nextChar();
while (inFile.hasNext())
studentName= inFile.next().charAt(0);
courseGrade= inFile.nextDouble();
I'm just trying to piece this thing together. Any tips would be appreciated. I will return with more pieces to the puzzle soon. As you can tell it's all kind of disorganized, and scatterbrained. Just trying to find some simplification or distillation, or recommendations.
WRHello,
Thanks for your reply. So I take it you are more familiar with Object Oriented Programming more than Procedural Based Programming?
Well the teacher insisted I follow the algorithm instead of trying to adapt another program to the problem. But sometimes that approach saves time I've noticed since many of the code examples we study in Java are like 'the golden oldies'.
The student gradebook problem is repeated over and over in different forms. Maybe if I just approached the problem more linearly:
Algorithm
1.) Initialize the variables
String studentId
int numberOfStudents
DoubleClass avg = new DoubleClass(); //average for a student
double avgGroup: //average for all students2.) Get the student name and his/her accompanying 6 exam scores.
Scanner group = new Scanner(new FileReader("c:\\list.txt"));
PrintWriter outfile = new PrintWriter("c:\\student.out"));
3a.) Calculate score of 6 exams for each student using void method called CalculateAverage using a loop to read and sum the six scores. The loop must be inside the method. It does not output the average score. The sum and average must be returned and output in void main.
method calculateAverage
double totalScore //to store the sum of all the scores of each student
int numberOfExams; //to store the number of
int score; //to read and store a course score
double totalScore = 0.0
int numberOfExams = 0;
int score = 0;3b.) Use a loop inside the method to read and sum the six scores.
Using psuedocode (since the variables have been declared and initialized)
i)get the next student score
RIght here my approach of adapting another program to my new program becomes problematic
the pseudocode here is:
ii) while (score != -999):
I.) update totalScore by adding course score read in step i.
II.) increment numberOfExams by 1
III.) Get the nex student score
iii) studentAvg.setNum(totalScore / numberOfExams);
*What is the purpose of the statement while (score != -999)?*
I don't see why they picked -999? Will this loop allow me to read an endless number of student names and theri accompanying number of exams and then find the average for each student?
I'll go into the next algorithmic steps later.
4.) Use value-returning method CalculateGrade to determine and return each student's grade.
5.) Output each student's grade in void main.
6.) Calculate the average score for all students
7.) Output entire class average
Thanks ahead of time for any suggestions, tips. -
Dual WAE's in mixed return methods?
Today we have a single 7341 attached directly to the router's Gi0/1. The original WAE uses Forwarded return. Lastweek we received a second 7341 (and 15 other WAE boxes for branch sites). Since we can not connect a second WAE directly to the router without adding a switch between them, we planned on eventually moving both 7341's to our internal LAN segment. Our new 7341 will be provisioned on the internal LAN and will use GRE Negotiated Return to the routers Loopback interface. Once the new 7341 is up and running we plan on moving our original 7341 to that same architecture.
Does this present an issue? Will the router have an issue with service group 61 and 62 having two WCCP clients, using different return mechanisms?
7341#1 = Forwarded Return (Directly connected to router, L2)
7341#2 = GRE Negotiated Return (On Internal LAN, Routed)Just to clarify, both of these 7341 boxes will be in the same WCCP service groups. (61 LAN & 62 WAN). The "Return method" is GRE for both.
"However please note that the packet return method should be the same."
7341#1
wccp router-list 8 10.X.X.1 (Gi0/1 on router)
wccp tcp-promiscuous service-pair 61 62 failure-detection 30
wccp tcp-promiscuous service-pair 61 62 router-list-num 8
wccp version 2
7341#2
wccp router-list 1 10.X.X.129 (Loopback1 on same router)
wccp tcp-promiscuous service-pair 61 62 failure-detection 30
wccp tcp-promiscuous service-pair 61 62 router-list-num 1
wccp version 2
egress-method negotiated-return intercept-method wccp -
Using return method to do this assignment
Write a method to delete character in a string.
Example:
A call to deleteChar(?hello?, ?l?) will return heo
A call to deleteChar(?madam?, ?a?) will return mdm
I have tried to solve this problem using return method, but it doesn't work. Please help me do this exercise with return method in main method.
Here is my work, using void method in main method
private static void deleteChar(String input, String deletedChar) {
for (int i = 0; i < input.length(); i++) {
if (!(input.charAt(i) + "").equalsIgnoreCase(deletedChar)) {
System.out.print(input.charAt(i));
public static void main(String[] args) {
String input, deletedChar;
Scanner kb = new Scanner(System.in);
System.out.print("Enter a String: ");
input = kb.nextLine();
System.out.println("Enter a letter you want to delete from String: ");
deletedChar = kb.nextLine();
deleteChar(input, deletedChar);
}In your main method, you replace the line
deleteChar(input, deletedChar);by
String result = deleteChar(input, deletedChar); and the method by :
private static String deleteChar(String input, String deletedChar) {
return input.replaceAll(deletedChar, "");
} -
How does the return method work?
how does the return method work?
What do you mean by "return method"? Methods return a value (or void, but that's still a "value" of sorts).
Returning a Value from a Method
http://java.sun.com/docs/books/tutorial/java/javaOO/methoddecl.html -
WCCP src group & redirect/return method
Has anyone here implemented 3rd party WAN optimization such as Bluecoat or Riverbed w/ WCCP?
What service groups and redirect/return methods did you use, and on which Cisco switch/router platforms?
I'd like to know what works, and what doesn't...
It looks like you generally use service group 61 & 62 to redirect all TCP traffic to WAAS, based on source/destination IP's.
Do those two service groups also work w/ 3rd party devices?
If they don't, do I just pick some random service groups, other than the well known ones?
How would the switch/router know what traffic to redirect, if no redirect-list is used?
The Networkers' wccp presentation slides say if GRE is to be used w/ 6500's, generic GRE needs to be used instead of WCCP GRE.
Where would you configure what type of GRE is used, within WAAS?
Does anyone know if such setting exists on 3rd party devices?
Our Bluecoat SE isn't even aware of two different versions of GRE, and neither was I, before I watched the Networkers session.Hi,
I know with Riverbed you can use wccp 61/62 as well. I don't have experience with other vendors though.
The router knows what to redirect based on the WCCP service number. It can be a well-known service or a custom service where you define what to redirect directly on the optimizer/web-cache device. The redirect list is only used to further limit what is redirected.
In h/w forwarding platform WCCP GRE is handled in s/w, this is why using generic GRE is suggested. On WAAS you can configure it using "egress-method generic-gre intercept-method wccp"
For more details check the "Egress Method" section in the following doc:
http://www.cisco.com/en/US/prod/collateral/switches/ps5718/ps708/white_paper_c11-629052.html
Here you have WCCP redirection method supported and suggested for different Cisco platforms:
http://www.cisco.com/en/US/prod/collateral/contnetw/ps5680/ps6870/white_paper_c11-608042.html
hope this helps,
Fabrizio -
Maintain Structure Relations - LSMW - IDOC method
Hi,
Trying to use LSMW Idoc method to upload BP masters.
Have maintained the ports, partner types, message types etc. When I reach the "Maintain structure relationship" step, I have a very big tree structure under EDI_DC40 when am trying to maintain the structure relationship between the source and the target in LSMW idoc method.
Do I need to maintain my relationship at all the levels of the tree structure under EDI_DC40 or can I choose the nodes that are relevant and maintain a relationship only for them?
Is there a short cut or a way where I can maintain relationship for each node under the target strucute EDI_DC40.
Appreciate your inputs.
SKHi SK,
There is no need to maintain EDI_DC40.
In 'Maintain Structure Relations' step, you just need to create Relationship for the structure you want the information be uploaded in the BP. Mapping of the fields in the structure to your upload file's values will be done in next step. Hope the above helps -
Compiling errors and return methods
The error is invalid method declaration; return type required
public Term(double c, int d)
Thanks
public Term(double c, int d)
coeff = c;
degree = d;
Multiplies a term.
@param other the other term
@return the new term after mulitiplication
public Term multiply(Term other)
return new Term(coeff * other.coeff, degree + other.degree);
Adds a coefficient.
@param c the coefficient to add
public void add(double c)
coeff += c;
return c;
Gets the coefficient.
@return the coefficient
public double getCoeff()
return coeff;
Gets the degree.
@return the degree
public int getDegree()
return degree;
private double coeff;
private int degree;
}I bet this means your enclosing class isn't called Term
is there an enclosing class at all ? what are those two declarations at the end ? member variables ?
When posting code, take care that the curly braces match, please (ie dont post half blocks of code) -
Returning the result of method in return statement.
hi,
If I write the following line of code then will there be any problem or what issues will arise
return method(x,y);Is it a good programming practice, if not why?It's perfectly valid syntax. This is a stylistic concern. Opinions on style vary far and wide according to each programmer's bias, personality, past experience, and what they had for lunch that day.
Personally, I would be fine with return foo(); if:
- It were the only line in the methodO_o
Why would that matter?
- The name of foo made it reasonably clear what it was doingSounds good, but shouldn't all method have good names?
>
I would avoid it if:
- It was likely that the method calling foo would be frequently changed to expand its functionalityWhy does it matter?
- foo returned a type of variable that should be named as a local variable simply to improve readabilityDoesn't matter what I eat to lunch, I would never agree on that :) -
HU_CREATE_GOODS_MOVEMENT returned error structure question
Hello,
FM HU_CREATE_GOODS_MOVEMENT has two error structures that are returned:
ES_MESSAGE TYPE HUITEM_MESSAGES
ET_MESSAGES TYPE HUITEM_MESSAGES_T
In the development process, I'm forcing errors; some are returned in ES_MESSAGES, some are returned in ET_MESSAGES.
Does anyone know the purpose of the two error structures?
Is anyone aware of what errors go in which structure?
Thx.
Andy
PS
Points rewarded immediately.Hi,
I dont know the difference but found out some input for you through some german language translations. Hope it helps.
ES_MESSAGE - Error Encountered before material booking .
ET_MESSAGES - Error messages after the material Booking.
Regards,
Mayank -
Function Module to get all feild names in a structure
Hello Friends,
Is there a function module,where i give the structure name and get all the feild names within that structure.
regards
kaushikHi,
You can use the for run time type descriptor classes to do this :
Here is a simple example :
REPORT z_assign_comp.
TYPE-POOLS : slis.
include <icon>.
"& Dynamic Programming ! Using Structure Descriptior Class. *
DATA: BEGIN OF line OCCURS 0,
col1 TYPE i,
col2(10) TYPE c,
col3 TYPE i,
END OF line.
FIELD-SYMBOLS : <fs> TYPE ANY.
FIELD-SYMBOLS : <itab_line> TYPE ANY.
DATA : BEGIN OF t_comp OCCURS 0,
comp(5) TYPE c,
END OF t_comp.
DATA : l_struc TYPE REF TO cl_abap_structdescr.
DATA : l_typedesc TYPE REF TO cl_abap_typedescr.
DATA : lt_comp TYPE abap_compdescr_tab,
w_comp LIKE LINE OF lt_comp.
line-col1 = 11.line-col2 = 'SAP'.line-col3 = 33.
APPEND line.
line-col1 = 44.line-col2 = 'P.I.'.line-col3 = 66.
APPEND line.
ASSIGN line TO <itab_line>.
"Call the static method of the structure descriptor describe_by_data
CALL METHOD cl_abap_structdescr=>describe_by_data
EXPORTING
p_data = <itab_line>
RECEIVING
p_descr_ref = l_typedesc.
"The method returns a reference of a type descriptor class therefore we
"need to Cast the type descriptor to a more specific class i.e
"Structure Descriptor.
l_struc ?= l_typedesc.
"Use the Attribute COMPONENTS of the structure Descriptor class to get
"the field names of the structure
lt_comp = l_struc->components.
LOOP AT line.
WRITE :/ 'Row : ', sy-tabix.
LOOP AT lt_comp INTO w_comp.
" Using the ASSIGN component ,assigns a data object to a field symbol.
ASSIGN COMPONENT w_comp-name OF STRUCTURE line TO <fs>.
WRITE :/ w_comp-name, ' ', <fs>.
ENDLOOP.
ENDLOOP.
Hope this helps.
regards,
Advait -
Wsdlc with jaxws - missing method on bean
One, at least, of the POJOs created by "wsdlc" for JAX-WS is missing a "setter" method. The "getter" exists. The corresponding "setter" is missing.
I generated a Web Service from a WSDL file using "wsdlc". I generated the JAX-RPC and JAX-WS Web Service. I compared one of the POJOs. The JAX-RPC version has the correct "getter" and corresponding "setter" methods. The JAX-WS version is missing a "setter". The code below is missing: setResponseStatusMessage.
Is there a bug in "wsdlc" related to generics?
package com.company.xml.location.v1.types.intf;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
* Common structure used to return the overall status of a request and an optional array of error, warning or informational messages
* <p>Java class for ResponseStatusType complex type.
* <p>The following schema fragment specifies the expected content contained within this class.
* <pre>
* <complexType name="ResponseStatusType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="returnCode" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="responseStatusMessage" type="{http://xml.company.com/location/v1/types/intf}ResponseStatusMessageType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponseStatusType", propOrder = {
"returnCode",
"responseStatusMessage"
public class ResponseStatusType {
protected int returnCode;
protected List<ResponseStatusMessageType> responseStatusMessage;
* Gets the value of the returnCode property.
public int getReturnCode() {
return returnCode;
* Sets the value of the returnCode property.
public void setReturnCode(int value) {
this.returnCode = value;
* Gets the value of the responseStatusMessage property.
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the responseStatusMessage property.
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getResponseStatusMessage().add(newItem);
* </pre>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ResponseStatusMessageType }
public List<ResponseStatusMessageType> getResponseStatusMessage() {
if (responseStatusMessage == null) {
responseStatusMessage = new ArrayList<ResponseStatusMessageType>();
return this.responseStatusMessage;
}1) Put an "action" in your form tag. The action should be either
a JSP or a servlet. e.g. <FORM name="createPerson" action="/servlet/process" method="post">2) If you use a JSP for processing then move your <jsp:useBean>
tag to the processing JSP. If you use a servlet then import the bean
class and instantiate the class.
import com.oxbow.*;
PersonBean person = new PersonBean();3) Get the parameters passed:
String firstName = request.getParameter(firstName);
String lastName = request.getParameter(lastName);Be sure to check for nulls and blanks.
4) call your create method
person.create(lastName,firstName); -
Export field symbol table out of method
Hi,
i have a report, that takes any xml and converts it into a table structure. In a method I generate the table structure using method cl_alv_table_create=>create_dynamic_table. Later in the same method I have filled the content of the XML file into a table typed as: FIELD-SYMBOLS: <outtab> type standard table
Now I need to export this <outtab> out of my method. Because it is a unspecific field symbol table, I can not do this, by normal exporting.
In the PAI, where my method is called, I have deffined the table to return into as:
FIELD-SYMBOLS: <itab_message> type standard table.
Any help will be greatly appreciated.
Kind regards
MikkelHi,
Please check this:
REPORT zmaschl_create_data_dynamic .
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SYST'
CHANGING
ct_fieldcat = it_fcat[].
LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
MOVE-CORRESPONDING is_fcat TO is_fieldcat.
is_fieldcat-fieldname = is_fcat-fieldname.
is_fieldcat-ref_field = is_fcat-fieldname.
is_fieldcat-ref_table = is_fcat-ref_tabname.
APPEND is_fieldcat TO it_fieldcat.
ENDLOOP.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP.
Regards,
Shiva Kumar -
hai all,
iam new to webdynpro abap as well as for OOPS.here iam working on PDO layer.I have already Identified the req.d Structures in which fields are used to O/P display.and for the SRM 5.0 screens in Monitor shopping Cart , I have to identify the Search aswellas Update_messages methods.could you please suggest me how can i identify the req.d methods. iam doing version upgradation of SrM 5.0 to SRM 6.0 please help megetDeclaredMethods() - I believe this might do what you want. It throws a SecurityException, but I'm not sure exactly under what circumstances! Oh, and it doesn't return methods defined on any superclasses.
Maybe you are looking for
-
Admin server running into issues in SOA.
Hi All, Can anyone help me. I have recently installed Oracle SOA suite on Linux box. While I was running the Admin Server I am running into Some issues. Though Admin Server is running fine but all that I am running out of memory because of the Logs.
-
No DSL, No Repair Techs, No Customer Service
I'm fed up. I feel like I'm being scammed and all I can do is sit here and take it. My DSL has been going out every single day, multiple times, for weeks. Resetting the modem sometimes helps, more often not. When the internet does come back on, 75% o
-
CM25 : automatic dispatching outside basic dated
Dear. When I try to do an automatic dispatch of a production order I need that the po can be dispatched forward outside the basic date. Actually in my settings the automatic dispatching is executed only inside the basic date. Only with a manual drag
-
Troubles with iPhoto 11 Upgrade.
I have recently upgraded to iphoto 11 and the install went great, but now it is common for it to crash during import and when working on photos. What gives? I never had this problem before. Also the crop tool is odd when pic is vertical and I want
-
This topic has been brought up before but I have not found a solution to my problem. Mail does NOT save my account passwords (POP or SMTP), which I have to input every time I launch the application. Here are the details: PowerPC G4 733 MHz OS X 10.3.