Move jsp code into servlet, not work!!
Hi:
I am new in servlet and java, I can use jdom to read xml file
into a jsp file, but whan I move jsp code into servlet, they are not work
have any ideals?
Thank!
Hi:
my.jsp
<%@ page contentType="text/html"%>
<%@ page import="java.io.File,
java.util.*,
org.jdom.*,
org.jdom.input.SAXBuilder,
org.jdom.output.*" %>
<%
String Records = "c:/XMl/Quotes.xml";
SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
Document l_doc = builder.build(new File(Records));
my servlet
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.input.SAXBuilder;
import org.jdom.output.*;
public class XmlJdom extends HttpServlet
String Records = "c:/xml/Quotes.xml";
SAXBuilder builder = null;
Element Author = null;
Element Text = null;
Element Date = null;
* Initializes the servlet.
public void init(ServletConfig config) throws ServletException
super.init(config); //pass ServletConfig to parent
try
// JDOM can build JDOM trees from a variety of input sources. One
// of those input sources is a SAX parser.
SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
catch ( org.jdom.JDOMEXception e)
public void doGet(
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
PrintWriter out = null;
out = response.getWriter();
try{
Document l_doc = builder.build(new File(Records));
Element root = l_doc.getRootElement();
//get a list of all recode in my XML document
String l_pages = root.getChild("quote");
String Iterator e = l_pages.iterator();
while ( e.hasNext())
Element l_quote= (Element) e.next();
Element l_Author = l_quote.getChild("Date").getChild("Text");
XMLOutputter l_format = new XMLOutputter();
String ls_result = l_format.outputString(l_doc);
out.println(ls_result);
catch( org.jdom.JDOMException e )
finally
if( out != null)
out.close();
Please tell me, what is wrong!!!
Element root = l_doc.getRootElement();
/* get a list of all the links in our XML document */
List l_pages = root.getChildren("quote");
Iterator Myloop = l_pages.iterator();
while ( Myloop.hasNext())
Element l_quote= (Element) Myloop.next();
Element l_Author = l_quote.getChild("Date").getChild("Text");
XMLOutputter l_format = new XMLOutputter();
String ls_result = l_format.outputString(l_doc);
ls_result = l_format.outputString(l_doc);
%>
<html><head><title></title></head>
<body>
<pre>
<%=ls_result%>
</pre>
</body>
</html>
Similar Messages
-
JSP Code completion DOES NOT WORK in JDev 9.0.3.1
Does anyone know when the next release of JDev will be? We are seriously considering dropping the use of JDev due to the bugs it has. In particular, the code completion for JSP authoring simply FAILS! This is a very very VERY nasty bug, and we are pleading!!!
Thanks,
-SeanWorks for me.
What OS/JDK etc are you using? -
Help and support sends you in circles and does not help redeem a card with a code that does not work.
Well, they have a website, but here is a link to their information about unlocking iPhones.
http://www.att.com/esupport/article.jsp?sid=KB414532&cv=820#fbid=6d7EKuCF_dr
You may not qualify for an unlock though. -
The code insight does not work for me. I followed the advice of Steve Muench given here:
http://radio.weblogs.com/0118231/stories/2003/01/17/whyIsntMyCodeInsightWorking.html
but that did not change the problem. The problem seems to be related to new java 1.5 features. As soon as I start using generics the code insight is lost...
Any clues what is going on? I s this easy to fix?
-- example: (NOTE that iI use double (( )) to indicate generics definitions. the forum software would not let me put in the correct syntax!)
package mypackage;
import java.util.Set;
public class tester1
private Set ((Integer)) intSet = null;
public tester1()
intSet. ---- NO CODE INSIGHT POPS UP! (if i change to "private Set intSet = null;" it works)
public static void main(String[] args)
new tester1();
P.S.
Also, i noticed that the auto-import ist not working for the "Set((Integer))" line!
Message was edited by:
user444936thanks for the info.
Hmm - too bad. I may have to switch to eclipse or something then, since my project involves some 1.5 parts and the missing code insights and import features are a real pain for me.
Cheers,
Jochen -
SAP Inbox t code sbwp is not working properly
Hi,
In our SAP server the SAP mail box t code SBWP is not working at a particular time between 11 AM to 12 AM. If we send internal mails between SAP users in t code SBWP we are able to receive all the time but at a particular time of 11 AM to 12 AM we are not able to receive any mail.
If we send any mail at that particular time after 11 AM we are receiving it only after 12 AM, but this error we are not facing expect that particular time.
I have checked whether any backgroung work process is Active at that time but all the BG work process are free at that time
please help me how to solve this issue.
Thanks
Senthilhi
check out this sap note
1348288 Delayed delivery of documents in SBWP -
Code completion particular not working
Hello,
in my program there are serveral internal classes. Each class has its own include file. Code completion seems not working for internal classes in other include files.
example:
lcl_class1 in includec01 (first included)
class-methods static1_1
methods method1_1
lcl_class2 in includec02 (second included)
class-methods static1_1
methods method1_1
problem:
While development in lcl_class2 there are no code completion for lcl_class1.
No code completation for lcl_class1=>static1_1
but if you declarate "data lo_myclass type ref to lcl_class1." code completion is working fine for public member methods and attributes in the same file.
In Functiongroups all working fine.
Best Regards
Markus Bauernschmitt
Und da hier eh die meisten deutschsprachig sind und mein Englisch grausam ist, nachfolgend die Erklärung nochmal auf deutsch.... ;-)
In meinen Programmen findet die Codevervollständigung keine interne Klassen aus vorangegangenen include Dateien. Dadurch werden weder die Klassen selbst noch die statischen Methoden angezeigt. Gebe ich eine statische Methode ein und möchte die Hilfe anzeigen (F2) erscheint die Fehlermeldung "Codeinformationen sind nicht verfügbar".
Dieses Problem tritt nicht auf, falls die Deklaration einer Variablen in der gleichen Include Datei erfolgt.
Deklaration einer Variablen in der aktuellen Include Datei -> Dokumentation der öffentlichen (nicht statische) Methoden und Attribute funktioniert
Zugriff auf öffentliche (statische oder nicht statische) Methoden und Attribute von globalen Variablen (deklariert in einer anderen Datei) funktioniert dagegen nicht.
Es sind nur anscheinend nur Programme betroffen. Bei Funktionsgruppen (getestet am Beispiel "ldemo_cr_car_rental_screen") trat der Fehler nicht auf.Hi Dominik,
thank you for your answer. The internal classes are already simple and lightweight. In my understanding of OO I keep classes private as possible and so I create this specific "one program helper classes" in the smallest reasonable scope.
However, this is a architektur decission. But the pivotal question is: Why working this kind of code completion in function groups but not in programs.
Some additional information.
- Code completion working in "START-OF-SELECTION."
- In Functiongroup includes (Testcase lcl_class1 show as public type and lcl_class2 show as local public class.
Best regards
Markus -
Content aware move tool and recompose do not work.
Content aware move tool and recompose do not work. Nothing happens...What can I possible do wrong?
There is not Content Aware Move or Recompose tool in Premiere Elements.
Have you tried taking this question to the Photoshop Elements forum, Dion? -
Code completion does not work with table alias
Hi all,
When i use SQL developer to create a simple query like below i alias my tables so i can oversee it better.
select
* from PRODUCTS p
inner join PRODUCT_TYPES pt on PRODUCT_TYPES.PRODUCT_TYPE_ID = p.But when i give the driving table a alias like p and i try to do a join like you see in the code SQL developer will not show the columns from table PRODUCTS.
What do i wrong or is this a bug?
Thanks in advance,
DanielHi,
Sue, there are lots of code completion don't work either.
Some of them are :
1. The code completion seems not working if we put double-quote ("") to enclosed the object name.
SELECT t. -- CTRL+Space the code completion won't work here
FROM MYSCHEMA."MYTABLE" t 2. The code completion also not working if we state some characters of the column name, although it still works for the uncomplete object name
i.e the name of the column is : MYFIELD
SELECT t.MY -- CTRL+Space, the code completion won't work here
FROM MYSCHEMA.MYTABLE t 3. Sometimes, I can see two code completion lists when I use CTRL + Space
Usually, it happens on the first connection's SQL Worksheet, the second and so forth are fine.
SELECT t. -- CTRL+Space, shows two lists which I can choose both of them
FROM MyTable t4. Code completion also not working when we try to access object from other schema. tbeech post it on
Re: Code Assist -- Table Alias
Are those code completion bugs are also logged?
Regards,
Buntoro -
Why does a movie I bought on iTunes not work without internet?
Why does a movie I bought on iTunes not work without internet?
As long as the film has been fully downloaded (or synced from your computer's iTunes) then you should be able to watch it in the iPad's Videos app without needing to be online - is that how you are trying to view it ?
-
JSP/Servlets not working after upload
I have a JSP file and some servlets that work fine on my PC running Tomcat.
I just uploaded them to my web server (which supports servlets/jsp and has apache web server running), but they do not work. The jsp file does not run, it just displays the source code.
Strangely, the support people at my server say the jsp files run ok when they view them. But when I view them from my browser it just shows source code.
Do I need to configure something in my program? Or is it a server problem?Very hard to help without seeing the page - the answer is in the code :-)
Can you please point a link to your page?
Are you sure you uploaded all the image files, and that the paths to the images are all correct?
Nadia
Adobe® Community Expert : Dreamweaver
http://www.perrelink.com.au
Unique CSS Templates |Tutorials |SEO Articles
http://www.DreamweaverResources.com
http://csstemplates.com.au/
http://twitter.com/nadiap -
Using JavaBean with JSP...will not work no matter what
Hi guys. Sorry that this is such a common, newb question, but I don't know where else to turn.
I'm new to web application development, Tomcat, and JSP. I'm trying to use a simple JavaBean in a JSP to store some user information. The JSP is located in $CATALINA_HOME\webapps\art , and the UserBean I'm trying to use is in $CATALINA_HOME\webapps\art\WEB-INF\classes . I've tried adding a context in the Tomcat server.xml file, but nothing seems to work, even putting the .class file into the \art directory along with the JSP. The error I get is the following:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /welcome.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\art\welcome_jsp.java:43: cannot resolve symbol
symbol : class UserBean
location: class org.apache.jsp.welcome_jsp
UserBean user = null;
^
The source code is:
welcome.jsp
<%@ page import="java.sql.*" %>
<jsp:useBean id="user" class="UserBean" scope="session"/>
<html>
<head>
<title>Art Webapp Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<h1>Art Site</h1><br><br>
<h3>Welcome Page</h3><br><br>
<%
user.setUsername("joe");
user.setTitle("admin");
%>
</body>
</html>
UserBean:
public class UserBean {
private String username = null;
private String title = null;
public UserBean()
this.username = null;
this.title = null;
public String getUsername()
return this.username;
public String getTitle()
return this.title;
public void setUsername(String inName)
this.username = inName;
public void setTitle(String inTitle)
this.title = inTitle;
}//UserBean
Thanks for any and all help anyone could give me about this. It seems such a simple thing, to get a JavaBean working in a JSP...and it's very frustrating to have it NOT work when it seems I've done everything possible to get it to.Ok, I figured out what the problem was. My Bean was not a part of any specific package. It was never made clear to me that Beans are required to be a part of some package...I had no idea (though they always put them in packages in the tutorials, you think I would have picked up on it!).
So I just added the following line to the Bean:
package com.art;
Then compiled it and copied the .class file to CATALINA_HOME\webapps\art\WEB-INF\classes\com\art
Ta-da
Thanks for the help and sorry for taking up space on this board.
-Matt -
Frame access from servlet not working
Dear all,
I am running my servlets on Tomcat 5.5 and using JDK 1.6. I have a small program that uses codecs to access frames from a video file. PreAccessCodec implements Codec interface and PostAccessCodec extends PreAccessCodec. I set the two codecs into the processor's codec chain. The program is implemented as a thread and once started grabs frames and stores the images in a certain interval. The problem is this: whenever I start the thread from a main program, everything runs without a glitch. However, when I put the code in init() method of the servlet, I get the following error message:
The input format is not compatible with the given codec plugin: com.mapper.utils.PostAccessCodec@69d02b
Failed to realize: com.sun.media.ProcessEngine@1478a43
Cannot build a flow graph with the customized options:
Unable to add customed codecs:
com.mapper.utils.PreAccessCodec@15356d5
com.mapper.utils.PostAccessCodec@69d02b
Error: Unable to realize com.sun.media.ProcessEngine@1478a43 I am using netbeans 5.5.1 to deploy my servlets. I doubt that the problem is with classpaths because the servlet doesn't complain when I am using JMF's classes like Processor.
I would really appreciate any help.
Thank you.
Message was edited by:
calculemusThe GE.iH() method should return false for
a ..head-full ..en-headed, not headless
environment, and I expect (from what you
reported above) that will return false for both
your servlet and application, and is apparently
not the problem.It returned false when I tried GE, and it was not the problem as you suggested. However, I now noticed in the logs:
java.awt.HeadlessException
I use Netbeans for the development, and I tried using -Dheadless=true and -Dheadless=false, it did not change anything...
I think it is time to check that assumption
more carefully.
My impression is that PreAccessCodec and
it's 'Post' equivalent are mentioned a lot in JMF
example code, but are custom classes,
built to suit the use at the time. Did you write the
Pre/PostAccessCodecs for this app.?Yes I customized them from the JMF sample codes. They are in the classpaths and are correctly read by the servlet. I did some logging and I actually saw that the code inside Pre/PostAccess was logging when my servlet was run.
>
So, what I am thinking, is that while the JMF
based Processor class may well be on the
server's
classpath, perhaps Pre/PostAccessCodec classes
are not.
oes a jar appear in the WEB-INF/lib directory,
that contains the Pre/PostAccessCodec.class?
Failing that, are the classes themselves in
WEB-INF/classes/(sub-dir according to package name)/ ?Nevertheless, just to double check I checked WEB-INF directory and the classes appear correctly in their appropriate 'package-folders'.
I figured out where exactly the thread was not running. In my PostAccessCodec class, I had overloaded getSupportedInputFormats() function to return RGB format.
public Format [] getSupportedInputFormats() {
Format [] fomats = {new RGBFormat()};
return fomrats;
When I changed it to return {VideoFormat()}, the codec initializes, but I get nothing when I want to access the frame.
I guess I will have to start another thread.
@moderators, please move the post if it is inappropriate to put it in this thread, my apologies.
The problem is still there and I am not able to get the frame access not working from the servlet. :(
Message was edited by:
calculemus
Message was edited by:
calculemus -
Hi ALL i have a BDC code it is not working properly
this BDC code is not working properly , when ever the file is transfering BDC is aborting in the case of invalid material/batch comes into teh picture... so please could you ''Check for invalid material/batch combinations so they are not processed by the BDC in the program and correctly output in an exception report''
*****************************CODE HERE*****************************
S E L E C T I O N S C R E E N
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_file LIKE rlgrap-filename,
p_arch LIKE rlgrap-filename. "RM080107
SELECTION-SCREEN SKIP.
PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N'.
SELECTION-SCREEN END OF BLOCK b1.
I N C L U D E S
INCLUDE zwm_np_stock_recon_top.
INCLUDE zwm_np_stock_recon_f01.
I N I T I A L I Z A T I O N
INITIALIZATION.
PERFORM get_interface_filename USING c_interface_file p_file.
PERFORM get_interface_filename USING c_archive_file p_arch."RM080107
S T A R T O F S E L E C T I O N
START-OF-SELECTION.
PERFORM read_file USING p_file.
PERFORM pre_processing.
E N D O F S E L E C T I O N
END-OF-SELECTION.
PERFORM process_checks.
IF w_no_change = 'X'.
WRITE: / text-b03.
WRITE: / sy-uline(34).
ELSE.
PERFORM bdc_mi09.
PERFORM file_check_report.
PERFORM bdc_report.
ENDIF.
PERFORM post_process_checks.
*-- Move the processed file to archive directory
PERFORM move_file.
...*************.........first include...................************
INCLUDE ZWM_NP_STOCK_RECON_TOP *
Data declaration ----------------------------------------------
TYPES: st_rawdata(2000) TYPE c.
TYPES: BEGIN OF st_stck_cnt,
werks TYPE iseg-werks, "plant
lgort TYPE iseg-lgort, "storage location
matnr TYPE iseg-matnr, "material number
charg TYPE iseg-charg, "batch
vfdat TYPE mch1-vfdat, "Sell by date
lwedt TYPE mch1-lwedt, "Manufacture date
quarn(8) TYPE n, "qaunrantine quantity
menge(8) TYPE n, "quantity on hand
message(1), "Message Type (E/W/I)
msg_txt TYPE t100-text, "Message Text
zerostck(1), "Zero stock identifier "RM220307
END OF st_stck_cnt.
TYPES: BEGIN OF st_batch_errors,
matnr TYPE iseg-matnr, "material number
charg TYPE iseg-charg, "batch
clabs TYPE mchb-clabs, "Stock Balance
END OF st_batch_errors.
DATA:
t_rawdata TYPE TABLE OF st_rawdata,
w_rawdata TYPE st_rawdata,
t_stck_cnt TYPE TABLE OF st_stck_cnt,
d_stck_cnt TYPE TABLE OF st_stck_cnt, "RM191006
w_stck_cnt TYPE st_stck_cnt,
t_batch_errors TYPE TABLE OF st_batch_errors,
w_batch_errors TYPE st_batch_errors,
t_messtab LIKE bdcmsgcoll OCCURS 0,
w_messtab LIKE LINE OF t_messtab,
w_no_change.
CONSTANTS: c_interface_file(26) TYPE c VALUE 'ZNP_STOCK_RECON',
c_archive_file(26) TYPE c
VALUE 'ZNP_STOCK_RECON_ARCHIVE'. "RM080107
.*************................second include..........************
***INCLUDE ZWM_NEXTPHARMA_STOKRECON_F01 .
*& Form read_file
reads NextPharma file sent through via webmethods
-->P_FILENAME
FORM read_file USING p_filename.
CLEAR: t_rawdata,
w_rawdata.
REFRESH: t_rawdata.
OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
IF sy-subrc <> 0.
MESSAGE e720(01).
ENDIF.
DO.
READ DATASET p_filename INTO w_rawdata.
IF sy-subrc <> 0.
EXIT.
ELSE.
APPEND w_rawdata TO t_rawdata.
ENDIF.
ENDDO.
CLOSE DATASET p_filename.
ENDFORM. " read_file
*& Form pre_processing
Read file values into internal table
FORM pre_processing.
DATA: lw_matnr TYPE iseg-matnr.
LOOP AT t_rawdata INTO w_rawdata.
lw_matnr = w_rawdata+21(20). "RM031006
lw_matnr = w_rawdata+22(18). "RM031006
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lw_matnr
IMPORTING
output = lw_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
MOVE: lw_matnr TO w_stck_cnt-matnr.
w_stck_cnt-werks = w_rawdata+14(4).
w_stck_cnt-lgort = w_rawdata+18(4).
w_stck_cnt-charg = w_rawdata+84(25).
w_stck_cnt-vfdat = w_rawdata+109(8).
w_stck_cnt-lwedt = w_rawdata+117(8).
w_stck_cnt-quarn = w_rawdata+141(8).
w_stck_cnt-menge = w_rawdata+125(8).
APPEND w_stck_cnt TO t_stck_cnt.
CLEAR w_stck_cnt.
ENDLOOP.
SORT t_stck_cnt BY werks
lgort
matnr
charg.
DELETE ADJACENT DUPLICATES FROM t_stck_cnt.
ENDFORM. " pre_processing
*& Form bdc_mi09
Run file data via BDC TCODE: MI09
FORM bdc_mi09.
DATA: t_bdcdata TYPE TABLE OF bdcdata,
w_bdcdata TYPE bdcdata,
lw_datum(10) TYPE c,
lw_count(2) TYPE n.
WRITE sy-datum TO lw_datum DD/MM/YYYY.
Front Screen
CLEAR w_bdcdata.
w_bdcdata-program = 'SAPMM07I'.
w_bdcdata-dynpro = '0700'.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO t_bdcdata.
Enter
CLEAR w_bdcdata.
w_bdcdata-fnam = 'BDC_OKCODE'.
w_bdcdata-fval = '/00'.
APPEND w_bdcdata TO t_bdcdata.
Count Date
CLEAR w_bdcdata.
w_bdcdata-fnam = 'RM07I-ZLDAT'.
w_bdcdata-fval = lw_datum.
APPEND w_bdcdata TO t_bdcdata.
Document Date
CLEAR w_bdcdata.
w_bdcdata-fnam = 'RM07I-BLDAT'.
w_bdcdata-fval = lw_datum.
APPEND w_bdcdata TO t_bdcdata.
Plant
CLEAR w_bdcdata.
w_bdcdata-fnam = 'IKPF-WERKS'.
w_bdcdata-fval = w_stck_cnt-werks.
APPEND w_bdcdata TO t_bdcdata.
Storage Location
CLEAR w_bdcdata.
w_bdcdata-fnam = 'IKPF-LGORT'.
w_bdcdata-fval = w_stck_cnt-lgort.
APPEND w_bdcdata TO t_bdcdata.
LOOP AT t_stck_cnt INTO w_stck_cnt.
Do not submit items with Errors against them
CHECK w_stck_cnt-message NE 'E' AND
w_stck_cnt-zerostck NE 'X'.
"RM220307
lw_count = lw_count + 1.
Input Screen
CLEAR w_bdcdata.
w_bdcdata-program = 'SAPMM07I'.
w_bdcdata-dynpro = '0731'.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO t_bdcdata.
Page Down
CLEAR w_bdcdata.
w_bdcdata-fnam = 'BDC_OKCODE'.
w_bdcdata-fval = '=P+'.
APPEND w_bdcdata TO t_bdcdata.
Material
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-MATNR(01)'.
w_bdcdata-fval = w_stck_cnt-matnr.
APPEND w_bdcdata TO t_bdcdata.
Batch
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-CHARG(01)'.
w_bdcdata-fval = w_stck_cnt-charg.
APPEND w_bdcdata TO t_bdcdata.
IF w_stck_cnt-menge NE 0.
Quantity
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-ERFMG(01)'.
w_bdcdata-fval = w_stck_cnt-menge.
APPEND w_bdcdata TO t_bdcdata.
*-- Begin RM220307 - We need to create an item when the quantity is zero
*-- in file and is non-zero in SAP
ELSE.
Zero Stock indicator
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-XNULL(01)'.
w_bdcdata-fval = 'X'.
APPEND w_bdcdata TO t_bdcdata.
*-- End RM220307
ENDIF.
ENDLOOP.
CHECK lw_count NE 0.
After all line items have been input
Final Screen
CLEAR w_bdcdata.
w_bdcdata-program = 'SAPMM07I'.
w_bdcdata-dynpro = '0731'.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO t_bdcdata.
Save Document
CLEAR w_bdcdata.
w_bdcdata-fnam = 'BDC_OKCODE'.
w_bdcdata-fval = '=BU'.
APPEND w_bdcdata TO t_bdcdata.
CALL TRANSACTION 'MI09' USING t_bdcdata
MODE p_mode
MESSAGES INTO t_messtab.
ENDFORM. " bdc_mi09
*& Form bdc_report
Write BDC Messages.
FORM bdc_report.
DATA: lw_text TYPE t100-text.
SKIP.
WRITE: / text-b01.
WRITE: / sy-uline(21).
SKIP.
Write BDC Messages
LOOP AT t_messtab INTO w_messtab WHERE msgspra = sy-langu.
MESSAGE ID w_messtab-msgid TYPE w_messtab-msgtyp
NUMBER w_messtab-msgnr
WITH w_messtab-msgv1
w_messtab-msgv2
w_messtab-msgv3
w_messtab-msgv4
INTO lw_text.
WRITE: / lw_text.
ENDLOOP.
ENDFORM. " bdc_report
*& Form process_checks
Perform process check before creating BDC Session
FORM process_checks.
DATA: lw_clabs LIKE mchb-clabs,
lw_menge LIKE mchb-clabs,
lw_matnr LIKE mara-matnr,
lw_charg LIKE mch1-charg,
lw_fail,
lw_vfdat TYPE mch1-vfdat,
lv_sell TYPE c, "RM191006
lv_qty(8) TYPE c. "RM191006
CLEAR: d_stck_cnt[], d_stck_cnt. "RM191006
Check if any of the stock figures differ from current stock figures
LOOP AT t_stck_cnt INTO w_stck_cnt.
lw_menge = w_stck_cnt-menge.
SELECT SINGLE clabs INTO lw_clabs
FROM mchb
WHERE matnr = w_stck_cnt-matnr
AND werks = w_stck_cnt-werks
AND lgort = w_stck_cnt-lgort
AND charg = w_stck_cnt-charg.
IF sy-subrc = 0.
IF lw_clabs NE lw_menge.
lw_fail = 'X'.
*-- Begin RM220307 - Do not create PI item if the stock is zero in the
*-- file and is zero in SAP
EXIT.
ELSEIF lw_clabs = 0 AND lw_menge = 0.
w_stck_cnt-zerostck = 'X'.
MODIFY t_stck_cnt FROM w_stck_cnt.
ENDIF.
*-- End RM220307
ELSE.
lw_fail = 'X'.
ERROR
ENDIF.
ENDLOOP.
If no differences are found set NO CHANGE Flag
IF lw_fail NE 'X'.
w_no_change = 'X'.
EXIT.
ENDIF.
Check for Errors in file data
LOOP AT t_stck_cnt INTO w_stck_cnt.
CLEAR lv_sell. "RM191006
SELECT SINGLE matnr INTO lw_matnr
FROM mara
WHERE matnr = w_stck_cnt-matnr.
IF sy-subrc NE 0.
Invalid Material (E)
w_stck_cnt-message = 'E'.
w_stck_cnt-msg_txt = 'Invalid Material'.
MODIFY t_stck_cnt FROM w_stck_cnt.
CONTINUE.
ENDIF.
SELECT SINGLE charg vfdat
INTO (lw_charg, lw_vfdat)
FROM mch1 "KOB01 - changed from MCHA
WHERE matnr = w_stck_cnt-matnr
AND charg = w_stck_cnt-charg.
AND werks = w_stck_cnt-werks.
IF sy-subrc NE 0.
Invalid Material Batch (E)
w_stck_cnt-message = 'E'.
CONCATENATE 'Invalid Material Batch for plant' w_stck_cnt-werks
INTO w_stck_cnt-msg_txt SEPARATED BY space.
MODIFY t_stck_cnt FROM w_stck_cnt.
CONTINUE.
ELSE.
IF w_stck_cnt-vfdat <> lw_vfdat.
Sell by dates do not match (W)
w_stck_cnt-message = 'W'.
w_stck_cnt-msg_txt =
'Sell by Date does not match Shelf life Expiry Date'.
MODIFY t_stck_cnt FROM w_stck_cnt.
lv_sell = 'X'. "RM191006
CONTINUE. "RM191006
ENDIF.
ENDIF.
IF w_stck_cnt-quarn > 0.
Quarantine balance not Zero (W)
w_stck_cnt-message = 'W'.
*-- Begin RM191006
*-- We do want all warning messages on the report
lv_qty = w_stck_cnt-quarn.
CONDENSE lv_qty NO-GAPS.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = lv_qty
IMPORTING
output = lv_qty.
w_stck_cnt-msg_txt = 'Quarantine balance is not zero'.
CONCATENATE 'Quarantine balance is ' lv_qty '- not zero'
INTO w_stck_cnt-msg_txt SEPARATED BY space.
MODIFY t_stck_cnt FROM w_stck_cnt.
CONTINUE.
IF lv_sell = 'X'.
APPEND w_stck_cnt TO d_stck_cnt.
CLEAR lv_sell.
ELSE.
MODIFY t_stck_cnt FROM w_stck_cnt.
ENDIF.
*-- End RM191006
ENDIF.
ENDLOOP.
*-- Begin RM191006
*-- Finally get all the records into dummy table to report
APPEND LINES OF t_stck_cnt TO d_stck_cnt.
SORT d_stck_cnt.
DELETE ADJACENT DUPLICATES FROM d_stck_cnt.
*-- End RM191006
ENDFORM. " process_checks
*& Form file_check_report
Write warning and Error messages from File checks
FORM file_check_report.
WRITE: /2 'Material',
22 'Batch',
32 'Sell By',
45 'Message Text'.
WRITE: /2 sy-uline(115).
SKIP.
LOOP AT t_stck_cnt INTO w_stck_cnt. "RM191006
LOOP AT d_stck_cnt INTO w_stck_cnt. "RM191006
CHECK w_stck_cnt-message NE ' '.
WRITE: /2 w_stck_cnt-matnr,
22 w_stck_cnt-charg,
32 w_stck_cnt-vfdat,
43 w_stck_cnt-message,
45 w_stck_cnt-msg_txt.
ENDLOOP.
ENDFORM. " file_check_report
*& Form post_process_checks
Check Material Batches in SAP against NP File
FORM post_process_checks.
RANGES: r_matnr FOR mchb-matnr,
r_lgort FOR mchb-lgort,
r_werks FOR mchb-werks.
SORT t_stck_cnt.
LOOP AT t_stck_cnt INTO w_stck_cnt.
AT END OF matnr.
r_lgort-sign = 'I'.
r_lgort-option = 'EQ'.
r_lgort-low = w_stck_cnt-lgort.
APPEND r_lgort.
r_werks-sign = 'I'.
r_werks-option = 'EQ'.
r_werks-low = w_stck_cnt-werks.
APPEND r_werks.
r_matnr-sign = 'I'.
r_matnr-option = 'EQ'.
r_matnr-low = w_stck_cnt-matnr.
APPEND r_matnr.
ENDAT.
ENDLOOP.
Select all material batches for NP Materials
SELECT matnr charg clabs
INTO TABLE t_batch_errors
FROM mchb
WHERE werks IN r_werks
AND lgort IN r_lgort.
IF sy-subrc EQ 0.
Check if the Material Batches are in the NP file
LOOP AT t_batch_errors INTO w_batch_errors.
Disregard Batches without positive unrestricted stock
IF w_batch_errors-clabs LE 0.
DELETE t_batch_errors.
CONTINUE.
ENDIF.
READ TABLE t_stck_cnt INTO w_stck_cnt
WITH KEY matnr = w_batch_errors-matnr
charg = w_batch_errors-charg.
IF sy-subrc = 0.
DELETE t_batch_errors.
ENDIF.
ENDLOOP.
ENDIF.
CHECK NOT t_batch_errors[] IS INITIAL.
Write Batch chak results to report
SKIP.
WRITE: / text-b02.
WRITE: / sy-uline(74).
WRITE: /2 'Material',
22 'Batch'.
WRITE: /2 sy-uline(32).
SKIP.
LOOP AT t_batch_errors INTO w_batch_errors.
WRITE: /2 w_batch_errors-matnr,
22 w_batch_errors-charg.
ENDLOOP.
ENDFORM. " post_process_checks
G E T _ I N T E R F A C E _ F I L E N A M E
FORM get_interface_filename USING filename lw_path.
DATA: i_file TYPE filename-fileintern,
out_filename LIKE v_path-pathextern.
CLEAR: out_filename.
i_file = filename.
get the interface filename to be used when creating file
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = i_file
IMPORTING
file_name = out_filename
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
MOVE out_filename TO lw_path.
IF filename NE c_archive_file. "RM080107
CONCATENATE lw_path 'NP_StockBalance.dat'
INTO lw_path.
*-- Begin RM080107 - Add timestamp to the archived file
ELSE.
CONCATENATE lw_path 'NP_StockBalance' sy-datum sy-uzeit '.dat'
INTO lw_path.
ENDIF.
*-- End RM080107
ELSE.
ENDIF.
ENDFORM. "get_interface_filename
*& Form move_file RM080107
Move the processed file to archive directory
FORM move_file.
*-- At last move the file to archive directory
OPEN DATASET p_arch FOR OUTPUT IN TEXT MODE.
IF sy-subrc = 0.
LOOP AT t_rawdata INTO w_rawdata.
TRANSFER w_rawdata TO p_arch.
ENDLOOP.
ENDIF.
CLOSE DATASET p_arch.
DELETE DATASET p_file.
ENDFORM. " move_fileHi,
S E L E C T I O N S C R E E N
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_file LIKE rlgrap-filename,
p_arch LIKE rlgrap-filename. "RM080107
SELECTION-SCREEN SKIP.
PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N'.
SELECTION-SCREEN END OF BLOCK b1.
I N C L U D E S
INCLUDE zwm_np_stock_recon_top.
INCLUDE zwm_np_stock_recon_f01.
I N I T I A L I Z A T I O N
INITIALIZATION.
PERFORM get_interface_filename USING c_interface_file p_file.
PERFORM get_interface_filename USING c_archive_file p_arch."RM080107
S T A R T O F S E L E C T I O N
START-OF-SELECTION.
PERFORM read_file USING p_file.
PERFORM pre_processing.
E N D O F S E L E C T I O N
END-OF-SELECTION.
PERFORM process_checks.
IF w_no_change = 'X'.
WRITE: / text-b03.
WRITE: / sy-uline(34).
ELSE.
PERFORM bdc_mi09.
PERFORM file_check_report.
PERFORM bdc_report.
ENDIF.
PERFORM post_process_checks.
*-- Move the processed file to archive directory
PERFORM move_file.
...*************.........first include...................************
INCLUDE ZWM_NP_STOCK_RECON_TOP *
Data declaration ----------------------------------------------
TYPES: st_rawdata(2000) TYPE c.
TYPES: BEGIN OF st_stck_cnt,
werks TYPE iseg-werks, "plant
lgort TYPE iseg-lgort, "storage location
matnr TYPE iseg-matnr, "material number
charg TYPE iseg-charg, "batch
vfdat TYPE mch1-vfdat, "Sell by date
lwedt TYPE mch1-lwedt, "Manufacture date
quarn(8) TYPE n, "qaunrantine quantity
menge(8) TYPE n, "quantity on hand
message(1), "Message Type (E/W/I)
msg_txt TYPE t100-text, "Message Text
zerostck(1), "Zero stock identifier "RM220307
END OF st_stck_cnt.
TYPES: BEGIN OF st_batch_errors,
matnr TYPE iseg-matnr, "material number
charg TYPE iseg-charg, "batch
clabs TYPE mchb-clabs, "Stock Balance
END OF st_batch_errors.
DATA:
t_rawdata TYPE TABLE OF st_rawdata,
w_rawdata TYPE st_rawdata,
t_stck_cnt TYPE TABLE OF st_stck_cnt,
d_stck_cnt TYPE TABLE OF st_stck_cnt, "RM191006
w_stck_cnt TYPE st_stck_cnt,
t_batch_errors TYPE TABLE OF st_batch_errors,
w_batch_errors TYPE st_batch_errors,
t_messtab LIKE bdcmsgcoll OCCURS 0,
w_messtab LIKE LINE OF t_messtab,
w_no_change.
CONSTANTS: c_interface_file(26) TYPE c VALUE 'ZNP_STOCK_RECON',
c_archive_file(26) TYPE c
VALUE 'ZNP_STOCK_RECON_ARCHIVE'. "RM080107
.*************................second include..........************
***INCLUDE ZWM_NEXTPHARMA_STOKRECON_F01 .
*& Form read_file
reads NextPharma file sent through via webmethods
-->P_FILENAME
FORM read_file USING p_filename.
CLEAR: t_rawdata,
w_rawdata.
REFRESH: t_rawdata.
OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
IF sy-subrc <> 0.
MESSAGE e720(01).
ENDIF.
DO.
READ DATASET p_filename INTO w_rawdata.
IF sy-subrc <> 0.
EXIT.
ELSE.
APPEND w_rawdata TO t_rawdata.
ENDIF.
ENDDO.
CLOSE DATASET p_filename.
ENDFORM. " read_file
*& Form pre_processing
Read file values into internal table
FORM pre_processing.
DATA: lw_matnr TYPE iseg-matnr.
LOOP AT t_rawdata INTO w_rawdata.
lw_matnr = w_rawdata+21(20). "RM031006
lw_matnr = w_rawdata+22(18). "RM031006
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lw_matnr
IMPORTING
output = lw_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
MOVE: lw_matnr TO w_stck_cnt-matnr.
w_stck_cnt-werks = w_rawdata+14(4).
w_stck_cnt-lgort = w_rawdata+18(4).
w_stck_cnt-charg = w_rawdata+84(25).
w_stck_cnt-vfdat = w_rawdata+109(8).
w_stck_cnt-lwedt = w_rawdata+117(8).
w_stck_cnt-quarn = w_rawdata+141(8).
w_stck_cnt-menge = w_rawdata+125(8).
APPEND w_stck_cnt TO t_stck_cnt.
CLEAR w_stck_cnt.
ENDLOOP.
SORT t_stck_cnt BY werks
lgort
matnr
charg.
DELETE ADJACENT DUPLICATES FROM t_stck_cnt.
ENDFORM. " pre_processing
*& Form bdc_mi09
Run file data via BDC TCODE: MI09
FORM bdc_mi09.
DATA: t_bdcdata TYPE TABLE OF bdcdata,
w_bdcdata TYPE bdcdata,
lw_datum(10) TYPE c,
lw_count(2) TYPE n.
WRITE sy-datum TO lw_datum DD/MM/YYYY.
<b>select single MATNR
WERKS
CHARG
from MCHA
into (l_matnr, l_werks, l_charg)
where matnr = w_stck_cnt-matnr
and werks = w_stck_cnt-werks.
and charg = w_stck_cnt-charg.
if sy-subrc ne 0.
continue.
endif.</b>
Front Screen
CLEAR w_bdcdata.
w_bdcdata-program = 'SAPMM07I'.
w_bdcdata-dynpro = '0700'.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO t_bdcdata.
Enter
CLEAR w_bdcdata.
w_bdcdata-fnam = 'BDC_OKCODE'.
w_bdcdata-fval = '/00'.
APPEND w_bdcdata TO t_bdcdata.
Count Date
CLEAR w_bdcdata.
w_bdcdata-fnam = 'RM07I-ZLDAT'.
w_bdcdata-fval = lw_datum.
APPEND w_bdcdata TO t_bdcdata.
Document Date
CLEAR w_bdcdata.
w_bdcdata-fnam = 'RM07I-BLDAT'.
w_bdcdata-fval = lw_datum.
APPEND w_bdcdata TO t_bdcdata.
Plant
CLEAR w_bdcdata.
w_bdcdata-fnam = 'IKPF-WERKS'.
w_bdcdata-fval = w_stck_cnt-werks.
APPEND w_bdcdata TO t_bdcdata.
Storage Location
CLEAR w_bdcdata.
w_bdcdata-fnam = 'IKPF-LGORT'.
w_bdcdata-fval = w_stck_cnt-lgort.
APPEND w_bdcdata TO t_bdcdata.
LOOP AT t_stck_cnt INTO w_stck_cnt.
Do not submit items with Errors against them
CHECK w_stck_cnt-message NE 'E' AND
w_stck_cnt-zerostck NE 'X'.
"RM220307
lw_count = lw_count + 1.
Input Screen
CLEAR w_bdcdata.
w_bdcdata-program = 'SAPMM07I'.
w_bdcdata-dynpro = '0731'.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO t_bdcdata.
Page Down
CLEAR w_bdcdata.
w_bdcdata-fnam = 'BDC_OKCODE'.
w_bdcdata-fval = '=P+'.
APPEND w_bdcdata TO t_bdcdata.
Material
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-MATNR(01)'.
w_bdcdata-fval = w_stck_cnt-matnr.
APPEND w_bdcdata TO t_bdcdata.
Batch
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-CHARG(01)'.
w_bdcdata-fval = w_stck_cnt-charg.
APPEND w_bdcdata TO t_bdcdata.
IF w_stck_cnt-menge NE 0.
Quantity
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-ERFMG(01)'.
w_bdcdata-fval = w_stck_cnt-menge.
APPEND w_bdcdata TO t_bdcdata.
*-- Begin RM220307 - We need to create an item when the quantity is zero
*-- in file and is non-zero in SAP
ELSE.
Zero Stock indicator
CLEAR w_bdcdata.
w_bdcdata-fnam = 'ISEG-XNULL(01)'.
w_bdcdata-fval = 'X'.
APPEND w_bdcdata TO t_bdcdata.
*-- End RM220307
ENDIF.
ENDLOOP.
CHECK lw_count NE 0.
After all line items have been input
Final Screen
CLEAR w_bdcdata.
w_bdcdata-program = 'SAPMM07I'.
w_bdcdata-dynpro = '0731'.
w_bdcdata-dynbegin = 'X'.
APPEND w_bdcdata TO t_bdcdata.
Save Document
CLEAR w_bdcdata.
w_bdcdata-fnam = 'BDC_OKCODE'.
w_bdcdata-fval = '=BU'.
APPEND w_bdcdata TO t_bdcdata.
CALL TRANSACTION 'MI09' USING t_bdcdata
MODE p_mode
MESSAGES INTO t_messtab.
ENDFORM. " bdc_mi09
*& Form bdc_report
Write BDC Messages.
FORM bdc_report.
DATA: lw_text TYPE t100-text.
SKIP.
WRITE: / text-b01.
WRITE: / sy-uline(21).
SKIP.
Write BDC Messages
LOOP AT t_messtab INTO w_messtab WHERE msgspra = sy-langu.
MESSAGE ID w_messtab-msgid TYPE w_messtab-msgtyp
NUMBER w_messtab-msgnr
WITH w_messtab-msgv1
w_messtab-msgv2
w_messtab-msgv3
w_messtab-msgv4
INTO lw_text.
WRITE: / lw_text.
ENDLOOP.
ENDFORM. " bdc_report
*& Form process_checks
Perform process check before creating BDC Session
FORM process_checks.
DATA: lw_clabs LIKE mchb-clabs,
lw_menge LIKE mchb-clabs,
lw_matnr LIKE mara-matnr,
lw_charg LIKE mch1-charg,
lw_fail,
lw_vfdat TYPE mch1-vfdat,
lv_sell TYPE c, "RM191006
lv_qty(8) TYPE c. "RM191006
CLEAR: d_stck_cnt[], d_stck_cnt. "RM191006
Check if any of the stock figures differ from current stock figures
LOOP AT t_stck_cnt INTO w_stck_cnt.
lw_menge = w_stck_cnt-menge.
SELECT SINGLE clabs INTO lw_clabs
FROM mchb
WHERE matnr = w_stck_cnt-matnr
AND werks = w_stck_cnt-werks
AND lgort = w_stck_cnt-lgort
AND charg = w_stck_cnt-charg.
IF sy-subrc = 0.
IF lw_clabs NE lw_menge.
lw_fail = 'X'.
*-- Begin RM220307 - Do not create PI item if the stock is zero in the
*-- file and is zero in SAP
EXIT.
ELSEIF lw_clabs = 0 AND lw_menge = 0.
w_stck_cnt-zerostck = 'X'.
MODIFY t_stck_cnt FROM w_stck_cnt.
ENDIF.
*-- End RM220307
ELSE.
lw_fail = 'X'.
ERROR
ENDIF.
ENDLOOP.
If no differences are found set NO CHANGE Flag
IF lw_fail NE 'X'.
w_no_change = 'X'.
EXIT.
ENDIF.
Check for Errors in file data
LOOP AT t_stck_cnt INTO w_stck_cnt.
CLEAR lv_sell. "RM191006
SELECT SINGLE matnr INTO lw_matnr
FROM mara
WHERE matnr = w_stck_cnt-matnr.
IF sy-subrc NE 0.
Invalid Material (E)
w_stck_cnt-message = 'E'.
w_stck_cnt-msg_txt = 'Invalid Material'.
MODIFY t_stck_cnt FROM w_stck_cnt.
CONTINUE.
ENDIF.
SELECT SINGLE charg vfdat
INTO (lw_charg, lw_vfdat)
FROM mch1 "KOB01 - changed from MCHA
WHERE matnr = w_stck_cnt-matnr
AND charg = w_stck_cnt-charg.
AND werks = w_stck_cnt-werks.
IF sy-subrc NE 0.
Invalid Material Batch (E)
w_stck_cnt-message = 'E'.
CONCATENATE 'Invalid Material Batch for plant' w_stck_cnt-werks
INTO w_stck_cnt-msg_txt SEPARATED BY space.
MODIFY t_stck_cnt FROM w_stck_cnt.
CONTINUE.
ELSE.
IF w_stck_cnt-vfdat <> lw_vfdat.
Sell by dates do not match (W)
w_stck_cnt-message = 'W'.
w_stck_cnt-msg_txt =
'Sell by Date does not match Shelf life Expiry Date'.
MODIFY t_stck_cnt FROM w_stck_cnt.
lv_sell = 'X'. "RM191006
CONTINUE. "RM191006
ENDIF.
ENDIF.
IF w_stck_cnt-quarn > 0.
Quarantine balance not Zero (W)
w_stck_cnt-message = 'W'.
*-- Begin RM191006
*-- We do want all warning messages on the report
lv_qty = w_stck_cnt-quarn.
CONDENSE lv_qty NO-GAPS.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = lv_qty
IMPORTING
output = lv_qty.
w_stck_cnt-msg_txt = 'Quarantine balance is not zero'.
CONCATENATE 'Quarantine balance is ' lv_qty '- not zero'
INTO w_stck_cnt-msg_txt SEPARATED BY space.
MODIFY t_stck_cnt FROM w_stck_cnt.
CONTINUE.
IF lv_sell = 'X'.
APPEND w_stck_cnt TO d_stck_cnt.
CLEAR lv_sell.
ELSE.
MODIFY t_stck_cnt FROM w_stck_cnt.
ENDIF.
*-- End RM191006
ENDIF.
ENDLOOP.
*-- Begin RM191006
*-- Finally get all the records into dummy table to report
APPEND LINES OF t_stck_cnt TO d_stck_cnt.
SORT d_stck_cnt.
DELETE ADJACENT DUPLICATES FROM d_stck_cnt.
*-- End RM191006
ENDFORM. " process_checks
*& Form file_check_report
Write warning and Error messages from File checks
FORM file_check_report.
WRITE: /2 'Material',
22 'Batch',
32 'Sell By',
45 'Message Text'.
WRITE: /2 sy-uline(115).
SKIP.
LOOP AT t_stck_cnt INTO w_stck_cnt. "RM191006
LOOP AT d_stck_cnt INTO w_stck_cnt. "RM191006
CHECK w_stck_cnt-message NE ' '.
WRITE: /2 w_stck_cnt-matnr,
22 w_stck_cnt-charg,
32 w_stck_cnt-vfdat,
43 w_stck_cnt-message,
45 w_stck_cnt-msg_txt.
ENDLOOP.
ENDFORM. " file_check_report
*& Form post_process_checks
Check Material Batches in SAP against NP File
FORM post_process_checks.
RANGES: r_matnr FOR mchb-matnr,
r_lgort FOR mchb-lgort,
r_werks FOR mchb-werks.
SORT t_stck_cnt.
LOOP AT t_stck_cnt INTO w_stck_cnt.
AT END OF matnr.
r_lgort-sign = 'I'.
r_lgort-option = 'EQ'.
r_lgort-low = w_stck_cnt-lgort.
APPEND r_lgort.
r_werks-sign = 'I'.
r_werks-option = 'EQ'.
r_werks-low = w_stck_cnt-werks.
APPEND r_werks.
r_matnr-sign = 'I'.
r_matnr-option = 'EQ'.
r_matnr-low = w_stck_cnt-matnr.
APPEND r_matnr.
ENDAT.
ENDLOOP.
Select all material batches for NP Materials
SELECT matnr charg clabs
INTO TABLE t_batch_errors
FROM mchb
WHERE werks IN r_werks
AND lgort IN r_lgort.
IF sy-subrc EQ 0.
Check if the Material Batches are in the NP file
LOOP AT t_batch_errors INTO w_batch_errors.
Disregard Batches without positive unrestricted stock
IF w_batch_errors-clabs LE 0.
DELETE t_batch_errors.
CONTINUE.
ENDIF.
READ TABLE t_stck_cnt INTO w_stck_cnt
WITH KEY matnr = w_batch_errors-matnr
charg = w_batch_errors-charg.
IF sy-subrc = 0.
DELETE t_batch_errors.
ENDIF.
ENDLOOP.
ENDIF.
CHECK NOT t_batch_errors[] IS INITIAL.
Write Batch chak results to report
SKIP.
WRITE: / text-b02.
WRITE: / sy-uline(74).
WRITE: /2 'Material',
22 'Batch'.
WRITE: /2 sy-uline(32).
SKIP.
LOOP AT t_batch_errors INTO w_batch_errors.
WRITE: /2 w_batch_errors-matnr,
22 w_batch_errors-charg.
ENDLOOP.
ENDFORM. " post_process_checks
G E T _ I N T E R F A C E _ F I L E N A M E
FORM get_interface_filename USING filename lw_path.
DATA: i_file TYPE filename-fileintern,
out_filename LIKE v_path-pathextern.
CLEAR: out_filename.
i_file = filename.
get the interface filename to be used when creating file
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = i_file
IMPORTING
file_name = out_filename
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
MOVE out_filename TO lw_path.
IF filename NE c_archive_file. "RM080107
CONCATENATE lw_path 'NP_StockBalance.dat'
INTO lw_path.
*-- Begin RM080107 - Add timestamp to the archived file
ELSE.
CONCATENATE lw_path 'NP_StockBalance' sy-datum sy-uzeit '.dat'
INTO lw_path.
ENDIF.
*-- End RM080107
ELSE.
ENDIF.
ENDFORM. "get_interface_filename
*& Form move_file RM080107
Move the processed file to archive directory
FORM move_file.
*-- At last move the file to archive directory
OPEN DATASET p_arch FOR OUTPUT IN TEXT MODE.
IF sy-subrc = 0.
LOOP AT t_rawdata INTO w_rawdata.
TRANSFER w_rawdata TO p_arch.
ENDLOOP.
ENDIF.
CLOSE DATASET p_arch.
DELETE DATASET p_file.
ENDFORM. " move_file
Best regards,
Prashant -
Jsp:setProperty tag is not working
hi i am working on project online test system when registering the student i want to use the setProperty tag to set the values from the student form into the approproate bean properties but this tag doesn't work instead i have to set all values of bean by calling the respective setter methods and i am using tomcat as web server.
i am sending the code as well please help me if u can.
the html coding for student form is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>registration of student</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#677E7E" text="#AC9E6C">
<table width="75%" border="1" align="center" bordercolor="#677E7E">
<tr>
<td><font size="5">STUDENT REGISTRATION FORM</font></td>
</tr>
</table>
<hr>
<p> </p>
<form name="student_registration_form" method="post" >
<script language="JavaScript" >
function validateField()
var
sos=document.student_registration_form.StartOfSession.selectedIndex,
eos=document.student_registration_form.EndOfSession.selectedIndex,
deg=document.student_registration_form.Degree.selectedIndex,
sem=document.student_registration_form.Smester.selectedIndex,
sec=document.student_registration_form.Section.selectedIndex,
rol=document.student_registration_form.RollNo.value,
pas=document.student_registration_form.Password.value;
if(sos==0)
alert(" \n You Can Not Leave StartOfSession Field Empty");
else
if(eos==0)
alert("\n You Can Not Leave EndOfSession Field Empty");
else
if(deg==0)
alert("\n You Can Not Leave Degree Field Empty");
else
if(sem==0)
alert("\n You Can Not Leave Smester Field Empty");
else
if(sec==0)
alert("\n You Can Not Leave Section Field Empty");
else
if(rol=="")
alert("\n You Can Not Leave RollNo Field Empty");
else
if(pas=="")
alert("\n You Can Not Leave Password Field Empty");
//document.student_registration_form.EndOfSession.value=="" || document.student_registration_form.Degree.value=="" || document.student_registration_form.Section.value=="" || document.student_registration_form.Smester.value=="" || document.student_registration_form.RollNo.value=="" || document.student_registration_form.Password.value=="")
else
if(!(sos==0) || !(eos==0) || !(deg==0) ||
!(sec==0) || !(Smester==0) ||
!(document.student_registration_form.RollNo.value=="") ||
!(document.student_registration_form.Password.value=="")
//document.forms[0].reset();
//checking validity of the password field
var LengthOfRollNo=pas.length;
for(i=0;i++;i<LengthOfRollNo )
if(!(pas.subString(i,i++)>0))
alert("please enter numaric value in the password field");
return true;
document.student_registration_form.submit();
self.location='StudentRegistration.jsp';
//return true;
student_registration_form.StartOfSession.value="";
student_registration_form.EndOfSession.value="";
student_registration_form.Degree.value="";
student_registration_form.Section.value="";
student_registration_form.Smester.value="";
student_registration_form.RollNo.value="";
</script>
<table width="76%" border="1" align="center" bordercolor="#677E7E">
<tr>
<td width="61%"><font size="3">SESSION</font></td>
<td width="39%">
<table width="75%" border="1" bordercolor="#677E7E">
<tr>
<td><select name="StartOfSession" size="1">
<option>Start of Session</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
</select></td>
<td bordercolor="#677E7E">TO</td>
<td><select name="EndOfSession" size="1">
<option>End Of Session</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>20006</option>
<option>2007</option>
<option>2008</option>
<option>2009</option>
<option>2010</option>
<option>2011</option>
<option>2012</option>
<option>2013</option>
<option>2014</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td><font size="3">NAME OF DEGREE</font></td>
<td><select name="Degree" size="1">
<option> </option>
<option>MCS</option>
<option>BCS</option>
<option>BBA</option>
<option>MBA</option>
<option>MPA</option>
<option>BSIT</option>
<option>MSIT</option>
<option>BBIT</option>
<option>MSIT</option>
</select></td>
</tr>
<tr>
<td>SEMESTER </td>
<td><select name="Smester" size="1">
<option> </option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select></td>
</tr>
<tr>
<td>SECTION</td>
<td><select name="Section" size="1">
<option> </option>
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
</select></td>
</tr>
<tr>
<td>ROLL NUMBER (<font size="2">NUMARIC ONLY</font>)</td>
<td><input type="text" name="RollNo"></td>
</tr>
<tr>
<td>PASSWORD</td>
<td><input type="password" name="Password"></td>
</tr>
</table>
<table width="12%" border="1" align="center" bordercolor="#677E7E">
<tr>
<td><input type="button" name="Submit_bt" value="Submit" onClick="validateField()" /></td>
</tr>
</table>
<p> </p>
</form>
<p> </p>
</body>
</html>
and the bean is
import java.sql.*;
public class StudentBean
private String StartOfSession="",EndOfSession="",Degree="",Section="",Smester="",RollNo="",Password="",Status="",LogIn="";
Connection cn;
Statement stmt;
ResultSet rs;
public StudentBean()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
cn=DriverManager.getConnection("jdbc:odbc:intery");
stmt=cn.createStatement();
catch(ClassNotFoundException exp)
System.out.println("class not found while obtaining connection from StudentBean.java");
catch(SQLException exp)
System.out.println("SQLException araised while obtaining a connection from StudentBean.java");
catch(Exception exp)
System.out.println("exception in obtaining connection from StudentBean.java");
public String getStartOfSession()
return StartOfSession;
public void setStartOfSession(String startofsession)
StartOfSession=startofsession;
public String getEndOfSession()
return EndOfSession;
public void setEndOfSession(String endofsession)
EndOfSession=endofsession;
public String getDegree()
return Degree;
public void setDegree(String degree)
Degree=degree;
System.out.println("Degree = "+Degree);
public String getSection()
return Section;
public void setSection(String section)
Section=section;
public String getSmester()
return Smester;
public void setSmester(String smester)
Smester=smester;
System.out.println("yar Smesterrrrrr"+Smester+" from StudentBean");
public String getRollNo()
return RollNo;
public void setRollNo(String rollno)
RollNo=rollno;
public String getPassword()
return Password;
public void setPassword(String password)
Password=password;
public String getStatus()
return Status;
public void setStatus(String status)
Status=status;
public String isRegistered()
String IsRegistered="";
LogIn=StartOfSession.concat("-").concat(EndOfSession).concat("-").concat(Degree).concat("-").concat(Section).concat("-").concat(Smester).concat("-").concat(RollNo);
try
PreparedStatement ps=cn.prepareStatement("select * from student where username = '"+LogIn+"'");
rs=ps.executeQuery();
if(rs.next())
IsRegistered="registered";
else
IsRegistered="notregistered";
catch(Exception exp)
IsRegistered="Exception";
System.out.println(exp+"from isRegistered method of StudentBean.java ");
return IsRegistered;
public boolean checkRollNo()
try
//rn is used to keep the value of RollNo
int rn=Integer.parseInt(RollNo);
catch(Exception exp)
return false;
return true;
public boolean registerStudent()
System.out.println("rigisterStudentMethod has been called");
LogIn=StartOfSession.concat("-").concat(EndOfSession).concat("-").concat(Degree).concat("-").concat(Section).concat("-").concat(Smester).concat("-").concat(RollNo);
System.out.println(LogIn);
try
PreparedStatement ps=cn.prepareStatement("insert into student values(?,?,?)");
ps.setString(1,LogIn);
ps.setString(2,Password);
ps.setString(3,"allowed");
ps.executeUpdate();
catch(SQLException exp)
System.out.println(exp+"from StudentBean.java");
catch(Exception exp)
System.out.println(exp+"from StudentBean.java");
System.out.println("Exception during insertion of record in student table from StudentBean.java");
return false;
return true;
and the jsp page for seting bean property and performing other actions is
<jsp:useBean id="StudBean" scope="page" class="StudentBean" />
\\(here <jsp:setPropety name="StudBean" property="*" /> is not working)
<%
StudBean.setStartOfSession(request.getParameter("StartOfSession"));
StudBean.setEndOfSession(request.getParameter("EndOfSession"));
StudBean.setDegree(request.getParameter("Degree"));
StudBean.setSmester(request.getParameter("Smester"));
StudBean.setSection(request.getParameter("Section"));
StudBean.setRollNo(request.getParameter("RollNo"));
StudBean.setPassword(request.getParameter("Password"));
if(StudBean.checkRollNo()==false)
%>
<%@ include file="invalid_data_in_rollno_field.htm" %>
<%
else
String IsRegistered=StudBean.isRegistered();
if(IsRegistered.equals("registered"))
%>
<%@ include file="already_registered.htm" %>
<%
else
if (StudBean.registerStudent() && IsRegistered.equals("notregistered") )
%>
<%@ include file="successfull_registration.htm" %>
<%
else
%>
<%@ include file="unsuccessfull_registration_of_student.htm" %>
<%
%>
please tell me where i am making mistake since i have mentioned all the
form attributes name and the bean attributes name as same.I think that all your form parameters must begin with alowercase letters, for example
startOfSession instead of StartOfSession
try to rename your selectname paramters.
Le me know if ti works,
Giovanni -
Embedding .mov video - followed all steps - not working!
I followed the steps, and it's not working.
I selected the space where I want it. Clicked "insert" "media" "plugin". Chose my .mov video from my root media folder - things looked good to me.
On properties changed the width and height. There is a lovely empty box on the page!
I am not sure what exactly needs to go in the Url. space (in properties).
One site says - http://www.apple.com/quicktime. for those users that don't have it - another linked to a web page I did not understand.
This is a Windows file .mov, so I am assuming it does not need the Mark of the Web - please correct me if I'm wrong.
Can anyone see what is wrong. Ppl make it look so easy - follow the steps and it just plays - Brilliant!!! - why NOT FOR ME?
Thanks a million.Do not use .mov files. Very few people have QuickTime / browser plugins to support this file type. The universal standard now is HTML5 <video> with OGV, WEBM and MP4 files. No players or special plugins required to view it. And it works in all web devices!
Copy & paste the following HTML5 code into a new, blank document. Save and preview in browsers.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 with Video</title>
<!--help for older IE browsers-->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<style>
video {
max-width:100%;
display:block;
margin:0 auto;
</style>
<body>
<h2>Use 3 File Types to support all browsers & mobile devices: MP4, WEBM and OGV.</h2>
<h3>Online Video Converter
http://video.online-convert.com/</h3>
<!--begin video-->
<video controls poster="Your_poster_image.jpg">
<!--these are 6 sec sample videos for testing purposes. Replace sample-videos with your own files-->
<source src="http://techslides.com/demos/sample-videos/small.webm" type="video/webm">
<source src="http://techslides.com/demos/sample-videos/small.ogv" type="video/ogg">
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
If you're seeing this, you're using an
outdated browser that doesn't support
the video tag. </video>
<!--end video-->
</body>
</html>
Nancy O.
Maybe you are looking for
-
How to validate multiple controls using a single Validator?
I am trying to do an HourValidator because Flex doesn't have this, so i am extending from the Validator class. I read in the Creating and extending Flex components document the following: "A validator can validate more than one field at a time. For e
-
A a:link has background image
I have a bkg img in my nav and bottom nav. (navBkg.jpg) These navs are styled very specifically for the nav and bottom Nav in my css. However all the a links are displaying this background, rather than just the nav and bottom Nav. You can see it in
-
I am installing a point to point bridge link using 1400 briges w/power injectors. The bridges are installed but the link goes up and down about every few minutes. When it does connect, it starts out at a low dbm but eventually ends up in the 80's and
-
Need one to many toplink+Jdeveloper tutorial with example
Hi I need tutorial with example of one to many with Toplink+J developer Thanks Edited by: user11802935 on Aug 18, 2009 1:06 PM
-
Hi every one, iam using .net2 enterprise library and oracle as my background db. can any one guide me in using the data access application block for .net2. i wrote a sample stored procedure which returns cursors as output parameter. is there any way