Performance ISSUE of JAVA Code

Hello,
We are having Delphi application. But as per our requirements we have to migrated the Delphi code to java. We have done this but it is consuming the 3 times more time as compare to Delphi Application.
We have used simple primitive types and arrays. But there are some loops which runs 4-8lac (800000) times.
Colud you please suggest me some ways to improve the performance, as it is very critical for me ?
Thanks,
Satbir

We have done this but it is consuming the 3
times more time as compare to Delphi Application.
We have used simple primitive types and arrays. But
there are some loops which runs 4-8lac (800000)
times.Sometimes trying too hard will make things slower.
I have some suggestions:
1) Do not inline functions yourself. This will in the best case have no effect and in the worst case make your code buggy. If your code is written according to good object-oriented methods it is probably not even possible.
2) Don't flog the garbage collector. If your inner loop creates new objects, don't release them for the collector to clean up. Instead put them in a free list and reuse them. For general coding this isn't such a great idea, because the collector can reclaim objects about as efficiently as you can recycle them yourself. But inside a tight loop it can help a lot.
2.1) Objects with finalizers are slow to garbage collect. Avoid finalizers in performance-critical code. (You can use classes that have finalizers, you just don't want them to be garbage collected while in tight code). Some of the classes provided by the Java API have finalizers also.
3) Try using the server VM.
4) Try different versions of the JDK. Some people have found that 1.4 is slower than 1.3, others find it is faster. Both are much faster than 1.2.
5) String operations in Java are very slow. Much slower even than they usually are. StringBuffers can be 4-5 times faster than Strings, but even then string handling is just not fast. See if you can minimize the amount of string handling in your tight loops.
6) Synchronization is quite slow also. It is faster in 1.4, but it is still slow. Don't synchronize unless absolutely necessary. Some synchronized operations can be done instead with volatile variables, unfortunately many things cannot.
7) Make sure you have enough heap space for everything to fit comfortably. If the garbage collector is running during a tight loop, this will kill your performance.
8) Some of the calls to the Java API are very slow. Some standard API classes, such as Hashtable, have synchronized methods, which can cause hidden slowing. Other functions are just plain slow in general.
9) Try using the -Xrunhprof option to profile your code. While it will run much more slowly with the profiler enabled, it will at least indicate where the slowness is. It might not be what you expect.

