Plz check the code

Hi all,
Friends please tell me what is the problem with this code.....
It is not giving what i want.......
I want only that row in the table to have orange background which contains the value 'check'..
but what it does is that it sets all the other rows as orange too....
but when i select all the rows in the table.....it does show the color of the cell which contains 'check' and the color of the rest of the cells which are set to highlight color...
please chk the following code and let me know if there is any error...
public class ErrorEntryCellRenderer extends DefaultTableCellRenderer {
    /** Creates a new instance of ErrorEntryCellRenderer */
    public ErrorEntryCellRenderer() {
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        Component retValue;
        retValue = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        if(value instanceof String) {
            if(((String)value).equalsIgnoreCase("check")) {
                setBackground(Color.ORANGE);
                validate();
        return retValue;
}Thank you..
Message was edited by:
vaibhavpingle

it doesnt work then...it does not paint any thing......
i did the following changes
public Component getTableCellRendererComponent(JTable table, Color c, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        Component retValue;
        retValue = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        if(value instanceof String) {
            if(((String)value).equalsIgnoreCase("check")) {
                setBackground(Color.ORANGE);
                validate();
            } else {
                setBackground(c);
                validate();
        return retValue;
    }

Similar Messages

  • Plz check the code and tell me necessary  modifications

    report Z_PHANIBDC2
           no standard page heading line-size 255.
    include bdcrecx1.
    PARAMETERS:P_FILE   LIKE RLGRAP-FILENAME DEFAULT
    'C:Documents and Settingssarath.vempatiDesktopphani1.TXT' OBLIGATORY
    DATA: BEGIN OF RECORD1 OCCURS 0,
            LIFNR(018),
            BURKS(011),
            KTOKK(014),
            ANRED(014),
            NAME1(014),
            SURTL(014),
            STRAS(012),
            ORT01(040),
            LAND1(013),
            SPRAS(019),
            KUNNR(015),
            BANKL(012),
            BANKS(018),
            AKONT(022),
            ZTERM(012),
            MAHNA(016),
    END OF RECORD1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME           = 'P_FILE '
    *   DEF_PATH               = ' '
       MASK                   = ',*.*,*.*. '
       MODE                   = 'O'
       TITLE                  = 'GET FILENAME '
    IMPORTING
       FILENAME               = P_FILE
    *   RC                     =
    EXCEPTIONS
       INV_WINSYS             = 1
       NO_BATCH               = 2
       SELECTION_CANCEL       = 3
       SELECTION_ERROR        = 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.
    START-OF-SELECTION.
    *LOOP AT RECORD1 FROM 2.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    *   CODEPAGE                      = ' '
       FILENAME                      = 'P_FILE '
       FILETYPE                      = 'DAT'
    *   HEADLEN                       = ' '
    *   LINE_EXIT                     = ' '
    *   TRUNCLEN                      = ' '
    *   USER_FORM                     = ' '
    *   USER_PROG                     = ' '
    *   DAT_D_FORMAT                  = ' '
    * IMPORTING
    *   FILELENGTH                    =
      TABLES
        DATA_TAB                      = RECORD1
    EXCEPTIONS
       CONVERSION_ERROR              = 1
       FILE_OPEN_ERROR               = 2
       FILE_READ_ERROR               = 3
       INVALID_TYPE                  = 4
       NO_BATCH                      = 5
       UNKNOWN_ERROR                 = 6
       INVALID_TABLE_WIDTH           = 7
       GUI_REFUSE_FILETRANSFER       = 8
       CUSTOMER_ERROR                = 9
       NO_AUTHORITY                  = 10
       OTHERS                        = 11
      DATA : RECORD LIKE RECORD1 OCCURS 0 WITH HEADER LINE.
      DATA : RECORD3 LIKE RECORD1 OCCURS 0 WITH HEADER LINE.
      DATA : LIFNR1 LIKE LFA1-LIFNR.
      LOOP AT RECORD1.
        IF RECORD1-LIFNR <> ''.
          LIFNR1 = RECORD1-LIFNR.
          RECORD3-LIFNR = RECORD1-LIFNR.
          RECORD3-BURKS = record1-BURKS.
          APPEND RECORD3.
        ELSE.
          RECORD3-LIFNR = LIFNR1.
          RECORD3-BURKS = record1-BURKS.
          APPEND RECORD3.
        ENDIF.
      ENDLOOP.
      DELETE RECORD1 WHERE LIFNR = ''.
      RECORD[] = RECORD1[].
      DATA VAR1(15).
      DATA VAR2(15).
      DATA COUNT(2).
      DATA COUNT1(2) VALUE 1.
      DATA VAR3(16).
      DATA VAR4(16).
      DATA VAR5(16).
      DELETE ADJACENT DUPLICATES FROM RECORD COMPARING LIFNR BURKS.
    write:/ 'phani'.
    *IF SY-SUBRC <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    perform open_group.
    perform bdc_dynpro      using 'SAPMF02K' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  record1-lifnr.
    perform bdc_field       using 'RF02K-BUKRS'
                                  RECORD1-BURKS.
    perform bdc_field       using 'RF02K-KTOKK'
                                  RECORD1-KTOKK.
    perform bdc_field       using 'RF02K-REF_LIFNR'
                                  RECORD1-LIFNR.
    perform bdc_field       using 'RF02K-REF_BUKRS'
                                  RECORD1-BURKS.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-TELX1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-ANRED'
                                  'RECORD1-ANRED'.
    perform bdc_field       using 'LFA1-NAME1'
                                  'RECORD1-NAME1'.
    perform bdc_field       using 'LFA1-SORTL'
                                  'RECORD1-SORTL'.
    perform bdc_field       using 'record1-STRAS'
                                  'RECORD1-STRAS'.
    perform bdc_field       using 'LFA1-ORT01'
                                  'RECORD1-ORT01'.
    perform bdc_field       using 'LFA1-LAND1'
                                  'RECORD1-LAND1'.
    perform bdc_field       using 'LFA1-SPRAS'
                                  'RECORD1-SPRAS'.
    perform bdc_dynpro      using 'SAPMF02K' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-KUNNR'
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFBK-BANKL(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'LFBK-BANKS(01)'
                                  'IN'.
    perform bdc_field       using 'LFBK-BANKL(01)'
                                  'RECORD1-BANKL'.
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-BANKS(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPMF02K' '0210'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-AKONT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0215'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-ZTERM'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0220'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-MAHNA'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'XK01'.
    perform close_group.

    report Z_PHANIBDC2
           no standard page heading line-size 255.
    include bdcrecx1.
    DATA: BEGIN OF RECORD1 OCCURS 0,
            LIFNR(018),
            BURKS(011),
            KTOKK(014),
            ANRED(014),
            NAME1(014),
            SURTL(014),
            STRAS(012),
            ORT01(040),
            LAND1(013),
            SPRAS(019),
            KUNNR(015),
            BANKL(012),
            BANKS(018),
            AKONT(022),
            ZTERM(012),
            MAHNA(016),
    END OF RECORD1.
    <b>perform upload.</b>
    perform open_group.
    loop at recored.
    perform bdc_dynpro      using 'SAPMF02K' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  record1-lifnr.
    perform bdc_field       using 'RF02K-BUKRS'
                                  RECORD1-BURKS.
    perform bdc_field       using 'RF02K-KTOKK'
                                  RECORD1-KTOKK.
    perform bdc_field       using 'RF02K-REF_LIFNR'
                                  RECORD1-LIFNR.
    perform bdc_field       using 'RF02K-REF_BUKRS'
                                  RECORD1-BURKS.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-TELX1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-ANRED'
                                  'RECORD1-ANRED'.
    perform bdc_field       using 'LFA1-NAME1'
                                  'RECORD1-NAME1'.
    perform bdc_field       using 'LFA1-SORTL'
                                  'RECORD1-SORTL'.
    perform bdc_field       using 'record1-STRAS'
                                  'RECORD1-STRAS'.
    perform bdc_field       using 'LFA1-ORT01'
                                  'RECORD1-ORT01'.
    perform bdc_field       using 'LFA1-LAND1'
                                  'RECORD1-LAND1'.
    perform bdc_field       using 'LFA1-SPRAS'
                                  'RECORD1-SPRAS'.
    perform bdc_dynpro      using 'SAPMF02K' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-KUNNR'
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFBK-BANKL(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'LFBK-BANKS(01)'
                                  'IN'.
    perform bdc_field       using 'LFBK-BANKL(01)'
                                  'RECORD1-BANKL'.
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-BANKS(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPMF02K' '0210'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-AKONT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0215'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-ZTERM'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0220'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'record1-MAHNA'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'XK01'.
    endloop.
    perform close_group.
    <b>form upload.</b>
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
       FILENAME                       = ' '
       FILETYPE                      = 'DAT'
      HEADLEN                       = ' '
      LINE_EXIT                     = ' '
      TRUNCLEN                      = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      DAT_D_FORMAT                  = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = RECORD1
    EXCEPTIONS
       CONVERSION_ERROR              = 1
       FILE_OPEN_ERROR               = 2
       FILE_READ_ERROR               = 3
       INVALID_TYPE                  = 4
       NO_BATCH                      = 5
       UNKNOWN_ERROR                 = 6
       INVALID_TABLE_WIDTH           = 7
       GUI_REFUSE_FILETRANSFER       = 8
       CUSTOMER_ERROR                = 9
       NO_AUTHORITY                  = 10
       OTHERS                        = 11
      DATA : RECORD LIKE RECORD1 OCCURS 0 WITH HEADER LINE.
      DATA : RECORD3 LIKE RECORD1 OCCURS 0 WITH HEADER LINE.
      DATA : LIFNR1 LIKE LFA1-LIFNR.
      LOOP AT RECORD1.
        IF RECORD1-LIFNR <> ''.
          LIFNR1 = RECORD1-LIFNR.
          RECORD3-LIFNR = RECORD1-LIFNR.
          RECORD3-BURKS = record1-BURKS.
          APPEND RECORD3.
        ELSE.
          RECORD3-LIFNR = LIFNR1.
          RECORD3-BURKS = record1-BURKS.
          APPEND RECORD3.
        ENDIF.
      ENDLOOP.
      DELETE RECORD1 WHERE LIFNR = ''.
      RECORD[] = RECORD1[].
      DATA VAR1(15).
      DATA VAR2(15).
      DATA COUNT(2).
      DATA COUNT1(2) VALUE 1.
      DATA VAR3(16).
      DATA VAR4(16).
      DATA VAR5(16).
      DELETE ADJACENT DUPLICATES FROM RECORD COMPARING LIFNR BURKS.
    write:/ 'phani'.
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    endform.

  • Please check the code

    I AM TRYING TO REPLICATE THE ADDRESS OF EQUIPMENT FROM ECC TO CRM.
    I AM ABLE TO REPLICATE THE IDENTIFICATION NUMBER.
    WHILE USING THE SAME FUNCTION MODULE FOR ADDRESS, THE ADDRESS IS NOT GETTING REPLICATED.
    PLEASE CHECK THE CODE AND TELL ME WHAT PRE-REQUISITES MUST BE TAKEN INTO CONSIDERATION AND IS THERE ANY MISTAKE FROM ME.
    FULL POINTS WILL BE REWARDED.
    ITS VERY VERY URGENT.
    METHOD IF_EX_CRM_EQUI_LOAD~ENLARGE_COMPONENT_DATA.
    **Data declarations
    DATA:
        ls_equi          type crmt_equi_mess,
        ls_comp          type ibap_dat1,
        ls_comp_det1     TYPE IBAP_COMP3,
        ls_address_data  type ADDR1_DATA,
        ls_object      type comt_product_maintain_api,
        ls_object1     type comt_product,
        lv_object_id   type IB_DEVICEID,
        lv_object_guid type IB_OBJNR_GUID16.
    **Map Sort field from ECC to CRM
    Read table it_equi_dmbdoc-equi into ls_equi index 1.
    lv_object_id  = ls_equi-equnr.
    move is_object to ls_object.
    move ls_object-com_product to ls_object1.
    lv_object_guid = ls_object1-product_guid.
    move is_component to ls_comp.
    ls_comp_det1-deviceid    = lv_object_id.
    ls_comp_det1-object_guid = lv_object_guid.
    ls_comp_det1-EXTOBJTYP   = 'CRM_OBJECT'.
    ls_comp_det1-ibase       = ls_comp-ibase.
    ls_address_data-roomnumber = '1000'.
    ls_address_data-floor = '10'.
    ls_address_data-country = 'US'.
    CALL FUNCTION 'CRM_IBASE_COMP_CHANGE'
      EXPORTING
       i_comp                       = ls_comp
       I_COMP_DET             = ls_comp_det1
       I_ADDRESS_DATA     = ls_address_data
      I_ADDRESS_ADMIN           =
      I_PARTNER                 =
      I_DATE                    =
      I_TIME                    =
    EXCEPTIONS
      DATA_NOT_CONSISTENT       = 1
      IBASE_LOCKED              = 2
      NOT_SUCCESFUL             = 3
      OTHERS                    = 4
    *IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    ENDMETHOD.

    Hi S B,
    May I the procedure for the replication of serialnumber into device ID that is Identification field In Ibase.
    And one more thing need this to be codded in the standard badi or needed an copy of the implementation .
    plz help me as u already have done the requirement.
    u will be twice rewarded.
    Thanking u in advance for the reply.
    Sree.

  • I didnt konw how to make a new account for my iTues card so i did it with a diffrent email but that email doesnt exist and when i tried to make it on a real email i just sai invalid code check the code and try again and can u please help me

    please help me it is a card of 25 dollars and i dont want it to go to waist i by mistake thought you used a frake email so i made one up i thought i was going to have a new one but then it said it was going to send a verifaction to my email so then i tried to use a real email and put in the code but it just kept on saying invalid code. check the code and try again. and i dont know what to do can u please please help me it was a gift and i really dont want it to go to waist please i need help

    for #1
    Frequently asked questions about Apple ID - Apple Support
    I have multiple Apple IDs. Is there a way for me to merge them into a single Apple ID?
    Apple IDs cannot be merged. You should use your preferred Apple ID from now on, but you can still access your purchased items such as music, movies, or software using your other Apple IDs.
    If you are wondering how using multiple Apple IDs relate to iCloud, see Apple IDs and iCloud.
    for #2
    Apple does not accept unsolicited ideas see Apple - Legal - Unsolicited Idea Submission Policy

  • Apple TV keeps asking my for my Credit Card verification code and I punch it in, still asks me for it, and restarted everything, went to my computer, checked the code, all is set, still can't rent a movie. Please help!

    Apple TV keeps asking my for my 3digit  Credit Card verification code and I punch it in, it still asks me for it, and went to my computer on iTunes store, checked the code, all is set and saved, go back to Apple TV still can't rent a movie, I still get the same Verification Required message without any further information after I punch in my 3digits. When I hit submit, the page goes back to the same place to type the code again, and yes the code is 100% accurate. I tried restoring the apple tv, every thing is up to date on all devices and signed in and out of my itunes store on my Mac, still no luck. Please help!

    This issue actually started a week ago... see: https://discussions.apple.com/message/23399558#23399558
    to determine if there are the same problems you are experiencing.  I have spent over 6 hours on this issue trying to isolate if it is a hardware, software, network, iTunes account, or Apple device issue.  My initial results indicate it is a software specific issue related to the Apply TV hardware device.

  • How to check the code source of some function in the portal.

    hi all.
    i have some problem  in the portal.
    i use the ESS in the portal, and now some people can not check their salary.
    i want to check the code source, but i do not know it uses which program.
    can some one tell me the way to check the program.
    best regards.

    If you want to access the source code of any ESS component, you will need access to NWDI. NWDI NWDI = NetWeaver Development Infrastructure, it provide the tools and process to build new / modify existing applications built using NWDS. There are plenty of threads discussing how to set up NWDI, you may search for the same.
    However if the payslip problem is only for some users, it could also be a pdf issue, have you tried running the payslip for those select users within ECC?
    Thanks,
    GLM

  • Check the code pls. getting attachment but some data missing

    HI all,
    PLs check the  code. I am getting mail in the attachment is having only " 12".  i am not getting 13 and 14.
    where i am doing wrong. ?
    TABLES:adr6.
    TYPES: BEGIN OF t_test,
    x(3),
    y(3),
    z(3),
    END OF t_test.
    DATA: itab TYPE STANDARD TABLE OF t_test,
    wa TYPE t_test.
    SELECT-OPTIONS : s_rcvr FOR adr6-smtp_addr LOWER CASE VISIBLE LENGTH 30
    NO INTERVALS OBLIGATORY.
    wa-x = 12.
    wa-y = 13.
    wa-z = 14.
    APPEND wa TO itab.
    *LOOP at itab INTO wa.
    WRITE:/ wa-x, wa-y, wa-z.
    *ENDLOOP.
    PERFORM send_email.
    **& Form send_email
    *text
    *--> p1 text
    *<-- p2 text
    FORM send_email .
      DATA : lo_mail_docu TYPE REF TO cl_document_bcs,
      lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
      lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL ,
      lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL ,
      l_oref TYPE REF TO cx_root,
      l_message_body TYPE bcsy_text VALUE IS INITIAL,
      l_message_line LIKE LINE OF l_message_body,
      l_doc_subject TYPE so_obj_des,
      l_file_subject TYPE so_obj_des,
      l_mail_subject TYPE string,
      l_text TYPE string.
      DATA itab_bin TYPE TABLE OF solix.
      CONCATENATE 'Error' ' Log ' INTO l_doc_subject SEPARATED BY space.
      l_mail_subject = l_doc_subject.
      CALL FUNCTION 'SCMS_TEXT_TO_BINARY'
        TABLES
          text_tab   = itab
          binary_tab = itab_bin.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CONCATENATE 'Attached is the' 'log file generated '
      INTO l_message_line-line SEPARATED BY space.
      APPEND l_message_line TO l_message_body.
      APPEND '' TO l_message_body. APPEND '' TO l_message_body.
      TRY.
          lo_mail_docu = cl_document_bcs=>create_document(
          i_type = 'RAW'
          i_text = l_message_body
          i_subject = l_doc_subject ).
          lo_mail_docu->add_attachment(
          EXPORTING
          i_attachment_type = 'TXT'
          i_attachment_subject = l_file_subject
          i_att_content_hex = itab_bin ).
          lo_send_request = cl_bcs=>create_persistent( ).
          CALL METHOD lo_send_request->set_message_subject
            EXPORTING
              ip_subject = l_mail_subject.
          LOOP AT s_rcvr .
            lo_recipient = cl_cam_address_bcs=>create_internet_address( s_rcvr-low ).
            lo_send_request->add_recipient(
            EXPORTING
            i_recipient = lo_recipient
            i_express = '' ).
          ENDLOOP.
          lo_send_request->set_document( lo_mail_docu ).
          lo_send_request->set_send_immediately( 'X' ).
          lo_send_request->send( ).
        CATCH : cx_send_req_bcs INTO l_oref,
        cx_document_bcs INTO l_oref,
        cx_address_bcs INTO l_oref.
      ENDTRY.
      COMMIT WORK.
      FREE : lo_mail_docu, lo_send_request, lo_sender, lo_recipient, l_oref.
      REFRESH : l_message_body, itab_bin.
      CLEAR : l_message_line, l_doc_subject, l_mail_subject, l_file_subject,
      l_text.
    ENDFORM.                    "send_email
    Thanks
    krupali

    HI Jelena,
    I think we cannot commenting the
    CALL FUNCTION 'SCMS_TEXT_TO_BINARY'  because we are transfering the data in binary format.
    Have you got the mail with full ITAb data ?
    have you tried it ?
    I have tried by commenting the
    CALL FUNCTION 'SCMS_TEXT_TO_BINARY'  but getting syntax error.
    Any other idea please  ?
    Thanks in advance
    krupali.

  • Im trying to redeem my prepaid illustrator card and it keeps coming up with an 'invalid code" I've check the code but I've typed the right code in. Help?

    Im trying to redeem my prepaid illustrator card and it keeps coming up with an 'invalid code" I've check the code but I've typed the right code in. Help?

    Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

  • How to check the code of spawned report

    Hi All,
    I've to modify a standard report from PA module.The report name is "PRC: Distribute Usage and Miscellaneous Costs"
    The executable method is SPAWNED.The executable name is PASDUC.
    Please let me know how to check the code of this report and in which path can I locate the report.
    Regards,
    Mahi.

    Does this mean can I tell to my client that "This is being a spawned program, any customizations to this report needs full report development efforts"?I believe yes.
    Before I state this to my client I want to verify with this forum. Please suggest me in either case.Would your client trust my reply on here :) ?
    I would suggest you log a SR and confirm this with Oracle support, that would be a better proof.
    Thanks,
    Hussein

  • Plz check the report ?

    hi,
    i writen the report by using bolck alvs  then iam not getting the field value in RS_SELFELD structure so that iam not able to check condition like
    if rs_selfield-fieldname = 'vbeln'.
    so that to rectify this is there any other solution plz send with code. iam also sending source code.
    REPORT  ZSSALV_BLOCKED.
    TYPE-POOLS : SLIS.
    TYPES: BEGIN OF ST_VBAK,
           VBELN TYPE VBAK-VBELN,
           ERDAT TYPE VBAK-ERDAT,
           VBTYP TYPE VBAK-VBTYP,
           NETWR TYPE VBAK-NETWR,
           WAERK TYPE VBAK-WAERK,
           END OF ST_VBAK.
    TYPES: BEGIN OF ST_VBAP,
           VBELN TYPE VBAP-VBELN,
           POSNR TYPE VBAP-POSNR,
           MATNR TYPE VBAP-MATNR,
           MATKL TYPE VBAP-MATKL,
           POSAR TYPE VBAP-POSAR,
           MEINS TYPE VBAP-MEINS,
           END OF ST_VBAP.
    DATA: IT_VBAK     TYPE TABLE OF ST_VBAK,
          W_VBAK      TYPE ST_VBAK,
          IT_VBAP     TYPE TABLE OF ST_VBAP,
          IT_TABLE    TYPE SLIS_TABNAME,
          W_VBAP      TYPE ST_VBAP,
          IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          W_FIELDCAT  TYPE SLIS_FIELDCAT_ALV,
          W_IS_LAYOUT TYPE SLIS_LAYOUT_ALV,
          IT_EVENT    TYPE SLIS_T_EVENT,
          REPID       TYPE SY-REPID.
    REPID = SY-REPID.
    REFRESH IT_VBAK.
    SELECT VBELN ERDAT VBTYP NETWR WAERK FROM VBAK INTO TABLE IT_VBAK UP TO 10 ROWS.
    W_FIELDCAT-FIELDNAME  = 'VBELN'.
    W_FIELDCAT-COL_POS    = '1'.
    W_FIELDCAT-SELTEXT_L  = 'SALES_DOCU_NO'.
    APPEND W_FIELDCAT TO IT_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-FIELDNAME  = 'ERDAT'.
    W_FIELDCAT-COL_POS    = '2'.
    W_FIELDCAT-SELTEXT_L  = 'SALES_DOCU_DATE'.
    APPEND W_FIELDCAT TO IT_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-FIELDNAME  = 'VBTYP'.
    W_FIELDCAT-COL_POS    = '3'.
    W_FIELDCAT-SELTEXT_L  = 'SALES_DOCU_TYPE'.
    APPEND W_FIELDCAT TO IT_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-FIELDNAME  = 'NETWR'.
    W_FIELDCAT-COL_POS    = '4'.
    W_FIELDCAT-SELTEXT_L  = 'NET_VALUE'.
    APPEND W_FIELDCAT TO IT_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_FIELDCAT-FIELDNAME  = 'WAERK'.
    W_FIELDCAT-COL_POS    = '5'.
    W_FIELDCAT-SELTEXT_L  = 'CURRENCY'.
    APPEND W_FIELDCAT TO IT_FIELDCAT.
    CLEAR W_FIELDCAT.
    W_IS_LAYOUT-ZEBRA = 'X'.
    W_IS_LAYOUT-NO_VLINE = 'X'.
          CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
            EXPORTING
              I_CALLBACK_PROGRAM             = REPID
            I_CALLBACK_PF_STATUS_SET       = ' '
             I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
            IT_EXCLUDING                   =
       CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          IS_LAYOUT                        = W_IS_LAYOUT
          IT_FIELDCAT                      = IT_FIELDCAT
          I_TABNAME                        = IT_TABLE
          IT_EVENTS                        = IT_EVENT
        TABLES
          T_OUTTAB                         = IT_VBAK
       EXCEPTIONS
         PROGRAM_ERROR                    = 1
         MAXIMUM_OF_APPENDS_REACHED       = 2
         OTHERS                           = 3.
         CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
         EXCEPTIONS
            PROGRAM_ERROR                 = 1
            OTHERS                        = 2
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                          rs_selfield TYPE slis_selfield.
    DATA:  IT_TABLE1     TYPE SLIS_TABNAME,
           IT_EVENT1     TYPE SLIS_T_EVENT,
           IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
           W_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV,
           W_IS_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
      CASE R_UCOMM.
      WHEN '&IC1'.
        IF RS_SELFIELD-FIELDNAME = 'VBELN' .
        REFRESH IT_VBAP.
        SELECT VBELN POSNR MATNR MATKL POSAR MEINS FROM VBAP INTO TABLE IT_VBAP WHERE VBELN = RS_SELFIELD-VALUE.
       ENDIF.
      ENDCASE.
    W_FIELDCAT1-FIELDNAME  = 'VBELN'.
    W_FIELDCAT1-COL_POS    = '1'.
    W_FIELDCAT1-SELTEXT_L  = 'SALES'.
    APPEND W_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR W_FIELDCAT1.
    W_FIELDCAT1-FIELDNAME  = 'POSNR'.
    W_FIELDCAT1-COL_POS    = '2'.
    W_FIELDCAT1-SELTEXT_L  = 'ITEM_NOS'.
    APPEND W_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR W_FIELDCAT1.
    W_FIELDCAT1-FIELDNAME  = 'MATNR'.
    W_FIELDCAT1-COL_POS    = '3'.
    W_FIELDCAT1-SELTEXT_L  = 'MATERIAL_TYPE'.
    APPEND W_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR W_FIELDCAT1.
    W_FIELDCAT1-FIELDNAME  = 'MATKL'.
    W_FIELDCAT1-COL_POS    = '4'.
    W_FIELDCAT1-SELTEXT_L  = 'MATKL'.
    APPEND W_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR W_FIELDCAT1.
    W_FIELDCAT1-FIELDNAME  = 'POSAR'.
    W_FIELDCAT1-COL_POS    = '5'.
    W_FIELDCAT1-SELTEXT_L  = 'POSAR'.
    APPEND W_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR W_FIELDCAT1.
    W_FIELDCAT1-FIELDNAME  = 'MEINS'.
    W_FIELDCAT1-COL_POS    = '6'.
    W_FIELDCAT1-SELTEXT_L  = 'MEINS'.
    APPEND W_FIELDCAT1 TO IT_FIELDCAT1.
    CLEAR W_FIELDCAT1.
    W_IS_LAYOUT1-ZEBRA = 'X'.
    W_IS_LAYOUT1-NO_VLINE = 'X'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = W_IS_LAYOUT1
        IT_FIELDCAT                      = IT_FIELDCAT1
        I_TABNAME                        = IT_TABLE1
        IT_EVENTS                        = IT_EVENT1
      TABLES
        T_OUTTAB                         = IT_VBAP
    EXCEPTIONS
       PROGRAM_ERROR                    = 1
       MAXIMUM_OF_APPENDS_REACHED       = 2
       OTHERS                           = 3.
    ENDIF.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
       EXCEPTIONS
         PROGRAM_ERROR                 = 1
         OTHERS                        = 2.
      REFRESH IT_VBAP.
    ENDFORM.
    bye.

    Hi Abhay,
    check if you are taking work area for every Internal Table in Smartform or not .
    just have to drag and drop that work area field into the position you want to display
    <i>Reward Points if it helps solves query .</i>
    Regards,
    Amber S

  • URGENT check the code for vendor ageing (Give Solution)

    hi this is the code which i am using to calculate the
    ageing but not able to get the result.
    every time the result is 0.plz suggest me the solution.
    its very urgent.
    *& Report  Z_VENDOR AGEING                                                    *
    *&  in this repoet I am calculating the vendor ageing
        which is depending on formula
        AGEING = Current Date(or any date entered by user) – Bline Date(BSIK-zfbdt) 
    REPORT  z_vendor  NO STANDARD PAGE HEADING
                      LINE-SIZE 200
                      LINE-COUNT 65(3).
    TABLES : bsik.
    DATA : BEGIN OF t_out OCCURS 0,
           bukrs LIKE bsik-bukrs,
           saknr LIKE bsik-saknr,
           bldat LIKE bsik-bldat,
           wrbtr LIKE bsik-wrbtr,
           lifnr LIKE bsik-lifnr,
           zfbdt like bsik-zfbdt,
           ageing type i,
           END OF t_out.
    parameters : p_date1 type d.
    SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,
                     s_saknr FOR bsik-saknr,
                     s_lifnr FOR bsik-lifnr.
    SELECT bukrs saknr bldat wrbtr lifnr zfbdt
           FROM bsik
           INTO  TABLE t_out
           WHERE saknr IN s_saknr
           AND bukrs IN s_bukrs
           AND lifnr IN s_lifnr.
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_bis                   = p_date1
        i_datum_von                   = t_out-zfbdt
      I_KZ_EXCL_VON                 = '0'
      I_KZ_INCL_BIS                 = '0'
      I_KZ_ULT_BIS                  = ' '
      I_KZ_ULT_VON                  = ' '
      I_STGMETH                     = '0'
      I_SZBMETH                     = '1'
    IMPORTING
       E_TAGE                        = t_out-ageing
    EXCEPTIONS
      DAYS_METHOD_NOT_DEFINED       = 1
      OTHERS                        = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT t_out.
      WRITE : / t_out-saknr,
                t_out-lifnr,
                t_out-wrbtr,
                t_out-zfbdt,
                t_out-ageing.
    ENDLOOP.

    hi sanjeev,
    still problem there.
    dont worry. just copy this code.
    try this code.
    TABLES : bsik.
    DATA : BEGIN OF t_out OCCURS 0,
    bukrs LIKE bsik-bukrs,
    saknr LIKE bsik-saknr,
    bldat LIKE bsik-bldat,
    wrbtr LIKE bsik-wrbtr,
    lifnr LIKE bsik-lifnr,
    zfbdt like bsik-zfbdt,
    ageing type i,
    END OF t_out.
    parameters : p_date1 type d.
    SELECT-OPTIONS : s_bukrs FOR bsik-bukrs,
    s_saknr FOR bsik-saknr,
    s_lifnr FOR bsik-lifnr.
    SELECT bukrs saknr bldat wrbtr lifnr zfbdt
    FROM bsik
    INTO <b>corresponding fields of</b> TABLE t_out
    WHERE saknr IN s_saknr
    AND bukrs IN s_bukrs
    AND lifnr IN s_lifnr.
    <b>loop at t_out.</b>
    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
    EXPORTING
    i_datum_bis = p_date1
    i_datum_von = t_out-zfbdt
    I_KZ_EXCL_VON = '0'
    I_KZ_INCL_BIS = '0'
    I_KZ_ULT_BIS = ' '
    I_KZ_ULT_VON = ' '
    I_STGMETH = '0'
    I_SZBMETH = '1'
    IMPORTING
    E_TAGE = t_out-ageing
    EXCEPTIONS
    DAYS_METHOD_NOT_DEFINED = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    <b>modify t_out.</b>
    clear t_out.
    <b>endloop.</b>
    LOOP AT t_out.
    WRITE : / t_out-saknr,
    t_out-lifnr,
    t_out-wrbtr,
    t_out-zfbdt,
    t_out-ageing.
    endloop
    rgds
    anver
    Message was edited by: Anversha s

  • Please check the code why it is not working

    I am a new java servlets and jsp learner. I am running below example of session in Tomcat and "AccessCount" supposed to be increased by one value whenever servelet is refereshed. But I am always getting 0 value even after refereshing it.
    I will appreciate your help.
    =======================================================
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.net.*;
    import java.util.*;
    /** Simple example of session tracking. See the shopping
    * cart example for a more detailed one.
    public class ShowSession extends HttpServlet {
    public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Session Tracking Example";
    String heading;
    HttpSession session = request.getSession(true);
    // Use getAttribute instead of getValue in version 2.2.
    Integer accessCount = (Integer)session.getAttribute("accessCount");
    if (accessCount == null) {
    accessCount = new Integer(0);
    heading = "Welcome, Newcomer";
    } else {
    heading = "Welcome Back";
    accessCount = new Integer(accessCount.intValue() + 1);
    // Use setAttribute instead of putValue in version 2.2.
    session.setAttribute("accessCount", accessCount);
    out.println("<html><h1>" + title + "</h1>" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1 ALIGN=\"CENTER\">" + heading + "</H1>\n" +
    "<H2>Information on Your Session:</H2>\n" +
    "<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
    "<TR BGCOLOR=\"#FFAD00\">\n" +
    " <TH>Info Type<TH>Value\n" +
    "<TR>\n" +
    " <TD>ID\n" +
    " <TD>" + session.getId() + "\n" +
    "<TR>\n" +
    " <TD>Creation Time\n" +
    " <TD>" +
    new Date(session.getCreationTime()) + "\n" +
    "<TR>\n" +
    " <TD>Time of Last Access\n" +
    " <TD>" +
    new Date(session.getLastAccessedTime()) + "\n" +
    "<TR>\n" +
    " <TD>Number of Previous Accesses\n" +
    " <TD>" + accessCount + "\n" +
    "</TABLE>\n" +
    "</BODY></HTML>");
    /** Handle GET and POST requests identically. */
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    ========================================================

    Change the code
    HttpSession session =
    request.getSession(true);AS
    HttpSession session =
    request.getSession(false);If you pass "false", then the Session is not created.
    If you pass "true" the session is always created
    new.
    Thanks and regards,
    Pazhanikanthan. PI dont think that's correct -
    1. request.getSession(false) returns a Session object if one exists.
    2. request.getSession(true) creates a new Session object if it doesnt exist or returns the reference to the existing object if the request is part of an valid session.
    OP, check with default session-timeout values in web.xml
    Ram.

  • Please check the code reg mail implementation and give guide lines to me

    Hi experts
    I written some code for implementing the mail in webdynpro using java mail API,i did not get the out put ,Is any configuration i have to do in webdynpro or WAS
    Can any body review my code and tell me where i mistaken in the implementation .Is there any thing i want to configure .Here with i am sending my code in the action of Send button
    public void onActionSendMail(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionSendMail(ServerEvent)
        // get the values entered by the user  in the form
        try{
        String toAddress=wdContext.currentContextElement().getTo();
        String ccAddress=wdContext.currentContextElement().getCC();
        String bccAddress=wdContext.currentContextElement().getBCC();
        String subject=wdContext.currentContextElement().getSubject();
        String messageBody=wdContext.currentContextElement().getMessage();
        //set the properties of host and port no
        Properties p = new Properties();
        p.put("mail.transport.protocol","smtp");
        p.put("mail.smtp.host","12.38.145.108");
         p.put("mail.smtp.port","25");
         //get the session object or connection to the mail server or host
         Session sess=Session.getDefaultInstance(p,null);
         //create a MimeMessage and add recipients
         MimeMessage message = new MimeMessage(sess);
         if(toAddress !=null && toAddress.length()>0){
              message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
         }else
              wdComponentAPI.getMessageManager().reportSuccess("Please Enter the To Address");
         if(bccAddress !=null && bccAddress.length()>0)
         message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bccAddress));
         if(ccAddress !=null && ccAddress.length()>0)
         message.addRecipient(Message.RecipientType.CC, new InternetAddress(ccAddress));
        if(subject!=null && subject.length()>0)
         message.setSubject(subject);
         message.setFrom(new InternetAddress("[email protected]"));
         if((messageBody!=null) && (messageBody.length()>0))
              message.setContent(messageBody,"text/plain");
         }else
              message.setContent("","text/plain"); 
         Transport.send(message);
        catch(Exception e)
             e.printStackTrace();
    Please mail to :  [email protected]
    Thanks and regards
    kalyan

    Hi Venkat,
       The code seems ok to me. you don't need to configure WAS to use JavaMail APIs. However, if this code doesnot work then check with the code given below as this is working fine.
    Properties prop = new Properties();
              prop.put("mail.smtp.host", host);
              prop.put("mail.smtp.auth", "false");
              Session session = Session.getInstance(prop, null);
              session.setDebug(true);
              try {
                   MimeMessage msg = new MimeMessage(session);
                   msg.setFrom(new InternetAddress(from));
                   InternetAddress[] address =
                        { new InternetAddress(to1)};
                   msg.setRecipients(Message.RecipientType.TO, address);
                   msg.setSubject(subject);
                   msg.setSentDate(new Date());
                   MimeBodyPart msg1Body = new MimeBodyPart();
                   msg1Body.setText(msg1);
                   MimeBodyPart msg2Body = new MimeBodyPart();
                   msg2Body.setText(msg2);
                   Multipart mp = new MimeMultipart();
                   mp.addBodyPart(msg1Body);
                   mp.addBodyPart(msg2Body);
                   msg.setContent(mp);
                   Transport.send(msg);
              } catch (AddressException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   System.out.print("AddressException : " + e.getMessage());
              } catch (MessagingException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   System.out.print("MessagingException : " + e.getMessage());
              } catch (Exception e) {
                   System.out.print("Exception : " + e.getMessage());
    where host is 12.38.145.108 in your case. May be you chk if your mail server  is using another port. 25 is the default port for the smtp. This may be the case that your code is not working.
    Regards:
    Abhinav Sharma
    PS : Do reward points if it helps

  • Plz chk the code wats wrong in it

    hi
    i m having itab with vbeln
    and ztable with objnr and ordsent.
    where objnr and vbeln are equal
    so now when i find objnr EQ vbeln i have to modify the ztable-ordsent = ' '.
    i have writen the followin code
    LOOP AT lt_ztsd2marc INTO ls_ztsd2marc.
        READ TABLE ct_success INTO ls_success WITH KEY ordnr =
        ls_ztsd2marc-ordnr.
        IF sy-subrc EQ 0.
          ls_ztsd2marc-ordsent = ' '.
          MODIFY TABLE lt_ztsd2marc FROM ls_ztsd2marc TRANSPORTING ordsent .
          MODIFY ztsd2marc FROM TABLE lt_ztsd2marc.
          IF sy-subrc EQ 0.
            MESSAGE s112(z2).
          ENDIF.
        ENDIF.
      ENDLOOP.
    its updating it in work area but the changes are not gettin reflected in the internal table and not even in my ztable ztsd2marc.
    plz tell me wat is wrong in this code?

    hi..
    jus try the code below.. it'll def give the solution to ur question.
    i've jus modified little of ur code that u posted.
    LOOP AT lt_ztsd2marc INTO ls_ztsd2marc.
    READ TABLE ct_success INTO ls_success WITH KEY ordnr =
    ls_ztsd2marc-ordnr.
    IF sy-subrc EQ 0.
    ls_ztsd2marc-ordsent = ' '.
    MODIFY TABLE lt_ztsd2marc FROM ls_ztsd2marc TRANSPORTING ordsent
    where ordnr = ls_ztsd2marc-ordnr .
    **MODIFY ztsd2marc FROM TABLE lt_ztsd2marc.
    update ztsd2marc set ordsent = it_ztsd2marc-orsent
    where ordnr = it_ztsd2marc-ordnr.
    IF sy-subrc EQ 0.
    MESSAGE s112(z2).
    ENDIF.
    ENDIF.
    ENDLOOP.
    all the best

  • SAX problem(plz see the code given)

    hi all,
    i am using SAX parser for validating my xml file against the dtd,i am getting some errors that i am not able to make out.cud u plz help me.i am sending u my files.
    ------------------------java file------------------------------------
    import java.io.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    public class Echo extends DefaultHandler
    public static void main(String argv[]){
    if (argv.length != 1) {
    System.err.println("Usage: cmd filename");
    System.exit(1);
    // Use an instance of ourselves as the SAX event handler
    //DefaultHandler handler=new DefaultHandler();
    Echo handler=new Echo();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(true);
    try {
    // Set up output stream
    out = new OutputStreamWriter(System.out, "UTF8");
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse( new File(argv[0]), handler );
    catch (SAXParseException spe) {
    // Error generated by the parser
    System.out.println("\n** Parsing error"
    + ", line " + spe.getLineNumber()
    + ", uri " + spe.getSystemId());
    System.out.println(" " + spe.getMessage() );
    }catch (Throwable t){
    t.printStackTrace();
    System.exit(0);
    static private Writer out;
    public void startDocument()
    throws SAXException{
    emit("<?xml version='1.0' encoding='UTF-8'?>");
    nl();
    public void endDocument()
    throws SAXException{
    try {
    nl();
    out.flush();
    }catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void startElement(String namespaceURI,
    String sName, // simple name (localName)
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
    String eName = sName; // element name
    if ("".equals(eName)) eName = qName; // namespaceAware = false
    emit("<"+eName);
    if (attrs != null) {
    for (int i = 0; i < attrs.getLength(); i++) {
    String aName = attrs.getLocalName(i); // Attr name
    if ("".equals(aName)) aName = attrs.getQName(i);
    emit(" ");
    emit(aName+"=\""+attrs.getValue(i)+"\"");
    emit(">");
    public void endElement(String namespaceURI,
    String sName, // simple name
    String qName // qualified name
    throws SAXException
    emit("</"+qName+">");
    public void characters(char buf[], int offset, int len)
    throws SAXException
    String s = new String(buf, offset, len);
    emit(s);
    public void ignorableWhitespace(char buf[], int offset, int Len)
    throws SAXException
    nl();
    //emit("IGNORABLE");
    private void emit(String s)
    throws SAXException
    try {
    out.write(s);
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    private void nl()
    throws SAXException
    String lineEnd = System.getProperty("line.separator");
    try {
    out.write(lineEnd);
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void error(SAXParseException e)
    throws SAXParseException
    throw e;
    public void warning(SAXParseException e)throws SAXParseException{
    System.out.println("WARNING : Line Number:- "+e.getLineNumber());
    System.out.println("WARNING : Column Number:- "+e.getColumnNumber());
    System.out.println("WARNING : System ID:- "+e.getSystemId());
    System.out.println("WARNING : Public Number:- "+e.getPublicId());
    --------------------------xml file------------------------------------
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE slideshow SYSTEM "echo.dtd">
    <!-- A SAMPLE set of slides -->
    <slideshow
    title="Sample Slide Show"
    date="Date of publication"
    author="Yours Truly"
    >
    <![CDATA[Digram : frobmorten <------------ fuznaten
    | <3> ^
    | <1> | <1> = fozzle
    V | <2> = framboze
    Staten+ <3> = frenzle
    <2>
    ]]>
    <!-- TITLE SLIDE -->
    <slide type="all">
    <image src="my.gif" alt="this is my pic" type="image/gif"/>
    <title>Wake up to WonderWidgets!</title>
    </slide>
    <!-- OVERVIEW -->
    <slide type="all">
    <title>Overview</title>
    <item>WonderWidgets are great</item>
    <item/>
    <item>Who buys WonderWidgets</item>
    </slide>
    <slide type="all">
    <title>Overview</title>
    <item>Who buys WonderWidgets</item>
    </slide>
    </slideshow>
    -----------------------------dtd file---------------------------------
    <!ELEMENT slideshow (slide+)>
    <!ATTLIST slideshow
    title CDATA #IMPLIED
    date CDATA #IMPLIED
    author CDATA #IMPLIED
    >
    <!ELEMENT slide (image?,title, item*)>
    <!ATTLIST slide type CDATA #IMPLIED>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT item (#PCDATA | item)* >
    <!ELEMENT image EMPTY>
    <!ATTLIST image
    alt CDATA #IMPLIED
    src CDATA #REQUIRED
    type CDATA "image/gif"
    >
    -----------------------ERROR I AM GETTING IS--------------------------
    <?xml version='1.0' encoding='UTF-8'?>
    <slideshow title="Sample Slide Show" date="Date of publication" author="Yours Tr
    uly">
    Digram : frobmorten <------------ fuznaten
    | <3> ^
    | <1> | <1> = fozzle
    V | <2> = framboze
    Staten+ <3> = frenzle
    <2>
    <slide type="all">
    <image src="my.gif" alt="this is my pic" type="image/gif"></image>
    <title>Wake up to WonderWidgets!</title>
    </slide>
    <slide type="all">
    <title>Overview</title>
    <item>WonderWidgets are great</item>
    <item></item>
    <item>Who buys WonderWidgets</item>
    </slide>
    <slide type="all">
    <title>Overview</title>
    <item>Who buys WonderWidgets</item>
    </slide>
    org.xml.sax.SAXException: The content of element type "slideshow" must m
    atch "(slide)+".
    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
    ava:979)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at Echo.main(Echo.java:28)
    with my lot efforts i am not able to make out where i am wrong,plz do have a look on the codes.
    thanx in advance
    best regards
    anshul

    Hi i have consulted the XML spec and it is not possible to have a CDATA section as element content. A element declaration can have only content that is empty, ANY (i.e. can include any other declared elements in DTD), mixed (i.e. can contain PCDATA or child elements, or child elements. An element cannot include any character data which CDATA represents. i.e it is not valid to do <!ELEMENT slideshow CDATA>
    The CDATA can only be used with an attribute declaration. Regard CDATA as a type definition for any attribute variables.
    So what do i suggest. You could declare a separate element which has an attribute for the CDATA section
    <!ELEMENT input (Name)>
    <!ATTLIST input instructions CDATA #REQUIRED>
    hope this helps.

Maybe you are looking for