Signed classes & preventing code modification

Hi, I've got a generic question concerning preventing code modification.
Suppose I have written some neat code (yeah, that might happen, one never knows ;-)) and I want to bundle it in a JAR AND make sure nobody will modify my code (at least, without a warning).
All right. I make up my JAR, and I sign it. This adds a SIGNER.SF & SIGNER.DSA/.RSA to the JAR.
Yes... but... what prevents another person from:
1. downloading my JAR
2. unjarring my JAR, and retrieving the important .classes
3. eventually, modifying the .class (to make my code silly and ugly for instance ! ;-( ).
4. make again the JAR, and sign it with his own keys
You'll tell me: "Yes, this is possible, but then the code is signed by him, not by you !". Correct... But who will warn the user that has downloaded my code that he's not using "my" code but another one.
I'll have to tell him "check the signature is 0215AB45...". 1/ This is Highly unpractical... 2/ If He's the bad guy, this does not prevent him from modifying my code !
Any solution or interesting thoughts for that topic ?
Thanks,
Axelle.

Signing is not intended to prevent modification, java classes can always be decompiled, modified and redistributed. What signing does is allow modification to be detected.
If a user has your public key, he will be able to detect that the (modified) jar was not signed by you, and hence is untrustworthy.
Similarly a java application can detect that a given jar file (or even object, eg: an authentication token) was not signed by you, and hence cannot be trusted. If however the Bad Girl has access to the application code, she can decompile said application code and modify it so that it doesn't care.
If you want to protect your code, you can try obfuscating it (there are various obfuscation tools around, do a search on google), but all this does is make the decompiled code less easy to read (variable names all a1, a2, etc), and won't really stop anyone who is serious about stealing your cool code.
Another option might be to deploy a compiled version (if you are distributing an application to a single platform), but this won't work with applets, loses the portability of java classes, and if the Bad Girl is good enough (and determined enough) it will only slow her down (though probably a fair bit).
The only sure fire way I know of preventing your Java code from being stolen is to not distribute it, which is hardly useful.

Similar Messages

  • How Midlet Signing prevents code modification.

    Hello
    I've previously read somethings about signing but never experienced it.
    I have a question now.
    Every where it is said that signing a midlet prevents others from modifying my code and distribute it under my name.
    Is this easy for any user to check the certificate owner on his handset??
    And could you please tell me how it can be done??

    Yeah, I'm pretty sure of that thanks to watching the diagnostics window. Everything falls apart at that point. Yes, Class 3 root certs are installed on the devices.
    We're regenerating our cert, so we'll see what happens then and hopefully our problem is solved.
    Thanks for the reply!

  • Code modification...urgent

    hi experts,
    i am new to enhancement and modifications.
    can anybody tell me
    1.is the term modification and code modification one and the       
       same?or different?if so,
    2.what is code modification?
    3.how do u do code modification?
    4.adv. and disadv. of code modifications?
    i appreciate if u provide links also.
    thanks in advance.

    Hi
    Explicit Enhancement Options
    There are two types of explicit enhancement options: Source code enhancements with source code plug-ins and BAdIs:
    •        Explicit enhancement options of the source code enhancement type allow you to insert source code plug-ins. These are lines of code that are executed if the source code enhancement option is inserted in the code with the Enhancement Point command. Source code enhancement options with the Enhancement Section command behave the same, except that the source code plug-in replaces the section in the original code. Therefore, you are not only able to enhance the original code, but can also flag specific code sections (as enhancement sections) so that other developers can replace these sections with other code without making modifications.
    •        Business Add-Ins (BAdIs) are “hangers” for object plug-ins. A BAdI definition comprises an interface with methods. BAdIs are enhanced by classes that implement the BAdI interface. If you instantiate a BAdI and then call its methods, you can, among other things, specify which method implementations are to be carried out on the basis of filter values. In other words, a BAdI method call is a dynamic method call with a specified interface, for which it is not determined until runtime which method implementations are to take place.
    In the case of source code enhancements, the definition and call coincide. You define BAdIs once in the BAdI Builder and can then call them at different points in the various compilation units.
    Implicit Enhancement Options 
    Implicit enhancement options are fixed points in compilation units – that is, points that remain intact even if the code is changed. This is important for the following reason: If the location of an enhancement is moved, you have to check manually after an upgrade whether the enhancement is still at the correct point and replace it if necessary. The following are implicit enhancement options at which enhancements can always be inserted:
    •        You can always insert source code plug-ins before the first and the after the last line of includes, methods, reports, and function modules.
    •        You can always add further optional parameters to function modules.
    •        For global classes, there are different permanent, implicit options for enhancements: You can insert additional attributes or methods, and you can add optional parameters to existing methods
    Customer-Specific Modification and Enhancement Possibilities
    Use
    The following documentation provides an overview of the customer-specific modification and enhancement possibilities in the IS-H System. Note that to implement enhancements, you require ABAP programming knowledge.
    Features
    The IS-H system provides the following technical possibilities for customer-specific modifications and enhancements
    Business Add-Ins (BAdIs)
       If default code (standard procedure defined by SAP) exists for the BAdI, please note it will be overwritten when you implement the BAdI. You can, if required, re-use the default code in your implementation.
    As of SAP NetWeaver 2004, the enhancement concept of the ABAP Workbench (Enhancement Framework) is available for BAdIs. Note that SAP Patient Management contains BAdIs that use the Enhancement Framework as well as the classic BAdIs.
    Customer Exits (transaction SMOD)
      If SAP delivers sample code for the customer exit, you can access it when implementing the exit by choosing Goto ® Sample Code. You can re-use the sample code using Copy&Paste
    User Exits from the IS-H Implementation Guide: Basic Settings ® Configuration/Systems/Events ® Display SAP User Exits.
      To implement the IS-H user exits, copy the function module delivered by SAP into a customer-specific function group. The name of the function module delivered by SAP is specified in the table you call in the IS-H Implementation Guide by choosing the path specified to the left here.
    Once you’ve copied the source code, you can modify this copy to meet your needs. Note that you must not modify the interface of your own function module.
    Now enter the name you’ve chosen for the function module in the customer table. You access this table by choosing Basic Settings ® Configuration/Systems/Events ® Configure Customer User Exits.
    If it is helpful rewards points.
    Regards
    Pratap.M

  • CGLIB generation from signed classes(in signed jar) = SecurityException

    Good Day!
    I have the following problem:
    My project uses a number of JARs signed with a jarsigner tool from JAVA distribution package including hibernate2.jar (the jar with all the hibernate stuff), spring.jar and cglib.jar (I think, exact names doesn't matter). All this jars are signed off course for security reasons.
    Then, I have my project working with Hibernate, and it uses lazy-initialized ORM-classes, so Hibernate tries to generate a proxy via CGLIB for these classes. But during initialization of Hibernate SessionFactoryImpl I'm getting a java.lang.SecurityException:
    java.lang.SecurityException: class "cern.spsea.hibernatebeans.BeamFileHibernateBean$$EnhancerByCGLIB$$773cc7e9"'s signer information does not match signer information of other classes in the same package
    cern.spsea.hibernatebeans.BeamFileHibernateBean is one of my ORM-classes and all my classes are not signed because they are in development (they are not in jar, so they can not be signed).
    I think it happens because signed code (from hibernate.jar and cglib.jar) tries to generate another signed code (cern.spsea.hibernatebeans.BeamFileHibernateBean$$EnhancerByCGLIB$$773cc7e9) but relate it to my unsigned package (cern.spsea.hibernatebeans).
    So, I have a couple of questions:
    1. Does signed code generates also signed code?
    2. If so, what can I do for development? I really need to avoid this problem only at development, because at release my classes will be also in the signed jars. Can I force CGLIB to generate not signed classes? Is it some options in JVM start command to skip security checking? May be something else?
    Any help is appreciated!
    Thanks a lot in advance!
    Roman

    I've got the same problem, if someone could help us he'll be very helpful.
    Regards,
    Alx

  • Activation problem: Adobe DRM Error System: 8 State: 4 Class: 65 Code: 59 Message: VE error 59

    Hi,
    I bought a book yesterday and I was able to open it in my vista machine. I have a second computer and I can't open my book there. I get this error:
    Adobe DRM Error
    System: 8
    State: 4
    Class: 65
    Code: 59
    Message:
    VE error 59
    --- end ---
    I already downloaded Adobe Digital Editions 1.5 beta 2, and went back to acrobat reader 6, activate from aractivate.adobe.com, but nothing seems to work. What can I do?

    System 7, code 31 is always a networking problem. Meaning something on your network is preventing the book information from getting to the rights-management server (or from the rights-management information getting sent back)
    You can check firewalls, security software, etc to see where the blockage might be, or work with your network admins if you have them. See 'Error "Adobe DRM Error" when you activate Digital Editions or access an eBook" at http://www.adobe.com/go/kb402747
    Regards,
    Bentley Wolfe
    Senior Support Engineer, Flash/Flash Player/Digital Editions
    Adobe

  • Problem in SAP standard code modification for FB03

    Hi Experts,
    I am adding 4custom fields in FB03 tcode by doing a SAP standard code modification in SE51.
    The program name is SAPMF05L and screen no. is 302(In some SAP verion, it is 304). This is the screen for document line item of an invoice.
    My problem is:
    When I add the fields in the screen, in which module will I put logic in the PBO and PAI as I am unable to figure out the German comments and the program structuring.
    Also, if anybody can tell me what to write as I am little bit confused about the logic of populating my fields with the values.
    FB03 is a display transaction so I have to keep my custom screen fields disabled.
    Regards,
    Sangeeta.

    Hi Sangeeta,
    For enhancing the screen of this Tcode, first of all search is there any Screen enhancement is provided by SAP or not and in case if it is provided then use that only.
    Regards
    Jagesh Lakdawala

  • [svn:fx-trunk] 14139: Fix for Player classes not code hinting  to framework FB projects.

    Revision: 14139
    Revision: 14139
    Author:   [email protected]
    Date:     2010-02-11 16:36:39 -0800 (Thu, 11 Feb 2010)
    Log Message:
    Fix for Player classes not code hinting  to framework FB projects. Changed all the $ tokens to use $ instead. While the compiler understands $, Flash Builder's code model does not.
    No code changes.
    QE notes: N/A
    Doc notes: N/A
    Bugs: None
    Reviewer: Pete
    Tests run: checkintests
    Is noteworthy for integration: No
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/airframework/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/airspark/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/flex/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/framework/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/osmf/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/rpc/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/spark/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/sparkskins/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/textLayout/.actionScriptProperties
        flex/sdk/trunk/frameworks/projects/wireframe/.actionScriptProperties

  • # sign in postal code field.

    Hi Experts,
    In ADRC table entry for an addr number, there is # sign in postal code field (NG26BJ#).
    And due to this incorrect # sign, there are issues occuring in the system.
    Can you suggest where do I search for this # sign in the system?
    I mean I searched for customer master, vendor master, etc but could not find out # sign in any partner data postal code field.
    Please suggest.
    -Chetan.

    Check all the tables that are on 'where used' list for ADRNR data element in dictionary (SE11).
    If it is an "orphaned" record, BW interface should not be actually pulling it in. I would recommend to base the interface on the main table (e.g. KNA1) and only pull ADRC records that are referenced.
    The easiest solution would be to write an ABAP report to update the record directly in the database. I wouldn't delete it though, just removed the # sign. Also check the OSS notes or send a message to SAP and they might provide such report for you.

  • Sign the Applet code using pfx certificate got Error?

    I use my existing certificate (.pfx) to sign my applet code as follows (without any key gen. before, directly sign by this certificate)
    jarsigner -storetype pkcs12 -keystore C:\mycert.pfx AppletCode.jar keyEntries
    Although the code can be signed, when i view this page, it prompts me "Certificate not verified" and with error:
    java.security.cert.CertificateException: Check leaf key usage failed in certificate.
    What is wrong? Any body can help me?
    * I try to geneate the self-certificate by keytool to sign my code, it can be viewed properly.

    1) Check if your .pfx certificate has the following purposes (read it using the venerable Internet Explorer):
    Ensures software came from software publisher
    Protects software from alteration after publication
    2) Put your certificate in the cacerts file

  • I can't Enter User Fields in Asset Class (t.code S_ALR_87009007)

    Hi All,
    In customizing I've to "Enter Your User Fields in Asset Class" (t.code S_ALR_87009007).
    SAP doesn't allow me to change the filling in the view, I only can display them.
    What cuold it depend on.
    Thanks for your help.
    G.

    Hi Rossi,
    This is not an authorisation issue at all.
    S_ALR_87009007, this tcode can be used to maintain a default Eval Group for asset master creation with the specified asset class.
    If your Maintainace Level at CLASS is not maintained for any evaluation group, you can edit the values over thers.
    SPRO-> FA-> AA ->Master Data -> Screen Layout -> Define Screen Layout for Asset Master Data -> Define Screen Layout for Asset Master Data....here select your screen layout, which is assigned to your questioned asset class on OAOA and click on logical field groups -> Allocations -> Field Group rules.
    Here for all eval groups, make the field status to optional and select check boxes CLASS, MNNO, SBNO and SAVE.
    Now check with S_ALR_87009007, here you will be able to edit the inputs.
    Hope this will resolve your issue.
    Regards,
    Srinu

  • VeriSign Java Object Signing (Class 3) Digital ID

    Hi,
    I have a VeriSign Java Object Signing (Class 3) Digital ID.
    How do i convert this to a file i can use for signing?
    I previously had a '.p12' file and used jarsigner which worked.
    Any help would be greatly appreciated!
    Thanks,
    J

    I just received our Verisign "Java Object Signing
    (Class 3) Digital ID". When I try to import it I get
    the following error:
    keytool error: java.lang.Exception: Input not an X.509
    certificate.
    The command I am using to import the cert is :
    keytool -import -alias pcs -file cert.cer -keystore
    vs.keystore -trustcacerts
    Any idea what I am doing wrong? I am using JDK 1.3,
    do I need to upgrade to 1.4 to import certs currently
    being provided by Verisign?
    Thanks,
    JimIf you did as I did and ordered a rsa certificate, you need to add the option
    -keyalg rsa
    to your command line.
    lmd

  • ICloud Sign out Prevention

    I have Question or rather Suggestion for Apple about IOS devices.
    If apple could introduce one more security Step to prevent signing out from iCloud or disabling the location finder, it could be great help to recover lost device. the Reason IF one have Free account and some times iOS device is used by kids who actually know the login and password but there could be sort of PIN code or admin password which should have been required if the used want to sigh out of iCloud or disable the location services, and if that PIN is not provided it should prevent disabling the location service and iCloud sign out, similarly when erasing iOS device after asking the login and password before proceeding for complete phone erase it should ask for PIN authentication which is set separately like passcode of device.

    Hi Paul,
    In order to sign out of your Apple ID on your iPad, follow the steps in this article -
    iTunes Store settings - iPhone
    If you are using iCloud, you will also want to go into Settings > iCloud > select Sign Out, the last item on the page.
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • Step by Step Instructions for Installing Self Signed Certificate using Certificate Modification Tool

    I am looking for some step by step instructions for installing the self signed certificate from my Microsoft SBS 2003 server on a Treo 755p and 750p.  In particular I need some help with the form of the actual certificate and how to use the Certificate Modification tool. 
    Some questions I have are as follows:
    1. When I install the certificate on a Windows Mobile device I used an exported version of the certificate.  This export is done using the DER x.509 format.  Is that the same form I’ll need for the Palm?  Do I need some other form? Can/should I just use sbscert.cer file that is generated when SBS is configured?
    2. Does the self signed cert need to be installed on the computer being used to update the Palm or do we just need to be able to access the appropriate .CER file?
    3. There are three things included in the PalmCertificatesTool.zip file:
                                    Trusted CAs (folder)
                                    Cert2pdb.exe
                                    PalmCertificates.exe
       How do I use these tools?
    4. It looks like the PalmCertificates.exe file opens an interface that will allow me to browse to the desired .CER file.  Then I suppose I use the < Generate PDB > to create something that needs to then be uploaded to the Palm device?  Not having any real experience with a Palm device how do I upload and install this file? 
    5. Once uploaded do I do something on the device to install it?
    If there is some white paper that provides step by step instructions on doing this that would be great.
    Thanks,
    Walt Bell
    Post relates to: Treo 755p (Verizon)
    Post relates to: Treo 755p (Verizon)

    Thanks for that.
    I have one question after reading the article 43375:
    The article has you "Turn of AutoSync" and then "Reset the device".  It then indicates the device should be left idle. 
    The next step relates to running the PalmCertificates.exe, navigate to the certificate file and add it and then run the < Generate PDB > button.  Should the device be connected to the computer during this process? If so, at what point after the reset do you connect it to the computer?
    Thanks!
    Post relates to: Treo 755p (Verizon)

  • ABAP Code Modification for Command Tickets

    Hi Experts
    Modification to processing of Command Orders & Tickets
    We require a modification to the processing being performed on sales data originating from the Command Concrete system and potentially from other systems yet to come online (e.g. Reddies Cement plant).
    The Sap process involved is
    ZINT_INBOUND_POLLING and within that,
    ZINT_CSTPORD_ROUTINES.
    The problem
    Currently there is an assumption that every sales order (and its deliveries) will include a product which is made to order, i.e. for which a production order will be required.
    In ZINT_CSTPORD_ROUTINES, a check is made to identify the production order linked to the sales order. If there is no such production order (usually because of the customeru2019s credit status) then processing of the ticket is terminated.
    This assumption would fall down if an order was to be raised (in Command) on which there is no concrete material. For example, if we sold a bag of pigment or a screed to a customer. In this case the item would be sold from stock and there would be no need for a production order
    The solution
    In the routine which checks for the existence of a production order, modify the code as follows:
    Inspect each item on the sales order
    If (and only if) there is at least one item with a category of u201CZTACu201D then check for a production order, otherwise process the order in the usual manner.
    The following Coding of programs are below.
    Report:      ZINT_INBOUND_POLLING
    Description: REDDIES Interfaces: Polling Job for Inbound Interfaces
    This report is a general file polling and distribution job for
    inbound interfaces. Interfaces are identified by their assigned ID
    and type values (refer to table ZINT_ADMIN). The polling job can be
    run only for a single interface. This restriction has been implemented
    for performance reasons. Dependent interfaces should be set up as
    separate, dependent jobs in SM37.
    For an interface to be triggered by this report, it must have:
    1. Administrative parameters entered in table ZINT_ADMIN.
    2. Other parameters (eg. organisational data such as plant or store)
       entered in table ZINT_PARAM.
    3. An interface-specific function module created in accordance with
       the inbound interface template (ZINT_INBOUND_INTERFACE).
    4. An interface-specific directory structure. This structure must
       be reflected in the directory parameters of table ZINT_ADMIN.
       Note that the directory names supplied in ZINT_ADMIN must exactly
       match those used for the actual directories.
    This job is designed to run as a periodic background job, but can
    also be run on-line when required.
    On each execution, the program performs the following tasks:
    1. Validate all selection parameters.
    2. Read interface administration and other parameters.
    3. Check the inbound directory to see if there are any new files.
    4. If there is a new file.
    4.1 Read the data and update the interface log.
    4.2 Archive the data and update the interface log.
    4.3 Call the interface function module, sending data and parameters.
    4.4 Log any messages returned from the function module.
    5. Exit.
    Please document all changes to this job carefully and clearly. Major
    additions to functionality should be put in new, parameterised form
    routines wherever possible to sustain maintainablility of the code.
    Change History:
    Date        User  Request     Description
    07/02/2006  EDWG  WG1K902600  Original program.
    20.07.2007  ROBS              Changes to handle error messages better.
    report zint_inbound_polling line-size  170
                                line-count 58(2)
                                message-id zz
                                no standard page heading.
    Global Data Declarations
    include zint_interface_data.
    data: begin of tbl_messages occurs 0,
            line(132) type c,
          end of tbl_messages.
    --Field Symbols--
    field-symbols: <function>.
    --Global Variables--
    Selection Screen
    --Interface Mode--
    RJS Start >>>
    selection-screen begin of block b1 with frame title t_mode.
    parameters: p_upl radiobutton group p1.
    selection-screen skip 1.
    select-options: s_intid for zint_intid-zint_id
                      matchcode object zint_intid,
                    s_intty for zint_intty-zint_ty
                      matchcode object zint_intty.
    selection-screen uline.
    parameters:  p_pro radiobutton group p1.
    selection-screen skip 1.
    RJS End <<<
    Interface ID
    parameters: p_intid like zint_intid-zint_id
                                matchcode object zint_intid.
    Interface type
    parameters: p_intty like zint_intty-zint_ty
                                matchcode object zint_intty
                                default 'I'.
    IDOC group or set
    parameters: p_intis type zint_is.
    select-options: s_datum for zint_data-created_on.
    selection-screen skip 1.
    parameters: p_dlgrp as checkbox default c_false.
    data: p_alone(1) type c value 'X'.
    selection-screen skip 1.
    Interface parameter set and sequence number.
    parameters: p_intsi like zint_param-zint_si,
                p_intsq type zint_sq default '001' no-display.
    selection-screen uline.
    parameters: p_apsrv radiobutton group r1,
                p_pc    radiobutton group r1.
    selection-screen skip 1.
    parameters: p_nowar as checkbox default c_true.
    selection-screen end   of block b1.
    Event Processing
    --IDOC Set Values--
    at selection-screen on value-request for p_intis.
    Display a selectable list of parameter sets
      perform select_idoc_set using    p_intid
                                       p_intty
                              changing p_intis
                                       v_rtcod.
      if v_rtcod ne c_noerr.
       Problem displaying parameter lists
        message i000 with 'Unable to display IDOC set values.'
                          'Please enter an interface ID and type.'.
      endif.
    --Parameter Set Values-----
    at selection-screen on value-request for p_intsi.
    Display a selectable list of parameter sets
      perform select_parameter_set using    p_intid
                                            p_intty
                                   changing p_intsi
                                            v_rtcod.
      if v_rtcod ne c_noerr.
       Problem displaying parameter lists
        message i000 with 'Unable to display parameter list values.'
                          'Please enter an interface ID and type.'.
      endif.
    --Check Interface Admin.---
    at selection-screen on: p_intty, p_intid.
      perform validate_interface_admin using    p_intid
                                                p_intty
                                       changing v_rtcod.
      if v_rtcod ne c_noerr.
      No administration parameters exist for interface
        message e001 with p_intid p_intty.
      endif.
    --Validate Parameter Set---
    at selection-screen on p_intsi.
      perform validate_interface_param using    p_intid
                                                p_intty
                                                p_intsi
                                       changing v_rtcod.
      if v_rtcod ne c_noerr.
      Parameter set does not exist for interface
        message e002 with p_intsi p_intid p_intty.
      endif.
    Initialisation
    initialization.
      perform set_screen_texts.
    Start of Selection
    start-of-selection.
    RJS Start >>>
      refresh: tbl_totals, tbl_messages.
    UPLOAD INBOUND DATA ---------------------
      if p_upl = 'X'.
        perform upload_data.
    PROCESS NEW or ERRORS -------------------
      else.   " p_pro = 'X'.
        perform process_data.
      endif.
    RJS End <<<
    End of Selection
    end-of-selection.
    Write the log file to the specified directory
      read table t_ibfil index 1.
      perform write_log_file tables   t_ldata
                             using    s_admin-zint_lg
                                      t_ibfil-filename
                                      p_apsrv
                             changing v_rtcod.
      if v_rtcod ne c_noerr.
      Error writing to log file
        message i000 with 'Could not write to log file for interface'
                          s_admin-zint_id '/' s_admin-zint_ty.
      endif.
    RJS Start >>>
    Write out Messages and totals
      if p_pro = 'X'.  " Processing Data
        describe table tbl_messages lines sy-tfill.
        if sy-tfill = 0.
          write:/ 'Processing Complete. Use ZSTA to analyse'.
        else.
          loop at tbl_messages.
            write:/ tbl_messages-line.
          endloop.
        endif.
      else.  " Uploading Data
        format color col_total.
        uline.
          write:/ 'Upload Details:', 132 space.
        uline.
        format color off.
        describe table tbl_totals lines sy-tfill.
        if sy-tfill = 0.
          write:/ '0 Records Processed'.
        endif.
        loop at tbl_totals.
          write:/ 'Interface ID:', tbl_totals-zint_id,
                  '     Type:', tbl_totals-zint_ty,
                  '     Command Date:', tbl_totals-created_on,
                  '     Records Processed:', tbl_totals-count.
        endloop.
        uline.
        message s999(b1) with 'Data Upload Completed'
                              '- Please see full Results uing trans ZSTA'.
      endif.
    RJS End <<<
    Form Routines
      include zint_interface_routines.
    *&      Form  upload_data
          text
    form upload_data.
      data: lt_admin type standard table of zint_admin with header line.
      data: l_message(80) type c.
      select * from zint_admin into table lt_admin
        where zint_id in s_intid
        and   zint_ty in s_intty.
      loop at lt_admin.
        refresh t_idata.
        refresh t_ibfil.
    Progress Message
        concatenate 'Reading Inbound data files in'
                    lt_admin-zint_ib
          into l_message separated by space.
        call function 'SAPGUI_PROGRESS_INDICATOR'
          exporting
          PERCENTAGE       = 0
            text             = l_message.
    Check for a new inbound file and read its data.
        perform read_inbound_data tables   t_idata
                                           t_ibfil
                                  using    lt_admin-zint_ib
                                           p_apsrv
                                  changing v_rtcod.
        if v_rtcod         ne c_noerr and
           v_rtcod         ne 7 and               " RJS- no files found
           lt_admin-zint_ib ne space.
      Write an error to the log
          perform write_log_entry
            tables t_ldata
            using  'E'
                   'ZINT_INBOUND_POLLING'
                   'READ_INBOUND_DATA'
                   'Problem reading inbound interface file.'
                   p_nowar space.
          exit.
        endif.
    Exit if there is no data.
        describe table t_idata lines v_fldsz.
        check v_fldsz gt 0.
    Write inbound data to a database table, for later access
        perform write_data tables t_idata
                           using lt_admin-zint_id
                                 lt_admin-zint_ty
                                 lt_admin-zint_fm
                                 lt_admin-zint_ib.
    Move the inbound file to the archive directory
        perform archive_inbound_data tables   t_ibfil
                                     using    p_apsrv
                                              lt_admin-zint_ar
                                              lt_admin-zint_ib
                                     changing v_rtcod.
        if v_rtcod ne c_noerr.
      Write an error to the log if unable to move file
          perform write_log_entry
            tables t_ldata
            using  'E'
                   'ZINT_INBOUND_POLLING'
                   'ARCHIVE_INBOUND_DATA'
                   'Problem archiving inbound interface file.'
                   p_nowar space.
        endif.
      endloop.
    endform.                    "upload_data
    *&      Form  process_data
          text
    form process_data.
      data: lt_idata type standard table of x_idata with header line.
      data: s_idata type x_idata,
            l_last_status(3) type c.
      data: l_message(80) type c,
            l_status(3) type c,
            l_lines(5) type c,
            l_date(10) type c.
    Validate input parameters
      if p_intid = space
      or p_intty = space
      or p_intsi = space.
        message e999(b1) with 'Mandatory fields must be filled'.
      endif.
    Read the interface administration parameters
      perform get_admin_parameters using    p_intid
                                            p_intty
                                   changing s_admin
                                            v_rtcod.
      if v_rtcod ne c_noerr.
      Write an error to the log
        perform write_log_entry
          tables t_ldata
          using  'E'
                 'ZINT_INBOUND_POLLING'
                 'GET_ADMIN_PARAMETERS'
                 'No admin. parameters for interface. Check ZINT_ADMIN'
                 p_nowar space.
      endif.
    Read the other interface parameters (if required)
      if p_intsi ne space.
        perform get_other_parameters tables   t_param
                                     using    p_intid
                                              p_intty
                                              p_intsi
                                     changing v_rtcod.
        if v_rtcod ne c_noerr.
        Write an error to the log
          perform write_log_entry
            tables t_ldata
            using  'E'
                   'ZINT_INBOUND_POLLING'
                   'GET_OTHER_PARAMETERS'
                   'No org. parameters for interface. Check ZINT_ADMIN'
                   p_nowar space.
        endif.
      endif.
    Read any Error records for reprocessing - if none, read New data
      perform read_data tables t_zint_data
                        changing v_rtcod.
      clear l_status.
      loop at t_zint_data.
    Create subset of all records, per Command Date
        at new created_on.
          refresh t_idata.
          clear l_lines.
        endat.
        at new key_val.
          add 1 to l_lines.
        endat.
        append t_zint_data-raw_data to t_idata.
    Process one date at a time
        at end of created_on.
    Progress Message:
          write t_zint_data-created_on to l_date dd/mm/yyyy.
          concatenate 'Processing' l_lines 'records for'
                      p_intid '/' p_intty '/' p_intsi 'Created:'
                      l_date
            into l_message separated by space.
          call function 'SAPGUI_PROGRESS_INDICATOR'
            exporting
              text = l_message.
    Process the incoming data
          assign s_admin-zint_fm to <function>.
          call function <function>
            exporting
              i_zint_id             = p_intid
              i_zint_ty             = p_intty
              i_zint_si             = p_intsi
              i_zint_is             = p_intis
              i_zint_dl             = p_dlgrp
              i_zint_as             = p_apsrv
              i_zint_al             = p_alone
              i_zint_nw             = p_nowar
              i_zint_sq             = p_intsq
            tables
              t_zint_mslog          = t_ldata
              t_zint_idata          = t_idata
              t_zint_param          = t_param
            changing
              c_zint_rc             = v_rtcod
            exceptions
              no_such_interface     = 1
              invalid_parameter_set = 2
              data_table_empty      = 3
              invalid_idoc_group    = 4.
          case sy-subrc.
    --No Such Interface--
            when 1.
              perform write_log_entry
                tables t_ldata
                using  'E' 'ZINT_INBOUND_POLLING' <function>
                       'Interface does not exist in ZINT_ADMIN.'
                       p_nowar space.
    --Invalid Parameter Set----
            when 2.
              perform write_log_entry
                tables t_ldata
                using  'E' 'ZINT_INBOUND_POLLING' <function>
                       'Invalid parameter set for interface. Check ZINT_PARAM'
                       p_nowar space.
    --Data Table Empty--
            when 3.
              perform write_log_entry
                tables t_ldata
                using  'E' 'ZINT_INBOUND_POLLING' <function>
                       'No inbound data. Check directory as per ZINT_ADMIN'
                       p_nowar space.
    --Invalid IDOC group--
            when 4.
              perform write_log_entry
                tables t_ldata
                using 'E' 'ZINT_INBOUND_POLLING' <function>
                      'Invalid IDOC group. Check ZINT_ADMIN.'
                      p_nowar space.
    --Others--
            when others.
          endcase.
    Now store messages not related to a specific key
          loop at t_ldata into s_ldata where key_val = space.
            move s_ldata-messg to tbl_messages-line.
            append tbl_messages.
          endloop.
          refresh t_ldata.
    If data for last date had errors, then stop processing further dates
          clear l_last_status.
          select status from zint_data into l_last_status
            where zint_id = p_intid
            and   zint_ty = p_intty
            and   key_val = t_zint_data-key_val.
          endselect.
          if l_last_status = 'ERR'.
            concatenate 'Processing Halted - Errors for Date' l_date
              into l_message separated by space.
            message s999(b1) with 'ZINT_INBOUND_POLLING' <function>
                     l_message.
            exit.
          endif.
        endat.
      endloop.
    endform.                    "process_data
    *&      Form  set_screen_texts
          Assign values to the selection screen titles.
    form set_screen_texts .
      t_mode  = 'Run Mode'.                                     " RJS
    endform.                    " set_screen_texts
    RJS Start >>>
    *&      Form  write_data
          Save the Inbound data to table ZINT_DATA, for later processing
         -->PT_IDATA   text
         -->PV_ID      text
         -->PV_TY      text
         -->PV_FM
         -->PV_IB
    form write_data tables pt_idata structure zint_idata
                    using  pv_id
                           pv_ty
                           pv_fm
                           pv_ib.
      data: l_key_val    like zint_data-key_val,
            l_seq        like zint_data-sequence,
            l_created_on like zint_data-created_on,
            l_counter    type i.
      data: lt_zint_data type standard table of zint_data with header line.
      get time.
      clear l_created_on.
      refresh lt_zint_data.
      loop at pt_idata.
        clear lt_zint_data.
        lt_zint_data-zint_id    = pv_id.
        lt_zint_data-zint_ty    = pv_ty.
        lt_zint_data-status     = 'NEW'.
    Derive both the "Key" value (KEY_VAL) and the
    "Command Data Date" value (CREATED_ON) to store on the Data table
        case pv_fm.
          when 'ZINT_INBOUND_INTERFACE_CSSORDR'.
            if pt_idata-zint_re(2) = '01'.
              perform get_command_order_key using pt_idata-zint_re
                                                  l_key_val
                                                  l_created_on.
            endif.
          when 'ZINT_INBOUND_INTERFACE_CSTPORD'.
            if pt_idata-zint_re(2) = '01'.
              perform get_prod_order_key using pt_idata-zint_re
                                               l_key_val
                                               l_created_on.
            endif.
          when 'ZINT_INBOUND_INTERFACE_CSTGISS'.
            perform get_sales_order_key using pt_idata-zint_re
                                            l_key_val.
        endcase.
        lt_zint_data-created_on = l_created_on.
        lt_zint_data-key_val    = l_key_val.
        lt_zint_data-length     = strlen( pt_idata-zint_re ).
        lt_zint_data-raw_data   = pt_idata-zint_re.
        append lt_zint_data.
      endloop.
    Setup the sequence number for each key value
      loop at lt_zint_data.
        at new key_val.
          clear l_seq.
        endat.
        add 1 to l_seq.
        lt_zint_data-sequence = l_seq.
        modify lt_zint_data.
      endloop.
    Check for existing data with this same key
      clear l_counter.
      select count(*) from zint_data into l_counter
        for all entries in lt_zint_data
        where zint_id    = lt_zint_data-zint_id
        and   zint_ty    = lt_zint_data-zint_ty
        and   created_on = lt_zint_data-created_on
        and   key_val    = lt_zint_data-key_val
        and   sequence   = lt_zint_data-sequence.
    Found duplicate data?
      if l_counter > 0.
    Yes: so remove these records from the input table
        loop at lt_zint_data.
          clear l_counter.
          select count(*) from zint_data into l_counter
            where zint_id    = lt_zint_data-zint_id
            and   zint_ty    = lt_zint_data-zint_ty
            and   created_on = lt_zint_data-created_on
            and   key_val    = lt_zint_data-key_val
            and   sequence   = lt_zint_data-sequence.
          if l_counter > 0.
            delete lt_zint_data.
          endif.
        endloop.
        message i999(b1) with 'Data already exists in SAP! Directory:' pv_ib
                              'Key:' lt_zint_data-key_val.
      endif.
    Now save whatever is not a duplicate
      loop at lt_zint_data.
    Store new data records
        insert zint_data from lt_zint_data.
    and Store totals for reporting
        tbl_totals-zint_id    = lt_zint_data-zint_id.
        tbl_totals-zint_ty    = lt_zint_data-zint_ty.
        tbl_totals-created_on = lt_zint_data-created_on.
        tbl_totals-count      = 1.
        collect tbl_totals.
      endloop.
    endform.                    "write_data
    *&      Form  get_command_order_key
          Extract Command Order from raw data
         -->L_LINE     text
         -->L_KEY      text
    form get_command_order_key using l_line l_key l_date.
      data: l_orddate    type d,
            l_order(12)  type n,
            l_data(3000) type c,
            l_shortorder(5) type n.
      l_data = l_line.
      perform extract_field(saplzint_csord)
        using    l_data
        changing l_data
                 l_orddate.
      perform extract_field(saplzint_csord)
        using    l_data
        changing l_data
                 l_order.
      l_shortorder = l_order.
      if l_order le 9999.
        concatenate l_orddate+2(6) '-'
                    l_shortorder
          into      l_key.
      else.
        concatenate l_orddate+2(6)
                    l_shortorder
          into      l_key.
      endif.
      l_date = l_orddate.
    endform.                    "get_command_order_key
    *&      Form  get_prod_order_key
          Extract Commant Ticket number from raw data
         -->L_LINE     text
         -->L_KEY      text
    form get_prod_order_key using l_line l_key l_date.
      data: l_ticketdate type d,
            l_data(3000) type c,
            l_ticket(10) type n.
      l_data = l_line.
      perform extract_field(saplzint_cstik)
        using    l_data
        changing l_data
                 l_ticketdate.
      perform extract_field(saplzint_cstik)
        using    l_data
        changing l_data
                 l_ticket.
      l_key = l_ticket.
      l_date = l_ticketdate.
    endform.                    "get_prod_order_key
    *&      Form  get_sales_order_key
          text
         -->L_LINE     text
         -->L_KEY      text
    form get_sales_order_key using l_line l_key.
      l_key = l_line(10).
    endform.                    "get_sales_order_key
    *&      Form  read_data
          Read data from custom table
         -->PT_ZINT_DATA   text
         -->P_STATUS   text
    form read_data tables pt_zint_data structure zint_data
                   changing p_rtcod.
      data: lt_zint_data type standard table of zint_data with header line.
      data: l_found_rec(1) type c.
      clear p_rtcod.
      refresh: pt_zint_data, lt_zint_data.
    Read stored data in date/time order
      select * from zint_data into table lt_zint_data
        where zint_id = p_intid
        and   zint_ty = p_intty
        and   status in ('ERR','NEW')
        and   created_on in s_datum
        order by created_on key_val sequence.
    Always ensure any existing Error records are re-processed first.
      loop at lt_zint_data where status = 'ERR'.
        move lt_zint_data to pt_zint_data.
        append pt_zint_data.
    Store totals for reporting
        tbl_totals-zint_id    = p_intid.
        tbl_totals-zint_ty    = p_intty.
        tbl_totals-created_on = lt_zint_data-created_on.
        tbl_totals-count      = 1.
        collect tbl_totals.
      endloop.
    Loop through the NEW records - add to list if no other errors
      loop at lt_zint_data where status = 'NEW'.
        l_found_rec = 'N'.
        loop at pt_zint_data where status = 'ERR'
                             and   created_on <> lt_zint_data-created_on.
          l_found_rec = 'Y'.
          exit.
        endloop.
    Found no errors for another date - so add NEW data
        if l_found_rec = 'N'.
          move lt_zint_data to pt_zint_data.
          append pt_zint_data.
    Store totals for reporting
          tbl_totals-zint_id    = p_intid.
          tbl_totals-zint_ty    = p_intty.
          tbl_totals-created_on = lt_zint_data-created_on.
          tbl_totals-count      = 1.
          collect tbl_totals.
        endif.
      endloop.
    endform.                    "read_data
                      UNDER THIS THERE IS BELOW PROGRAM
    *&  Include           ZINT_CSTPORD_ROUTINES                            *
    Report:      ZINT_CSTPORD_ROUTINES
    Description: REDDIES Interfaces: COMMAND-SAP Interface Forms (Tickets)
    Routines fpr the COMMAND-SAP production order interface. Note: some
    of the code in this file has been directly copied from the original
    interface (ZPPU_COMMAND_PRODUCTION, Jason Moore, Extend). This has
    been done for two reasons: (1) the code works and (2) to save time.
    Change History:
    Date        User  Request     Description
    13/02/2006  EDWG  WG1K902600  Original program.
    *&      Form  process_inbound_data
          Create prod. orders from ticket data extracted from the COMMAND
          system. Note that large portions of the code in this routine
          have been copied from the retired ZPPU_COMMAND_PRODUCTION
          interface program. This was done (1) because the old code works
          and (2) to save development time.
         -->T_ZINT_IDATA  Internal table of interface data
         -->T_ZINT_PARAM  Internal table of interface parameters
         -->T_ZINT_MSLOG  Internal table of messages
         -->P_ZINT_ID     Interface ID
         -->P_ZINT_TY     Inteface type
         -->P_ZINT_IS     IDOC group for interface
         -->P_ZINT_DL     Flag: delete IDOC group when complete
         -->P_ZINT_AL     Flag: run in standalone mode
         -->P_ZINT_NW     Flag: do not log warning messages
         -->P_ZINT_SQ     Interface sequence number
         <--P_ZINT_RC     Return code (<>0=>error)
    form process_inbound_data  tables   t_zint_idata structure zint_idata
                                        t_zint_param structure zint_param
                                        t_zint_mslog structure zint_mslog
                               using    p_zint_id    type      zint_id
                                        p_zint_ty    type      zint_ty
                                        p_zint_is    type      zint_is
                                        p_zint_dl    type      zint_dl
                                        p_zint_al    type      zint_al
                                        p_zint_nw    type      zint_nw
                                        p_zint_sq    type      zint_sq
                               changing p_zint_rc    type      zint_rc.
      data: lva_partner(10)   type n,
            lva_cmdord(12)    type n,
            lva_prodmat(18)   type n,
            lva_filemat(18)   type n,
            lva_prodord(12)   type n,
            lwa_file          type ty_file,
            lva_type(2)       type c,
            lva_satsur        type c,
            lva_mincart       type c,
            lva_text(200)     type c,
            lva_counter       type i,
            bblines           type i,
            lva_shortorder(5) type n,
            lva_loggr         like marc-loggr,
            lva_saleord       like vbkd-vbeln,
            lva_linkindex     like sy-tabix,
            lva_xabln         like likp-xabln,
            lva_vbeln         like likp-vbeln,
            l_vbfa            like vbfa,
            lva_igmng         like caufv-igmng,
            lva_gamng         like caufv-gamng,
            lva_qdiff         like caufv-gamng,
            lva_ltxa1         like afru-ltxa1,
            lva_aufnr         like afru-aufnr,
            lva_wemng         like afpo-wemng,
            lva_psmng         like afpo-psmng,
            lva_rsnum         like resb-rsnum,
            lva_rspos         like resb-rspos,
            l

    Hi ,
    Modify your code like this .
    DATA: YEARS TYPE TFMATAGE,
    MONTHS TYPE TFMATAGE.
    *declare the variable as type Char
    DATA: Y_NUM(4) TYPE c,
    M_NUM(2) TYPE c.
    IF NOT SOURCE_FIELDS-/BIC/ZDOB IS INITIAL.
    CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
    EXPORTING
    I_DATE_FROM = SOURCE_FIELDS-/BIC/ZDOB
    I_DATE_TO = SY-DATUM
    I_FLG_SEPARATE = 'X'
    IMPORTING
    E_MONTHS = MONTHS
    E_YEARS = YEARS.
    Y_NUM = YEARS.
    M_NUM = MONTHS.
    CONCATENATE Y_NUM '.' M_NUM INTO RESULT.
    This will solve your problem.
    MM

  • * sign in ABAP code

    Hi Experts
    I found in SAP code the usage of * sign but it wasnt in select statement. Anyone knows how below statement works?
    i_frggr       = *ekko-frggr
    Thanks in advance.
    az

    Hi,
    the statement with *
    i_frggr = *ekko-frggr
    you can find in the declarations that they would be declared in this way
    Tables : *ekko,
                  ekko.
    These kind of declarations are used in the programs which has updates in it...
    so *ekko keeps the older value and it is treated as a normal work area only, It has no special meaning attached to it.
    ekko holds the modified or updated value which has to be updated in the database table.
    so to differentiate between older values and modified values
    they used '*' to differentiate them thats all,
    Regards,
    Siddarth

Maybe you are looking for

  • How to capture the data from a JSP form

    Hi I have a JSP form, My task is to capture the data from a JSP and submit to Data Base. for example I have the field like Enter Table name to be created in data base: The table name is to be captured by a servlet and by that table name, table should

  • PI EHP1 7.1 CACHE UPDATE ISSUE

    Hi All; I get an error when I try do a full cache refresh. I've read all the posts have been solved before in sdn for the same issue as same mine but stil there's no help. I've checked the sm59 RFC connection test for INTEGRATION_DIECTORY_HMI configu

  • IMovie taking forever to share anything

    I've finished editing hours of video. Spent days on it. It is all chopped up into smaller movies usually under an hour in length. I have let it sit overnight to try and export and it doesn't finish, it takes forever. If I click share to file and unch

  • Can i use oracle 8i for oracle 9ias application server for developijsp applicationes?

    hi, can i use oracle 8i database for oracle 9ias application server for developing jsp applicationes? can any one give suggetion? jpullareddy

  • IRecruitment Notification Approvals AME Transaction Type not being triggerd

    Hi, We are trying to customize iRecruitment Notification Approvals AME Transaction Type for our requirement of sending customized notification to recruiters and employees whilst doing any application status. But for some reason AME is not triggered.