Sample code to sign and verify

Hi,
Those of you who might be following my threads will know that signing and verifying data is proving to be a big problem
on my Java Card. I use JC 2.1.1
Could anyone please post a simple code snippet that signs AND verifies data. Please post code that actually works on your card and is thus tested and proven.
Thank you all very much for all your support and help.

Hi,
probably not the right forum for this type of questions. However, have a look here, maybe it helps: https://blogs.oracle.com/shay/entry/to_adf_or_oaf_or
Frank

Similar Messages

  • Looking for sample code using "first_tab" and "next_tab"

    Looking for sample code using "first_tab" and "next_tab". How is it used with ItemID within a dialog box? I've read the reference books - don't understand it.

    Hi Ray,
    There are several ways to do this, and in the example I created, I actually did not end up using shift registers. I've attached some example code that basically multiplies the period by the duty cycle percentage to achieve the number of milliseconds to be high and low.
    You would just need to insert your DIO code in each frame of the sequence structure.
    Hope that helps. Kind regards,
    -Sam F, DAQ Marketing Manager
    Learn about measuring temperature
    Learn how to take voltage measurements
    Learn how to measure current
    Attachments:
    70_PWM_Example.vi ‏23 KB

  • Transaction code to learn for sample codes about trees and containers

    trnasaction code to learn for sample codes about trees and containers

    hi check this....,
    REPORT  Ztree_TEST_PGM.
    Type-pools : fibs,stree.
    data : t_node type snodetext.
    data : node_tab like t_node occurs 0 with header line.
    clear : node_tab, node_tab[].
    node_tab-type = 'T'.
    node_tab-name = 'Earth'.
    node_tab-tlevel = '01'.
    node_tab-nlength = '5'.
    node_tab-color = '4'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Europe'.
    node_tab-tlevel = '02'.
    node_tab-nlength = '6'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 4.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Germany'.
    node_tab-tlevel = '03'.
    node_tab-nlength = '7'.
    node_tab-color = '4'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 4.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Berlin'.
    node_tab-tlevel = '04'.
    node_tab-nlength = '6'.
    node_tab-color = '4'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Asia'.
    node_tab-tlevel = '02'.
    node_tab-nlength = '4'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'India'.
    node_tab-tlevel = '03-'.
    node_tab-nlength = '5'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    node_tab-type = 'P'.
    node_tab-name = 'Bombay'.
    node_tab-tlevel = '04-'.
    node_tab-nlength = '6'.
    node_tab-color = '1'.
    node_tab-text = 'Hello'.
    node_tab-tlength ='5'.
    node_tab-tcolor = 3.
    append node_tab.
    clear node_tab.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
      TABLES
        NODETAB                  = node_tab .
      DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
      DATA: wa_type TYPE stree_ctl_type_mapping.
      CLEAR: type_mapping[].
        wa_type-type = 'A'.
        wa_type-icon = '@BL@'.
        APPEND wa_type TO type_mapping.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
       USE_CONTROL                     = 'L'.
    A list of other function modules that can also be used to construct tree reports:
    SEUT,                            Hierarchy framework
    RS_TREE_ADD_NODE                 Insert nodes
    RS_TREE_AUTOMATIC_REFRESH
    RS_TREE_COMPRESS                 Hide subtree(s)
    RS_TREE_CONSTRUCT                Construct new hierarchy or insert subtree
    RS_TREE_CONTROL_PREPARE
    RS_TREE_CREATE                   Create hierarchy
    RS_TREE_DELETE_NODE              Delete node with associated sub-tree
    RS_TREE_EXPAND                   Expand subtree
    RS_TREE_GET_CURRENT_LAYOUT       Get layout information for displayed hierarchy
    RS_TREE_GET_CURRENT_NODE         Get node at which cursor is positioned
    RS_TREE_GET_CURRENT_ROOT         Get current root node
    RS_TREE_GET_CURRENT_TREE         Get structure information for displayed hierarchy
    RS_TREE_GET_INPUT                Get entires from input fields
    RS_TREE_GET_MARKED_NODES         Get selected nodes
    RS_TREE_GET_MODIFICATION_LOG     Get change log for hierarchy
    RS_TREE_GET_NODE                 Get nodes for specified ID
    RS_TREE_GET_NODE_BY_NAME         Get node for specified node name
    RS_TREE_GET_PREDECESSOR          Get preceding node
    RS_TREE_GET_SEARCHSTRING         Get last search strinng
    RS_TREE_LIST                     Simulate hierarchy or subtree display
    RS_TREE_LIST_DISPLAY             Display hierarchy
    RS_TREE_LIST_DISPLAY             Display hierarchy
    RS_TREE_MODIFY_NODE
    RS_TREE_MOVE                     Reassign node with subtree
    RS_TREE_POP                      Get hierarchy from the stack and restore
    RS_TREE_PUSH                     Place hierarchy on the stack
    RS_TREE_RESET_LOCK               Deselect node
    RS_TREE_SET_CURRENT_LAYOUT       Set layout with marked cursor position
    RS_TREE_SET_CURRENT_TREE         Set other hierarchy
    RS_TREE_SET_LOCK                 Select node
    RS_TREE_SET_NODE                 Change Nodes
    RS_TREE_SET_SCROLL_POS           Position node at the beginning of the page
    RS_TREE_SLEEP
    RS_TREE_SORT_CHILDREN
    regards,
    venkat.

  • Where can i get more sample code of javacard and OCF

    i'm a newbie..can anybody tell me where can i get
    more sample code of OCF and javacard..especially OCF's sample code..because the OCF's programmer's guide is too simple..
    thx a lot

    Hi,
    will U pl. clear which sample code you are having? Anyway you can check with www.alphaworks.ibm.com.
    Rgs,
    Anupam

  • Sample code in PBO and PAI

    Hi all,
    i created a new field in the customer master (xd03) screen with a button. if i click that button, it will display the next screen with the new field. now i need to write the code in PBO and PAI events in that screen to get the data from table and to change the already exiting data.
    can any body provide me the sample code wht to write in the PBO and PAI eventts.?
    thanks in advance.
    kp

    Hi,
    I think you find the answer but i still answered your question.
    You can use the function module 'DYNP_VALUES_READ' to read value you want and use the function module ' HELP_VALUES_GET_WITH_TABLE' to get the values from kna1 table.
    Good luck.

  • Can u please send me a sample code to upload and download a file using java

    Hi,
    Please can u send me a sample code to upload a file and to download the same file from a remote server using a java servlets. The file should be read byte by byte.
    Message was edited by:
    user461713

    Hi, Thank u.
    Sorry, I forgot to attach a code. Here it is.
    Actually i need to upload a file to a remote server and download it from a server to my machine. I'm trying it using servlets and using tomcat5.0 as a servlet container. Here i'm sening a code used to upload a file. Let me know whether it works. Only few lines are here.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.lang.Object;
    import java.util.*;
    import java.lang.String;
    import com.oreilly.servlet.MultipartRequest;
    public class FileUpload extends HttpServlet{
         public void doPost(HttpServletRequest req, HttpServletResponse res)throws
         ServletException, IOException{
         MultipartRequest multi=new MultipartRequest(req);     
         String file="file1";
         byte[] b=file.getBytes();
         InputStream in=null;
         BufferedInputStream bis=null;
         FileWriter fw=null;
    try{
         in=multi.getInputStream("file1");
    bis=new BufferedInputStream(in);
         File output=new File("/fileuploadtest");
         fw=new FileWriter(output);
              int i;
              i=bis.read();
              while (i != -1) {
    fw.write(i);
    i = bis.read();
         catch(IOException e){
              System.out.println("Exception=" +e);
    finally{
         try{
              if(in!=null)
              in.close();
              if(bis!=null)               
              bis.close();
              if(fw!=null)
              fw.close();
         catch(Exception e){
              System.out.println(e);
    This code is giving error as: cannot resolve symbol: class MultipartRequest
    Why is this happening?
    Pls let me know whether this code works or no and also i have written form.html.
    Can u pls tel me whether there are ways in which i can write a code to upload a file using servlets without using third party packages. Pls help.
    Also how should be the servlet mapping for this code.?
    Regards
    Message was edited by:
    user461713

  • Form signing and verifying

    Hi,
    Sorry if it's little bit offtopic but:
    We have such a scenario:
    We have forms (HTML or XML) that must be submited and digitaly signed
    in Communicator or IE. Then these signed forms must go to some
    application server. Form's signature must be verified there.
    If it's OK fields are parsed from form and passed to Oracle DB.
    Has Oracle any products that support such a things and how
    to reach this?
    At least how to verify digital signature in Oracle server side?
    Thanks
    Rolanas Ycas

    Oracle 8i supports SSL Authentication but that is for Net8. Please refer to Net 8.1.6 Advanced Security Manual for more details on this.
    Using Oracle Application Server you can enable the SSL for client authentication and SSL encryption.
    null

  • Sample code to download and open an Asset

    For anyone who wants to download an asset from the web and load it into your Adobe application, this is how I did it:
    // .js
    var TMP_FOLDER="/tmp/com.mb.extension/";
    var doOpen = function(uri) {
              var xhr = new XMLHttpRequest();
              xhr.open("GET", uri, true);
              xhr.responseType = "blob";
              xhr.onload = function(event) {
                        var blob = this.response;
                        var data;
                        blobToBase64(blob, function(result) {
                                  data = result;
                                  var file = TMP_FOLDER+name;
                                  window.cep.fs.writeFile(file, data, cep.encoding.Base64);
                                  doOpenFile(file);
              xhr.send();
    function doOpenFile(file) {
              var ppid = "ILST";
              var extScript = "$._ext_"+ppid+".open('"+file+"')";
              evalScript(extScript);
    var base64ToBlob = function(base64, callback) {
      var binary = atob(base64);
      var len = binary.length;
      var buffer = new ArrayBuffer(len);
      var view = new Uint8Array(buffer);
      for (var i = 0; i < len; i++) {
           view[i] = binary.charCodeAt(i);
      callback(new Blob([view]));
    // .jsx
    $._ext_ILST={
        open : function(path) {
            openDocument(path);
    var openDocument = function(path) {
        return app.open(File(path));

    I don't know why, but when I use this code. The file was downloaded right, but Illustrator doesn't open the file.
    When doOpenFile is fired the args are correct, because I have debug it in console. But I think the problem is with the JSX file, sure I'm doing something wrong.
    Anybody could guide me about it?
    I'm newbie trying to script Adobe Extensions.

  • Where I could find the sample code for Pan and Zoom?

    hello all:
    I saw a demo for showing how to implement Pan and Zoom in java. If I remember correctly it should be included in JAI, however I cannot find it in JAI sample demos any more.
    THe only samples it included are
    * JAIDemo
    * JAIExampleApp/SampleDescriptor
    * JAIFileBrowser
    * JAIWarpDemo
    * JAIImageReader
    * FormatDemo
    Does anyone know where I could find that demo back?
    Thank you
    -Daniel

    Hi,
    I think this document will help you to develop your own modules.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f013e82c-e56e-2910-c3ae-c602a67b918e?quicklink=index&overridelayout=true
    later version pi71
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e6747fa?quicklink=index&overridelayout=true
    regards,
    francis

  • XML Sign and Verify with custom canonization algorithm

    How can i implement my canonization algorithm?
    I'm unable to find any explanation or examples of how to do it?
    Thanks

    Woland_CA wrote:
    How can i implement my canonization algorithm?Do you mean "canonicalization"? Also, are you using the JSR 105 API (javax.xml.crypto)?
    If so, you need to implement a subclass of javax.xml.crypto.dsig.TransformService.
    I'm unable to find any explanation or examples of how to do it?Well, it is a fairly new API (introduced in Java SE 6), and the implementation included in SE 6 contains all of the required standard canonicalization algorithms (inclusive C14N, exclusive C14N). So it's not something many developers need to do.

  • HT202667 I did not do my research before changing my Apple ID from an outdated email address to a current one. I just changed and verified and though I was all set. WRONG! Now I cannot sign in to iCloud because it will not let me enter the new Apple ID! H

    I did not do my research before changing my Apple ID from an outdated email address to a current one. I just changed and verified and though I was all set. WRONG! Now I cannot sign in to iCloud because it will not let me enter the new Apple ID. I read the 10/30/13 randers4 post to just change your Apple ID back then sign in and change it to the new email address again and then you can sign in, but I cannot change back to the prior email address Apple ID because that is no longer an active email account (or at least not mine). Any thoughts on how to get signed into iCloud when it does not allow me to type in the new Apple ID and the old Apple ID no longer exists.
    I see that many people have asked, but no one has come up with a solution that I found.
    Thanks for any help!

    This did not work for me.  My old email account for iCloud still pops up on my screen every time I open my macbook.  I've deleted it, reset it, every thing I can think of and it still shows up.  I think six months of this is more than enough time to wait.
    RDG

  • Need case studies and sample code for all concept of ABAP

    Hello,
           Can anybody provide me the case studies and sample code for learning different concepts in ABAP programming like: module pool, ALV, interactive reports, BDC, Smart Form etc.? As I want to do some practical application by which i can learn more.
    Thanks & Regards,
    Vikram Rawal

    In this link You can find Step by Step Scren Shot document :
    http://www.201interviewquestions.com/docs/User%20exits.ppt
    http://erpgenie.com/abaptips/component/option,com_docman/task,doc_details/gid,27/
    <b>
    Reprots</b>
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    <b>Dictionary</b>
    http://sapabap.iespana.es/sapabap/manuales/learnabap/
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea31446011d189700000e8322d00/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf
    <b>ABAP objects</b>
    Please check this online document (starting page 1291).
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Also check this links as well.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.futureobjects.de/content/intro_oo_e.html
    http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    <b>
    SAPScripts</b>
    http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
    http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
    http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
    http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
    http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
    http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
    SAP SCRIPT FIELDS
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
    scripts easy material
    http://www.allsaplinks.com/sap_script_made_easy.html
    Check these step-by-step links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    <b>Smartforms material</b>
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
    http://www.sap-img.com/smartforms/smart-006.htm
    http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
    Re: Need FAQ's
    check most imp link
    http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    <b>
    BAPI</b>
    http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sapgenie.com/abap/bapi/example.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    <b>List of all BAPIs</b>
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.topxml.com/sap/sap_idoc_xml.asp
    http://www.sapdevelopment.co.uk/
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    <b>ALV programs.</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    . How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    <b>ALV</b>
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    <b>Top-of-page in ALV</b>
    selection-screen and top-of-page in ALV
    <b>ALV Group Heading</b>
    http://www.sap-img.com/fu037.htm
    <b>ALV</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    <b>
    RFC Destination</b>
    Re: SM59
    <b>
    ALE/ IDOC</b>http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/sapedi/idoc_abap.htm
    http://www.allsaplinks.com/idoc_sample.html
    http://www.sappoint.com/abap.html
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.allsaplinks.com/idoc_sample.html
    <b>Table Control</b>
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    <b>
    ABAP transactions</b>
    http://www.easymarketplace.de/transactions-a-e.php?Area=4soi&name=volker&pw=vg&
    Regards,
    Priyanka.

  • I want sample code and tables for my requriement

    Hi Experts,
    I have MATNR(material no), Werks(plant) and date as selection screen fields Based on this I have to get procurement data. i.e Material
    Description
    Vendor
    Vendor name
    Product hierarchy
    Qty unrestricted
    Date product recieve at warehouse.
    i.e.Based on MATERIAL and PLANT I have to get total unrestricted quantity of that material.
    please provide me relevant tables and sample code
    thanx in advance

    I have MATNR(material no), Werks(plant) and date as selection screen fields Based on this I have to get  procurement data. i.e
    Material - <b>EKPO</b>
    Description - <b>MAKT</b>
    Vendor - <b>EKKO</b>
    Vendor name - <b>LFA1</b>
    Product hierarchy - <b>(???)</b>
    Qty unrestricted -<b> EKPO</b>
    Date product recieve at warehouse. <b>(EKKO)</b>
    Please provide me relevant tables <b>(As Above)</b>
    and
    sample code -<b> You need to contact technical expert</b>

  • Sample code to find duplicated entries in internal table and mark them?

    We have one internal table called itab1 which contains the following fields:
    f1 (key field)
    f2 (non-key field)
    f3 (non-key field)
    The business scenario is f1, f2, and f3 are one to one relationship to each other, or in other word, f2 or f3 can't be duplicated with the the same values for different f1 (key field) records. We will move the check result of the duplication into another internal table itab2 which contains f1, f2, f3, f4, and f5 where f1, f2, and f3 are the same ones as in itab1, f4 will get the value "Yes" to mark duplicated for f2 (or "No" to mark non-duplicated), and f5 will get the value "Yes" to mark duplicated for f3 (or "No" to mark non-duplicated).
    We know that through the loop of itab1, the above logic can be done to fill in f4 and f5 value for each row with either "Yes" or "No".
    Just give an example of how itab2 will look like after the coding:
    f1----f2--f3--f4(f2 duplicated?)---f5(f3 duplicated?)
    A----01-X0YesNo--
    B----01-X1YesYes--
    C----02-X1NoYes--
    Could any ABAP expert here show us the sample code to generate itab2 in loop of itab1 to find the duplicated entries of f2 and f3 and then populated the corresponding row values for f4 and f5 with "Yes" or "No"? We will give you reward points!

    TYPES: BEGIN OF ty_1,
    f1,
    f2(2),
    f3(2),
    f4,
    f5,
    END OF ty_1.
    TYPES: BEGIN OF ty_2,
    type(2),
    value(2),
    END OF ty_2.
    DATA: itab1 TYPE STANDARD TABLE OF ty_1 WITH HEADER LINE,
          itab2 TYPE TABLE OF ty_2 WITH HEADER LINE.
    DATA: f2_c TYPE sy-tabix VALUE 0,
         f3_c TYPE sy-tabix VALUE 0,
         curr_f2 LIKE itab1-f2,
         curr_f3 LIKE itab1-f3.
    itab1-f1 = 'A'.
    itab1-f2 = '01'.
    itab1-f3 = 'X0'.
    APPEND itab1.
    itab1-f1 = 'B'.
    itab1-f2 = '01'.
    itab1-f3 = 'X1'.
    APPEND itab1.
    itab1-f1 = 'C'.
    itab1-f2 = '02'.
    itab1-f3 = 'X1'.
    APPEND itab1.
    SORT itab1 BY f1 f2 f3 AS TEXT.
    LOOP AT itab1.
      IF sy-tabix EQ 1.
        curr_f2 = itab1-f2.
        curr_f3 = itab1-f3.
      ENDIF.
      IF itab1-f2 NE curr_f2.
        f2_c = 0.
        curr_f2 = itab1-f2.
      ENDIF.
      IF itab1-f3 NE curr_f3.
        f3_c = 0.
        curr_f3 = itab1-f3.
      ENDIF.
      f2_c = f2_c + 1.
      f3_c = f3_c + 1.
      IF f2_c > 1.
        itab1-f4 = 'X'.
        MODIFY itab1.
        itab2-type = 'f2'.
        itab2-value = itab1-f2.
        APPEND itab2.
      ENDIF.
      IF f3_c > 1.
        itab1-f5 = 'X'.
        MODIFY itab1.
        itab2-type = 'f3'.
        itab2-value = itab1-f3.
        APPEND itab2.
      ENDIF.
    ENDLOOP.
    DELETE ADJACENT DUPLICATES FROM itab2.
    LOOP AT itab2.
      IF itab2-type = 'f2'.
        LOOP AT itab1 WHERE f2 = itab2-value AND f4 NE 'X'.
          itab1-f4 = 'X'.
          MODIFY itab1.
        ENDLOOP.
      ELSE.
        LOOP AT itab1 WHERE f3 = itab2-value AND f5 NE 'X'.
          itab1-f5 = 'X'.
          MODIFY itab1.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
    Edited by: Ramiro Escamilla on Apr 5, 2008 1:45 AM
    changed the code, now should work

  • How to sign VBA Code in AO and save it on BW-IP side.

    Does anybody know if it is possible to sign vba code in AO and save this as Document into BW-IP (to SAP NetWeaver)?
    If I try to sign the complete Workbook with a certificate I always get the prompt to convert the file into a Excel file, is it still possible than to save the Workbook to SAPNetWeaver? Anybody tried?

    Hi,
    I have done that many times. Create a button in the toolbar,say 'SAVE'. Write the code in the subroutine user command.For example :
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
            RS_SELFIELD TYPE SLIS_SELFIELD.
      DATA : REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA: L_VALID TYPE C.
    *Code to reflect the changes done in the internal table
      IF REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = REF_GRID.
      ENDIF.
      IF NOT REF_GRID IS INITIAL.
        CALL METHOD REF_GRID->CHECK_CHANGED_DATA
          IMPORTING
            E_VALID = L_VALID.
      ENDIF.
      CASE SY-UCOMM.
        WHEN 'SAVE'.
        PERFORM BDC."Write all you BDC code in this subroutine
      ENDCASE.
    ENDFORM.
    Hope this will help.
    Thanks & Regards,
    Rock.

Maybe you are looking for