Similar Messages

  • Performance issue in this code

    public int[][] init(int[][] a, int m, int n){
      for(int j=0; j<n; j++){
        for(int i=0; i<m; i++){
          a[i][j] = i+j;
      return a;
    }Just a technical quest faced in one of the interview...
    There is a performance issue in this code. Can you identify, correct and justify your answer?
    Edited by: EJP on 17/10/2011 20:29

    mithu wrote:
    public int[][] init(int[][] a, int m, int n){
    for(int j=0; j<n; j++){
    for(int i=0; i<m; i++){
    a[i][j] = i+j;
    return a;
    }Just a technical quest faced in one of the interview...
    There is a performance issue in this code. Can you identify, correct and justify your answer?Not a good question at all. There's no performance issue here that can be positively identified by inspection. The only potentially significant one is, as EJP pointed out, loss of locality of reference because of the order of the loops. But even that's not a guarantee, since I don't think array layouts are defined by the spec. We could only determine for sure that that's a performance problem by profiling.

  • Performance issue on Java Stored Procedure

    I have converted the Stored Procedures into JSP with SQLJ. I
    loaded the classes (not the source) onto Oracle 8i Database and
    published within tbe stored packages. What I found out was the
    performance is about 12 times on average slower than the PL/SQL
    stored packages when I made calls to JSP. I am not surprise JSP
    is slower than PL/SQL but can we improve by tunning the Java
    codings or VM within the 8i database?
    null

    James Chan (guest) wrote:
    : I have converted the Stored Procedures into JSP with SQLJ. I
    : loaded the classes (not the source) onto Oracle 8i Database and
    : published within tbe stored packages. What I found out was the
    : performance is about 12 times on average slower than the PL/SQL
    : stored packages when I made calls to JSP. I am not surprise JSP
    : is slower than PL/SQL but can we improve by tunning the Java
    : codings or VM within the 8i database?
    all user written java code in the 8i rdbms is currently running
    as bytecode in the jvm.
    a future release will provide a component called "Native Compiler
    [NCOMP]" so it should run considerably faster then.
    see the following link for details :
    http://technet.oracle.com/files/search/search.htm?ncomp
    null

  • Performance issue with JavaFX code

    Hi, I'm experienced in Java, but not in JavaFX. I wrote simple LIFE cellular automata, it has two options: randomize cells, and take a step forward in simulation. My problem is that following simulation steps are slower and slower. NetBeans profiler suggests that if I take more steps in simulation then get method's self time (get$impl$$bound$int__int method exactly) is getting slower in time -- at first it takes about 0.054 (270/5000) ms per call, but later the average jumps to 0.55 (12709/23000) ms per call. I don't really know how bind mechanism works, could this be a bind issue? Maybe I create many unneccessary objects? Here's the code:
    import java.lang.Math;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.paint.Color;
    import javafx.scene.Scene;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    import javafx.ext.swing.SwingButton;
    import java.lang.System;
    var tab : CellTable = CellTable {
         width: 10
         height: 10
    def rects =
    for (i in [0..tab.width-1]) {
         for (j in [0..tab.height-1]) {
              Rectangle {
                   x: 20 * i + 1
                   y: 20 * j + 1
                   width: 17
                   height: 17
                   stroke: Color.RED
                   fill: bind if (tab.get(i, j)) Color.RED else Color.WHITE;
    def stage = Stage {
         title: "LIFE"
         resizable: false
         scene: Scene {
              width: 200
              height: 250
              content: [
                   rects,
                   SwingButton {
                        text: "random!"
                        translateX: 0
                        translateY: 210
                        width: 100
                        action: function() {
                             tab.random();
                   SwingButton {
                        text: "next>"
                        translateX: 100
                        translateY: 210
                        width: 100
                        action: function() {
                             tab.next();
    class CellTable {
         postinit {
              for (i in [0..width-1]) {
                   for (j in [0..height-1]) {
                        insert false into cells;
                        insert false into tmp;
              xrange = [0..width-1];
              yrange = [0..height-1];
         var cells : Boolean[];
         var tmp : Boolean[];
         var width : Integer;
         var height : Integer;
         var xrange : Integer[];
         var yrange : Integer[];
         function random() {
              for (x in [0..width-1]) {
                   for (y in [0..height-1]) {
                        set(x, y, Math.random() < 0.5);
         function next() {
              for (x in xrange) {
                   for (y in yrange) {
                        var ct = 0;
                        for (xx in [-1..1]) {
                             for (yy in [-1..1]) {
                                  if (get((x + width + xx) mod width, (y + height + yy) mod height)) {
                                       ++ct;
                        if (get(x,y)) {
                             --ct;
                             tmp[idx(x,y)] = (ct == 2 or ct == 3);
                        } else {
                             tmp[idx(x,y)] = (ct == 3);
              for (x in xrange) {
                   for (y in yrange) {
                        set(x, y, tmp[idx(x, y)]);
         function idx(x : Integer, y : Integer) : Integer {
              return x * height + y;
         bound function get(x : Integer, y : Integer) : Boolean {
              return cells[idx(x,y)];
         function set(x : Integer, y : Integer, b : Boolean) {
              cells[idx(x,y)] = b;
    }I would be very grateful if anyone could tell me what could be the issue or at least what should I check to figure it out.

    I tried to solve your problem.
    First, I eliminated the keyword 'bound' from the function in CellTable class. Then I rewrite the value of 'fill' attribute in the Rectangle as below :
    fill: bind if (tab.cells[tab.idx(i, j)]) Color.RED else Color.WHITE;As a result, I found your code ran faster than before. But I don't know why it became so.
    Could it be that the 'bound function' creates some new Boolean instances every time it was called ???
    Sorry, I can not help you.
    I hope anyone would tell me why the 'bound function' made the code slower.

  • Performance issue of this code

    Hi folks,
    This report is working fine.But it is taking lot of time if i enter only company code.Could any one suggest me where is the problem.
    kaki
    REPORT  Z1F_RFKEPL00 no standard page heading
            line-size 140
            line-count 65
            message-id Z1.
    TABLES: LFA1,t005t,bsak,bseg,t001,skat.
    data: begin of t_bsak occurs 0,
            bukrs like bsak-bukrs,        "company code
            lifnr like bsak-lifnr,        "Vendor acc number
            augdt like bsak-augdt,        "Clearing date
            AUGBL like bsak-AUGBL,        "Clearing Document
            GJAHR like bsak-GJAHR,        "year
            belnr like bsak-belnr,        "Document number
            BUZEI like bsak-BUZEI,        "Line Item
            budat like bsak-budat,        "Posting Date in the Document
            bldat like bsak-bldat,        "Document date in document
            blart like bsak-blart,        "Document type
            BSCHL like bsak-BSCHL,        "Posting key
            WAERS like bsak-WAERS,        "Currency key
            CPUDT like bsak-cpudt,        "Accounting Document Entry Date
            SHKZG like bsak-shkzg,        "Debit/Credit Indicator
            DMBTR like bsak-dmbtr,        "Amount in local currency
            WRBTR like bsak-wrbtr,        "Amount in document currency
            SGTXT like bsak-sgtxt,        "Item Text
            SAKNR LIKE bsak-saknr,        "G/L Account Number
            hkont like bsak-hkont,        "General Ledger Account
            SKFBT LIKE BSAK-SKFBT,        "Amount Eligible for Cash Discount
            KOSTL LIKE BSEG-KOSTL,        "Cost center
            ktopl like t001-ktopl,        "chart of accounts
            txt20 like skat-txt20,        "Short test for the GL acc
            name1 like lfa1-name1,
            land1 like lfa1-land1,
            landx like t005t-landx,
          end of t_bsak.
    data: begin of t_header occurs 0,
            bukrs like bsak-bukrs,
            hkont like bsak-hkont,
            lifnr like bsak-lifnr,
            waers like bsak-waers,
            land1 like lfa1-land1,
            name1 like lfa1-name1,
            landx like t005t-landx,
          end of t_header.
    data: begin of t_lfa1 occurs 0,
            lifnr like lfa1-lifnr,
            name1 like lfa1-name1,
            land1 like lfa1-land1,
            landx like t005t-landx,
          end of t_lfa1.
    data: t_bseg like t_bsak occurs 0 with header line.
    data: t_data like t_bsak occurs 0 with header line.
    selection-screen begin of block blk1 with frame title text-001.
    select-options: s_lifnr for bsak-lifnr,
                    s_bukrs for bsak-bukrs.
    selection-screen end of block blk1.
    selection-screen begin of block blk2 with frame title text-002.
    parameters s_budat like bsik-budat default sy-datum.
    select-options: s_augdt for bsak-augdt.
    selection-screen end of block blk2.
    selection-screen begin of block blk3 with frame title text-003.
    parameters: stand as checkbox default 'X',
                park as checkbox.
    selection-screen end of block blk3.
    start-of-selection.
      perform process_data.
    top-of-page.
      perform set_page_header.
    *&      Form  process_data
          text
    form process_data.
      data: line like t_bsak occurs 0 with header line.
      data: l_wrbtr(10) type c.
      data: l_debit type bsak-wrbtr,l_credit type bsak-wrbtr,
            l_balance type bsak-wrbtr.
      data:l_hkont(10) type n.
      select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR BUZEI BUDAT BLDAT
              CPUDT WAERS BLART BSCHL SHKZG DMBTR WRBTR SGTXT HKONT SKFBT
             from bsak
             into corresponding fields of table t_bsak
              where
              lifnr in s_lifnr and
              BUKRS in s_bukrs and
              budat le s_budat and                 " Open  items
              augdt in s_augdt order by lifnr.
      if sy-subrc ne 0.
        message i016.
        leave list-processing.
      endif.
      sort t_bsak by BUDAT.
      CHECK NOT t_bsak[] IS INITIAL.
      select MANDT BUKRS LIFNR AUGDT AUGBL GJAHR BELNR
             SHKZG DMBTR WRBTR SGTXT SKFBT KOSTL BSCHL hkont BUZEI
       into corresponding fields of table t_bseg from bseg
                FOR ALL ENTRIES IN t_bsak
                where belnr = t_bsak-belnr and
                      bukrs = t_bsak-bukrs and
                      gjahr = t_bsak-gjahr
                     ORDER BY PRIMARY KEY .
      loop at t_bsak.
    to get vendor name
        select single * from lfa1 where lifnr = t_bsak-lifnr.
        move lfa1-lifnr to t_header-lifnr.
        move lfa1-name1 to t_header-name1.
        move lfa1-land1 to t_header-land1.
        move t_bsak-bukrs to t_header-bukrs.
        move t_bsak-hkont to t_header-hkont.
        move t_bsak-waers to t_header-waers.
        if sy-subrc = 0.
          append t_header.
          clear t_header.
        endif.
    to get vendor country
        loop at t_header.
          select single * from t005t where land1 = t_header-land1 and
                                           SPRAS = 'E'.
          move t005t-landx to t_header-landx.
          if sy-subrc = 0.
            modify t_header.
            clear t_header.
          endif.
        endloop.
        loop at t_bseg where belnr = t_bsak-belnr and
                             bukrs = t_bsak-bukrs and
                             gjahr = t_bsak-gjahr.
          l_hkont = t_bseg-hkont.
    *To get chart of accounts
          select single * from t001 where bukrs = t_bseg-bukrs.
          move t001-ktopl to t_bseg-ktopl.
    *To get short text for the chart of accounts
          select single * from skat where ktopl = t_bseg-ktopl and
                                          saknr = l_hkont and
                                          spras = 'E'.
          t_data-bukrs = t_bsak-bukrs.
          t_data-lifnr = t_bsak-lifnr.
          t_data-augdt = t_bseg-augdt.
          t_data-AUGBL = t_bseg-AUGBL.
          t_data-GJAHR = t_bseg-GJAHR.
          t_data-belnr = t_bsak-belnr.
          t_data-BUZEI = t_bseg-BUZEI.
          t_data-budat = t_bsak-budat.
          t_data-bldat = t_bsak-bldat.
          t_data-blart = t_bsak-blart.
          t_data-BSCHL = t_bseg-BSCHL.
          t_data-WAERS = t_bsak-WAERS.
          t_data-CPUDT = t_bsak-cpudt.
          t_data-SHKZG = t_bseg-shkzg.
          t_data-DMBTR = t_bseg-dmbtr.
          t_data-WRBTR = t_bseg-wrbtr.
          t_data-SGTXT = t_bsak-sgtxt.
          t_data-SAKNR = t_bseg-saknr.
          t_data-hkont = t_bseg-hkont.
          t_data-SKFBT = t_bseg-SKFBT.
          t_data-KOSTL = t_bseg-KOSTL.
          t_data-ktopl = t_bseg-ktopl.
          t_data-txt20 = skat-txt20.
          append t_data.
          clear t_data.
        endloop.
      endloop.
      sort t_header by lifnr.
      delete adjacent duplicates from t_header.
    *Display----
    *to display header
      data: l_buzei type bseg-buzei.
      loop at t_header.
        write:/1(6) t_header-bukrs    color 2,
                7(8) t_header-hkont    color 2,
                18(10) t_header-lifnr   color 2.
        write:/30(10) t_header-name1.
        write:/30(10) t_header-landx.
        uline.
        loop at t_data where lifnr = t_header-lifnr.
          l_wrbtr = t_data-wrbtr.
          if t_data-wrbtr = t_data-skfbt.
            concatenate l_wrbtr '-' into l_wrbtr.
          endif.
          write:/15(11) t_data-BUDAT no-zero    color 7,
                  26(5) t_data-BLART            color 7,
                  30(12) t_data-belnr           color 7,
                  42(16) t_data-BLDAT           color 7,
                  58(5)  t_data-buzei           color 7,
                  63(12)  t_data-BSCHL          color 7,
                  75(9)  t_data-AUGDT           color 7,
                  84(35) t_data-AUGBL           color 7,
                  119(7) t_data-WAERS           color 7,
                  126(12) l_wrbtr               color 7.
          write:/55 t_data-sgtxt.
          write:/60(10) t_data-kostl,
                70(10) t_data-hkont,
                80(20) t_data-txt20.
          clear l_wrbtr.
        endloop.
        write:/1(6) t_data-bukrs    color 2,
               7(8) t_data-hkont    color 2,
               18(10) t_data-lifnr  color 2.
        uline.
        line[] = t_data[].
        loop at line where lifnr = t_header-lifnr.
          if line-shkzg = 'H'.
            l_debit = l_debit + line-wrbtr.
          endif.
          if line-shkzg = 'S'.
            l_credit = l_credit + line-wrbtr.
          endif.
        endloop.
       write:/1(6) t_data-bukrs    color 3,
              7(8) t_data-hkont    color 3,
              18(10) t_data-lifnr  color 3.
        write:/1(6) t_data-bukrs    color 3,
               7(11) t_data-hkont    color 3,
               18(102) t_data-lifnr  color 3.
        l_balance = l_debit -  l_credit.
       write:115(15) l_debit  color 3.   write:135(1) 'D' color 3.
       write:/115(15) l_credit color 3. write:135(1) 'C' color 3.
      for balnce
       write:/90(25) 'Bal.:' color 3.
       write:115(15) l_balance color 3.
        write:120(15) l_debit  color 3.
        write:138(2) 'D' color 3.
        write:/120(15) l_credit color 3.
        write:138(2) 'C' color 3.
      for balnce
        write:/90(00) 'Bal.:' color 3.
        write:120(15) l_balance color 3.
        clear: l_debit,l_credit,l_balance.
        uline.
      endloop.
    endform.                    "process_data
    *&      Form  set_page_header
          text
    FORM set_page_header.
      call function 'Z_REPORT_TITLE'
        EXPORTING
          line_size       = sy-linsz
          sy_title        = 'List of Vendor Line Items'
          uline           = 'X'
          first_page_only = ' '.
      write :1(15)  'Allocation'            color col_heading,
             15(10) 'Pstng'         color col_heading,
             25(5)  'Do'             color col_heading,
             30(10) 'Documnet'          color col_heading,
             40(10) 'Doc'        color col_heading,
             50(8)  'BusA'              color col_heading,
             58(5)  'LIm'        color col_heading,
             63(4)  'PK'         color col_heading,
             67(4)  'S'       color col_heading,
             71(4)  'P'       color col_heading,
             75(7)  'Clrg'       color col_heading,
             82(10) 'Clearing'       color col_heading,
             92(20) 'D/c discount Amnt'       color col_heading,
             112(5) 'Rsn'       color col_heading,
             117(2) 'G'       color col_heading,
             119(7)  'Curr-'       color col_heading,
             126(12) 'Amount in'       color col_heading,
             138(2)  'T'       color col_heading.
      write space.
      write :1(15)  'number'            color col_heading,
             15(10) 'date'            color col_heading,
             25(5)  'ty'      color col_heading,
             30(10) 'number'     color col_heading,
             40(18) 'date'         color col_heading,
             58(5)  ''        color col_heading,
             63(4)  ''         color col_heading,
             67(4)  'I'       color col_heading,
             71(4)  'K'       color col_heading,
             75(7)  'date'       color col_heading,
             82(24) 'doc.no'       color col_heading,
             105(20) 'in LC'       color col_heading,
             112(5) 'code'       color col_heading,
             117(2) 'L'       color col_heading,
             119(7) 'ency'       color col_heading,
             126(12) 'doc.curr.'       color col_heading,
             138(2) 'X'       color col_heading.
      write space.
      uline.
    ENDFORM.                    " set_page_header

    it will better to optimize the below part of your code -
    loop at t_bsak.
    to get vendor name
    select single * from lfa1 where lifnr = t_bsak-lifnr.
    move lfa1-lifnr to t_header-lifnr.
    move lfa1-name1 to t_header-name1.
    move lfa1-land1 to t_header-land1.
    move t_bsak-bukrs to t_header-bukrs.
    move t_bsak-hkont to t_header-hkont.
    move t_bsak-waers to t_header-waers.
    if sy-subrc = 0.
    append t_header.
    clear t_header.
    endif.
    to get vendor country
    loop at t_header.
    select single * from t005t where land1 = t_header-land1 and
    SPRAS = 'E'.
    move t005t-landx to t_header-landx.
    if sy-subrc = 0.
    modify t_header.
    clear t_header.
    endif.
    endloop.
    loop at t_bseg where belnr = t_bsak-belnr and
    bukrs = t_bsak-bukrs and
    gjahr = t_bsak-gjahr.
    l_hkont = t_bseg-hkont.
    *To get chart of accounts
    select single * from t001 where bukrs = t_bseg-bukrs.
    move t001-ktopl to t_bseg-ktopl.
    *To get short text for the chart of accounts
    select single * from skat where ktopl = t_bseg-ktopl and
    saknr = l_hkont and
    spras = 'E'.
    t_data-bukrs = t_bsak-bukrs.
    t_data-lifnr = t_bsak-lifnr.
    t_data-augdt = t_bseg-augdt.
    t_data-AUGBL = t_bseg-AUGBL.
    t_data-GJAHR = t_bseg-GJAHR.
    t_data-belnr = t_bsak-belnr.
    t_data-BUZEI = t_bseg-BUZEI.
    t_data-budat = t_bsak-budat.
    t_data-bldat = t_bsak-bldat.
    t_data-blart = t_bsak-blart.
    t_data-BSCHL = t_bseg-BSCHL.
    t_data-WAERS = t_bsak-WAERS.
    t_data-CPUDT = t_bsak-cpudt.
    t_data-SHKZG = t_bseg-shkzg.
    t_data-DMBTR = t_bseg-dmbtr.
    t_data-WRBTR = t_bseg-wrbtr.
    t_data-SGTXT = t_bsak-sgtxt.
    t_data-SAKNR = t_bseg-saknr.
    t_data-hkont = t_bseg-hkont.
    t_data-SKFBT = t_bseg-SKFBT.
    t_data-KOSTL = t_bseg-KOSTL.
    t_data-ktopl = t_bseg-ktopl.
    t_data-txt20 = skat-txt20.
    append t_data.
    clear t_data.
    endloop.
    endloop.
    You are selecting data from database inside the loop and specially you are populating t_header inside the loop and again looping on the same table to get value of t005t-landx. Here you are updating even those records which are already update by initial loop pass so multiple updation for already updated records.
    Thanks,
    Rajeev

  • Performance Issue Of Java Application on Pentium 4

    Dear All
    I have finished an application program, which runs smoothly in PC with Intel Pentium 3 Processor with high performance, but the performance is highly decreased with Intel Pentium 4 Processor. Is it a limitation of Java?
    Im using MS Access database.
    I have restructured the queries but the performance is highly enhanced in P3 but it degrades and sometimes there is no consistency in the performance timmings in P4.
    System Configuration are:
    P3 : 256 MB RAM with Windows 2000 SP2,MS ACCESS 2000
    P4: 256 MB RAM with WIN 2000 SP2,MS ACCESS 2000
    Is there any solution to this problem?
    Pls help!
    Best Regards
    Sourav

    256MB of RAM for a Windows 2000 machine?!?
    You're probably swapping memory.
    - Go into Task Manager and see what is running on each machine.
    ...and see if you can not start up some things.
    - See how much memory you have Available on each BEFORE you run the app.
    - use java -Xmx option to specify less than the available memory you have.

  • Performance issue with the code

    hi,
    i have below code.for printing it is taking enough time..
    which way i can improve the performance of below piece of code and what changes i will do for improving performance??
    kindly help me..
    form get_komgd.
      tables: kotd994.                     "kondd
      data : tfill_auswahl type i.
      data: begin of auswahl occurs 10,
               kappl like kotd994-kappl ,
               kschl like kotd994-kschl ,
               vkorg like kotd994-vkorg ,
               vtweg like kotd994-vtweg ,
               spart like kotd994-spart ,
               kvgr1 like kotd994-kvgr1 ,
               matwa like kotd994-matwa ,
               datbi like kotd994-datbi ,
               datab like kotd994-datab ,
               knumh like kotd994-knumh ,
               smatn like kondd-smatn,
               meins like kondd-meins,
                 sugrd like kondd-sugrd,
         end of auswahl.
      tables: kondd.
      select * from  kondd
             where  smatn       = ltap-matnr.
        select * from  kotd994
               where  kappl       = 'V'
             and    kschl       = vbak-kschl
               and    vkorg       = vbak-vkorg
               and    vtweg       = vbak-vtweg
         and    spart       = vbak-spart
               and    kvgr1       = vbak-kvgr1
         and    matwa       = vbak-matwa
               and    datbi       >= sy-datum
               and    datab       <= sy-datum
               and    knumh       = kondd-knumh    .
        endselect.
        if sy-subrc = 0.
       and kotd994-kvgr1(1) = 'Z'.
          move-corresponding kotd994 to auswahl.
          move-corresponding kondd to auswahl.
          append auswahl   .
        endif.                             " sy-subrc = 0.
    write: / auswahl.
      endselect.
      describe table auswahl lines tfill_auswahl.
      if tfill_auswahl = 1.
        komgd-matwa = auswahl-matwa.
      else.
        clear komgd-matwa.
      endif.                               " tfill_auswahl = 1.
    endform.                               " ZHX_GET_COSTUMER_NR

    Hi,
    Using two select statements will take more time.
    Rather use this sample code:
    select *    from kondd in to corresponding fields of table auswahl
            where smatn = ltap-matnr.
        select *      from kotd994 into corresponding fields of auswahl
                 for all entries of auswahl
                  where kappl = 'V'
                  and vkorg = vbak-vkorg
                  and vtweg = vbak-vtweg
                  and kvgr1 = vbak-kvgr1
                  and datbi >= sy-datum
                  and datab <= sy-datum
                  and knumh = auswahl-knumh .
    however, in the structure of auswahl maintain the field of knumh as well, so that we can pass the values in the second select directly.
    This will improve the performance very well.
    if possible, try and use the primary key combinations in the where clause while extracting the data.

  • Performance Issue with this code

    Hi Gurus,
    Can anyone please help tweak the performance of this program.
    REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SPREPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP[code]REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    [/code]2 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP[code]REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    [/code]3 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP[code]REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    [/code]4 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP[code]REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    [/code]5 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP[code]REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    [/code]6 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP[code]REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    [/code]7 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP[code]REPORT ZSQ01_AUDITSALESORD4_1.
    TABLES: VBAP, MATERIALID, VBAK, VBEP.
    SELECTION-SCREEN: BEGIN OF BLOCK PROG WITH FRAME TITLE TEXT-F58.
    SELECT-OPTIONS SP$00001 FOR VBAK-VBELN MEMORY ID AUN.
    SELECT-OPTIONS SP$00002 FOR VBAP-POSNR MEMORY ID APO.
    SELECT-OPTIONS SP$00003 FOR MATERIALID-MATNR_EXT.
    SELECT-OPTIONS SP$00004 FOR VBAK-ERDAT.
    SELECT-OPTIONS SP$00005 FOR VBAP-KWMENG.
    SELECT-OPTIONS SP$00006 FOR VBAP-UEPOS.
    SELECT-OPTIONS SP$00007 FOR VBAP-MATWA MEMORY ID MAT.
    SELECT-OPTIONS SP$00008 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       KUNNR(10),                                              
       AUGRU(3),                                               
       KZTLF(1),                                               
       FILLER(12),                                             
    END OF ITAB2_SALESORD4.
    CONSTANTS: C_REASON_VR LIKE VBAK-AUGRU VALUE 'VR',                      
               C_REASON_EM LIKE VBAK-AUGRU VALUE 'EM'.
    DATA: L_VBELN TYPE VBFA-VBELN,                             
          L_POSNR TYPE VBFA-POSNN,                             
          L_LVBELN TYPE VBFA-VBELN.                            
    DATA: BEGIN OF ITAB_SUPER OCCURS 0,                        
          VBELN TYPE VBAP-VBELN,                               
         POSNR  TYPE VBAP-POSNR,                               
        END OF ITAB_SUPER.
    START-OF-SELECTION.
      SELECT VBAK~ERDAT VBAK~VBELN VBAP~KWMENG VBAP~MATNR VBAP~MATWA
               VBAP~POSNR VBAP~PSTYV VBAP~UEPOS VBAP~VBELN VBAP~VRKME
                VBAP~ABGRU MATERIALID~MATNR_EXT MATERIALID~MATNR_INT
            VBAP~Z_PROM_SHP_DT VBAK~AUART VBAP~WERKS VBAK~BSTNK VBAK~KUNNR    VBAK~AUGRU  VBAP~KZTLF  
                                  INTO (VBAK-ERDAT , VBAK-VBELN , VBAP-KWMENG , VBAP-MATNR , VBAP-MATWA
           , VBAP-POSNR , VBAP-PSTYV , VBAP-UEPOS , VBAP-VBELN , VBAP-VRKME
            , VBAP-ABGRU  , MATERIALID-MATNR_EXT , MATERIALID-MATNR_INT,
              VBAP-Z_PROM_SHP_DT, VBAK-AUART, VBAP-WERKS, VBAK-BSTNK,
              VBAK-KUNNR, VBAK-AUGRU, VBAP-KZTLF)
        FROM ( VBAK
               INNER JOIN VBAP
               ON VBAP~VBELN = VBAK~VBELN
               INNER JOIN MATERIALID
               ON MATERIALID~MATNR_INT = VBAP~MATNR )
               WHERE VBAK~ERDAT IN SP$00004
                 AND VBAK~VBELN IN SP$00001
                 AND VBAP~KWMENG IN SP$00005
                 AND VBAP~MATWA IN SP$00007
                 AND VBAP~POSNR IN SP$00002
                 AND VBAP~PSTYV IN SP$00008
                 AND VBAP~UEPOS IN SP$00006
                 AND MATERIALID~MATNR_EXT IN SP$00003.
    SELECT SINGLE VBELN POSNN
           FROM VBFA
           INTO (L_VBELN, L_POSNR)
           WHERE VBELV = VBAK-VBELN AND
           POSNV       = VBAP-POSNR AND
           VBTYP_N     = 'J'.
        IF SY-SUBRC = 0 AND NOT L_VBELN IS INITIAL.
          SELECT SINGLE VBELN
          FROM LIPS
          INTO L_LVBELN
          WHERE VBELN = L_VBELN AND
                POSNR = L_POSNR.
          IF SY-SUBRC NE 0.
            IF NOT VBAP-UEPOS IS INITIAL.                      
              MOVE VBAP-VBELN TO ITAB_SUPER-VBELN.             
              MOVE VBAP-UEPOS TO ITAB_SUPER-POSNR.             
              APPEND ITAB_SUPER.                               
            ENDIF.                                             
            CONTINUE.
          ENDIF.
        ENDIF.
        MOVE VBAK-VBELN TO ITAB2_SALESORD4-VBELN.              
        MOVE VBAK-AUART TO ITAB2_SALESORD4-AUART.              
        MOVE VBAP-POSNR TO ITAB2_SALESORD4-POSNR.              
        MOVE VBAP-WERKS TO ITAB2_SALESORD4-WERKS.              
        MOVE MATERIALID-MATNR_EXT TO ITAB2_SALESORD4-MATNR_EXT.
        MOVE VBAK-ERDAT TO ITAB2_SALESORD4-ERDAT.              
        MOVE VBAP-KWMENG TO ITAB2_SALESORD4-KWMENG.            
        MOVE VBAP-VRKME TO ITAB2_SALESORD4-VRKME.              
        MOVE VBAP-UEPOS TO ITAB2_SALESORD4-UEPOS.              
        MOVE VBAP-MATWA TO ITAB2_SALESORD4-MATWA.              
        MOVE VBAP-PSTYV TO ITAB2_SALESORD4-PSTYV.              
        MOVE VBAP-ABGRU TO ITAB2_SALESORD4-ABGRU.              
        MOVE VBAP-Z_PROM_SHP_DT TO ITAB2_SALESORD4-Z_PROM_SHP_DT.
        MOVE VBAK-BSTNK TO ITAB2_SALESORD4-BSTNK.              
        MOVE VBAK-KUNNR TO ITAB2_SALESORD4-KUNNR.              
        IF VBAK-AUGRU = C_REASON_VR.                           
          MOVE  C_REASON_EM TO ITAB2_SALESORD4-AUGRU.          
        ELSE.                                                  
          MOVE VBAK-AUGRU TO ITAB2_SALESORD4-AUGRU.            
        ENDIF.                                                 
        MOVE VBAP-KZTLF TO ITAB2_SALESORD4-KZTLF.              
        ITAB2_SALESORD4-KWMENG = ITAB2_SALESORD4-KWMENG * 1000.
        WRITE ITAB2_SALESORD4-KWMENG TO ITAB2_SALESORD4-KWMENG 
                        DECIMALS 0 RIGHT-JUSTIFIED.
        OVERLAY ITAB2_SALESORD4-KWMENG WITH '00000000000000000'.
        APPEND ITAB2_SALESORD4.                                
        CLEAR ITAB2_SALESORD4.                                 
      ENDSELECT.
      SORT ITAB2_SALESORD4 BY VBELN POSNR Z_PROM_SHP_DT.       
      SORT ITAB_SUPER BY VBELN POSNR.
      DATA: G_FILE LIKE RLGRAP-FILENAME,
            ZDFLTVAL11(40),
            ZDFLTVAL22(40).
      SELECT SINGLE Z_DFLT_VAL1 Z_DFLT_VAL2 INTO
                        (ZDFLTVAL11,ZDFLTVAL22)
                             FROM ZLE_LOG_DFLT_VAL
                                    WHERE LGNUM = ' '
                                 AND Z_DFLT_TYP = 'IMAS_SAP_SALESORD4_G1'.
      TRANSLATE ZDFLTVAL22 TO LOWER CASE.
      CONCATENATE ZDFLTVAL11 ZDFLTVAL22 INTO G_FILE.
      OPEN DATASET G_FILE FOR OUTPUT IN TEXT MODE.
      LOOP AT ITAB2_SALESORD4.
        READ TABLE ITAB_SUPER WITH KEY VBELN = ITAB2_SALESORD4-VBELN
                                         POSNR = ITAB2_SALESORD4-POSNR
                                        BINARY SEARCH.         
        IF SY-SUBRC EQ 0.
          CONTINUE.
        ENDIF.
        TRANSFER ITAB2_SALESORD4 TO G_FILE.
      ENDLOOP.
      CLOSE DATASET G_FILE.
    [/code]8 FOR VBAP-PSTYV.
    SELECTION-SCREEN: END OF BLOCK PROG.
    DATA: BEGIN OF ITAB2_SALESORD4 OCCURS 0,
       VBELN(10),
       AUART(4),
       POSNR(6),
       WERKS(4),
       MATNR_EXT(40),
       ERDAT(8),
       KWMENG(19),
       VRKME(3),
       UEPOS(6),
       MATWA(40),
       PSTYV(4),
       ABGRU(2),
       Z_PROM_SHP_DT(8),                                       
       BSTNK(20),                                              
       K

    The first SELECT looks a bit shaky. Have you done a performance trace (ST05) to find out where the problem is?
    Rob

  • Flickr API and cflickr - performance issue with my code.

    I using cflickr to access the Flickr api and display photos in a lightbox. My code is working, but incredibly slow. I'm assuming that I'm going about it in an incorrect way and hoping someone can point out a better way to do what I'm trying to accomplish. My speed issues develop when I'm trying to extract the image descriptions within a loop that is outputing the images to the page.
    Here is an example of the code that I'm using:
    using the following to grab the photos:
    <cfset photos = cflickr.photosets_getPhotos(photoset_id=72157624340881708 , auth_token=token) />
    I am then using the following to loop through the array of photos and and also retrieve the description for each image.
    <div style="width:423px; margin: auto;" id="gallery">
            <cfloop from="1" to="#arraylen(photos.photoset.photo)#" index="i">
                <cfset p = photos.photoset.photo[i] />
                <cfset img_desc = cflickr.photos_getInfo(photo_id=p.id).photo.description />
                <cfset img_desc = replace(img_desc, 'TRIP', '<br />TRIP') />
                <cfset title = photos.photoset.photo[i].title />
                <cfset title = title & "<br />" & img_desc />
                <cfoutput>
                <a href="#cflickr.getPhotoUrl(p, '')#" title="#title#"><img src="#cflickr.getPhotoUrl(p, 's')#"  /></a>
                </cfoutput>
            </cfloop>
        </div>
    The problem with the code is when it is making the request for img_desc inside of the loop to the Flickr api. Each instance of that call is taking on average 300 to 400ms and the array has over 300 items so it times out. Should I be retrieveing all of the image descritpions at once before the loop and if so how would I best link these with image data that they belong with? It seems like I'm going about this in a rather inefficient manner.
    I was hoping that I could call a function that retrieved all of the data that I need in one call, but so far I've been unable to find that.

    ( Grrr... this forum trashes emails better than any application I have ever seen.  Here is what my previous response actually said ...)
    <cfset photos = cflickr.photosets_getPhotos(photoset_id=72157624340881708 , auth_token=token)>
    I cannot say I have used it. But the cfc usage seems to follow the API pretty closely. So I took a quick look at the flickr forums, and one person suggests you can grab the descriptions too by adding the "extras" parameter.
    http://www.flickr.com/groups/api/discuss/72157594456853637/#comment72157623785775034
    So try using:
        <cflickr.photosets_getPhotos(photoset_id=72157624340881708 ,
             auth_token=token, extras="description")>

  • Issue in Java Code for the dropdown

    Hi,
    I have created a HR form.
    Here I have 2 text fields Firstname & Lastname
    I have made those 2 TEXT fields as mandatory using the following code:
    if (Page1.Subform1.VORNA.isNull) {
    xfa.host.setFocus(Page1.Subform1.VORNA);
    xfa.host.messageBox("First Name is a required field.","Required Field",1);
    xfa.host.setFocus(Page1.Subform1.VORNA);
    This code is working fine for the TEXT fields.
    I have two another DROPDOWN FIELDS  (TITEL & GENDER).
    When I am applying the same code to these fields then it goes into an endless loop.
    Kindly help.
    Thanks & Regards,
    Lina Khanna

    800414 wrote:
    Hi,
    It's a very interesting subject -
    It appears under "validity of enc.\ proofs" in the following:Thanks for the information. It looks to require more than a couple of hours for me to get a grip on the subject so I suspect I will not get round to it.
    Best of luck with your research.
    Sabre

  • Comparing performance of different Java code designs - benchmarking

    Here's the problem:
    How do I run the java compiler (preferably Sun's javac) without getting any compile time optimization?
    I'd like to be able to compile a number of different programs to java bytecode - without having any optimization done by the compiler.
    The metric I want to use on the design of these programs is the "total number of bytecode instructions executed".
    The designs I want to compare can be reduced to "straight-line programs" with no conditionals or loops so I can learn a lot just by looking at the bytecodes emitted the compiler.
    Any pointers or help greatly appreciated.
    Cheers,
    Dafydd

    CORBA is supported by Windows machines (Windows XP/2000 as I know of it) and other APIs may be bought or included in some enterprise applications.
    RMI and CORBA are about as fast as each other. RMI-IIOP is slower then RMI and CORBA, however, it can sometimes go a little faster depending on deployment and environment.

  • Performance issue: Java and XSLT

    I have a performance issue concerning Java and XSLT: my goal is to transform an xml file (source.xml)
    by using a given xsl file (transformation.xsl). As result I would like to get a String object, in which the result
    of the transformation (html-code) is in, so that I can display it in a browser. The problem is the long time
    it takes for the code below to run through.
    xml = new File("C:\\source.xml");
    xmlSource = new StreamSource(xml);
    xslt = new File("C:\\transformation.xsl");
    StreamSource xsltSource = new StreamSource(xslt);
    TransformerFactory transFact = TransformerFactory.newInstance();
    trans = transFact.newTransformer(xsltSource);
    StringWriter stringWriter = new StringWriter();
    StreamResult streamResult = new StreamResult(stringWriter);
    trans.transform(xmlSource, streamResult);
    String output = stringWriter.toString();
    stringWriter.close();
    Before, I made the same transformation in an xml development environment, named Cooktop
    (see http://xmlcooktop.com/). The transformation took about 2 seconds. With the code above in Java it
    takes about 20 seconds.
    Is there a way to make the transformation in Java faster?
    Thanks in advance,
    Marcello
    Oldenburg, Germany
    [email protected]

    I haven't tried it but the if you can use java 6, you could try the new stax (StAX) with the XML stream loading..
    Take a look at:
    http://javaboutique.internet.com/tutorials/staxxsl/
    Then, you could cache the xslt in templates:
    ---8<---
    templates = transformerFactory.newTemplates( xsltSource );
    Transformer transformer = templates.newTransformer();
    (here you could probobly also cache the Transformer object but I think it's it's not thread safe so it's a little tricker..)
    StreamResult result = new StreamResult( System.out );
              transformer.transform(xmlSource, result);
    And, don't transform your result to a string, use a Stream or something, then the transformer could start pumping out html while working, and if you get a out of memory error it looks like you have a pretty big xml file...
    If you use jsp you could try the build in jsp taglib for xml which I think is rather good and they have support for varReader which implements the StreamSource iirc.
    /perty

  • Performance problem with java stored procedure

    hi,
    i developped a java class, then I stored it in Oracle 8.1.7.
    This class contains several import of other classes stored in the database.
    It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the great number of classes to load that are necessary for my class execution.
    I tried to increase the size of the java pool (I parameter 70 Mo in the java_pool_size parameter of the init.ora), but the performance is not much better.
    Has anyone an idea to increase the performance of this execution of my class ?
    In particular, is there a way to keep permanently in memory the java objects used by my class ?
    Thanks in advance
    bye
    [email protected]
    null

    before running Java, the database session needs to be Java enabled; this might be the reason why it is taking so long. If this is the case, you should see an improvement in subsequent calls, once a database session is Java enabled, other users can benefit from it.
    Kuassi
    I have some performance issue with java stored procedure. Hope some one will be able to help me out. I'm using java stored procedures in my application and basically these procedures are used to do some validation and form the XML message of the database tables. I have noticed that when I call the PL/SQL wrapper function, it is taking time to load the java class and once the class is loaded the execution is faster. Most of the time is spent for loading the class rather than executing the function. if I reduce the class load time, I can improve the performance drastically. Do any one of you know how to reduce the class load time. The following are the platform and oracle version.
    O/S: IBM AIX
    Oracle: 8.1.7

  • GP API performance issue

    We are experiencing a performance issue with custom code using the GP API.
    We get an array of IGPWorkItem objects using IGPRuntimeManager.getWorkItems.
    We use IGPRuntimeManager.getProcessInstanceInformation to retieve IGPProcessInstanceInfo object for each item in the array.
    There are around 220 items in the array.
    Each getProcessInstanceInformation() call normally completes in 50ms.
    Intermittently the time increases to 500ms.
    Sometimes this is for all items in the array.
    Sometimes it starts at 500ms and reduces to 50ms.
    After some period,  the speed returns to normal (50ms).
    This happens across multiple instances running on multiple servers.
    We can see no issues in cpu, memory, threads, or connections.
    Would appreciate any suggestions on how to troubleshoot this issue.
    Here is sample code with trace to capture times before and after method call.
    IGPRuntimeManager rtManager = GPProcessFactory.getRuntimeManager();
    IUser user = WDClientUser.getCurrentUser().getSAPUser();
    IGPContextManager contextManager = GPContextFactory.getContextManager();
    IGPUserContext userContext = contextManager.createUserContext(user, new Locale("en_US"));
    IGPWorkItem[] workItems = rtManager.getWorkItems(GPWorkItemStatus.WORKITEM_STATUS_OPEN, userContext);
    int len = workItems.length;
    for (int i = 0; i < len; i++)
         try
              loc.infoT("start loop " + i);
              IGPWorkItem workItem = workItems<i>;          
              processID = workItem.getProcessID();
              loc.infoT("start info object call");
              IGPProcessInstanceInfo info = rtManager.getProcessInstanceInformation(processID, user);
              loc.infoT("stop info object method");
              do other stuff ...
         catch (Exception e)
              loc.errorT(e.toString());
    Edited by: Ray Erdelyan on Dec 11, 2009 10:49 PM

    Dear BRamchan,
    From what you have described , I think you are well ahead in use of MDM APIs. The information you have provided below is not enough for understanding where the issue is. If you do not have any issues, if you could send a copy of your code - ( deleteing any confidential/ intellectual property related stuff ) , i can try to simulate the same code and see what kind of issues arise. If you think it is possible ,please send me the code at [email protected]
    Thanks.
    Siva K.

  • FlexBuilder 2 Performance Issue

    Hi,
    I have the following Development Environment. I have
    FlexBuilder 2.0 installed on my Laptop. The projects I am currently
    developing are on a server in the internal network. I am connected
    via Samba to this server.
    During my work I experience a different performance Issue
    than most of the people. If I try to write a Tag it takes the Code
    Assist about a minute to pop up the Tags, which are available in
    the context.
    If I try to develop a project locally, there is no
    performance issue with the Code Assist. My question now is: what
    the hell takes FlexBuilder so long to display the available Tags on
    the server? Is there any other way than turning the Code Assist
    off, to solve this Issue.
    I have an IBM ThinkPad T60 Dual Processor
    1 GB RAM
    and JRE 1.5 update 6 running
    thx Flo

    Hi,
    thx for the answer. I do not think of an memory problem. This
    performance issue is directly after the startup from Flexbuilder so
    that a restart of the application would not be the solution.
    The question is, what does FlexBuilder do by displaying the
    available tags? We had a look on the network connection statistics
    and they show, that a lot of traffic is produced only by the
    Content Assist. I think, FlexBuilder tries to find something on the
    remote Server and this takes so long. Am I wrong?
    mfg Flo

Maybe you are looking for

  • Volume licensing for Acrobat pro or standard

    We might purchase Adobe Acrobat XI pro or standard. We have 10-12 computers that program needs. Can we get volume licensing for acrobat pro or standard? how much it would be for pro and standard?

  • Help on erasing and installing

    I have put in the original disc that I had for my Macbook.  I have erased the hard drive.  I had Bootcamp with partition for Windows. I have successfully erased and removed the partition.  Now I go to install Max Snow Leopard but can't get the origin

  • Archive backup error

    Hi, we are taking archive backup for that i getting below error plz help me to resolve the error. BR0002I BRARCHIVE 7.00 (32) BR0006I Start of offline redo log processing: aecmkecv.cds 2010-02-02 10.51.45 BR0484I BRARCHIVE log file: /oracle/KBP/sapar

  • Deprecated Function in ECC6.0

    Hi, I am trying to find the impact of upgrading a 4.6C SAP system to an ECC6.0 for my custom applications. Therefore I would lik to ind what arethe changes in the standard SAP function. Wich one are still existing, removed, modified, renamed, ... Doe

  • Workitem execution from outlook - via citrix

    Hallo, we access SAP via Citrix and we want to execute workitems from outlook (by a decision task). I use the report RSWUWFML2, the user receives e-mail with corresponding attachments to execute the workitem, but I don't know, how to open them. Do I