Very Urgent - Draw a string in a rectangle with a given width

Hi
I have a jtextArea and I have set its width to a fixed value. I set the wrap line property to tru and the word wrap true so as if the word is too large it will be displayed on the next line of the jtextArea. I read a string value and give it to the JTextArea.
I want to know the height of the JTextarea after the String is wrapped in it. The string may be of a single line but after it is wrapped, in the JTextArea it may appear as multiple line. All the methods of the JTextarea tell me that the JTextarea has a string of one line and the rectangle it returns does not match the true one.
I want to know either the real values of the rectangle after the string is wrapped or the number of lines the string is divided as it appears in the textareas.
My email address is [email protected]
Thx.. and please help..

See this example of line numbering in JEditorPane.
I think in the text area it's the same
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.rtf.*;
class Test extends JFrame
public Test()
super("Test");
JEditorPane edit = new JEditorPane();
edit.setEditorKit(new MyRTFEditorKit());
edit.setEditable(true);
JScrollPane scroll=new JScrollPane(edit);
getContentPane().add(scroll);
setSize(300,300);
setVisible(true);
public static void main(String a[])
new Test();
class MyRTFEditorKit extends RTFEditorKit
public ViewFactory getViewFactory()
return new MyRTFViewFactory();
class MyRTFViewFactory implements ViewFactory
public View create(Element elem)
String kind = elem.getName();
if (kind != null)
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
// return new ParagraphView(elem);
return new MyParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
// return new BoxView(elem, View.Y_AXIS);
return new MySectionView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
// default to text display
return new LabelView(elem);
class MySectionView extends BoxView {
public MySectionView(Element e, int axis)
super(e,axis);
public void paintChild(Graphics g,Rectangle r,int n) {
if (n>0) {
MyParagraphView child=(MyParagraphView)this.getView(n-1);
int shift=child.shift+child.childCount;
MyParagraphView current=(MyParagraphView)this.getView(n);
current.shift=shift;
super.paintChild(g,r,n);
class MyParagraphView extends javax.swing.text.ParagraphView
public int childCount;
public int shift=0;
public MyParagraphView(Element e)
super(e);
short top=0;
short left=20;
short bottom=0;
short right=0;
this.setInsets(top,left,bottom,right);
public void paint(Graphics g, Shape a)
childCount=this.getViewCount();
super.paint (g,a);
int rowCountInThisParagraph=this.getViewCount(); //<----- YOU HAVE REAL ROW COUNT FOR ONE PARAGRAPH}
System.err.println(rowCountInThisParagraph);
public void paintChild(Graphics g,Rectangle r,int n) {
super.paintChild(g,r,n);
g.drawString(Integer.toString(shift+n+1),r.x-20,r.y+r.height-3);
best regards
Stas

Similar Messages

  • Hi all..very urgent..error fixing..full marks wud be given for the answers.

    Hi guys..facing problem in error fixing.in bdc...prgm is in ECC 6.0..
    prgm is
    *& Report  ZCJI_CNV_POSTGOODSRECEIPT_ALT1
    REPORT  ZCJI_CNV_POSTGOODSRECEIPT_ALT1.
    *REPORT ZCJI_CNV_POSTGOODSRECEIPT_ALT NO STANDARD PAGE HEADING
                      LINE-SIZE 255.
    *Program:  ZCJI_CNV_POSTGOODSRECEIPT_ALT                               *
    *Function: This program is used to carry out GR transaction MB0A for
             CJI import logistics purchase orders. The objective is to
             choose only those purchase orders for which billing has been
             carried out already. Once GR document is posted, the status
             of delivery document items is also updated.
    DATE        AUTHOR      SCR #         CHANGE DESCRIPTION
    11/04/03   Ohm Reddy   BRD # 90      Initial version
                           DEVK928402
    02/25/04   Ohm Reddy                 In BDC session for posting Goods
                           DEVK929329    Receipt document, update document
                                         date with system local date
                                         (SYST-DATLO) rather than with
                                         system date(SYST-DATUM)
    06/23/04   Ohm Reddy                 Post GR only when sales order
                           DEVK931359    item SKU and PO item SKU matches
    03/21/05   Alex Mutia  13829/DEVK934135                              *
                           Phase II modifications:                       *
                           1. Added criteria in the selection screen;    *
                           2. Modified record selection logic;           *
                           3. Added fields in the Control Report;        *
    04/08/05   Alex Mutia  13829/DEVK934262                              *
                           Fixed bug in processing MFRGR field;          *
    04/13/05   Alex Mutia  13829/DEVK934283                              *
                           1.Fixed bug in assigning error record pointers*
                             to part-success part-error POs;             *
                           2.Added SO and SO line item numbers in report;*
                           3.Compressed report to fit in 255 columns;    *
    04/27/05   Alex Mutia  13829/DEVK934384                              *
                           1.Material documents retrieval changed from   *
                             MSEG to EKBE for performance.               *
                           2.Display empty ALV columns when no records   *
                             were selected for processing;               *
    TYPE-POOLS: SLIS.
    DATA:   GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:   G_LAYOUT_ALV_SPEC TYPE SLIS_LAYOUT_ALV.
    *INCLUDE ZMMCJI_CNV_POSTGR_BDC2.
    INCLUDE ZCJI_CNV_PGR_DATA_ALT.
    $--"DEVK934135 Begin;-$
    INITIALIZATION.                                  "DEVK934135
      PERFORM INITIALIZE_VENDOR.                     "DEVK934135
      PERFORM INITIALIZE_PRICE.                      "DEVK934135
    $--"DEVK934135 End;---$
    START-OF-SELECTION.
      IF P_LIFNR IS INITIAL.                         "DEVK934135
        PERFORM INITIALIZE_VENDOR.                   "DEVK934135
      ENDIF.                                         "DEVK934135
      IF P_NETPR IS INITIAL.                         "DEVK934135
        PERFORM INITIALIZE_PRICE.                    "DEVK934135
      ENDIF.                                         "DEVK934135
      PERFORM 100_SELECT_DATA.
    END-OF-SELECTION.
    CHECK: g_return_code IS INITIAL.               "DEVK934384
    IF NOT itab[] IS INITIAL.                      "DEVK934384
      IF G_RETURN_CODE IS INITIAL  AND               "DEVK934384
         NOT ITAB[] IS INITIAL.                      "DEVK934384
        PERFORM 200_PROCESS_DATA.
        PERFORM 300_POST_DOCUMENTS.
        PERFORM 399_RETRIEVE_DOCUMENTS.
        PERFORM REORG_ITAB.
        PERFORM BUILD_HEADER_CATALOG.
        PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].
        SY_COPY = SYST.
        PERFORM SHOW_TRANSACTION_ERRORS.
      ELSE.                                          "DEVK934384
        PERFORM SHOW_EMPTY_LIST.                     "DEVK934384
      ENDIF.
    *&      Form  SELECT_DATA
    FORM 100_SELECT_DATA.
      PERFORM 110_SELECT_OPEN_PO_QTY.
      CHECK: G_RETURN_CODE IS INITIAL.
      PERFORM 120_SELECT_PO_BILLED_QTY.
    ENDFORM.                    " 100_SELECT_DATA
    *&      Form  110_SELECT_OPEN_PO_QTY
    FORM 110_SELECT_OPEN_PO_QTY.
    $--"DEVK934135 Begin;-$
      SELECT T1~VGBEL
             T1~VGPOS
             T1~VBELN
             T1~POSNR
             T1~MATNR
             T1~LFIMG
             T1~MFRGR
             T2~LIFEX
             T2~LFDAT
             FROM       LIPS AS T1
             INNER JOIN LIKP AS T2
             ON T1MANDT EQ T2MANDT  AND
                T1VBELN EQ T2VBELN
             APPENDING CORRESPONDING FIELDS OF TABLE ITAB_LIPS
             WHERE T1~MANDT EQ SY-MANDT         "client is system client
              AND  T1~VBELN IN S_VBELN          "billing doc in criteria
              AND  T1~VGBEL IN S_EBELN          "po reference in criteria
              AND  T1~PSTYV EQ 'ELN'            "billing item category
              AND  T1~WERKS EQ 'JDC1'           "plant
              AND  T1~MFRGR NE 'C'              "material freight group
              AND  T2~LIFNR EQ  P_LIFNR.        "vendor is param vendor
      LOOP AT ITAB_LIPS.
        ITAB_LIPS-EBELN = ITAB_LIPS-VGBEL.
        ITAB_LIPS-EBELP = ITAB_LIPS-VGPOS.
        ITAB_LIPS-CHARG = ITAB_LIPS-LIFEX.
        ITAB_LIPS-OLDMFRGR
                        = ITAB_LIPS-MFRGR.
        MODIFY ITAB_LIPS.
      ENDLOOP.
      IF ITAB_LIPS[] IS INITIAL.
      MESSAGE i032(zm) WITH text-m11.              "DEVK934384
        G_RETURN_CODE = 'X'.
        EXIT.
      ENDIF.
      SELECT T1~EBELN
             T1~EBELP
             T1~LICHA
             T2~MATNR
             T2~MENGE
             T2~LOEKZ
             T2~ELIKZ
             T2~NETPR
             T3~IHREZ
             FROM       EKET AS T1
             INNER JOIN EKPO AS T2
             ON T1MANDT EQ T2MANDT  AND
                T1EBELN EQ T2EBELN  AND
                T1EBELP EQ T2EBELP
             INNER JOIN EKKO AS T3
             ON T1MANDT EQ T3MANDT  AND
                T1EBELN EQ T3EBELN
             APPENDING CORRESPONDING FIELDS OF TABLE ITAB
             FOR ALL ENTRIES IN ITAB_LIPS
             WHERE T1~MANDT EQ SY-MANDT         "client is system client
              AND  T1~EBELN EQ ITAB_LIPS-EBELN  "po# matches w/ billing
              AND  T3~BSART IN ('YT', 'YN').    "po type
      IF ITAB[] IS INITIAL.
      MESSAGE i032(zm) WITH text-m11.              "DEVK934384
        G_RETURN_CODE = 'X'.
        EXIT.
      ENDIF.
    $--"DEVK934135 End;---$
    delete any duplicate entries in itab table
      SORT ITAB BY EBELN EBELP.
      DELETE ADJACENT DUPLICATES FROM ITAB COMPARING EBELN EBELP.
      LOOP AT ITAB.
        ITAB-RECID = SY-TABIX.
        IF NOT ITAB-IHREZ IS INITIAL.
          WHILE ITAB-IHREZ+0(1) EQ ' '.
            SHIFT ITAB-IHREZ.
          ENDWHILE.
          WHILE ITAB-IHREZ+9(1) EQ ' '.
            SHIFT ITAB-IHREZ RIGHT.
            ITAB-IHREZ+0(1) = '0'.
          ENDWHILE.
        ENDIF.
        MODIFY ITAB.
      ENDLOOP.
    delete  ITAB_LIPS entries that are not there in ITAB
      LOOP AT ITAB_LIPS.
        SY_COPY-TABIX = SY-TABIX.
        CLEAR ITAB.
        READ TABLE ITAB WITH KEY EBELN = ITAB_LIPS-EBELN
                                 EBELP = ITAB_LIPS-EBELP BINARY SEARCH.
        SY_COPY-INDEX = SY-TABIX.
        IF SY-SUBRC NE 0.
          DELETE ITAB_LIPS.
        ELSE.
          ITAB_LIPS-IHREZ = ITAB-IHREZ.
          MODIFY ITAB_LIPS INDEX SY_COPY-TABIX.
          ITAB-MFRGR = ITAB_LIPS-MFRGR.
          ITAB-LIFEX = ITAB_LIPS-LIFEX.
          ITAB-OLDMFRGR
                     = ITAB_LIPS-OLDMFRGR.
          MODIFY ITAB      INDEX SY_COPY-INDEX.
        ENDIF.
      ENDLOOP.
    select the goods receipts documents created for the above deliveries
      SELECT EBELN EBELP BELNR GJAHR
                     INTO TABLE ITAB_EKBE FROM EKBE
                                FOR ALL ENTRIES IN ITAB_LIPS
                                WHERE EBELN = ITAB_LIPS-EBELN
                                AND   EBELP = ITAB_LIPS-EBELP.
    select Goods receipt data from MSEG table for the above deliveries
      IF NOT ITAB_EKBE[] IS INITIAL.
        SELECT EBELN EBELP CHARG BWART MENGE MBLNR MJAHR ZEILE
                       INTO TABLE ITAB_MSEG FROM MSEG
                                  FOR ALL ENTRIES IN ITAB_EKBE
                                  WHERE MBLNR = ITAB_EKBE-BELNR
                                  AND   MJAHR = ITAB_EKBE-GJAHR.
      ENDIF.
      SORT ITAB_MSEG BY EBELN EBELP CHARG.
    calculate the GR qty eligible to be posted
      SORT ITAB_LIPS BY EBELN EBELP.
      LOOP AT ITAB_LIPS.
        ITAB_LIPS-POSTQTY = ITAB_LIPS-LFIMG.
        CLEAR ITAB_MSEG.
        LOOP AT ITAB_MSEG WHERE EBELN = ITAB_LIPS-EBELN
                          AND   EBELP = ITAB_LIPS-EBELP
                          AND   CHARG = ITAB_LIPS-CHARG.
          IF ITAB_MSEG-BWART = '101'.
            ITAB_LIPS-POSTQTY = ITAB_LIPS-POSTQTY - ITAB_MSEG-MENGE.
          ELSEIF ITAB_MSEG-BWART = '102'.
            ITAB_LIPS-POSTQTY = ITAB_LIPS-POSTQTY + ITAB_MSEG-MENGE.
          ENDIF.
        ENDLOOP.
        MODIFY ITAB_LIPS.
        CLEAR ITAB_LIPS.
      ENDLOOP.
      LOOP AT ITAB.
        ITAB-RECID = SY-TABIX.
        MODIFY ITAB.
        LOOP AT ITAB_LIPS WHERE EBELN EQ ITAB-EBELN
                           AND  EBELP EQ ITAB-EBELP.
          ITAB_LIPS-RECID = ITAB-RECID.
          MODIFY ITAB_LIPS.
        ENDLOOP.
      ENDLOOP.
    free the memory of unnecessary internal tables
    $--"DEVK934135 Begin;-$
      CLEAR: ITAB_EKBE.
      FREE:  ITAB_EKBE.
    $--"DEVK934135 End;---$
    ENDFORM.                    " 110_SELECT_OPEN_PO_QTY
    *&      Form  120_SELECT_PO_BILLED_QTY
    FORM 120_SELECT_PO_BILLED_QTY.
    $--"DEVK934135 Begin;-$
      SELECT T1~VBELN
             T1~POSNR
             T1~FKIMG
             T1~AUBEL
             T1~AUPOS
             APPENDING CORRESPONDING FIELDS OF TABLE ITAB_VBRP
             FROM       VBRP AS T1
             INNER JOIN VBRK AS T2
             ON T1MANDT EQ T2MANDT  AND
                T1VBELN EQ T2VBELN
             FOR ALL ENTRIES IN ITAB
             WHERE T1~MANDT EQ SY-MANDT         "client is system client
              AND  T1~VBELN EQ ITAB-IHREZ+0(10) "billing doc = your ref.
              AND  T2~FKSTO EQ ' '.             "status NOT cancelled
    Match ITAB-IHREZ <-> ITAB_VBRP-VBELN...
           ITAB-LICHA <-> ITAB_VBRP-POSNR...
      LOOP AT ITAB.
        SY_COPY-TABIX = SY-TABIX.
      Check your reference (IHREZ) field;
        IF ITAB-IHREZ IS INITIAL.                    "your-ref blank
          ITAB-ERRFA = 'X'.
          GT_ERROR-RECID = ITAB-RECID.
          GT_ERROR-ERRTX = TEXT-E0A.
          APPEND GT_ERROR.
        ELSE.                                        "your-ref NOT blank
          IF ITAB-IHREZ CO ' 0123456789'.            "your-ref numeric
          ENDIF.                                     "your-ref numeric
          IF SY-FDPOS NE 12.                         "your-ref NOT numeric
            ITAB-ERRFA = 'X'.
            GT_ERROR-RECID = ITAB-RECID.
            GT_ERROR-ERRTX = TEXT-E0A.
            APPEND GT_ERROR.
          ELSE.                                      "your-ref NOT numeric
          Check PO line item (LICHA) field;
            IF ITAB-LICHA IS INITIAL.                "line item blank
              ITAB-ERRFA = 'X'.
              GT_ERROR-RECID = ITAB-RECID.
              GT_ERROR-ERRTX = TEXT-E01.
              APPEND GT_ERROR.
            ELSE.                                    "line item NOT blank
              IF ITAB-LICHA CO ' 0123456789'.        "line item numeric
              ENDIF.                                 "line item numeric
              IF SY-FDPOS NE 15.                     "line item NOT numeric
                ITAB-ERRFA = 'X'.
                GT_ERROR-RECID = ITAB-RECID.
                GT_ERROR-ERRTX = TEXT-E01.
                APPEND GT_ERROR.
              ELSE.                                  "line item NOT numeric
                SY_COPY-SUBRC = 4.
                READ TABLE ITAB_VBRP
                     WITH KEY VBELN = ITAB-IHREZ+0(10)
                              POSNR = ITAB-LICHA+0(6)    BINARY SEARCH.
                SY_COPY-SUBRC = SY-SUBRC.
                IF SY_COPY-SUBRC NE 0.
                  ITAB-ERRFA = 'X'.
                  GT_ERROR-RECID = ITAB-RECID.
                  GT_ERROR-ERRTX = TEXT-E01.
                  APPEND GT_ERROR.
                ELSE.                                "DEVK934283
                  ITAB-AUBEL = ITAB_VBRP-AUBEL.      "DEVK934283
                  ITAB-AUPOS = ITAB_VBRP-AUPOS.      "DEVK934283
                ENDIF.
              ENDIF.                                 "line item NOT numeric
            ENDIF.                                   "line item blank
          ENDIF.                                     "your-ref NOT numeric
        ENDIF.                                       "your-ref blank
      Check ID - LIFEX;
        IF ITAB-LIFEX EQ ' '.                        "LIFEX is blank
          ITAB-ERRFB = 'X'.
          GT_ERROR-RECID = ITAB-RECID.
          GT_ERROR-ERRTX = TEXT-ERB.
          APPEND GT_ERROR.
        ELSE.                                        "LIFEX is NOT blank
        Check ID - MFRGR;
          IF ITAB-MFRGR NE 'G'.                      "MFRGR NOT G
            ITAB-ERRFC = 'X'.
            GT_ERROR-RECID = ITAB-RECID.
            GT_ERROR-ERRTX = TEXT-ERC.
            APPEND GT_ERROR.
          ENDIF.                                     "MFRGR NOT G
        ENDIF.                                       "LIFEX is blank
      Check PO - Deletion indicator;
        IF ITAB-LOEKZ NE ' '.                        "LOEKZ NOT blank
          ITAB-ERRFD = 'X'.
          GT_ERROR-RECID = ITAB-RECID.
          GT_ERROR-ERRTX = TEXT-ERD.
          APPEND GT_ERROR.
        ENDIF.                                       "LOEKZ NOT blank
      Check PO - Delivery completed flag;
        IF ITAB-ELIKZ NE ' '.                        "ELIKZ NOT blank
          ITAB-ERRFE = 'X'.
          GT_ERROR-RECID = ITAB-RECID.
          GT_ERROR-ERRTX = TEXT-ERE.
          APPEND GT_ERROR.
        ENDIF.                                       "ELIKZ NOT blank
      Check PO - Net price;
        IF ITAB-NETPR LT P_NETPR.                    "price < parameter
          ITAB-ERRFF = 'X'.
          GT_ERROR-RECID = ITAB-RECID.
          CONCATENATE TEXT-ERF
                      G_NETPR
                      TEXT-USD
                      INTO GT_ERROR-ERRTX SEPARATED BY SPACE.
          APPEND GT_ERROR.
        ENDIF.                                       "ELIKZ NOT blank
        IF ITAB-AUPOS EQ '000000'.
          CLEAR: ITAB-AUPOS.
        ENDIF.
        MODIFY ITAB INDEX SY_COPY-TABIX.
      ENDLOOP.
      LOOP AT ITAB.                                  "DEVK934283
        READ TABLE ITAB_LIPS                         "DEVK934283
             WITH KEY VGBEL = ITAB-EBELN             "DEVK934283
                      VGPOS = ITAB-EBELP             "DEVK934283
             BINARY SEARCH.                          "DEVK934283
        SY_COPY-TABIX = SY-TABIX.                    "DEVK934283
        IF SY-SUBRC EQ 0.                            "DEVK934283
          ITAB_LIPS-AUBEL = ITAB-AUBEL.              "DEVK934283
          ITAB_LIPS-AUPOS = ITAB-AUPOS.              "DEVK934283
          MODIFY ITAB_LIPS INDEX SY_COPY-TABIX.      "DEVK934283
        ENDIF.                                       "DEVK934283
      ENDLOOP.                                       "DEVK934283
    Transfer errors from ITAB to ITAB_LIPS;
      LOOP AT ITAB WHERE ERRFA EQ 'X'
                    OR   ERRFB EQ 'X'
                    OR   ERRFC EQ 'X'
                    OR   ERRFD EQ 'X'
                    OR   ERRFE EQ 'X'
                    OR   ERRFF EQ 'X'.
        READ TABLE ITAB_LIPS
             WITH KEY VGBEL = ITAB-EBELN
                      VGPOS = ITAB-EBELP  BINARY SEARCH.
        SY_COPY-TABIX = SY-TABIX.
        IF SY-SUBRC EQ 0.
          ITAB_LIPS-ERRFA    = ITAB-ERRFA.
          ITAB_LIPS-ERRFB    = ITAB-ERRFB.
          ITAB_LIPS-ERRFC    = ITAB-ERRFC.
          ITAB_LIPS-ERRFD    = ITAB-ERRFD.
          ITAB_LIPS-ERRFE    = ITAB-ERRFE.
          ITAB_LIPS-ERRFF    = ITAB-ERRFF.
          ITAB_LIPS-NEWMFRGR = 'E'.
          MODIFY ITAB_LIPS INDEX SY_COPY-TABIX.
        ENDIF.
      ENDLOOP.
    $--"DEVK934135 End;---$
    ENDFORM.                    " 120_SELECT_PO_BILLED_QTY
    *&      Form  200_PROCESS_DATA
    FORM 200_PROCESS_DATA.
      PERFORM 210_CONSOLIDATE_DATA.
      PERFORM 220_PROCESS_DATA.
    ENDFORM.                    " 200_PROCESS_DATA
    *&      Form  210_consolidate_data
    FORM 210_CONSOLIDATE_DATA.
    Get the PO item open qty and billed qty into one table
      LOOP AT ITAB.
        CLEAR ITAB_LIPS.
        LOOP AT ITAB_LIPS WHERE EBELN = ITAB-EBELN
                          AND   EBELP = ITAB-EBELP.
         ITAB-IDQTY = ITAB-IDQTY + ITAB_LIPS-POSTQTY.      "inbound delv qty
        ENDLOOP.
        CLEAR ITAB_VBRP.
        LOOP AT ITAB_VBRP WHERE VBELN = ITAB-IHREZ
                          AND   POSNR = ITAB-LICHA.
          ITAB-FKIMG = ITAB-FKIMG + ITAB_VBRP-FKIMG.    "PO item billed qty
        ENDLOOP.
        CLEAR ITAB_MSEG.
        LOOP AT ITAB_MSEG WHERE EBELN = ITAB-EBELN
                          AND   EBELP = ITAB-EBELP.
          IF ITAB_MSEG-BWART = '101'.
           ITAB-GRQTY = ITAB-GRQTY + ITAB_MSEG-MENGE.        "PO item GR qty
          ELSEIF ITAB_MSEG-BWART = '102'.
           ITAB-GRQTY = ITAB-GRQTY - ITAB_MSEG-MENGE.        "PO item GR qty
          ELSEIF ITAB_MSEG-BWART = '122'.            "DEVK934135
           ITAB-GRQTY = ITAB-GRQTY - ITAB_MSEG-MENGE.        "PO item GR qty
          ENDIF.
        ENDLOOP.
        ITAB-RCVQTY = ITAB-FKIMG - ITAB-GRQTY.  "qty billed but not received
    calculate the quantity to be processed for which GRs are to be posted
        IF ITAB-RCVQTY > 0 AND ITAB-RCVQTY > ITAB-IDQTY.
          ITAB-PROCQTY = ITAB-IDQTY.
        ELSEIF ITAB-RCVQTY > 0 AND ITAB-RCVQTY < ITAB-IDQTY.
          ITAB-PROCQTY = ITAB-RCVQTY.
        ELSEIF ITAB-RCVQTY > 0 AND ITAB-RCVQTY = ITAB-IDQTY.
          ITAB-PROCQTY = ITAB-IDQTY.
        ENDIF.
        MODIFY ITAB.
        CLEAR ITAB.
      ENDLOOP.
    free the memory of unnecessary internal tables
    $--"DEVK934135 Begin;-$
      CLEAR: ITAB_MSEG.
      FREE:  ITAB_MSEG.
    $--"DEVK934135 End;---$
    ENDFORM.                    " 210_consolidate_data
    *&      Form  220_PROCESS_DATA
    FORM 220_PROCESS_DATA.
      DATA: L0_FISCAL_PERIOD  LIKE BAPI0002_4-FISCAL_PERIOD,
            L0_FISCAL_YEAR    LIKE BAPI0002_4-FISCAL_YEAR,
            L0_RETURN         LIKE BAPIRETURN1,
            L1_FISCAL_PERIOD  LIKE BAPI0002_4-FISCAL_PERIOD,
            L1_FISCAL_YEAR    LIKE BAPI0002_4-FISCAL_YEAR,
            L1_RETURN         LIKE BAPIRETURN1.
      SORT ITAB_LIPS BY VGBEL VGPOS EBELN EBELP
                        LFDAT DESCENDING POSNR ASCENDING.
      SORT ITAB BY EBELN EBELP.
    Calculate the GR quanities to be posted for all inbound deliveries
      LOOP AT ITAB_LIPS.
        AT NEW EBELP.
          CLEAR ITAB.
          CLEAR V_RCVQTY.
          READ TABLE ITAB WITH KEY EBELN = ITAB_LIPS-EBELN
                                   EBELP = ITAB_LIPS-EBELP BINARY SEARCH.
          V_RCVQTY = ITAB-RCVQTY.
        ENDAT.
        IF ITAB-PROCQTY GT 0.
          IF ITAB_LIPS-POSTQTY GT ITAB-PROCQTY.
            ITAB_LIPS-PROCQTY = ITAB-PROCQTY.
            ITAB_LIPS-NEWMFRGR = 'B'.
            ITAB-PROCQTY = 0.
          ELSEIF ITAB_LIPS-POSTQTY LT ITAB-PROCQTY.
            ITAB_LIPS-PROCQTY = ITAB_LIPS-POSTQTY.
            ITAB_LIPS-NEWMFRGR = 'C'.
            ITAB-PROCQTY = ITAB-PROCQTY - ITAB_LIPS-POSTQTY.
          ELSEIF ITAB_LIPS-POSTQTY EQ ITAB-PROCQTY.
            ITAB_LIPS-PROCQTY = ITAB_LIPS-POSTQTY.
            ITAB_LIPS-NEWMFRGR = 'C'.
            ITAB-PROCQTY = 0.
          ENDIF.
    Compare the Inbound delivery processing quantity with the pending
    billing quantity to write it in the report log
          IF ITAB_LIPS-POSTQTY LT V_RCVQTY.
            ITAB_LIPS-GRIND = 'D'.            "GR will be created for ID qty
            V_RCVQTY = V_RCVQTY - ITAB_LIPS-POSTQTY.
          ELSEIF ITAB_LIPS-POSTQTY GT V_RCVQTY.
            ITAB_LIPS-GRIND = 'B'.       "GR will be created for Billied qty
            V_RCVQTY = 0.
          ELSEIF ITAB_LIPS-POSTQTY EQ V_RCVQTY.
            ITAB_LIPS-GRIND = 'S'.            "Billed qty is equal to ID qty
            V_RCVQTY = 0.
          ENDIF.
        ELSE.
    Decide why this inbound delivery could not have GR quantity -
    excess GR quantity or unavailable Billing quantity
          IF ITAB-RCVQTY LT ITAB-IDQTY.
            ITAB_LIPS-GRIND = 'C'.      "GR not created - Lack of Billed qty
          ENDIF.
          IF ITAB-RCVQTY LT 0.
            ITAB_LIPS-GRIND = 'A'.       "GR not created - GR qty > Bill qty
          ENDIF.
        ENDIF.
        MODIFY ITAB_LIPS.
        CLEAR ITAB_LIPS.
      ENDLOOP.
    $--"DEVK934135-Begin;-$
      LOOP AT ITAB_LIPS.
        AT NEW EBELP.
          CLEAR ITAB.
          CLEAR V_RCVQTY.
          READ TABLE ITAB WITH KEY EBELN = ITAB_LIPS-EBELN
                                   EBELP = ITAB_LIPS-EBELP BINARY SEARCH.
          V_RCVQTY = ITAB-FKIMG - ITAB-GRQTY.
        ENDAT.
        IF ITAB_LIPS-ERRFA IS INITIAL.
          IF V_RCVQTY EQ 0.
            ITAB_LIPS-ERRF1    = 'X'.
            ITAB_LIPS-NEWMFRGR = 'E'.
            GT_ERROR-RECID = ITAB-RECID.
            GT_ERROR-ERRTX = TEXT-R01.
            APPEND GT_ERROR.
          ELSEIF V_RCVQTY LT 0.
            ITAB_LIPS-ERRF2    = 'X'.
            ITAB_LIPS-NEWMFRGR = 'E'.
            GT_ERROR-RECID = ITAB-RECID.
            GT_ERROR-ERRTX = TEXT-R02.
            APPEND GT_ERROR.
          ELSEIF V_RCVQTY GT 0.
            IF V_RCVQTY EQ ITAB_LIPS-LFIMG.
              ITAB_LIPS-ERRF3    = 'X'.
              ITAB_LIPS-NEWMFRGR = 'C'.
            ELSEIF V_RCVQTY GT ITAB_LIPS-LFIMG.
              ITAB_LIPS-ERRF4    = 'X'.
              ITAB_LIPS-NEWMFRGR = 'C'.
              ITAB_LIPS-PROCQTY  =  ITAB_LIPS-LFIMG.
              GT_ERROR-RECID = ITAB-RECID.
              GT_ERROR-ERRTX = TEXT-R04.
              APPEND GT_ERROR.
            ELSEIF V_RCVQTY LT ITAB_LIPS-LFIMG.
              ITAB_LIPS-ERRF5    = 'X'.
              ITAB_LIPS-NEWMFRGR = 'E'.
              GT_ERROR-RECID = ITAB-RECID.
              GT_ERROR-ERRTX = TEXT-R05.
              APPEND GT_ERROR.
            ENDIF.
          ENDIF.
        ENDIF.
        CLEAR: ITAB_LIPS-BLDAT.
        READ TABLE ITAB WITH KEY EBELN = ITAB_LIPS-VGBEL
                                 EBELP = ITAB_LIPS-VGPOS BINARY SEARCH.
        SELECT SINGLE FKDAT
               FROM  VBRK
               INTO (ITAB_LIPS-BLDAT)
               WHERE VBELN EQ ITAB-IHREZ+0(10).
        CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
             EXPORTING
                  COMPANYCODEID = 'C800'
                  POSTING_DATE  =  ITAB_LIPS-BLDAT
             IMPORTING
                  FISCAL_YEAR   =  L0_FISCAL_YEAR
                  FISCAL_PERIOD =  L0_FISCAL_PERIOD
                  RETURN        =  L0_RETURN.
        CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
             EXPORTING
                  COMPANYCODEID = 'C800'
                  POSTING_DATE  =  SY-DATLO
             IMPORTING
                  FISCAL_YEAR   =  L1_FISCAL_YEAR
                  FISCAL_PERIOD =  L1_FISCAL_PERIOD
                  RETURN        =  L1_RETURN.
        IF L0_FISCAL_YEAR   EQ L1_FISCAL_YEAR  AND
           L0_FISCAL_PERIOD EQ L1_FISCAL_PERIOD.
          ITAB_LIPS-BUDAT = ITAB_LIPS-BLDAT.
        ELSE.
          ITAB_LIPS-BUDAT = SY-DATLO.
        ENDIF.
        MODIFY ITAB_LIPS.
        CLEAR ITAB_LIPS.
      ENDLOOP.
    $--"DEVK934135-End;---$
    collect all the inbound deliveries for which goods receipt are to be
    made / material freight status  are to be updated
      LOOP AT ITAB_LIPS    WHERE ERRFA IS INITIAL       "DEVK934135
                            AND  ERRFB IS INITIAL       "DEVK934135
                            AND  ERRFC IS INITIAL       "DEVK934135
                            AND  ERRFD IS INITIAL       "DEVK934135
                            AND  ERRFE IS INITIAL       "DEVK934135
                            AND  ERRFF IS INITIAL       "DEVK934135
                            AND  ERRF1 IS INITIAL       "DEVK934135
                            AND  ERRF2 IS INITIAL       "DEVK934135
                            AND  ERRF5 IS INITIAL.      "DEVK934135
        IF ITAB_LIPS-PROCQTY GT 0 AND ITAB_LIPS-LFIMG NE 0.
          ITAB_LIPS_G-VBELN = ITAB_LIPS-VBELN.
          ITAB_LIPS_G-BLDAT = ITAB_LIPS-BLDAT.       "DEVK934135
          ITAB_LIPS_G-BUDAT = ITAB_LIPS-BUDAT.       "DEVK934135
          ITAB_LIPS_G-IHREZ = ITAB_LIPS-IHREZ.       "DEVK934135
          APPEND ITAB_LIPS_G.
        ENDIF.
      ENDLOOP.
      SORT ITAB_LIPS_G BY VBELN.
      DELETE ADJACENT DUPLICATES FROM ITAB_LIPS_G.
      LOOP AT ITAB_LIPS    WHERE NOT ERRFA IS INITIAL       "DEVK934135
                            OR   NOT ERRFB IS INITIAL       "DEVK934135
                            OR   NOT ERRFC IS INITIAL       "DEVK934135
                            OR   NOT ERRFD IS INITIAL       "DEVK934135
                            OR   NOT ERRFE IS INITIAL       "DEVK934135
                            OR   NOT ERRFF IS INITIAL       "DEVK934135
                            OR   NOT ERRF1 IS INITIAL       "DEVK934135
                            OR   NOT ERRF2 IS INITIAL       "DEVK934135
                            OR   NOT ERRF3 IS INITIAL       "DEVK934135
                            OR   NOT ERRF4 IS INITIAL       "DEVK934135
                            OR   NOT ERRF5 IS INITIAL.      "DEVK934135
          ITAB_LIPS_X-VBELN = ITAB_LIPS-VBELN.
          ITAB_LIPS_X-BLDAT = ITAB_LIPS-BLDAT.       "DEVK934135
          ITAB_LIPS_X-BUDAT = ITAB_LIPS-BUDAT.       "DEVK934135
          ITAB_LIPS_X-IHREZ = ITAB_LIPS-IHREZ.       "DEVK934135
          APPEND ITAB_LIPS_X.
      ENDLOOP.
      SORT ITAB_LIPS_X BY VBELN.
      DELETE ADJACENT DUPLICATES FROM ITAB_LIPS_X.
      LOOP AT ITAB_LIPS.
          READ TABLE ITAB WITH KEY RECID = ITAB_LIPS-RECID.
          SY_COPY-INDEX = SY-TABIX.
          IF SY-SUBRC EQ 0.
            ITAB-ERRFA = ITAB_LIPS-ERRFA.
            ITAB-ERRFB = ITAB_LIPS-ERRFB.
            ITAB-ERRFC = ITAB_LIPS-ERRFC.
            ITAB-ERRFD = ITAB_LIPS-ERRFD.
            ITAB-ERRFE = ITAB_LIPS-ERRFE.
            ITAB-ERRFF = ITAB_LIPS-ERRFF.
            ITAB-ERRF1 = ITAB_LIPS-ERRF1.
            ITAB-ERRF2 = ITAB_LIPS-ERRF2.
            ITAB-ERRF3 = ITAB_LIPS-ERRF3.
            ITAB-ERRF4 = ITAB_LIPS-ERRF4.
            ITAB-ERRF5 = ITAB_LIPS-ERRF5.
            MODIFY ITAB INDEX SY_COPY-INDEX.
          ENDIF.
      ENDLOOP.
    Decide the goods receipt item number for the delivery items that are
    to be processed. Delivery items with zero quantities are not shown up
    in MB0A transaction for GR
      CLEAR V_DEL_ZERO.
      IF NOT ITAB_LIPS_G[] IS INITIAL.
        SELECT VBELN POSNR LFIMG
                  INTO CORRESPONDING FIELDS OF TABLE ITAB_LIPS_Z FROM LIPS
                                  FOR ALL ENTRIES IN ITAB_LIPS_G
                                  WHERE VBELN = ITAB_LIPS_G-VBELN
                                  AND LFIMG EQ 0.
        IF SY-SUBRC EQ 0.
          V_DEL_ZERO = 'X'.
          CLEAR ITAB_LIPS_Z.
          FREE ITAB_LIPS_Z.
          SELECT VBELN POSNR LFIMG
                   INTO CORRESPONDING FIELDS OF TABLE ITAB_LIPS_Z FROM LIPS
                                    FOR ALL ENTRIES IN ITAB_LIPS_G
                                    WHERE VBELN = ITAB_LIPS_G-VBELN.
          SORT ITAB_LIPS_Z BY VBELN POSNR.
          LOOP AT ITAB_LIPS_Z.
            AT NEW VBELN.
              CLEAR V_ZEILE.
            ENDAT.
            IF ITAB_LIPS_Z-LFIMG NE 0.
              V_ZEILE = V_ZEILE + 1.
            ENDIF.
            ITAB_LIPS_Z-ZEILE = V_ZEILE.
            MODIFY ITAB_LIPS_Z.
          ENDLOOP.
        ELSE.
          V_DEL_ZERO = ' '.
        ENDIF.
      ENDIF.
      SORT ITAB_LIPS_Z BY VBELN POSNR.
      LOOP AT ITAB_LIPS.
        IF V_DEL_ZERO = ' '.
          ITAB_LIPS-ZEILE = ITAB_LIPS-POSNR.
        ELSE.
          CLEAR ITAB_LIPS_Z.
          READ TABLE ITAB_LIPS_Z WITH KEY VBELN = ITAB_LIPS-VBELN
                                    POSNR = ITAB_LIPS-POSNR BINARY SEARCH.
          ITAB_LIPS-ZEILE = ITAB_LIPS_Z-ZEILE.
        ENDIF.
        MODIFY ITAB_LIPS.
      ENDLOOP.
      SORT ITAB_LIPS BY VBELN DESCENDING POSNR ASCENDING.
    ENDFORM.                    " 220_PROCESS_DATA
    *&      Form  300_post_documents
    FORM 300_POST_DOCUMENTS.
      LOOP AT ITAB_LIPS_G.
        PERFORM 310_POST_GR_DOC.
        MODIFY ITAB_LIPS_G.
        CLEAR ITAB_LIPS_G.
      ENDLOOP.
      CLEAR: BDCDATA, BDCDATA[].
      ITAB_LIPS_R[] = ITAB_LIPS_G[].
      ITAB_LIPS_G[] = ITAB_LIPS_X[].
      LOOP AT ITAB_LIPS_G.
        PERFORM 350_UPDATE_DELIVERY_DOC.
        MODIFY ITAB_LIPS_G.
        CLEAR ITAB_LIPS_G.
      ENDLOOP.
    PERFORM close_group.
    ENDFORM.                    " 300_post_documents
    *&      Form  310_POST_GR_DOC
    FORM 310_POST_GR_DOC.
      PERFORM 320_POST_GR_HEADER.
      LOOP AT ITAB_LIPS WHERE VBELN = ITAB_LIPS_G-VBELN
                        AND   LFIMG NE 0
                        AND PROCQTY NE 0
                        AND ERRFA   IS INITIAL
                        AND ERRFB   IS INITIAL
                        AND ERRFC   IS INITIAL
                        AND ERRFD   IS INITIAL
                        AND ERRFE   IS INITIAL
                        AND ERRFF   IS INITIAL
                        AND ERRF1   IS INITIAL
                        AND ERRF2   IS INITIAL
                        AND ERRF5   IS INITIAL.
        IF ITAB_LIPS-ZEILE EQ 1.
          PERFORM 335_POST_GR_ITEMS.
        ELSE.
          PERFORM 330_POST_GR_ITEMS.
        ENDIF.
      ENDLOOP.
      PERFORM 340_SAVE_GR_DOC.
    ENDFORM.                    " 310_POST_GR_DOC
    *&      Form  320_POST_GR_HEADER
    FORM 320_POST_GR_HEADER.
      DATA: L_BLDAT    TYPE SYDATUM,
            L_BUDAT    TYPE SYDATUM.
      WRITE: ITAB_LIPS_G-BLDAT TO L_BLDAT,
             ITAB_LIPS_G-BUDAT TO L_BUDAT.
      IF ITAB_LIPS_G-IHREZ+0(10) NE '0000000000'  AND
         ITAB_LIPS_G-IHREZ+0(10) NE '          '.
        WHILE ITAB_LIPS_G-IHREZ+0(1) EQ '0'.
          SHIFT ITAB_LIPS_G-IHREZ.
        ENDWHILE.
      ENDIF.
      perform bdc_dynpro      using 'SAPMM07M' '0201'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RM07M-VLIEF'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'MKPF-BKTXT'
                                    ITAB_LIPS_G-IHREZ.
      perform bdc_field       using 'MKPF-BLDAT'
                                    L_BLDAT.
      perform bdc_field       using 'MKPF-BUDAT'
                                    L_BUDAT.
      perform bdc_field       using 'RM07M-BWARTWE'
                                    '101'.
      perform bdc_field       using 'RM07M-WERKS'
      perform bdc_field       using 'RM07M-LGORT'
      perform bdc_field       using 'RM07M-XNUVO'
                                    'X'.
      perform bdc_field       using 'XFULL'
      perform bdc_field       using 'RM07M-VLIEF'
                                    ITAB_LIPS_G-VBELN.
      perform bdc_dynpro      using 'SAPMM07M' '0221'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SELN'.
      perform bdc_dynpro      using 'SAPMM07M' '0221'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MSEG-ERFMG(01)'.
    ENDFORM.                    " 320_POST_GR_HEADER
    *&      Form  330_POST_GR_ITEMS
    FORM 330_POST_GR_ITEMS.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=KLA'.
      perform bdc_dynpro      using 'SAPMM07M' '1501'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=OK'.
      VV_ZEILE = ITAB_LIPS-ZEILE.
      PERFORM BDC_FIELD       USING 'RM07M-ZEILE'
                                    VV_ZEILE.
      perform bdc_dynpro      using 'SAPMM07M' '0221'.
      perform bdc_field       using 'RM07M-XSELK(01)'
                                    'X'.
      VV_PROCQTY = ITAB_LIPS-PROCQTY.
      perform bdc_field       using 'MSEG-ERFMG(01)'
                                    VV_PROCQTY.
      perform bdc_field       using 'MSEG-CHARG(01)'
                                    ITAB_LIPS-CHARG.
      perform bdc_field       using 'MSEG-INSMK(01)'
                                    'S'.
    ENDFORM.                    " 330_POST_GR_ITEMS
    *&      Form  340_SAVE_GR_DOC
    FORM 340_SAVE_GR_DOC.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BU'.
      CLEAR V_FAIL_IND.
      PERFORM BDC_TRANSACTION USING 'MB0A'
                              CHANGING V_FAIL_IND.
    ENDFORM.                    " 340_SAVE_GR_DOC
    *&      Form  350_UPDATE_DELIVERY_DOC
    FORM 350_UPDATE_DELIVERY_DOC.
      PERFORM 360_UPDATE_DELIVERY_HEADER.
      LOOP AT ITAB_LIPS WHERE VBELN = ITAB_LIPS_G-VBELN
                         AND  ERRFA IS INITIAL
                         AND  ERRFB IS INITIAL
                         AND  ERRFC IS INITIAL.
                       AND  errfd IS INITIAL
                       AND  errfe IS INITIAL.
        PERFORM 370_UPDATE_DELIVERY_ITEMS.
      ENDLOOP.
      PERFORM 380_SAVE_DELIVERY_DOC.
    ENDFORM.                    " 350_UPDATE_DELIVERY_DOC
    *&      Form  360_UPDATE_DELIVERY_HEADER
    FORM 360_UPDATE_DELIVERY_HEADER.
      perform bdc_dynpro      using 'SAPMV50A' '0108'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'LIKP-VBELN'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=UELA'.
      perform bdc_field       using 'LIKP-VBELN'
                                    ITAB_LIPS_G-VBELN.
    ENDFORM.                    " 360_UPDATE_DELIVERY_HEADER
    *&      Form  370_UPDATE_DELIVERY_ITEMS
    FORM 370_UPDATE_DELIVERY_ITEMS.
      IF ITAB_LIPS-ERRFD EQ 'X'  OR
         ITAB_LIPS-ERRFE EQ 'X'  OR
         ITAB_LIPS-ERRFF EQ 'X'.
        ITAB_LIPS-NEWMFRGR = 'E'.
      ENDIF.
      perform bdc_dynpro      using 'SAPMV50A' '0270'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RV50A-VERUR_LA'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=POPO'.
      perform bdc_dynpro      using 'SAPMV50A' '0111'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RV50A-POSNR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=POPO'.
      VV_POSNR =  ITAB_LIPS-POSNR.
      perform bdc_field       using 'RV50A-POSNR'
                                    VV_POSNR.
      perform bdc_dynpro      using 'SAPMV50A' '0270'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'LIPS-POSNR(01)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=LAPD'.
      perform bdc_field       using 'RV50A-LIPS_SELKZ(01)'
                                    'X'.
      perform bdc_dynpro      using 'SAPMV50A' '0570'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'LIPS-MFRGR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BACK'.
      perform bdc_field       using 'LIPS-MFRGR'
                                    ITAB_LIPS-NEWMFRGR.
    ENDFORM.                    " 370_UPDATE_DELIVERY_ITEMS
    *&      Form  380_SAVE_DELIVERY_DOC
    FORM 380_SAVE_DELIVERY_DOC.
      perform bdc_dynpro      using 'SAPMV50A' '0270'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RV50A-VERUR_LA'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SICH'.
    If GR document is not posted successfully, then do not update the
    status of delivery document
      CLEAR V_FAIL_IND.
      PERFORM BDC_TRANSACTION USING 'VL32'
                              CHANGING V_FAIL_IND.
      IF V_FAIL_IND = 'X'.
        CALL FUNCTION 'BDC_INSERT'
             EXPORTING
                  TCODE     = 'VL32'
             TABLES
                  DYNPROTAB = BDCDATA.
        REFRESH BDCDATA.
      ENDIF.
    ENDFORM.                    " 380_SAVE_DELIVERY_DOC
           Start new transaction according to parameters                 *
    FORM BDC_TRANSACTION USING TCODE
                         CHANGING V_FAILURE_IND.
      DATA: L_MSTRING(480).
      DATA: L_SUBRC LIKE SY-SUBRC.
      REFRESH MESSTAB.
      CALL TRANSACTION TCODE USING BDCDATA
                       MODE   CTUMODE
                       UPDATE CUPDATE
                       MESSAGES INTO MESSTAB.
      L_SUBRC = SY-SUBRC.
      CLEAR V_FAILURE_IND.
      IF L_SUBRC NE 0.
        V_FAILURE_IND = 'X'.
        CLEAR V_IND.
        LOOP AT MESSTAB.
          SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
                                    AND   ARBGB = MESSTAB-MSGID
                                    AND   MSGNR = MESSTAB-MSGNR.
          IF SY-SUBRC = 0.
            L_MSTRING = T100-TEXT.
            IF L_MSTRING CS '&1'.
              REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
              REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
              REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
              REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
            ELSE.
              REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
              REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
              REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
              REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
            ENDIF.
            CONDENSE L_MSTRING.
            IF MESSTAB-MSGTYP = 'E'.
              ERRORTAB-TCODE       = TCODE.
              ERRORTAB-VBELN       = ITAB_LIPS_G-VBELN.
              ERRORTAB-ERROR_TEXT  = L_MSTRING.
              APPEND ERRORTAB.
              V_IND = 'X'.
            ENDIF.
          ELSE.
            IF MESSTAB-MSGTYP = 'E'.
              ERRORTAB-TCODE       = TCODE.
              ERRORTAB-VBELN       = ITAB_LIPS_G-VBELN.
              ERRORTAB-ERROR_TEXT  = TEXT-U01.
              APPEND ERRORTAB.
              V_IND = 'X'.
            ENDIF.
          ENDIF.
        ENDLOOP.
        IF V_IND IS INITIAL.
          ERRORTAB-TCODE       = TCODE.
          ERRORTAB-VBELN       = ITAB_LIPS_G-VBELN.
          ERRORTAB-ERROR_TEXT  = TEXT-U01.
          APPEND ERRORTAB.
        ENDIF.
      ELSE.
        IF TCODE = 'MB0A'.
          LOOP AT MESSTAB WHERE MSGTYP = 'S'
                          AND   MSGID = 'M7'
                          AND   MSGNR = '060'.
            IF NOT MESSTAB-MSGV1 IS INITIAL.
              ITAB_LIPS_G-MBLNR = MESSTAB-MSGV1.
            ENDIF.
          ENDLOOP.
        ELSEIF TCODE = 'VL32'.
          ITAB_LIPS_G-DLVIND = 'X'.
        ENDIF.
      ENDIF.
      IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
        IF E_GROUP_OPENED = ' '.
          CALL FUNCTION 'BDC_OPEN_GROUP'
               EXPORTING
                    CLIENT   = SY-MANDT
                    GROUP    = E_GROUP
                    USER     = E_USER
                    KEEP     = E_KEEP
                    HOLDDATE = E_HDATE.
          E_GROUP_OPENED = 'X'.
        ENDIF.
        CALL FUNCTION 'BDC_INSERT'
             EXPORTING
                  TCODE     = TCODE
             TABLES
                  DYNPROTAB = BDCDATA.
      ENDIF.
      REFRESH BDCDATA.
    ENDFORM.
    *&      Form  335_POST_GR_ITEMS
    FORM 335_POST_GR_ITEMS.
      VV_ZEILE = ITAB_LIPS-ZEILE.
      perform bdc_field       using 'RM07M-XSELK(01)'
                                    'X'.
      VV_PROCQTY = ITAB_LIPS-PROCQTY.
      perform bdc_field       using 'MSEG-ERFMG(01)'
                                    VV_PROCQTY.
      perform bdc_field       using 'MSEG-CHARG(01)'
                                    ITAB_LIPS-CHARG.
      perform bdc_field       using 'MSEG-INSMK(01)'
                                    'S'.
    ENDFORM.                    " 335_POST_GR_ITEMS
    *&      Form  399_RETRIEVE_DOCUMENTS
    &----

    that is a warning message only ... But if you want to fix it then replace all 000 with 001 in your write statement. The position instead of 000 you have to give 001
    write : /000(10)....instead of this
    write : /1(10) or write : /(10) or write : /001(10) any thing you can use.
    regards
    shiba dutta

  • VERY URGENT - NOT TALLYING OF RECON.A/C WITH  THE TOTAL OF LINE ITEMS

    Dear FI Experts,
    Since the total balances as per individual customers' balances ( thro FBL5N with one Recon a/c )  which is not tallied with Recon.GL for Local debtors if we see the same thro FS10N, please guide me immediately to reslove these problem as I need to give the detailed customer balance report to my management.
    My observation of the same is " one customer a/c if it is changed from one recon. a/c to another recon a/c after transaction made ( ie. from Local debtors to Foreign debtors ) " , line entries after changing of recon.a/c which is not updating with respective Recon.GL.
    Please revert back with some solutions which will be rewarded.
    Thanks
    G. Jana

    Dear Team,
    your observation is right ,
    in the customer line items select the two rec. accounts old and New Rec. it will match with your FS10N balance.
    regards
    radha

  • Very Urgent: Sun Access Manager 7.1 SSO with Domino 6.5.4

    Hi,
    I am facing some perplexing issue while making SSO work on Domino ( running on Win2k3 )using Sun AM 7.1( running on the same machine ).
    After following all the steps outlined in the policy agent 2.2 guide, I am not being able to access 'names.nsf' in the browser. The Domino Server is getting crashed.
    The log which I get in 'amagent' says :
    2007-05-31 00:31:11.906 Error 4136:7b42aa8 PolicyAgent: render_response(): Entered.
    2007-05-31 00:32:01.109 Error 4136:7b43210 PolicyEngine: am_policy_evaluate: InternalException in AuthService::create_auth_context() with error message:Error sending request for authentication context from server. and code:16
    What do I need to do inorder to make it work.
    I also have some questions regarding the agent. The doc says that the name of the DSAPI filter is "libamdomino6.dll". whereas in the agent which i downloaded from SUN, i only see "amdomino6.dll" & "amdomino.dll". Are the dlls correct. Which one should I use?
    Also i have set the values in properties file as :
    com.sun.am.policy.am.username =testAgent
    com.sun.am.policy.am.password =LYnKyOIgdWt404ivWY6HPQ==
    after creating an Agent under Subjects under the main realm. Have also put the crypted password.
    Moreover, Now if i remove the DSAPI filter value, then the domino server is no longer protected. And i can access any url on the server.
    If you have any idea as to how to make this work, please let me know asap.
    Thanks & Regards,
    Niraj

    Hi,
    I installed opensso (so Sun Java(TM) System Access Manager 7.5) and the agent for Domino 6.5.4 and I have the message in logs "amAgent"
    2007-07-11 18:40:16.119 Error 1708:3dbcf768 PolicyAgent: render_response(): Entered.
    I have the box to identify but it doesnot connect me on my opensso server.
    It still identify with Domino's server
    Thanks for your response
    Thomas

  • Pls...help...printing the whole delivery order...very very urgent

    Can anybody help me in this code.
    I would like to print out delivery order,but when i printed,it just printed out the whole delivery order in the bottom of A4 paper.Can anybody modify the source code and give me proper one?
    I would it to fit on A4 paper.
    These are the soource code,Pls help,it's very urgent.Thanks for any help.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.sql.*;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.awt.print.*;
    import java.awt.geom.*;
    public class ConfirmDeliveryOrderDialog extends JDialog implements ActionListener,Printable
    private ResultSetTableModel retrieveDOInfoModel;
    private JTable newDOTable;
    private JScrollPane newDOSp;
    private JLabel comT1,comT2,comT3,doT,doID,doIDNo,receivedDate,actualReceivedDate,deliveryTo,deliveryToCustomerInfo,
    companyAddress,companyAddressInfo,tel,telNo,dispatchDate,actualDispatchDate,total,totalQuantity,
    inputTotalQuantity,totalKg,inputTotalKg,remark,inputRemark;
    private Line2D line,line1;
    private Graphics2D g;
    private Container cp;
    private JButton printBtn,exitBtn;
    private Connection con;
    private Statement retrieveDOInfoStmt;
    private ResultSet retrieveDOInfoRs;
    int quan,Kg;
    boolean centered = true;
    public ConfirmDeliveryOrderDialog(JDialog parent)
    super(parent,"New Delivery Order",true);
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = Laundry.getConnection();
    retrieveDOInfoStmt = con.createStatement();
    String retrieveDOInfo = "SELECT ItemName,ItemTypeName,WashingType,CleaningType,ItemCategory,QuantityOrKg AS [Quantity/Kg] " +
    "FROM DoDetail,DOInfo " +
    "WHERE DODetail.DOID = DOInfo.DOID " +
    "AND DOInfo.CompanyID = " + Laundry.companyDetails.get(0) +
    "AND DODetail.DOID = " + EnterDeliveryOrderNumberDialog.DOInfo.get(0);
    retrieveDOInfoRs = retrieveDOInfoStmt.executeQuery(retrieveDOInfo);
    if(Laundry.SCROLLABLE)
    retrieveDOInfoModel = new ScrollingResultSetTableModel(retrieveDOInfoRs);
    else
    retrieveDOInfoModel = new CachingResultSetTableModel(retrieveDOInfoRs);
    newDOTable = new JTable(retrieveDOInfoModel);
    newDOSp = new JScrollPane(newDOTable);
    newDOTable.getTableHeader().setReorderingAllowed(false);
    newDOTable.setPreferredScrollableViewportSize(new Dimension(550,350));
    retrieveDOInfoStmt.close();
    con.close();
    cp = getContentPane();
    cp.add(newDOSp, BorderLayout.CENTER);
    catch(SQLException ext)
    JOptionPane.showMessageDialog(null,"SQL Exception:","ERROR",JOptionPane.ERROR_MESSAGE);
    while (ext != null)
    JOptionPane.showMessageDialog(null,"SQL State:" + ext.getSQLState() + "\nMessage:" + ext.getMessage() + "\nVendor:" + ext.getErrorCode(),"ERROR",JOptionPane.ERROR_MESSAGE);
    ext = ext.getNextException();
    catch(ClassNotFoundException ex)
    JOptionPane.showMessageDialog(null,"Exception:" + ex,"ERROR",JOptionPane.ERROR_MESSAGE);
    ex.printStackTrace();
    catch(Exception e)
    JOptionPane.showMessageDialog(null,"Exception:" + e,"ERROR",JOptionPane.ERROR_MESSAGE);
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = Laundry.getConnection();
    retrieveDOInfoStmt = con.createStatement();
    String retrieveDOInfo = "SELECT SUM(QuantityOrKg) AS [Total Quantity] " +
    "FROM DOInfo,DODetail " +
    "WHERE DOInfo.DOID = DODetail.DOID " +
    "AND DOInfo.CompanyID = " + Laundry.companyDetails.get(0) +
    "AND DODetail.DOID = " + EnterDeliveryOrderNumberDialog.DOInfo.get(0) +
    "AND ItemCategory = 'Piece' " +
    "GROUP BY DODetail.DOID ";
    retrieveDOInfoRs = retrieveDOInfoStmt.executeQuery(retrieveDOInfo);
    while(retrieveDOInfoRs.next())
    quan = retrieveDOInfoRs.getInt("Total Quantity");
    retrieveDOInfoStmt.close();
    con.close();
    catch(SQLException ext)
    JOptionPane.showMessageDialog(null,"SQL Exception:","ERROR",JOptionPane.ERROR_MESSAGE);
    while (ext != null)
    JOptionPane.showMessageDialog(null,"SQL State:" + ext.getSQLState() + "\nMessage:" + ext.getMessage() + "\nVendor:" + ext.getErrorCode(),"ERROR",JOptionPane.ERROR_MESSAGE);
    ext = ext.getNextException();
    catch(ClassNotFoundException ex)
    JOptionPane.showMessageDialog(null,"Exception:" + ex,"ERROR",JOptionPane.ERROR_MESSAGE);
    ex.printStackTrace();
    catch(Exception e)
    JOptionPane.showMessageDialog(null,"Exception:" + e,"ERROR",JOptionPane.ERROR_MESSAGE);
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = Laundry.getConnection();
    retrieveDOInfoStmt = con.createStatement();
    String retrieveDOInfo = "SELECT SUM(QuantityOrKg) AS [Total Kg] " +
    "FROM DOInfo, DODetail " +
    "WHERE DOInfo.DOID = DODetail.DOID " +
    "AND DODetail.DOID = " + EnterDeliveryOrderNumberDialog.DOInfo.get(0) +
    "AND DOInfo.CompanyID = " + Laundry.companyDetails.get(0) +
    "AND ItemCategory = 'Kg' " +
    "GROUP BY DODetail.DOID ";
    retrieveDOInfoRs = retrieveDOInfoStmt.executeQuery(retrieveDOInfo);
    while(retrieveDOInfoRs.next())
    Kg = retrieveDOInfoRs.getInt("Total Kg");
    retrieveDOInfoStmt.close();
    con.close();
    catch(SQLException ext)
    JOptionPane.showMessageDialog(null,"SQL Exception:","ERROR",JOptionPane.ERROR_MESSAGE);
    while (ext != null)
    JOptionPane.showMessageDialog(null,"SQL State:" + ext.getSQLState() + "\nMessage:" + ext.getMessage() + "\nVendor:" + ext.getErrorCode(),"ERROR",JOptionPane.ERROR_MESSAGE);
    ext = ext.getNextException();
    catch(ClassNotFoundException ex)
    JOptionPane.showMessageDialog(null,"Exception:" + ex,"ERROR",JOptionPane.ERROR_MESSAGE);
    ex.printStackTrace();
    catch(Exception e)
    JOptionPane.showMessageDialog(null,"Exception:" + e,"ERROR",JOptionPane.ERROR_MESSAGE);
    comT1 = new JLabel("Deluxe Laundry Sdn Bhd");
    comT1.setFont(new Font("Sanserif",Font.BOLD,12));
    comT2 = new JLabel("Lot 1641, Jln Sungai Tua, Batu Caves, 68100 Selangor Darul Ehsan");
    comT2.setFont(new Font("Sanserif",Font.PLAIN,10));
    comT3 = new JLabel("Tel : 03-61863093 03-61863091 Fax : 03-61863096");
    comT3.setFont(new Font("Sanserif",Font.PLAIN,10));
    Box comBox = Box.createVerticalBox();
    comBox.add(Box.createVerticalStrut(5));
    comBox.add(comT1);
    comBox.add(Box.createVerticalStrut(2));
    comBox.add(comT2);
    comBox.add(Box.createVerticalStrut(2));
    comBox.add(comT3);
    comBox.add(Box.createVerticalStrut(2));
    Box comNBox = Box.createHorizontalBox();
    comNBox.add(Box.createHorizontalStrut(10));
    comNBox.add(comBox);
    comNBox.add(Box.createHorizontalStrut(300));
    //line = new Line2D.Float();
    //line.setLine(10,50,600,50);
    //Graphics2D dfl = (Graphics2D)g;
    //dfl.drawLine(10,50,600,50);
    doT = new JLabel("Delivery Order");
    doT.setFont(new Font("Sanserif",Font.BOLD,17));
    doID = new JLabel("DO ID : ");
    doID.setFont(new Font("Sanserif",Font.BOLD,12));
    doIDNo = new JLabel("");
    doIDNo.setText("" + EnterDeliveryOrderNumberDialog.DOInfo.get(0));
    doIDNo.setFont(new Font("Sanserif",Font.PLAIN,12));
    receivedDate = new JLabel("Received Date : ");
    receivedDate.setFont(new Font("Sanserif",Font.BOLD,12));
    actualReceivedDate = new JLabel("");
    actualReceivedDate.setText("" + EnterDeliveryOrderNumberDialog.DOInfo.get(1));
    actualReceivedDate.setFont(new Font("Sanserif",Font.PLAIN,12));
    JPanel jp = new JPanel();
    jp.setLayout(new GridLayout(2,3));
    jp.add(doID);
    jp.add(doIDNo);
    jp.add(receivedDate);
    jp.add(actualReceivedDate);
    Box doBox = Box.createHorizontalBox();
    doBox.add(Box.createHorizontalStrut(200));
    doBox.add(doT);
    doBox.add(Box.createHorizontalStrut(50));
    doBox.add(jp);
    doBox.add(Box.createHorizontalStrut(100));
    //line1 = new Line2D.Float();
    //line1.setLine(10,0,600,0);
    //Graphics2D df2 = (Graphics2D)g;
    //df2.drawLine(10,100,600,100);
    deliveryTo = new JLabel("Delivery To :");
    deliveryTo.setFont(new Font("Sanserif",Font.BOLD,12));
    deliveryToCustomerInfo = new JLabel("");
    deliveryToCustomerInfo.setText("" + Laundry.companyDetails.get(1));
    deliveryToCustomerInfo.setFont(new Font("Sanserif",Font.PLAIN,12));
    Box deliveryToBox = Box.createHorizontalBox();
    deliveryToBox.add(Box.createHorizontalStrut(10));
    deliveryToBox.add(deliveryTo);
    deliveryToBox.add(Box.createHorizontalStrut(10));
    deliveryToBox.add(deliveryToCustomerInfo);
    deliveryToBox.add(Box.createHorizontalStrut(500));
    companyAddress = new JLabel("");
    companyAddress.setFont(new Font("Sanserif",Font.BOLD,12));
    companyAddressInfo = new JLabel("");
    companyAddressInfo.setText("" + Laundry.companyDetails.get(2));
    companyAddressInfo.setFont(new Font("Sanserif",Font.PLAIN,12));
    Box companyAddressBox = Box.createHorizontalBox();
    companyAddressBox.add(Box.createHorizontalStrut(98));
    companyAddressBox.add(companyAddress);
    companyAddressBox.add(Box.createHorizontalStrut(10));
    companyAddressBox.add(companyAddressInfo);
    companyAddressBox.add(Box.createHorizontalStrut(500));
    tel = new JLabel("Tel :");
    tel.setFont(new Font("Sanserif",Font.BOLD,12));
    telNo = new JLabel("");
    telNo.setText("" + '0'+Laundry.companyDetails.get(3));
    telNo.setFont(new Font("Sanserif",Font.PLAIN,12));
    Box telBox = Box.createHorizontalBox();
    telBox.add(Box.createHorizontalStrut(10));
    telBox.add(tel);
    telBox.add(Box.createHorizontalStrut(10));
    telBox.add(telNo);
    telBox.add(Box.createHorizontalStrut(500));
    dispatchDate = new JLabel("Dispatch Date :");
    dispatchDate.setFont(new Font("Sanserif",Font.BOLD,12));
    actualDispatchDate = new JLabel("");
    actualDispatchDate.setText("" + EnterDeliveryOrderNumberDialog.DOInfo.get(2));
    actualDispatchDate.setFont(new Font("Sanserif",Font.PLAIN,12));
    Box dispatchBox = Box.createHorizontalBox();
    dispatchBox.add(Box.createHorizontalStrut(10));
    dispatchBox.add(dispatchDate);
    dispatchBox.add(Box.createHorizontalStrut(10));
    dispatchBox.add(actualDispatchDate);
    dispatchBox.add(Box.createHorizontalStrut(500));
    remark = new JLabel("Remark :");
    remark.setFont(new Font("Sanserif",Font.BOLD,12));
    inputRemark = new JLabel("");
    inputRemark.setText("" + EnterDeliveryOrderNumberDialog.DOInfo.get(3));
    inputRemark.setFont(new Font("Sanserif",Font.PLAIN,12));
    Box remarkBox = Box.createHorizontalBox();
    remarkBox.add(Box.createHorizontalStrut(10));
    remarkBox.add(remark);
    remarkBox.add(Box.createHorizontalStrut(10));
    remarkBox.add(inputRemark);
    remarkBox.add(Box.createHorizontalStrut(500));
    Box infoBox = Box.createVerticalBox();
    infoBox.add(Box.createVerticalStrut(5));
    infoBox.add(deliveryToBox);
    infoBox.add(Box.createVerticalStrut(5));
    infoBox.add(companyAddressBox);
    infoBox.add(Box.createVerticalStrut(5));
    infoBox.add(telBox);
    infoBox.add(Box.createVerticalStrut(5));
    infoBox.add(dispatchBox);
    infoBox.add(Box.createVerticalStrut(5));
    infoBox.add(remarkBox);
    infoBox.add(Box.createVerticalStrut(5));
    Box northBox = Box.createVerticalBox();
    northBox.add(Box.createVerticalStrut(5));
    northBox.add(comNBox);
    northBox.add(Box.createVerticalStrut(5));
    northBox.add(doBox);
    northBox.add(Box.createVerticalStrut(5));
    northBox.add(infoBox);
    northBox.add(Box.createVerticalStrut(5));
    Shape firstShape = new Rectangle(350,100,10,5);
    //Font font = new Font("Sanserif",Font.PLAIN,5);
    String text = "Checked By";
    //g.drawString(text,365,105);
    //g.setFont(new Font("Sanserif",Font.PLAIN,5));
    //g.fill(firstShape);
    //g.draw(firstShape);
    //Box joinBox = Box.createHorizontalBox();
    //joinBox.add(northBox);
    //joinBox.add(Box.createHorizontalStrut(10));
    //joinBox.add(g);
    printBtn = new JButton("Print");
    printBtn.addActionListener(this);
    exitBtn = new JButton("Exit");
    exitBtn.addActionListener(this);
    JPanel jp3 = new JPanel();
    jp3.add(printBtn);
    jp3.add(exitBtn);
    total = new JLabel("Total");
    totalQuantity = new JLabel("Quantity");
    totalQuantity.setFont(new Font("Sanserif",Font.PLAIN,12));
    inputTotalQuantity = new JLabel("");
    inputTotalQuantity.setFont(new Font("Sanserif",Font.PLAIN,12));
    inputTotalQuantity.setText("" + quan);
    totalKg = new JLabel("Kg");
    totalKg.setFont(new Font("Sanserif",Font.PLAIN,12));
    inputTotalKg = new JLabel("");
    inputTotalKg.setFont(new Font("Sanserif",Font.PLAIN,12));
    inputTotalKg.setText("" + Kg);
    Box totalBox = Box.createHorizontalBox();
    totalBox.add(Box.createHorizontalStrut(270));
    totalBox.add(total);
    totalBox.add(Box.createHorizontalStrut(50));
    totalBox.add(totalQuantity);
    totalBox.add(Box.createHorizontalStrut(50));
    totalBox.add(inputTotalQuantity);
    totalBox.add(Box.createHorizontalStrut(30));
    totalBox.add(totalKg);
    totalBox.add(Box.createHorizontalStrut(50));
    totalBox.add(inputTotalKg);
    totalBox.add(Box.createHorizontalStrut(30));
    Box southBox = Box.createVerticalBox();
    southBox.add(Box.createVerticalStrut(10));
    southBox.add(totalBox);
    southBox.add(Box.createVerticalStrut(5));
    southBox.add(jp3);
    cp = getContentPane();
    cp.add(northBox, BorderLayout.NORTH);
    cp.add(southBox, BorderLayout.SOUTH);
    setSize(600,400);
    setLocation(100,100);
    public void actionPerformed(ActionEvent ae)
    if(ae.getSource() == printBtn)
    PageFormat page = new PageFormat();
    Paper paper = new Paper();
    paper.setSize(595.275590551181,841.8897637795276);
    paper.setImageableArea(70.8661417322835,70.8661417322835,453.5433070866141,700.1574803149607);
    page.setPaper(paper);
    page.setOrientation(PageFormat.PORTRAIT);
    PrinterJob printJob = PrinterJob.getPrinterJob();
    if(page == null)
    page = printJob.defaultPage();
    printJob.setPrintable(this,page);
    if(printJob.printDialog())
    try
    printJob.print();
    setVisible(false);
    JOptionPane.showMessageDialog(null,"Please Generate Normal Or Express JobList","JobList",JOptionPane.INFORMATION_MESSAGE);
    catch(PrinterException e)
    JOptionPane.showMessageDialog(this,e);
    else if(ae.getSource() == exitBtn)
    EnterDeliveryOrderNumberDialog.removeDOInfo();
    setVisible(false);
    public int print(Graphics g, PageFormat pf, int page) throws PrinterException
    if(page >= 1)
    return Printable.NO_SUCH_PAGE;
    Graphics2D g2 = (Graphics2D)g;
    g2.translate(pf.getImageableX(), pf.getImageableY());
    if(centered)
    g2.translate(pf.getImageableWidth(), pf.getImageableHeight());
    Dimension d = getSize();
    double scale = Math.min(pf.getImageableWidth() / d.width, pf.getImageableHeight() / d.height);
    if (scale < 1.0)
    g2.scale(scale, scale);
    if (centered)
    g2.translate(-d.width, -d.height);          
    paint(g2);
    return Printable.PAGE_EXISTS;

    Hi Thanx, your code helped. I have got another question. How do i implement a method from another method class into the applet. say, i want to implemen set frequency from the below code into my applet you wrote above?
    class Histogram
         int frequency[];
         String alphabet;
         Histogram(String alphabet)
              this.alphabet=alphabet;
              frequency=new int[alphabet.length()];
         void scan(String message)
              for(int i=0;i<message.length;i++)
                   frequncy[alphabet.IndexOf(message.charAt(i))]++;
         void setfrequency(int frequency[])
              for(int i=0;i<alphabet.length;i++)
              this.frequency=frequency[i];
         double entropy()
              int total=0;
              double probablity;
              log2=Math.log(2.0);
              for(int i=0;i<alphabet.length;i++)
                   total+=freguency[i];

  • Please help me with the following two questions, very urgent

    Hi All,
    Please help me with some scenerios about what are the common problems when modifying a standard script such a standard Invoice script and how can we overcome them.
    What are the common problems encountered when working with SAP SMARTFORMS and how to overcome them?
    Please help me with these questions, its very urgent.
    Thanks in advance.
    MD.

    hi
    hope it will help you.
    reward if ehlp.
    How to create a New smartfrom, it is having step by step procedure
    http://sap.niraj.tripod.com/id67.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    Here is the procedure
    1. Create a new smartforms
    Transaction code SMARTFORMS
    Create new smartforms call ZSMART
    2. Define looping process for internal table
    Pages and windows
    First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
    Here, you can specify your title and page numbering
    &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
    Main windows -> TABLE -> DATA
    In the Loop section, tick Internal table and fill in
    ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
    3. Define table in smartforms
    Global settings :
    Form interface
    Variable name Type assignment Reference type
    ITAB1 TYPE Table Structure
    Global definitions
    Variable name Type assignment Reference type
    ITAB2 TYPE Table Structure
    4. To display the data in the form
    Make used of the Table Painter and declare the Line Type in Tabstrips Table
    e.g. HD_GEN for printing header details,
    IT_GEN for printing data details.
    You have to specify the Line Type in your Text elements in the Tabstrips Output options.
    Tick the New Line and specify the Line Type for outputting the data.
    Declare your output fields in Text elements
    Tabstrips - Output Options
    For different fonts use this Style : IDWTCERTSTYLE
    For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
    5. Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 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.
    Smartform
    you can check this link here you can see the steps and you can do it the same by looking at it..
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    SMARTFORMS STEPS.
    1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
    2. Create Table type(t_struct) of stracture in se11.
    3. In your program declare Internal table(Itab) type table of structure(struct).
    4. Define work area(wa) like line of internal table.
    5. Open Tcode Smartforms
    6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
    7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
    8. In form pages and window, create Page node by default Page1 is available.
    9. In page node you can create numbers of secondary window. But in form there is only one Main window.
    10. By right click on page you can create windows or Go to Edit, Node, Create.
    11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
    12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
    13. In table there are three areas Header, Main Area, Footer.
    14. Right click on the Main area create table line by default line type1 is there select it.
    15. Divide line into cells according to your need then for each cell create Text node.
    16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
    17. Save form and activate it.
    18. Then go to Environment, function module name, there you get the name of function module copy it.
    19. In your program call the function module that you have copied from your form.
    20. In your program in exporting parameter of function pass the internal table(itab).
    SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
    SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
    configure forms with data from an SAP System for the relevant business processes.
    To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
    You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
    You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
    SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
    SAP Smart Forms also support postage optimizing.
    Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
    What Transaction to start SAP Smart Forms?
    Execute transaction SMARTFORMS to start SAP Smart Forms.
    Key Benefits of SAP Smart Forms:
    SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
    You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
    To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
    These actions do not include writing of coding lines or using a Script language.
    Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
    For Web publishing, the system provides a generated XML output of the processed form.
    Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
    SmartForms System Fields
    Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.
    System fields of Smart Forms
    &SFSY-DATE&
    Displays the date. You determine the display format in the user master record.
    &SFSY-TIME&
    Displays the time of day in the form HH:MM:SS.
    &SFSY-PAGE&
    Inserts the number of the current print page into the text. You determine the format of the page number (for example, Arabic, numeric) in the page node.
    &SFSY-FORMPAGES&
    Displays the total number of pages for the currently processed form. This allows you to include texts such as'Page x of y' into your output.
    &SFSY-JOBPAGES&
    Contains the total page number of all forms in the currently processed print request.
    &SFSY-WINDOWNAME&
    Contains the name of the current window (string in the Window field)
    &SFSY-PAGENAME&
    Contains the name of the current page (string in the Page field)
    &SFSY-PAGEBREAK&
    Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])
    &SFSY-MAINEND&
    Is set as soon as processing of the main window on the current page ends
    &SFSY-EXCEPTION&
    Contains the name of the raised exception. You must trigger your own exceptions, which you defined in the form interface, using the user_exception macro (syntax: user_exception <exception name >).
    Example Forms Available in Standard SAP R/3
    SF_EXAMPLE_01
    Simple example; invoice with table output of flight booking for one customer
    SF_EXAMPLE_02
    Similar to SF_EXAMPLE_01 but with subtotals
    SF_EXAMPLE_03
    Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request
    Advantages of SAP Smart Forms
    SAP Smart Forms have the following advantages:
    1. The adaption of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore, power user forms can also make configurations for your business processes with data from an SAP system. Consultants are only required in special cases.
    2. Displaying table structures (dynamic framing of texts)
    3. Output of background graphics, for form design in particular the use of templates which were scanned.
    4. Colored output of texts
    5. User-friendly and integrated Form Painter for the graphical design of forms
    6. Graphical Table Painter for drawing tables
    7. Reusing Font and paragraph formats in forms (Smart Styles)
    8. Data interface in XML format (XML for Smart Forms, in short XSF)
    9. Form translation is supported by standard translation tools
    10. Flexible reuse of text modules
    11. HTML output of forms (Basis release 6.10)
    12. Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release 6.10)

  • Very Urgent, files, threads, and swing !!!!

    Dear friends, i have a swing application, in that application i have a class that extends a thread, that thread will do nothing but read the contents of my data file and puts them in an array, but i am getting a NullpointerException in my thread, could any friend help me please, it is very urgent, i will post my code below.
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DateFormat;
    import java.util.*;
    import javax.swing.*;
    import java.sql.*;
    import java.net.URL;
    import java.io.*;
    public class FinalMachine extends JFrame
    private JPanel MainPanel, ThicknessPanel, MainManager,fieldsPanel, sub_panel;
    private Container c;
    private CardLayout CardManager;
    private String timezone;
    private static final int ONE_SECOND = 1000;
    private JLabel welcome_label, label1, label2, label3,field_label;
    private JTextField data_entry;
    private Connection connection;
    public JPanel thick_figure;
    public int num_of_hits, next_index, recCount;
    public int dataBuffer[];
    public FileReader data_file;
    public BufferedReader b_data_file;
    public File tem_file;
    final int num_of_rec = 20;
    public FinalMachine()
    super("PHOENIX MACHINERY s.a.l");
    /* Start all threads */
    /* Start filling data file in global array */
         loadData dataFile = new loadData();
         dataFile.start();          
    /* Adding control to window application */
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent windowevent)
    // setDefaultCloseOperation(0);
              System.exit(0);
    public void windowDeiconified(WindowEvent eve)
    setState(0);
    addComponentListener(new ComponentAdapter() {
    public void componentResized(ComponentEvent componentevent)
    setSize(500, 500);
    Dimension dimension1 = Toolkit.getDefaultToolkit().getScreenSize();
    if(dimension1.width == 800 && dimension1.height == 600)
    setLocation(150, 25);
    else
    if(dimension1.width == 1024 && dimension1.height == 768)
    setLocation(200, 100);
    /* Setting the location of the application on the screen */
    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
    if(dimension.width == 800 && dimension.height == 600)
    setLocation(150, 25);
    else
    if(dimension.width == 1024 && dimension.height == 768)
    setLocation(200, 100);
    /* Constructing the main menu */
         JMenuBar bar = new JMenuBar();
         setJMenuBar( bar );
         JMenu fileMenu = new JMenu( "File");
         fileMenu.setMnemonic( 'F' );
         JMenuItem mainItem = new JMenuItem( "Main page" );
         mainItem.setMnemonic( 'M' );
         mainItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   CardManager.show(MainManager, "main");
         fileMenu.add( mainItem );
         JMenuItem dataItem = new JMenuItem( "Database page" );
         dataItem.setMnemonic( 'D' );
         dataItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   CardManager.show(MainManager, "data_base");
         fileMenu.add( dataItem );
         JMenuItem printItem = new JMenuItem( "Print" );
         printItem.setMnemonic( 'P' );
         printItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   PrintUtilities.printComponent(MainManager);
         fileMenu.add( printItem );
         JMenuItem exitItem = new JMenuItem( "Exit" );
         exitItem.setMnemonic( 'P' );
         exitItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                        System.exit(0);
         fileMenu.add( exitItem );
         bar.add( fileMenu );
         JMenu figureMenu = new JMenu( "Figures");
         figureMenu.setMnemonic( 'G' );
         JMenuItem thicknessItem = new JMenuItem( "Thickness" );
         thicknessItem.setMnemonic( 'T' );
         thicknessItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   CardManager.show(MainManager, "thickness");
         figureMenu.add( thicknessItem );
         bar.add( figureMenu );
         JMenu helpMenu = new JMenu( "Help");
         helpMenu.setMnemonic( 'H' );
         JMenuItem aboutItem = new JMenuItem( "About us" );
         aboutItem.setMnemonic( 'A' );
         aboutItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   JOptionPane.showMessageDialog(null, "Engineer Bilal Haidar (Computer & "+                     "Communication Engineering)\n\n All Rights Reserevd. @ 2002",
                        "About me...", JOptionPane.PLAIN_MESSAGE);
         helpMenu.add( aboutItem );
         bar.add( helpMenu );
    /* Intializing global values */
    dataBuffer = new int[60];
    /* Initializing the panels */
    c = getContentPane();
    c.setLayout(new FlowLayout());
    CardManager = new CardLayout();
    MainManager = new JPanel(false);
    MainManager.setLayout(CardManager);
    c.add(MainManager);
    javax.swing.border.Border border = BorderFactory.createEmptyBorder(10, 10, 5, 10);
    MainPanel = new JPanel(false);
    MainPanel.setLayout(new BoxLayout(MainPanel, 1));
    MainPanel.setBorder(border);
    ThicknessPanel = new JPanel(false);
    ThicknessPanel.setLayout(new BoxLayout(ThicknessPanel, 1));
    ThicknessPanel.setBorder(border);
    fieldsPanel = new JPanel(false);
    fieldsPanel.setLayout( new BoxLayout( fieldsPanel,1));
    fieldsPanel.setBorder(border);
    sub_panel = new JPanel(false);
    sub_panel.setLayout( new BoxLayout(sub_panel,0) );
    sub_panel.setBorder(border);
    thick_figure = new JPanel(false);
    thick_figure.setBorder(border);
    /* Filling the main panel */
    JLabel jlmain = new JLabel("Main Page");
    MainPanel.add(jlmain);
    timezone = showTime(new Locale("en", "US"));
    JLabel jltime = new JLabel(" " + timezone);
    MainPanel.add(jltime);
    MainManager.add(MainPanel, "main");
    /* Filling the thickness panel */
    num_of_hits = 0;
    next_index = 0;
    /* fill in with ero values for everything*/
    /*display the figure*/
    ThicknessPanel.add(thick_figure);
    JLabel blanklabel = new JLabel(" ");
    ThicknessPanel.add(blanklabel);
    JButton build_fig = new JButton("Draw Figure");
    build_fig.addActionListener(
         new ActionListener() {  // anonymous inner class
         public void actionPerformed( ActionEvent e )
    if ( num_of_hits == 0 )
    /* draw figure based on first 20 points in the array */
    next_index = num_of_rec;
    else
    if ( num_of_hits > 3 )
    JOptionPane.showMessageDialog(null,"No more data to draw","Error Drawing",JOptionPane.ERROR_MESSAGE);
    else
    /* draw the figure starting the data from index 20*/
    next_index = next_index + num_of_rec;
    num_of_hits += 1;
    ThicknessPanel.add(build_fig);
    MainManager.add(ThicknessPanel, "thickness");
    /* filling the database panel */
    label1 = new JLabel(" ",SwingConstants.CENTER);
    welcome_label = new JLabel(" Database Page ",SwingConstants.CENTER);
    label2 = new JLabel(" ",SwingConstants.CENTER);
    fieldsPanel.add( label1 );
    fieldsPanel.add( welcome_label );
    fieldsPanel.add( label2 );
    field_label = new JLabel(" Enter your name: ");
    data_entry = new JTextField( 10 );
    sub_panel.add( field_label );
    sub_panel.add( data_entry );
    fieldsPanel.add( sub_panel );
    JButton add_data = new JButton( "Add me" );
    add_data.addActionListener(
         new ActionListener() {  // anonymous inner class
         public void actionPerformed( ActionEvent e )
    // try {
    //          url = "jdbc:odbc:DataEntry";
    //          Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    //          connection = DriverManager.getConnection( url );
    //               System.out.println( "Connection Suucessfull");
    // Statement statement = connection.createStatement();
    //                String get_field;
    //               get_field = data_entry.getText();
    //               String query = "INSERT INTO data (anyField) VALUES ('get_field')";
    //                int result1 = statement.executeUpdate( query );
    //           if ( result1 == 1 )
    // JOptionPane.showMessageDialog(null, "Thanks for the info..."," Data Entry Success",JOptionPane.INFORMATION_MESSAGE);
    //                else
    //                     JOptionPane.showMessageDialog(null, "Sorry, your name was not added...","Data entry error",JOptionPane.ERROR_MESSAGE);
    //     catch ( ClassNotFoundException cnfex ) {
    //          // process ClassNotFoundExceptions here
    //          cnfex.printStackTrace();
    //               System.out.println( "Connection UN Suucessfull");
    //          catch ( SQLException sqlex ) {
    //     // process SQLExceptions here
    //          sqlex.printStackTrace();
    //                System.out.println( "Connection UN Suucessfull");
    //          catch ( Exception ex ) {
    //          // process remaining Exceptions here
    //          ex.printStackTrace();
    //               System.out.println( "Connection UN Suucessfull");
    fieldsPanel.add(add_data);
    MainManager.add(fieldsPanel, "data_base");
    /* display time */
    Timer timer = new Timer(1000, new ActionListener() {
    public void actionPerformed(ActionEvent actionevent)
    timezone = showTime(new Locale("en", "US"));
    setTitle("PHOENIX MACHINERY s.a.l " + timezone);
    timer.start();
    public static void main(String args[])
    FinalMachine finalmachine = new FinalMachine();
    finalmachine.setSize(500, 500);
    ImageIcon imageicon = new ImageIcon("images/pc.gif");
    finalmachine.setIconImage(imageicon.getImage());
    finalmachine.show();
    public static String showTime(Locale locale)
    java.util.Date date = new java.util.Date();
    byte byte0 = 2;
    DateFormat dateformat = DateFormat.getTimeInstance(byte0, locale);
    String s = dateformat.format(date);
    return s;
    /* Thread loadData starts here */
    class loadData extends Thread
    public void run()
    try {
              readMyFile();
    catch( Exception x )
    System.out.println("The following error occured in LoadData thread : "+x.toString() ); }
    } // run() ends here
    /* method read file inside thread loadData */
    void readMyFile() {
    String record = " ";
    recCount = 0;
    try {
              tem_file = new File("mydata.dat");
              data_file = new FileReader(tem_file);
              b_data_file = new BufferedReader( data_file );
              record = new String();
              while ( (record = b_data_file.readLine()) != null ) {
              dataBuffer[recCount] = Integer.parseInt(record);
              recCount += 1; }
         b_data_file.close();     
              catch (IOException e) {
         System.out.println("Uh oh, got an IOException error!");
         e.printStackTrace();
         } // end of readMyFile()
    } // thread loadData ends
    mydata.dat
    2
    4
    3
    1
    2
    3
    5
    2
    4
    1
    6
    3
    2
    5
    4
    1
    2
    5
    8
    2
    6
    9
    7
    4
    2
    1
    0
    2
    5
    4
    8
    7
    5
    6
    3
    2
    1
    4
    3
    0
    2
    3
    6
    5
    2
    1
    4
    5
    6
    9
    8
    5
    2
    1
    6
    8
    3
    1
    7
    5

    Thank you Mr. jobuck, you helped me a lot, i wonder if you can provide me with a tutorial on how threads work and how runnables work too. i fixed the error ut old me about but still when i try to add another thread to my program i got an error saying that, i must decalre the new thread in a seperate file please can u have a look on what i have:
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DateFormat;
    import java.util.*;
    import javax.swing.*;
    import java.sql.*;
    import java.net.URL;
    import java.io.*;
    public class FinalMachine extends JFrame
    private JPanel MainPanel, ThicknessPanel, MainManager,fieldsPanel, sub_panel;
    private Container c;
    private CardLayout CardManager;
    private String timezone;
    private static final int ONE_SECOND = 1000;
    private JLabel welcome_label, label1, label2, label3,field_label;
    private JTextField data_entry;
    private JPanel thick_figure;
    private int num_of_hits, next_index, recCount, read_flag;
    private int dataBuffer[];
    private FileReader data_file;
    private BufferedReader b_data_file;
    private File tem_file;
    private Connection connection;     
    final int num_of_rec = 20;
    public FinalMachine()
    super("PHOENIX MACHINERY s.a.l");
    /* load JDBC drivers */
    try {
    String url = "jdbc:odbc:DataEntry";
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
         connection = DriverManager.getConnection( url );
         System.out.println( "Connection Suucessfull");
    catch ( ClassNotFoundException cnfex ) {
    // process ClassNotFoundExceptions here
    cnfex.printStackTrace();
         System.out.println( "Connection UN Suucessfull");
    catch ( SQLException sqlex ) {
    // process SQLExceptions here
    sqlex.printStackTrace();
         System.out.println( "Connection UN Suucessfull");
    catch ( Exception ex ) {
    // process remaining Exceptions here
    ex.printStackTrace();
         System.out.println( "Connection UN Suucessfull");
    /* Intializing global values */
    dataBuffer = new int[60];
    /* Start all threads */
    /* Start filling data file in global array */
         loadData dataFile = new loadData();
         dataFile.start();          
         setData setdata = new setData();
         setdata.start();          
    /* Adding control to window application */
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent windowevent)
    // setDefaultCloseOperation(0);
              System.exit(0);
    public void windowDeiconified(WindowEvent eve)
    setState(0);
    addComponentListener(new ComponentAdapter() {
    public void componentResized(ComponentEvent componentevent)
    setSize(500, 500);
    Dimension dimension1 = Toolkit.getDefaultToolkit().getScreenSize();
    if(dimension1.width == 800 && dimension1.height == 600)
    setLocation(150, 25);
    else
    if(dimension1.width == 1024 && dimension1.height == 768)
    setLocation(200, 100);
    /* Setting the location of the application on the screen */
    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
    if(dimension.width == 800 && dimension.height == 600)
    setLocation(150, 25);
    else
    if(dimension.width == 1024 && dimension.height == 768)
    setLocation(200, 100);
    /* Constructing the main menu */
         JMenuBar bar = new JMenuBar();
         setJMenuBar( bar );
         JMenu fileMenu = new JMenu( "File");
         fileMenu.setMnemonic( 'F' );
         JMenuItem mainItem = new JMenuItem( "Main page" );
         mainItem.setMnemonic( 'M' );
         mainItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   CardManager.show(MainManager, "main");
         fileMenu.add( mainItem );
         JMenuItem dataItem = new JMenuItem( "Database page" );
         dataItem.setMnemonic( 'D' );
         dataItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   CardManager.show(MainManager, "data_base");
         fileMenu.add( dataItem );
         JMenuItem printItem = new JMenuItem( "Print" );
         printItem.setMnemonic( 'P' );
         printItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   PrintUtilities.printComponent(MainManager);
         fileMenu.add( printItem );
         JMenuItem exitItem = new JMenuItem( "Exit" );
         exitItem.setMnemonic( 'P' );
         exitItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                        System.exit(0);
         fileMenu.add( exitItem );
         bar.add( fileMenu );
         JMenu figureMenu = new JMenu( "Figures");
         figureMenu.setMnemonic( 'G' );
         JMenuItem thicknessItem = new JMenuItem( "Thickness" );
         thicknessItem.setMnemonic( 'T' );
         thicknessItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   CardManager.show(MainManager, "thickness");
         figureMenu.add( thicknessItem );
         bar.add( figureMenu );
         JMenu helpMenu = new JMenu( "Help");
         helpMenu.setMnemonic( 'H' );
         JMenuItem aboutItem = new JMenuItem( "About us" );
         aboutItem.setMnemonic( 'A' );
         aboutItem.addActionListener (
              new ActionListener() {
                   public void actionPerformed( ActionEvent e )
                   JOptionPane.showMessageDialog(null, "Engineer Bilal Haidar (Computer & "+                     "Communication Engineering)\n\n All Rights Reserevd. @ 2002",
                        "About me...", JOptionPane.PLAIN_MESSAGE);
         helpMenu.add( aboutItem );
         bar.add( helpMenu );
    /* Initializing the panels */
    c = getContentPane();
    c.setLayout(new FlowLayout());
    CardManager = new CardLayout();
    MainManager = new JPanel(false);
    MainManager.setLayout(CardManager);
    c.add(MainManager);
    javax.swing.border.Border border = BorderFactory.createEmptyBorder(10, 10, 5, 10);
    MainPanel = new JPanel(false);
    MainPanel.setLayout(new BoxLayout(MainPanel, 1));
    MainPanel.setBorder(border);
    ThicknessPanel = new JPanel(false);
    ThicknessPanel.setLayout(new BoxLayout(ThicknessPanel, 1));
    ThicknessPanel.setBorder(border);
    fieldsPanel = new JPanel(false);
    fieldsPanel.setLayout( new BoxLayout( fieldsPanel,1));
    fieldsPanel.setBorder(border);
    sub_panel = new JPanel(false);
    sub_panel.setLayout( new BoxLayout(sub_panel,0) );
    sub_panel.setBorder(border);
    thick_figure = new JPanel(false);
    thick_figure.setBorder(border);
    /* Filling the main panel */
    JLabel jlmain = new JLabel("Main Page");
    MainPanel.add(jlmain);
    timezone = showTime(new Locale("en", "US"));
    JLabel jltime = new JLabel(" " + timezone);
    MainPanel.add(jltime);
    MainManager.add(MainPanel, "main");
    /* Filling the thickness panel */
    num_of_hits = 0;
    next_index = 0;
    /* fill in with ero values for everything*/
    /*display the figure*/
    ThicknessPanel.add(thick_figure);
    JLabel blanklabel = new JLabel(" ");
    ThicknessPanel.add(blanklabel);
    JButton build_fig = new JButton("Draw Figure");
    build_fig.addActionListener(
         new ActionListener() {  // anonymous inner class
         public void actionPerformed( ActionEvent e )
    if ( num_of_hits == 0 )
    /* draw figure based on first 20 points in the array */
    next_index = num_of_rec;
    else
    if ( num_of_hits > 3 )
    JOptionPane.showMessageDialog(null,"No more data to draw","Error Drawing",JOptionPane.ERROR_MESSAGE);
    else
    /* draw the figure starting the data from index 20*/
    next_index = next_index + num_of_rec;
    num_of_hits += 1;
    ThicknessPanel.add(build_fig);
    MainManager.add(ThicknessPanel, "thickness");
    /* filling the database panel */
    label1 = new JLabel(" ",SwingConstants.CENTER);
    welcome_label = new JLabel(" Database Page ",SwingConstants.CENTER);
    label2 = new JLabel(" ",SwingConstants.CENTER);
    fieldsPanel.add( label1 );
    fieldsPanel.add( welcome_label );
    fieldsPanel.add( label2 );
    field_label = new JLabel(" Enter your name: ");
    data_entry = new JTextField( 10 );
    sub_panel.add( field_label );
    sub_panel.add( data_entry );
    fieldsPanel.add( sub_panel );
    JButton add_data = new JButton( "Add me" );
    add_data.addActionListener(
         new ActionListener() {  // anonymous inner class
         public void actionPerformed( ActionEvent e )
              try {
    Statement statement = connection.createStatement();
                   String get_field;
              get_field = data_entry.getText();
              String query = "INSERT INTO data (anyField) VALUES ('"+get_field+"')";
              int result1 = statement.executeUpdate( query );
              if ( result1 == 1 )
              JOptionPane.showMessageDialog(null, "Thanks for the info..."," Data Entry Success",JOptionPane.INFORMATION_MESSAGE);
                        data_entry.setText(" ");     
              else
                        JOptionPane.showMessageDialog(null, "Sorry, your name was not added...","Data entry error",JOptionPane.ERROR_MESSAGE);
         catch ( SQLException sqlex ) {
         // process SQLExceptions here
              sqlex.printStackTrace();
                   System.out.println( "Connection UN Suucessfull");
              catch ( Exception ex ) {
              // process remaining Exceptions here
              ex.printStackTrace();
                   System.out.println( "Connection UN Suucessfull");
    fieldsPanel.add(add_data);
    MainManager.add(fieldsPanel, "data_base");
    /* display time */
    Timer timer = new Timer(1000, new ActionListener() {
    public void actionPerformed(ActionEvent actionevent)
    timezone = showTime(new Locale("en", "US"));
    setTitle("PHOENIX MACHINERY s.a.l " + timezone);
    timer.start();
    public static void main(String args[])
    FinalMachine finalmachine = new FinalMachine();
    finalmachine.setSize(500, 500);
    ImageIcon imageicon = new ImageIcon("images/pc.gif");
    finalmachine.setIconImage(imageicon.getImage());
    finalmachine.show();
    public static String showTime(Locale locale)
    java.util.Date date = new java.util.Date();
    byte byte0 = 2;
    DateFormat dateformat = DateFormat.getTimeInstance(byte0, locale);
    String s = dateformat.format(date);
    return s;
    /* Thread loadData starts here */
    public class loadData extends Thread
    public void run()
    try {
              readMyFile();
              read_flag = 1;
              notify();
    catch( Exception x )
    System.out.println("The following error occured in LoadData thread : "+x.toString() );
    } // run() ends here
    /* method read file inside thread loadData */
    void readMyFile() {
    String record = " ";
    recCount = 0;
    try {
              tem_file = new File("mydata.dat");
              data_file = new FileReader(tem_file);
              b_data_file = new BufferedReader( data_file );
              record = new String();
              while ( (record = b_data_file.readLine()) != null ) {
              dataBuffer[recCount] = Integer.parseInt(record);
              recCount += 1; }
         b_data_file.close();     
              catch (IOException e) {
         System.out.println("Uh oh, got an IOException error!");
         e.printStackTrace();
         } // end of readMyFile()
    } // thread loadData ends
    public class setData extends Thread {
    public void run()
    try {
              while ( !read_flag ) {
                   try {     wait(); }
                   catch( InterruptedException e ) {
                        e.printStackTrace();
              } // end while
              for(int index = 0; index < 60; index++)
              System.out.println("Array["+index+"] = "+dataBuffer[index]);
    catch( Exception x )
    System.out.println("The following error occured in LoadData thread : "+x.toString() );
    } // run() ends here
    the only added thing is the setData thread, i want this thread to start printing out the array whenever, loadData thread has finished filling the data inside the array please i need ur help.

  • VERY URGENT!! How to Pass a "% " symbol from form to Report

    Hi
    I am using oracle 10g and passing a symbol "%" as a parameter to the report from a form. But it shows error as follows:
    REP-52006: Failed to decode the specified URL PARAMETER1=%.
    But it is working when it runs in the Report directly.
    Then Why we can't pass the symbol "%" to the report from form.
    Please reply me as soon as possible. IT IS VERY URGENT !!

    Hi,
    Try using a lexical parameter(&parm_1) for a string of values or a bind parameter(:parm_1) for a single value
    Thanks,
    Kimosabe

  • Unable to start IDC Content Service(Very Urgent)

    Hi,
    My local system has Windows XP.I have installed Oracle 10g Express Edition,Apache,has jre1.6.0_03 and run the UCM installer.Both IDC Content Admin Service and IDC Content Service are set to start automatically during installation time."IDC Content Admin Service" is getting started automatically but "IDC Content Service" is not getting started.It is getting the following Error Message when we are starting IDC Content Service
    Error 1064 : An exception occured in the service when handling the Control Request.
    I have already installed Oracle Database 10g and D2k 10g also on my local system.
    i am getting following error in the log file
    Failed to initialize the server. Unable to initialize the system provider 'SystemDatabase'. Unable to create database connection for the database 'SystemDatabase' with connection string 'jdbc:oracle:thin:@localhost:1521:xe'. Please make sure that the connection string, user and password are correct. Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    The Connection descriptor used by the client was:
    localhost:1521:xe
    Unable to create database connection for the database 'SystemDatabase' with connection string 'jdbc:oracle:thin:@localhost:1521:xe'. Please make sure that the connection string, user and password are correct. Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    The Connection descriptor used by the client was:
    localhost:1521:xe
    java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    The Connection descriptor used by the client was:
    localhost:1521:xe [ Details ]
    A fatal error has occurred. The stack trace below shows more information.
    !csFailedToInitServer!csProviderUnableToInitialize,SystemDatabase!csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:<br>ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor<br>The Connection descriptor used by the client was:<br>localhost:1521:xe<br>!csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:<br>ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor<br>The Connection descriptor used by the client was:<br>localhost:1521:xe<br>!syExceptionType2,java.sql.SQLException,Listener refused the connection with the following error:<br>ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor<br>The Connection descriptor used by the client was:<br>localhost:1521:xe<br>
    intradoc.common.ServiceException: !csProviderUnableToInitialize,SystemDatabase!csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:
    ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor
    The Connection descriptor used by the client was:
    localhost:1521:xe
         at intradoc.server.IdcSystemLoader.loadProviders(IdcSystemLoader.java:1949)
         at intradoc.server.IdcSystemLoader.initProviders(IdcSystemLoader.java:1729)
         at intradoc.server.IdcSystemLoader.finishInit(IdcSystemLoader.java:221)
         at intradoc.server.IdcSystemLoader.init(IdcSystemLoader.java:185)
         at intradoc.server.IdcServerManager.init(IdcServerManager.java:73)
         at IdcServerNT.init(IdcServerNT.java:86)
         at IdcServerNT.main(IdcServerNT.java:54)
    Caused by: intradoc.data.DataException: !csJdbcUnableToCreateConnection,SystemDatabase,jdbc:oracle:thin:@localhost:1521:xe!$Listener refused the connection with the following error:
    ORA-12505\, TNS:listener does not currently know of SID given in connect descriptor
    The Connection descriptor used by the client was:
    localhost:1521:xe
         at intradoc.jdbc.JdbcConnectionUtils.getConnection(JdbcConnectionUtils.java:88)
         at intradoc.jdbc.JdbcWorkspace.init(JdbcWorkspace.java:97)
         at intradoc.provider.Provider.init(Provider.java:68)
         at intradoc.server.IdcSystemLoader.loadProviders(IdcSystemLoader.java:1937)
         ... 6 more
    Caused by: java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
    The Connection descriptor used by the client was:
    localhost:1521:xe
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
         at oracle.jdbc.driver.PhysicalConnection.&#60;init&#62;(PhysicalConnection.java:441)
         at oracle.jdbc.driver.T4CConnection.&#60;init&#62;(T4CConnection.java:165)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at intradoc.jdbc.JdbcConnectionUtils.getConnection(JdbcConnectionUtils.java:70)
         ... 9 more
    The Oracle Homes are different for both the Oracle.
    If somebody have idea about this problem,please help me. This is very urgent.
    Manoj Baghel
    [email protected]

    I think so..
    Your Oracle Database doesn't connect to content server..
    Maybe, you can edit the configuration of your UCM..
    Please open the file at C:\oracle\ucm\server\config\config.cfg..
    And then add the code :
    NumConnection = 5;
    CMIIW

  • Need very urgent help

    Hi every1,
    i am in a very bad situation as i am very new to AS3, so i
    need some help from any one who can help me out of this.
    I have created a FLV Player using FLVPlayback Component
    everything is working fine but the only problem is the rewind and
    forward button behaves very strange when i test it on web page
    residing in a webserver.
    In brief i want to say that the rewind and forward control in
    the application works alright when i play it in my local machine
    but when i take the file to a web sever and play it the controls
    behave very strange (when i click on the forward and rewind button
    it just takes me to the end of the movie and to the start of the
    movie at one shot which should not be the purpose of the rewind and
    forward button).
    So, somebody please look at my code below and i will be very
    thank full to the person who can send me the correct code.
    The code for the rewind and forward control is higlighted in
    the below code. please help... .very urgent..........
    import fl.video.*;
    var flvSou:String;
    var dynText:String;
    myflv.autoPlay = true;
    onscreen_play_btn.visible = false;
    onscreen_replay_btn.visible = false;
    if (myflv.playing) {
    onscreen_play_btn.visible = false;
    onscreen_replay_btn.visible = false;
    //myflv.source = "Call_to_action.flv";
    myflv.source = root.loaderInfo.parameters.flvSou;
    dynTxt.text = String(root.loaderInfo.parameters.dynText);
    slash_txt.text = "/";
    myflv.playPauseButton = playPause_btn;
    myflv.stopButton = stop_btn;
    myflv.muteButton = mute_btn;
    myflv.volumeBar = volume_bar;
    myflv.volume = .6;
    myflv.forwardButton = forward_btn;
    myflv.backButton = back_btn;
    myflv.seekBar = seek_bar;
    myflv.bufferingBar = buffering_bar;
    myflv.fullScreenButton = fullscreen_btn;
    //========================= Actions for Button Controls
    =========================//
    //========================= Actions for Play and Pause Button
    =========================//
    playPause_btn.pause_mc.addEventListener(MouseEvent.CLICK,
    clickHandlerPause);
    function clickHandlerPause(event:MouseEvent):void {
    //trace("clickHandler detected an event of type: " +
    event.type);
    //trace("the event occurred on: " + event.target.name);
    trace("u clicked pause button");
    onscreen_play_btn.visible = true;
    //myflv.alpha = .5; // uncomment later
    playPause_btn.play_mc.addEventListener(MouseEvent.CLICK,
    clickHandlerPlay);
    function clickHandlerPlay(event:MouseEvent):void {
    //trace("clickHandler detected an event of type: " +
    event.type);
    //trace("the event occurred on: " + event.target.name);
    trace("u clicked play button");
    onscreen_play_btn.visible = false;
    //myflv.alpha = 100; // uncomment later
    if (onscreen_replay_btn.visible==true) {
    onscreen_replay_btn.visible=false;
    //========================= Actions for Play and Pause Button
    =========================//
    //========================= Actions for FLVPlayback
    =========================//
    myflv.addEventListener(MouseEvent.CLICK,
    clickHandlerPauseFlv);
    function clickHandlerPauseFlv(event:MouseEvent):void {
    //trace("clickHandler detected an event of type: " +
    event.type);
    //trace("the event occurred on: " + event.target.name);
    trace("u clicked video component button");
    trace(myflv.totalTime);
    if (myflv.playing==true) {
    myflv.pause();
    onscreen_play_btn.visible = true;
    //myflv.alpha = .5; // uncomment later
    } else {
    myflv.play();
    onscreen_play_btn.visible = false;
    onscreen_replay_btn.visible = false;
    //myflv.alpha = 100; // uncomment later
    //========================= Actions for FLVPlayback
    =========================//
    //========================= Actions for Fullscreen Button
    =========================//
    fullscreen_btn.addEventListener(MouseEvent.CLICK,onFullScreenButtonClick);
    function onFullScreenButtonClick(event:MouseEvent):void {
    stage.displayState = StageDisplayState.FULL_SCREEN;
    //or set it to normal like: stage.displayState =
    StageDisplayState.NORMAL;
    //========================= Actions for Fullscreen Button
    =========================//
    //========================= Actions for onScreenPlay Button
    =========================//
    onscreen_play_btn.addEventListener(MouseEvent.CLICK,onScreenPlayButtonClick);
    function onScreenPlayButtonClick(event:MouseEvent):void {
    trace("working");
    if (myflv.playing==true) {
    myflv.pause();
    } else {
    myflv.play();
    //myflv.alpha = 100; // uncomment later
    onscreen_play_btn.visible = false;
    //========================= Actions for onScreenPlay Button
    =========================//
    //========================= Actions for onScreenReplay Button
    =========================//
    onscreen_replay_btn.addEventListener(MouseEvent.CLICK,onScreenReplayButtonClick);
    function onScreenReplayButtonClick(event:MouseEvent):void {
    trace("working");
    myflv.play();
    //myflv.seek(0);
    onscreen_replay_btn.visible = false;
    if (onscreen_play_btn.visible==true) {
    onscreen_play_btn.visible=false;
    //========================= Actions for onScreenReplay Button
    =========================//
    //========================= Actions for Stop Button
    =========================//
    stop_btn.addEventListener(MouseEvent.CLICK, StopButtonClick);
    function StopButtonClick(event:MouseEvent):void {
    myflv.seek(0);
    //myflv.autoRewind = true;
    //myflv.stop();
    onscreen_replay_btn.visible = true;
    //========================= Actions for Stop Button
    =========================//
    //========================= Actions for Button Controls
    =========================//
    //========================= Actions for Displaying Elapsed
    and Total Time =========================//
    myflv.addEventListener(MetadataEvent.METADATA_RECEIVED,
    cp_listener);
    function cp_listener(eventObject:MetadataEvent):void {
    //trace("Elapsed time in seconds: " + myflv.playheadTime);
    //trace("Total time is: " + eventObject.info.duration);
    var rounded:int = Math.round(eventObject.info.duration);
    var minutes:int = Math.floor(rounded/60);
    var seconds:int = rounded%60;
    flvTotalTime_txt.text = eventObject.info.duration;
    flvTotalTime_txt.text = (minutes<10 ? "0" :
    "")+minutes+":"+(seconds<10 ? "0" : "")+seconds;
    //flvElapsedTime_txt.text = String(myflv.playheadTime);
    stage.addEventListener(Event.ENTER_FRAME, updateTime);
    function updateTime(ev:Event):void {
    var rounded:int = Math.round(myflv.playheadTime);
    var minutes:int = Math.floor(rounded/60);
    var seconds:int = rounded%60;
    flvElapsedTime_txt.text = String(myflv.playheadTime);
    flvElapsedTime_txt.text = (minutes<10 ? "0" :
    "")+minutes+":"+(seconds<10 ? "0" : "")+seconds;
    //========================= Actions for Displaying Elapsed
    and Total Time =========================//
    myflv.addEventListener(Event.COMPLETE, com_listener);
    function com_listener(eventObject:Event):void {
    trace("movie complete");
    myflv.stop();
    onscreen_replay_btn.visible = true;
    back_btn.addEventListener(MouseEvent.CLICK, BackButtonClick);
    function BackButtonClick(event:MouseEvent):void {
    myflv.play();
    //myflv.autoRewind = true;
    //myflv.stop();
    onscreen_replay_btn.visible = false;
    /************************************ THE CODE FOR FORWARD
    AND REWIND CONTROL STARTS HERE *****************************/
    var id1:Number;
    forward_btn.addEventListener(MouseEvent.MOUSE_DOWN,
    ForwardButtonDown);
    function ForwardButtonDown(event:MouseEvent):void {
    //forward_btn.onPress = function() {
    //mklik_flv.pause();
    var dest1:Number = myflv.playheadTime;
    id1 = setInterval(function ():void {
    myflv.seek(dest1 += 2);
    }, 100);
    forward_btn.addEventListener(MouseEvent.MOUSE_UP,
    ForwardButtonUp);
    function ForwardButtonUp(event:MouseEvent):void {
    //forward_btn.onRelease = function() {
    //myflv.play();
    clearInterval(id1);
    // ************************ Forward Button Function
    // ************************ Rewind Button Function
    var id2:Number;
    back_btn.addEventListener(MouseEvent.MOUSE_DOWN,
    BackButtonDown);
    function BackButtonDown(event:MouseEvent):void {
    //back_btn.onPress = function() {
    //mklik_flv.pause();
    var dest2:Number = myflv.playheadTime;
    id2 = setInterval(function ():void {
    myflv.seek(dest2 -= 2);
    }, 100);
    back_btn.addEventListener(MouseEvent.MOUSE_UP, BackButtonUp);
    function BackButtonUp(event:MouseEvent) {
    //back_btn.onRelease = function() {
    //mklik_flv.play();
    clearInterval(id2);
    }

    how long is your flv (in seconds), if allowed to play without
    ff/rewind/pause?

  • Very Urgent! Help!

    I have an eclipse application to open a new email message with an attachment (in the default mail client) clicking a button.
    Below are my codes:-
    Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start mailto:[email protected]?subject=MailTo&cc=[email protected]&attachment="e://myfile.txt"});
    The problem is that the file can't be attached.
    Appreciate suggestions and solutions.
    Pls reply asap as this application is very urgent
    Thanks.

    You should have simplified your problem by producing a valid Windows command before trying to Runtime.exec it. What you are doing there is testing with your eyes shut.
    If you had typed that string you thought was a Windows command, and fiddled with it a bit, you would have found out that the & character is treated as a delimiter that separates a list of commands by the Windows shell. You would have seen the error message that says
    'cc' is not recognized as an internal or external command, operable program or batch file.
    Sorry, I don't know what you can do about that. But it isn't a Java question.

  • XML SQL utility ( Very Urgent)

    Hi,
    Running the Client side Front-End works for me....Thank you
    very much. These are all my questions.
    1. As far as my understanding goes XML Parsers are used to parse
    the incoming XML documents before updating the database. But
    when I used the Oraxle XML class(getXML option)I found one
    command line option called -useDOMDoc( Use the DOM API to
    generate the XML doc). I am not clear about it's functionality.
    Why it's being used to create a XML document? Or explain me
    clearly about the functionality of getXML option?
    2.With the help of putXML command line option I could insert one
    XML document into Oracle 8i ( I could insert one table only). My
    question is if I have a XML document which contains elements
    from two tables( emp and detail) and tags from the same two
    table too. In that case how could I insert into two tables? what
    I should do?
    For example my DTD has columns for two tables emp and detail.
    Here is my xml document, and the command which I am going to use
    in the command line would be
    java OracleXML putXML -user "scott/tiger" -filename xxxxx emp,
    details
    <?xml version="1.0"?>
    <!DOCTYPE ROWSET [
    <!ELEMENT ROWSET (ROW)*>
    <!ELEMENT ROW (EMPNO, ENAME?, JOB?, MGR?, HIREDATE?, SAL?,
    COMM?, DEPTNO?)>
    <!ATTLIST ROW num CDATA #REQUIRED>
    <!ELEMENT EMPNO (#PCDATA)>-----------To Table EMP
    <!ELEMENT ENAME (#PCDATA)>-----------To Table EMP
    <!ELEMENT JOB (#PCDATA)>-------------To Table EMP
    <!ELEMENT MGR (#PCDATA)>-------------To Table EMP
    <!ELEMENT HIREDATE (#PCDATA)>--------To Table EMP
    <!ELEMENT SAL (#PCDATA)>-------------To Table EMP
    <!ELEMENT COMM (#PCDATA)>------------To Table EMP
    <!ELEMENT DEPTNO (#PCDATA)>----------To Table EMP
    <!ELEMENT LOCATION (#PCDATA)>--------To Table DETAILS
    <!ELEMENT ALLOWANCE (#PCDATA)>-------To Table DETAILS
    ]>
    <ROWSET>
    <ROW num="1">
    <EMPNO>88</EMPNO>
    <ENAME>cmos</ENAME>
    <LOCATION>usa</LOCATION>
    <ALLOWANCE>1000</ALLOWANCE>
    </ROW>
    </ROWSET>
    Thanks,
    Chan...
    null

    Hi Chan,
    Hello Mr. "very urgent" Chan,
    1- The command line front end of the XSU, besides being useful
    for you users, it is also a great tool for us to test the XSU.
    Basically the -useDOMDoc makes the XSU use OracleXMLDocGenDOM to
    generate the doc. When using the query API you can pass the
    OracleXMLDocGenDom class to the getXML request and instead of a
    string contining the xml document you will get back a DOM tree
    (i.e. Document object).
    2- This issue is visited at:
    http://f2.dejanews.com/oracletechnet/members/index.cgi?do=showmsg
    &conf=Oracl1.XML&msg=1431&show=all&depth=all
    Chan (guest) wrote:
    : Hi,
    : Running the Client side Front-End works for me....Thank you
    : very much. These are all my questions.
    : 1. As far as my understanding goes XML Parsers are used to
    parse
    : the incoming XML documents before updating the database. But
    : when I used the Oraxle XML class(getXML option)I found one
    : command line option called -useDOMDoc( Use the DOM API to
    : generate the XML doc). I am not clear about it's functionality.
    : Why it's being used to create a XML document? Or explain me
    : clearly about the functionality of getXML option?
    : 2.With the help of putXML command line option I could insert
    one
    : XML document into Oracle 8i ( I could insert one table only).
    My
    : question is if I have a XML document which contains elements
    : from two tables( emp and detail) and tags from the same two
    : table too. In that case how could I insert into two tables?
    what
    : I should do?
    : For example my DTD has columns for two tables emp and detail.
    : Here is my xml document, and the command which I am going to
    use
    : in the command line would be
    : java OracleXML putXML -user "scott/tiger" -filename xxxxx emp,
    : details
    : <?xml version="1.0"?>
    : <!DOCTYPE ROWSET [
    : <!ELEMENT ROWSET (ROW)*>
    : <!ELEMENT ROW (EMPNO, ENAME?, JOB?, MGR?, HIREDATE?, SAL?,
    : COMM?, DEPTNO?)>
    : <!ATTLIST ROW num CDATA #REQUIRED>
    : <!ELEMENT EMPNO (#PCDATA)>-----------To Table EMP
    : <!ELEMENT ENAME (#PCDATA)>-----------To Table EMP
    : <!ELEMENT JOB (#PCDATA)>-------------To Table EMP
    : <!ELEMENT MGR (#PCDATA)>-------------To Table EMP
    : <!ELEMENT HIREDATE (#PCDATA)>--------To Table EMP
    : <!ELEMENT SAL (#PCDATA)>-------------To Table EMP
    : <!ELEMENT COMM (#PCDATA)>------------To Table EMP
    : <!ELEMENT DEPTNO (#PCDATA)>----------To Table EMP
    : <!ELEMENT LOCATION (#PCDATA)>--------To Table DETAILS
    : <!ELEMENT ALLOWANCE (#PCDATA)>-------To Table DETAILS
    : ]>
    : <ROWSET>
    : <ROW num="1">
    : <EMPNO>88</EMPNO>
    : <ENAME>cmos</ENAME>
    : <LOCATION>usa</LOCATION>
    : <ALLOWANCE>1000</ALLOWANCE>
    : </ROW>
    : </ROWSET>
    : Thanks,
    : Chan...
    Oracle Technology Network
    http://technet.oracle.com
    null

  • How use class file in jsp(very urgent)

    i have class file called birds (birds is actually a xslt file transformed to java class file) now this class file i have to use in my jsp file. how can i use them. if possible can any one give me sample code please very urgent
    can any one help me

    java files
    import org.w3c.dom.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import java.io.*;
    public class XmlParser
         public String XmlParser()
              try
    String strXML= "employee.xml";
                   String xslFile = "employeeId.xsl";
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                   StreamResult theTransformationResult = new StreamResult( new ByteArrayOutputStream() );
                   Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
                   transformer.transform(new StreamSource(new StringReader(strXML)), theTransformationResult);
                   String output = theTransformationResult.getOutputStream().toString()
              catch(Exception e)
                   System.out.println(" ***** XmlParser.XmlParser ERROR ***** " + e);
    return output;
    using class files in jsp
    <%@ page import="com.qqqq.aaaa.XmlParser"%>
    <%
         XmlParser xmlParser          =     new XmlParser();
    out.println(xmlParser.XmlParser());
    %>
    i think it will help you.

  • How to send Zip files as attachments !! Very urgent, Please help!

    I am sending PDF files as attachments using java mail (it works fine). But now my requirement is to zip the PDFs and send them as attachments instead of actual PDF's. But i don't know how to achieve that. does java mail API support zip attachment facilities? I have looked in activation API also, but i couldn't find anything helpful. even i searched the forums, but no clue. Please, anybody help me about this, it's very urgent.
    thanks
    sri

    Check the first "if". If I specify an attachment, then a myme multipart doby is created: one for text and the other for the attachemnt I use this myme ovbject only for attachemnts, because some ISPs have problems and report error in email format if the attachemnet is missing and it contains only text and no attachment.
    static public void send(String to,
         String from,
         String host,
         String smtpPort,
         String subject,
         String body,
         String fileAttachment,
         String attachmentMimeType,
         String username,
         String password,
         String debug)
    throws Exception
         // create some properties and get the default Session
         Properties props = new Properties();
         props.put("mail.smtp.host", host);
         props.put("mail.smtp.port", smtpPort);
         props.put("mail.smtp.timeout","5000");
         props.put("mail.debug", debug);
         Session session = null;
         if (username != null && password != null)
              props.put("mail.smtp.auth", "true");
              MyPasswordAuthenticator auth = new MyPasswordAuthenticator(username, password);
              session = Session.getDefaultInstance(props,auth);
         else
              session = Session.getDefaultInstance(props, null);
         //session.setDebug(true);
         // create a message
         MimeMessage message = new MimeMessage(session);
         message.setFrom(new InternetAddress(from));
         InternetAddress[] address = InternetAddress.parse(to, false);
         message.setRecipients(Message.RecipientType.TO, address);
         message.setSubject(subject);
         message.setSentDate(new Date());
         // create the message part
         if ( fileAttachment != null && fileAttachment != "NO" )
              MimeBodyPart messageBodyPart = new MimeBodyPart();
              //fill message
              messageBodyPart.setText(body);
              //Multipart multipart = new MimeMultipart();
              Multipart multipart = new MimeMultipart("alternative");
              multipart.addBodyPart(messageBodyPart);
              // Part two is attachment
              System.out.println("----->fileAttachment DISTINTO de NULL");
              messageBodyPart = new MimeBodyPart();
              FileDataSource fds = new FileDataSource(fileAttachment);
              messageBodyPart.setDataHandler( new DataHandler(fds));
              messageBodyPart.setFileName(fileAttachment); //<-- El archivo atachado.
              multipart.addBodyPart(messageBodyPart);
              //EN DESARROLLO el envio de attachment!!          
              // Put parts in message
              message.setContent(multipart);
         } else { //Envio es solamente TEXTO
              message.setText(body);
         // send the message
         Transport.send(message);
    Regards,
    Vladimir

  • A very urgent deployment issue about DBAdapter

    Hello All,
    I have a very urgent deployment issue about DBAdapter.
    That DBAdapter is connect to DB2 AS400 Database. I have a developing database (jdbc:as400://server01/TEST) and a production database (jdbc:as400://server01/PROD).
    During developing, I used DBAdapter wizard to create it, and import some tables, and set the Adapter to use jabc/DB2DS as connection information for easily deployment later.
    Then I deploy to Production. I configured Data-source.xml and oc4j-ra.xml rightly; I set DB connection point to production database. But the DBAdapter still write into developing Database.
    I checked the DBAdapter, the imported tables are something like this, TEST.table1, TEST.table2. And there are a lot "TEST" located in DB2Writer_toplink_mapping.xml, DB2Writer.xml, TEST.schema, DB2Writer.table1.ClassDescriptor.xml.
    This TEST is refrer to the TEST in connect String jdbc:as400://server01/TEST.
    I think this might be the reason cause the problem. As to production database, "TEST" should replaced by "PROD". If I changed it manually, I have to change every time when switch between TEST and PROD. And I also don't know if it is safe to do it? (I tried, and bring some toplink mapping problem)
    By the way, for Oracle Database, because we use 2 instances for testing and production with same schema name, and do not have this issue.
    Anyone could help and many thanks.
    Kerr
    Message was edited by:
    Kerr

    Hi Kerr,
    The idea is to set up all connections in the BPEL or ESB services with logical names, e.g. typically of the form eis/DB/MyFinancialSystem or eis/DB/MyLogisticsSystem. This way, you do not have to modify code when deploying it onto different environments that serve different purposes.
    When moving your services through their lifecyle, on every environment you deploy these to you will have the same logical connections configured on each instance, e.g. for DEV, QA, SIT, UAT and PROD. Only, in case of QA the actual physical connection is configured to point to the QA instance of the systems that your services interact with whereas in case of UAT it points to the UAT instance of the same system.
    Maybe your problem is caused by connecting as user "SomeUser" when running the DB Adapter wizard during development and actually selecting objects from a different schema than you used to connect with, e.g. "Test" in your case.
    Hth,
    Sjoerd

Maybe you are looking for