Skip to Content
Author's profile photo Former Member

Upload Return from csv file in C&R Application

     The Dealers use the C&R application to place their returns online. The normal process is the dealer to select the return type, enter a product number and quantity for return for each item.  As the return which the dealer wants to enter manually can also be pretty big (>50 items) we shall give him the option to enter such data into a Excel spread sheet upfront, create a CSV-file out of it and upload the same in return screen. Here we shall see how to implement the solution in C& R  application.

The logical flow for the implementation is as follows

CSV file upload.gif


Steps for the above implementation


1) Add a upload button in the Create new return screen.

2) On click of the button call the action class and redirect to the newly created action class. the newly created action class will read the csv file and load the values in the return document

3) The code to add the line item to return document is as follows


ComplaintData complaint = (ComplaintData)getComplaintFromDocHandler(userSessionData, complaintBom);

The above code will get the Return document from the Document Handler (the class is common for both Complaint & Return)

Once the instance for return is instantiated we can use the same for manipulating the document. Here is a snippet for  adding the line item to return document.


The below loop will run for number of line items


while ((lineItem = br.readLine()) != null) {

  if(lineItem.contains(“;”))

  {

  String item[] = lineItem.split(“;”);

  if(item.length==2)

  {

  ComplaintItemData complaintItem = (ComplaintItemData)complaint.createItemBase();

  complaintItem.setProduct(item[0]);

  complaintItem.setQuantity(item[1]);

  complaint.addItem(complaintItem);

  }

}



Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.