Performance problem in ABAP programming

Hi!
Please review the following program,
LOOP AT TG_PRICE INTO WA_PRICE.
    CLEAR WA_VBELN.
    READ TABLE TG_VBELN INTO WA_VBELN WITH KEY KNUMV = WA_PRICE-KNUMV
                                               POSNR = WA_PRICE-KPOSN.
    IF SY-SUBRC = 0.
      WA_PRICE-VKORG = WA_VBELN-VKORG.
      WA_PRICE-VBELN = WA_VBELN-VBELN.
      WA_PRICE-POSNR = WA_VBELN-POSNR.
      WA_PRICE-MATNR = WA_VBELN-MATNR.
      WA_PRICE-MAKTX = WA_VBELN-MAKTX.
      WA_PRICE-ERNAM = WA_VBELN-ERNAM.
      WA_PRICE-ERDAT = WA_VBELN-ERDAT.
      MODIFY TG_PRICE FROM WA_PRICE.
      DELETE TABLE TG_VBELN FROM WA_VBELN.
    ELSE.
      DELETE TABLE TG_PRICE FROM WA_PRICE.
    ENDIF.
  ENDLOOP.
comments: internal table TG_PRICE has about 20,000 records and TG_VBELN has about 70,000.
this segment run spent too much time.
Comparing the following program, the speed is more faster.
  LOOP AT TG_PRICE INTO WA_PRICE.
    CLEAR WA_KONP.
    SELECT SINGLE KNUMH
                  KBETR
                  KONWA
                  KPEIN
                  KMEIN
                  INTO WA_KONP
    FROM KONP
    WHERE KNUMH = WA_PRICE-KNUMH.
    IF SY-SUBRC = 0.
      WA_PRICE-KBETR_FROM = WA_KONP-KBETR_FROM.
      WA_PRICE-KONWA_FROM = WA_KONP-KONWA_FROM.
      WA_PRICE-KPEIN_FROM = WA_KONP-KPEIN_FROM.
      WA_PRICE-KMEIN_FROM = WA_KONP-KMEIN_FROM.
      VL_AMOUNT = WA_PRICE-KBETR_FROM.
      CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'
        EXPORTING
          CURRENCY              = WA_PRICE-KONWA_FROM
          AMOUNT_INTERNAL       = VL_AMOUNT
        IMPORTING
          AMOUNT_DISPLAY        = VL_RATE
        EXCEPTIONS
          INTERNAL_ERROR        = 1
          OTHERS                = 2 .
      IF SY-SUBRC = 0.
        WA_PRICE-PRICE_FROM = VL_RATE.
      ENDIF.
      MODIFY TG_PRICE FROM WA_PRICE.
    ELSE.
      DELETE TABLE TG_PRICE FROM WA_PRICE.
    ENDIF.
  ENDLOOP.
commmets: internal table TG_PRICE has also 20,000 records. Within the Loop, there is system table selection clause. it should be slower than the previous program. But why the previous is more slower, is there something wrong with the READ clasue or any others?
Many thanks,
Aries

Hi Suresh,
The complete READ statment is as follows:
READ TABLE TG_VBELN INTO WA_VBELN
     WITH KEY KNUMV = WA_PRICE-KNUMV
              POSNR = WA_PRICE-KPOSN.
Hi Andreas,
The two internal tables have already been sorted as follows:
  SORT TG_PRICE BY KNUMV KPOSN.
  SORT TG_VBELN BY KNUMV POSNR.
And these two internal table are defined as follows:
Price
TYPES:BEGIN OF YS_PRICE,
         KNUMV      TYPE KNUMV,     "Number of the document condition
         KPOSN      TYPE KPOSN,     "Condition item number
         KNUMH      TYPE KNUMH,     "Condition record number
         VKORG      TYPE VKORG,     "Sales orgnazation
         VBELN      TYPE VBELN_VA,  "Order Number
         POSNR      TYPE POSNR_VA,  "Item number
         MATNR      TYPE MATNR,     "Material Number
         MAKTX      TYPE MAKTX,     "Material Description
         KBETR_FROM TYPE KBETR_KOND,"Changed From Price
         KONWA_FROM TYPE KONWA,     "Price Unit
         KPEIN_FROM TYPE KPEIN,     "Per
         KMEIN_FROM TYPE KMEIN,     "Per
         KBETR_TO   TYPE KBETR_KOND,"Changed to Price
         KONWA_TO   TYPE KONWA,     "Price Unit
         KPEIN_TO   TYPE KPEIN,     "Per
         KMEIN_TO   TYPE KVMEI,     "Per
         ERNAM      TYPE ERNAM,     "Created by
         ERDAT      TYPE ERDAT,     "Date Created
         PRICE_FROM TYPE P  DECIMALS 2,
         PRICE_TO   TYPE P  DECIMALS 2,
      END OF YS_PRICE.
Sales order
TYPES: BEGIN OF YS_VBELN,
         KNUMV      LIKE VBAK-KNUMV,"Number of the document condition
         VKORG      TYPE VKORG,     "Sales orgnazation
         VBELN      TYPE VBELN_VA,  "Order Number
         POSNR      TYPE POSNR_VA,  "Item number
         MATNR      TYPE MATNR,     "Material Number
         MAKTX      TYPE MAKTX,     "Material Description
         ERNAM      TYPE ERNAM,     "Created by
         ERDAT      TYPE ERDAT,     "Date Created
       END OF YS_VBELN.
DATA: TG_PRICE  TYPE YS_PRICE  OCCURS 0,
      TG_VBELN  TYPE YS_VBELN  OCCURS 0.
Do you have any ideas?
Many thanks,
Aries

Similar Messages

  • Performance  of a ABAP program

    Hi Friends,
    I have one doubt , in Performance  of a ABAP program.
    Which one gives good performance in Select Statement
    Open Cusor.. Select ... Close cusor  OR
    Select ..Package Size <n>
    If anybody having the  Idea please let me know .
    With Thanx.
    Elango

    Hi elangoraj,
    1. There is no standard calculation / method
       to determine the  package size.
    2. Its totally subjective and depends upon
      - the total number of records in database table,
      - the time taken to fetch one package
      - how many fetches we want.
    3. Usually It can be kept from 100 - 500.
    regards,
    amit m.

  • How to improve the performance of the abap program

    hi all,
    I have created an abap program. And it taking long time since the number of records are more. And can anyone let me know how to improve the performance of my abap program.
    Using se30 and st05 transaction.
    can anyone help me out step by step
    regds
    haritha

    Hi Haritha,
    ->Run Any program using SE30 (performance analysis)
    Note: Click on the Tips & Tricks button from SE30 to get performance improving tips.
    Using this you can improve the performance by analyzing your code part by part.
    ->To turn runtim analysis on within ABAP code insert the following code
    SET RUN TIME ANALYZER ON.
    ->To turn runtim analysis off within ABAP code insert the following code
    SET RUN TIME ANALYZER OFF.
    ->Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    ->Avoid for all entries in JOINS
    ->Try to avoid joins and use FOR ALL ENTRIES.
    ->Try to restrict the joins to 1 level only ie only for tables
    ->Avoid using Select *.
    ->Avoid having multiple Selects from the same table in the same object.
    ->Try to minimize the number of variables to save memory.
    ->The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    ->Avoid creation of index as far as possible
    ->Avoid operators like <>, > , < & like % in where clause conditions
    ->Avoid select/select single statements in loops.
    ->Try to use 'binary search' in READ internal table. -->Ensure table is sorted before using BINARY SEARCH.
    ->Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
    ->Avoid using ORDER BY in selects
    ->Avoid Nested Selects
    ->Avoid Nested Loops of Internal Tables
    ->Try to use FIELD SYMBOLS.
    ->Try to avoid into Corresponding Fields of
    ->Avoid using Select Distinct, Use DELETE ADJACENT
    Check the following Links
    Re: performance tuning
    Re: Performance tuning of program
    http://www.sapgenie.com/abap/performance.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    check the below link
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    See the following link if it's any help:
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    Check also http://service.sap.com/performance
    and
    books like
    http://www.sap-press.com/product.cfm?account=&product=H951
    http://www.sap-press.com/product.cfm?account=&product=H973
    http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    Performance tuning for Data Selection Statement
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    Debugger
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
    http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
    Run Time Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
    SQL trace
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
    CATT - Computer Aided Testing Too
    http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
    Test Workbench
    http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
    Coverage Analyser
    http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
    Runtime Monitor
    http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
    Memory Inspector
    http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
    ECATT - Extended Computer Aided testing tool.
    http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm
    Just refer to these links...
    performance
    Performance
    Performance Guide
    performance issues...
    Performance Tuning
    Performance issues
    performance tuning
    performance tuning
    You can go to the transaction SE30 to have the runtime analysis of your program.Also try the transaction SCI , which is SAP Code Inspector.
    edited by,
    Naveenan

  • Performance issue in abap program

    hi,
    how can we improve the performance of  abap program

    hi,
    read the follwing links
    ABAP provides few tools to analyse the perfomance of the objects, which was developed by us.
    Run time analysis transaction SE30
    This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing.
    SQL Trace transaction ST05
    by using this tool we can analyse the perfomance issues related to DATABASE calls.
    Perfomance Techniques for improve the perfomance of the object.
    1) ABAP/4 programs can take a very long time to execute, and can make other processes have to wait before executing. Here are some tips to speed up your programs and reduce the load your programs put on the system:
    2) Use the GET RUN TIME command to help evaluate performance. It's hard to know whether that optimization technique REALLY helps unless you test it out.
    3) Using this tool can help you know what is effective, under what kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so you should use it to test small pieces of your program, rather than the whole program.
    4) Generally, try to reduce I/O first, then memory, then CPU activity. I/O operations that read/write to hard disk are always the most expensive operations. Memory, if not controlled, may have to be written to swap space on the hard disk, which therefore increases your I/O read/writes to disk. CPU activity can be reduced by careful program design, and by using commands such as SUM (SQL) and COLLECT (ABAP/4).
    5) Avoid 'SELECT *', especially in tables that have a lot of fields. Use SELECT A B C INTO instead, so that fields are only read if they are used. This can make a very big difference.
    6) Field-groups can be useful for multi-level sorting and displaying. However, they write their data to the system's paging space, rather than to memory (internal tables use memory). For this reason, field-groups are only appropriate for processing large lists (e.g. over 50,000 records). If you have large lists, you should work with the systems administrator to decide the maximum amount of RAM your program should use, and from that, calculate how much space your lists will use. Then you can decide whether to write the data to memory or swap space.
    Use as many table keys as possible in the WHERE part of your select statements.
    7)Whenever possible, design the program to access a relatively constant number of records (for instance, if you only access the transactions for one month, then there probably will be a reasonable range, like 1200-1800, for the number of transactions inputted within that month). Then use a SELECT A B C INTO TABLE ITAB statement.
    8) Get a good idea of how many records you will be accessing. Log into your productive system, and use SE80 -> Dictionary Objects (press Edit), enter the table name you want to see, and press Display. Go To Utilities -> Table Contents to query the table contents and see the number of records. This is extremely useful in optimizing a program's memory allocation.
    9) Try to make the user interface such that the program gradually unfolds more information to the user, rather than giving a huge list of information all at once to the user.
    10) Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to be accessing. If the number of records exceeds NUM_RECS, the data will be kept in swap space (not memory).
    11) Use SELECT A B C INTO TABLE ITAB whenever possible. This will read all of the records into the itab in one operation, rather than repeated operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement. Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to access.
    12) If the number of records you are reading is constantly growing, you may be able to break it into chunks of relatively constant size. For instance, if you have to read all records from 1991 to present, you can break it into quarters, and read all records one quarter at a time. This will reduce I/O operations. Test extensively with GET RUN TIME when using this method.
    13) Know how to use the 'collect' command. It can be very efficient.
    14) Use the SELECT SINGLE command whenever possible.
    15) Many tables contain totals fields (such as monthly expense totals). Use these avoid wasting resources by calculating a total that has already been calculated and stored.
    Some tips:
    1) Use joins where possible as redundant data is not fetched.
    2) Use select single where ever possible.
    3) Calling methods of a global class is faster than calling function modules.
    4) Use constants instead of literals
    5) Use WHILE instead of a DO-EXIT-ENDDO.
    6) Unnecessary MOVEs should be avoided by using the explicit work area operations
    see the follwing links for a brief insifght into performance tuning,
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_Introduction.asp
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/801f7c454211d189710000e8322d00/frameset.htm
    regards
    Rohan

  • Performance problem in ABAP code

    hai guys,
    I created report using tables like bsis,t001 etc,( tax report).
    I have performance problem in this report.
    COuld you pls tell me how to analyse the report and find out the place where process is taking more memory etc.
    i did abap trace and runtime analysis..but could not find out exact point.
    how to do this..
    i want to analysis each subroutine,internal table and query process.
    could you pls give me some ideas.
    ambichan

    There is an excellent tool available in SAP - <b>Code Inspector.
    </b>
    Transaction is SCII
    Try the following link and I am sure you will find a bunch of useful documents.
    <a href="http://www.google.co.in/search?hl=en&safe=off&q=site%3Asdn.sap.comfiletype%3ApdfCode+Inspector&btnG=Search&meta=">ABAP Performance</a>
    I use the Code Inspector to search for
    a) All the select statements which are present within the loop
    b) Nested Loops
    c) Select query without providing criteria for primary keys, depending upon situation
    d) Can the search be narrowed with extra conditions
    e) Using READ .. BINARY SEARCH if internal table has lots of records.
    The list is actually endless, but this is something to start with.
    You can actually have a checklist, and depending upon it, go through your code. The more you adhere to checklist, you will find that, the performance would dramatically improve.
    Also use <b>ST05</b> transaction, for SQL Trace and find out which select query is taking the maximum time for response.
    Regards,
    Subramanian V.

  • Increasing the performance of the abap program

    Hi ,
    Anybody had any document regarding how to increase the performance of ABAP program.
    Regards,
    baiju

    hi,
      Refer This link.
    <b>
    Performance tuning for Data Selection Statement</b> 
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    <b>
    1.     Debugger</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
    http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
    <b>2. Run Time Analyser</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
    <b>3. SQL trace</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
    <b>4. CATT - Computer Aided Testing Too</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
    <b>
    5. Test Workbench</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
    <b>
    6. Coverage Analyser</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
    <b>
    7. Runtime Monitor</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
    <b>
    8. Memory Inspector</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
    <b>9. ECATT - Extended Computer Aided testing tool.</b>
    http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm

  • Facing problem in ABAP program "HINCALC0"

    hi all,
               i m facing problem in the  ABAP program "HINCALC0". when i m run this hr program we face problem in processing problem is " No entry in table T512W for key 40 /4OD for time 30.04.2009". plz suggest me hw can i rectify this problem.
    thanks

    Hi,
    As mohan said, you will need to create wage type /4OD. Some of the standand Function/PCR calculating amount and trying to push into /4OD which in not available in the system.
    Regards,
    Karunakar

  • Performance problems with abap report SAPLPRGN_STRUCTURE during users login

    Hello,
    after patchimport of SAP BASIS level 21 and SAPABAP level 21 our SAP Production System (ECC6-UNICODE KERNEL 240) denote a performance problems. A lot of ours users during logon phase must wait until 10-12 minutes before that the navigation menu is displayed. The problem is generated by the slow performance of the standard SAP REPORT SAPLPRGN_STRUCTURE that require a lot time.  Any idea?
    Thanks

    Hi Pat,
    I would stop SAP and use DLTR3PKG, If this doesn't help, you need to investigate, if it is a CPU or DB-Time issue in ST03. Then you have to handle accordingly ...
    Regards
    Volker Gueldenpfennig, consolut international ag
    http://www.consolut.net - http://www.4soi.de - http://www.easymarketplace.de

  • Expression problem for ABAP program

    Hi everyone,
    Once i have saw a expression in ABAP program. as follows.
    DATA:drag_object TYPE REF TO lcl_dragdrop_dataobject.
    CATCH SYSTEM-EXCEPRIONS move_cast_error = 1.
    drag_object ?= dragdrop_object->object.
    ENDCATCH.
    IF sy-subrc = 1.
    CALL METHOD dragdrop_object->abort.
    EXIT.
    ENDIF.
    I don't know what is "?=" .
    Please help me.
    Thanks Advanced !

    DATA: airplane TYPE REF TO lcl_airplane,
                cargo_airplane TYPE REF TO lcl_cargo_airplane,
                cargo_airplane2 TYPE REF TO lcl_cargo_airplane.
          CREATE OBJECT cargo_airplane.
          airplane = cargo_airplane.
          cargo_airplane2 ?= airplane.
                 The type of case described above is known as a widening cast because it changes the
                 view to one with more details. The instance assigned (a cargo plane in the above
                 example) must correspond to the object reference (cargo_airplane in the above example),
                 that is, the instance must have the details implied by the reference. This is also known as
                 a u201Cdown castu201D. The widening cast in this case does not cause an error because the
                 reference airplane actually points to an instance in the subclass lcl_cargo_airplane. The
                 dynamic type is therefore u2018REF TO lcl_cargo_airplaneu2019.
    The widening cast logically represents the opposite of the narrowing cast. The widening cast cannot be checked statically, only at runtime. The Cast Operator u201C?=u201D (or the equivalent u201CMOVE ... ?TO u2026u201D) must be used to make this visible.

  • Serious Performance Problems in ABAP Reports

    Hi All,
    We are developing ABAP reports for SAP IS-U/CCS Modules and facing Performance issues.Whole scenario is given below.Please suggest some solution.
    1. Total No. Of Business Partners = 1500000
    2. Reports Selection Criteria are of two types:
         a) GSBER(Business Area) - Selection for atleast 200000 Business Partners
         b) Cokey(Division)     - Selection for around 1000 to 50000 Business Partners
    3. For implementing our reports logic we have to access several tables all of which are very large.They are :
         Table Name     No. of records (Appx)          
         DBERCHV               20000000
         DBERCHZ1              20000000
         DBERDLB               20000000
         DFKKKO                20000000
         DFKKOP                20000000
         EANLH                  4000000
         ERCH                  10000000
         ERCHC                 10000000
         ETTIFN                30000000
         EVER                   1500000
         FKKVKP                 1500000
         TECOKT                     500     
         TGSBT                       12
    4. Due to large no. of records we are facing problems at two levels:
         a) OpenSQL Statement is taking too much time for data selection
         b) Since large no. of records are selected Corresponding loops and data processing also takes much time
    5. We have tried almost all ABAP Performance optimization techniques such as using Index, SQL optimization techniques,Read Table Optimization, Loop Statement Optimization etc. but there is not much improvement.
    6. For example one of our Reports "R15" takes around 1500 seconds for 1000 Business Partners.
    Its Code is attached below:
    <b>a) ZISU_SCHL_LTR15_BAPI - Program which schedules actual R15 report in background</b>
    *& Report  ZISU_SCHL_LTR15_BAPI                                        *
    *& Developed By : Piyusha Kirwai                                       *
    *& Date         : 02/12/2005                                           *
    *& Purpose      : To Schedule the LT R 15 prog in background and store
    *& the File for Manual R-15 into server.
    REPORT  ZISU_SCHL_LTR15_BAPI  NO STANDARD PAGE HEADING.
    TABLES ZEVERFKKVKP.
    DATA:  DYFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
    DATA: IT_TAB TYPE FILETABLE,
          GD_SUBRC TYPE I.
    DATA: LV_GSBER TYPE TGSBT-GSBER.
    RANGES R_COKEY FOR ZEVERFKKVKP-COKEY.
    DATA: BEGIN OF GT_TECOKT OCCURS 100,
            COKEY TYPE TECOKT-COKEY,
            LTEXT TYPE TECOKT-LTEXT,
          END   OF GT_TECOKT,
          BEGIN OF GT_TE422 OCCURS 100,
            TERMSCHL TYPE TE422-TERMSCHL,
            TERMTEXT TYPE TE422-TERMTEXT,
          END   OF GT_TE422.
    DATA: BEGIN OF GWA_MANUAL_DATA,
            COL_1(5)        TYPE C,
            COL_2(10)       TYPE C,
            COL_3(40)       TYPE C,
            COL_4(40)       TYPE C,
            COL_5(10)       TYPE C,
            COL_6(19)       TYPE C,
            COL_7(19)       TYPE C,
            COL_8(19)       TYPE C,
            COL_9(19)       TYPE C,
            COL_10(19)      TYPE C,
            COL_11(19)      TYPE C,
            COL_12(10)      TYPE C,
            COL_13(19)      TYPE C,
            COL_14(19)      TYPE C,
            COL_15(19)      TYPE C,
            COL_16(19)      TYPE C,
            COL_17(19)      TYPE C,
            COL_18(19)      TYPE C,
          END   OF GWA_MANUAL_DATA,
          GT_MANUAL_DATA LIKE GWA_MANUAL_DATA OCCURS 0,
          GT_INTERN_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    *&-----FOR UPLOADING FILE TO SERVER------------------------------------*
    DATA: LV_SERVER_FILE_PREFIX(60) TYPE C.
    DATA: LV_SERVER_DATAFILE_NAME(60) TYPE C.
    DATA: LV_SERVER_ERRFILE_NAME(60) TYPE C.
    DATA: ENDT LIKE SY-UZEIT,
          ENDD LIKE SY-DATUM,
          JOBCOUNT TYPE TBTCJOB-JOBCOUNT.
    SELECTION-SCREEN BEGIN OF BLOCK 001 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: SO_GSBER FOR ZEVERFKKVKP-GSBER OBLIGATORY,
                    SO_COKEY FOR ZEVERFKKVKP-COKEY OBLIGATORY,
                    SO_MRU   FOR ZEVERFKKVKP-ABLEINH.
    PARAMETERS:     P_BMNTH(7) TYPE C OBLIGATORY.
    SELECT-OPTIONS: SO_GPART FOR ZEVERFKKVKP-GPART.
    SELECTION-SCREEN END  OF BLOCK 001.
    SELECTION-SCREEN BEGIN OF BLOCK 002 WITH FRAME TITLE TEXT-003.
    PARAMETERS:  P_COMPUT RADIOBUTTON GROUP R15,
                 P_INCLUD RADIOBUTTON GROUP R15,
                 P_FILE  TYPE  RLGRAP-FILENAME MODIF ID ACT.
    SELECTION-SCREEN END   OF BLOCK 002.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(83) TEXT-004.
    SELECTION-SCREEN END   OF LINE.
    *SELECTION-SCREEN BEGIN OF LINE.
    *  SELECTION-SCREEN COMMENT 8(40) TEXT-005.
    *SELECTION-SCREEN END   OF LINE.
    SELECTION-SCREEN BEGIN OF BLOCK 003 WITH FRAME TITLE TEXT-002.
    PARAMETERS   P_SCHL TYPE C AS CHECKBOX.
    PARAMETERS : P_IMMED RADIOBUTTON GROUP SCH ,
                 P_DT_TM  RADIOBUTTON GROUP SCH,
                 P_DATE TYPE SY-DATUM MODIF ID SHL,
                 P_TIME TYPE SY-UZEIT MODIF ID SHL.
    SELECTION-SCREEN END   OF BLOCK 003.
    AT SELECTION-SCREEN.
    AT SELECTION-SCREEN ON SO_GSBER.
      IF NOT SO_GSBER-LOW IS INITIAL.
        SELECT SINGLE GSBER FROM TGSBT INTO LV_GSBER
          WHERE GSBER = SO_GSBER-LOW.
        IF SY-SUBRC <> 0.
          MESSAGE E007(ZISU).
        ENDIF.
      ENDIF.
      IF NOT SO_GSBER-HIGH IS INITIAL .
        SELECT SINGLE GSBER FROM TGSBT INTO LV_GSBER
          WHERE GSBER = SO_GSBER-HIGH.
        IF SY-SUBRC <> 0.
          MESSAGE E007(ZISU).
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON P_BMNTH.
    **check the validity of Billing month format and for valid billing month
      IF P_BMNTH CO '0123456789/'.
        IF P_BMNTH CP '++++/++'.
          IF P_BMNTH+5(2) > 12.
            MESSAGE E002(ZISU) WITH 'from'.
          ENDIF.
    ** current year is less than year entered
          IF SY-DATUM(4) < P_BMNTH(4).
            MESSAGE E003(ZISU) WITH 'from'.
          ELSEIF SY-DATUM(4) = P_BMNTH(4).
    ** month in future
            IF SY-DATUM+4(2) < P_BMNTH+5(2).
              MESSAGE E004(ZISU) WITH 'from'.
            ENDIF.
          ENDIF.
        ELSE.
          MESSAGE E001(ZISU) WITH 'from'.
        ENDIF.
      ELSE.
    **  entry have some invalid char
        MESSAGE E010(ZISU).
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-LOW.
    **for geting the CO account assigment key of the entered Business area
      CLEAR: DYFIELDS[], DYFIELDS.
      PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-HIGH.
    **for geting the CO account assigment key of the entered Business area
      CLEAR: DYFIELDS[], DYFIELDS.
      PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-HIGH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_MRU-LOW.
      CLEAR: DYFIELDS[], DYFIELDS.
      PERFORM MRU_DATA_GET CHANGING SO_MRU-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_MRU-HIGH.
      CLEAR: DYFIELDS[], DYFIELDS.
      PERFORM MRU_DATA_GET CHANGING SO_MRU-HIGH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
      REFRESH: IT_TAB.
    **Opens File Open Dialog Box for selecting input file.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
        EXPORTING
          WINDOW_TITLE     = 'Select File'
          DEFAULT_FILENAME = '*.xls'
          MULTISELECTION   = ' '
        CHANGING
          FILE_TABLE       = IT_TAB
          RC               = GD_SUBRC.
      LOOP AT IT_TAB INTO P_FILE.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'ACT'.
          IF P_INCLUD = ' '.
            SCREEN-INPUT = '0'.
          ELSE.
            SCREEN-INPUT = '1'.
          ENDIF.
        ENDIF.
        IF SCREEN-GROUP1 = 'SHL'.
          IF P_DT_TM = 'X'.
            SCREEN-INPUT = '1'.
          ELSE.
            SCREEN-INPUT = '0'.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    INITIALIZATION.
      P_DATE = SY-DATUM.
      P_TIME = SY-UZEIT + 180.
    START-OF-SELECTION.
      IF P_INCLUD = 'X' AND P_FILE IS INITIAL.
        MESSAGE 'Enter the Manual R-15 File' TYPE 'E'.
      ENDIF.
    *  IF P_INCLUD = 'X'.
    *    PERFORM UPLOAD_EXCEL_FILE.
    *    CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
    *    CONCATENATE LV_SERVER_FILE_PREFIX '-' 'LT.TMP' INTO
    *    LV_SERVER_DATAFILE_NAME.
    *    OPEN DATASET LV_SERVER_DATAFILE_NAME
    *      FOR OUTPUT
    *      IN TEXT MODE
    *      ENCODING DEFAULT.
    *    LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
    *      IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
    *      AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
    *        MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
    *      ENDIF.
    *      TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
    *    ENDLOOP.
    *    CLOSE DATASET LV_SERVER_DATAFILE_NAME.
    *  ENDIF.  "  P_INCLUD = 'X'.
      IF P_SCHL = 'X'.
        IF P_IMMED = 'X'.
          CALL FUNCTION 'C14B_ADD_TIME'
            EXPORTING
              I_STARTTIME = SY-UZEIT
              I_STARTDATE = SY-DATUM
              I_ADDTIME   = '000010'
            IMPORTING
              E_ENDTIME   = ENDT
              E_ENDDATE   = ENDD.
        ELSEIF P_DT_TM = 'X'.
          ENDD = P_DATE.
          ENDT = P_TIME.
        ENDIF.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
    *     DELANFREP              = ' '
    *     JOBGROUP               = ' '
            JOBNAME                = 'R15JOB'
    *      SDLSTRTDT              = ENDD
    *      SDLSTRTTM              = ENDT
    *     JOBCLASS               =
         IMPORTING
           JOBCOUNT               = JOBCOUNT
    *   CHANGING
    *     RET                    =
    *   EXCEPTIONS
    *     CANT_CREATE_JOB        = 1
    *     INVALID_JOB_DATA       = 2
    *     JOBNAME_MISSING        = 3
    *     OTHERS                 = 4
        IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        IF P_INCLUD = 'X'.
          PERFORM UPLOAD_EXCEL_FILE.
         CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
          CONCATENATE LV_SERVER_FILE_PREFIX '-' JOBCOUNT 'LT.TMP' INTO
          LV_SERVER_DATAFILE_NAME.
          CONDENSE LV_SERVER_DATAFILE_NAME.
          OPEN DATASET LV_SERVER_DATAFILE_NAME
            FOR OUTPUT
            IN TEXT MODE
            ENCODING DEFAULT.
          IF SY-SUBRC NE 0.
            MESSAGE 'Error in Creating File on Server' TYPE 'E'.
          ENDIF.
          LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
            IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
              MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
            ENDIF.
            TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
          ENDLOOP.
          CLOSE DATASET LV_SERVER_DATAFILE_NAME.
          IF SY-SUBRC NE 0.
            MESSAGE 'Error in Creating File on Server' TYPE 'E'.
          ENDIF.
        ENDIF.  "  P_INCLUD = 'X'.
        SUBMIT ZISU_LTR15_TUNE
          WITH SO_GSBER IN SO_GSBER
          WITH SO_COKEY IN SO_COKEY
          WITH SO_MRU   IN SO_MRU
          WITH SO_GPART IN SO_GPART
          WITH P_BMNTH  =  P_BMNTH
          WITH P_COMPUT = P_COMPUT
          WITH P_INCLUD = P_INCLUD
          WITH P_FILE   = LV_SERVER_DATAFILE_NAME
          USER SY-UNAME VIA JOB 'R15JOB' NUMBER JOBCOUNT AND RETURN.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
    *   AT_OPMODE                         = ' '
    *   AT_OPMODE_PERIODIC                = ' '
    *   CALENDAR_ID                       = ' '
    *   EVENT_ID                          = ' '
    *   EVENT_PARAM                       = ' '
    *   EVENT_PERIODIC                    = ' '
            JOBCOUNT                          = JOBCOUNT
            JOBNAME                           = 'R15JOB'
    *   LASTSTRTDT                        = NO_DATE
    *   LASTSTRTTM                        = NO_TIME
    *   PRDDAYS                           = 0
    *   PRDHOURS                          = 0
    *   PRDMINS                           = 0
    *   PRDMONTHS                         = 0
    *   PRDWEEKS                          = 0
    *   PREDJOB_CHECKSTAT                 = ' '
    *   PRED_JOBCOUNT                     = ' '
    *   PRED_JOBNAME                      = ' '
            SDLSTRTDT                         = ENDD
            SDLSTRTTM                         = ENDT
    *   STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
            STRTIMMED                         = P_IMMED
    *   TARGETSYSTEM                      = ' '
    *   START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
    *   START_ON_WORKDAY_NR               = 0
    *   WORKDAY_COUNT_DIRECTION           = 0
    *   RECIPIENT_OBJ                     =
    *   TARGETSERVER                      = ' '
    *   DONT_RELEASE                      = ' '
    *   TARGETGROUP                       = ' '
    *   DIRECT_START                      =
    * IMPORTING
    *   JOB_WAS_RELEASED                  =
    * CHANGING
    *   RET                               =
    * EXCEPTIONS
    *   CANT_START_IMMEDIATE              = 1
    *   INVALID_STARTDATE                 = 2
    *   JOBNAME_MISSING                   = 3
    *   JOB_CLOSE_FAILED                  = 4
    *   JOB_NOSTEPS                       = 5
    *   JOB_NOTEX                         = 6
    *   LOCK_FAILED                       = 7
    *   INVALID_TARGET                    = 8
    *   OTHERS                            = 9
        IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.  " IF NOT TO RUN IN BACKGROUND
        IF P_INCLUD = 'X'.
          PERFORM UPLOAD_EXCEL_FILE.
         CONCATENATE 'R15' SY-DATUM '-' SY-UZEIT INTO LV_SERVER_FILE_PREFIX.
          CONCATENATE LV_SERVER_FILE_PREFIX '-' 'LT.TMP' INTO
          LV_SERVER_DATAFILE_NAME.
          CONDENSE LV_SERVER_DATAFILE_NAME.
          OPEN DATASET LV_SERVER_DATAFILE_NAME
            FOR OUTPUT
            IN TEXT MODE
            ENCODING DEFAULT.
          IF SY-SUBRC NE 0.
            MESSAGE 'Error in Creating File on Server' TYPE 'E'.
          ENDIF.
          LOOP AT GT_MANUAL_DATA INTO GWA_MANUAL_DATA.
            IF ( GWA_MANUAL_DATA-COL_6 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_7 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_8 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_9 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_10 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_11 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_13 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_14 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_15 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_16 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_17 CN '0123456789 '
            AND GWA_MANUAL_DATA-COL_18 CN '0123456789 ' ).
              MESSAGE 'Character Data in Numerical Field' TYPE 'E'.
            ENDIF.
            TRANSFER GWA_MANUAL_DATA TO LV_SERVER_DATAFILE_NAME.
          ENDLOOP.
          CLOSE DATASET LV_SERVER_DATAFILE_NAME.
          IF SY-SUBRC NE 0.
            MESSAGE 'Error in Creating File on Server' TYPE 'E'.
          ENDIF.
        ENDIF.  "  P_INCLUD = 'X'.
        IF NOT SY-BATCH IS INITIAL.
          SUBMIT ZISU_LTR15_TUNE
            WITH SO_GSBER IN SO_GSBER
            WITH SO_COKEY IN SO_COKEY
            WITH SO_MRU   IN SO_MRU
            WITH SO_GPART IN SO_GPART
            WITH P_BMNTH  =  P_BMNTH
            WITH P_COMPUT = P_COMPUT
            WITH P_INCLUD = P_INCLUD
            WITH P_FILE   = LV_SERVER_DATAFILE_NAME
            TO SAP-SPOOL WITHOUT SPOOL DYNPRO.
        ELSE.
          SUBMIT ZISU_LTR15_TUNE
            WITH SO_GSBER IN SO_GSBER
            WITH SO_COKEY IN SO_COKEY
            WITH SO_MRU   IN SO_MRU
            WITH SO_GPART IN SO_GPART
            WITH P_BMNTH  =  P_BMNTH
            WITH P_COMPUT = P_COMPUT
            WITH P_INCLUD = P_INCLUD
            WITH P_FILE   = LV_SERVER_DATAFILE_NAME.
        ENDIF.
      ENDIF.
    *&      Form  divison_data_get
    *       text
    *      <--P_SO_COKEY_LOW  text
    FORM DIVISON_DATA_GET  CHANGING P_SO_COKEY_LOW.
    **to get the search help for division
      DATA : LV_LINES TYPE SY-TFILL,
            LT_RETURN_TAB LIKE DDSHRETVAL OCCURS 0, " with header line.
            LWA_RETURN_TAB LIKE DDSHRETVAL.
      DATA: LV_COKEY TYPE ZEVERFKKVKP-COKEY.
    **according to the Business area entered]
    *  break csebdev1.
      REFRESH R_COKEY[].
      DESCRIBE TABLE SO_GSBER LINES LV_LINES.
    **  when user has neither pressed the enter key nor selected the values
    **using search help
      IF LV_LINES = 0.
    *  loop at so_gsber.
        CLEAR R_COKEY.
    *    if so_gsber-high is initial.
    *    break csebdev1.
        DYFIELDS-FIELDNAME = 'SO_GSBER-LOW'.
        APPEND DYFIELDS.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME     = SY-CPROG
            DYNUMB     = SY-DYNNR
          TABLES
            DYNPFIELDS = DYFIELDS.
    *      r_cokey-sign = 'I'.
    *      r_cokey-option = 'CP'.
    *r_cokey-low = so_gsber-low+0(2).
        CONCATENATE DYFIELDS-FIELDVALUE+0(2) '*' INTO R_COKEY-LOW.
    *    elseif not so_gsber-high is initial.
        DYFIELDS-FIELDNAME = 'SO_GSBER-HIGH'.
        APPEND DYFIELDS.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME     = SY-CPROG
            DYNUMB     = SY-DYNNR
          TABLES
            DYNPFIELDS = DYFIELDS.
        IF NOT DYFIELDS-FIELDVALUE IS INITIAL.
          CONCATENATE DYFIELDS-FIELDVALUE+0(2) '99999999' INTO R_COKEY-HIGH.
        ENDIF.
    *    endif.
        IF NOT R_COKEY-HIGH IS INITIAL.
          R_COKEY-SIGN = 'I'.
          R_COKEY-OPTION = 'BT'.
        ELSEIF R_COKEY-HIGH IS INITIAL.
          R_COKEY-SIGN = 'I'.
          R_COKEY-OPTION = 'CP'.
        ENDIF.
        APPEND R_COKEY.
      ENDIF.
    *  endloop.
    *  APPEND DYFIELDS.
      IF LV_LINES > 0.
    *    break-point.
        IF NOT SO_GSBER[] IS INITIAL.
          LOOP AT SO_GSBER.
    *        r_cokey-sign = 'I'.
    *        r_cokey-option = 'CP'.
    *r_cokey-low = so_gsber-low+0(2).
            CONCATENATE SO_GSBER-LOW+0(2) '*' INTO R_COKEY-LOW.
            IF NOT SO_GSBER-HIGH IS INITIAL.
              CONCATENATE SO_GSBER-HIGH+0(2) '99999999' INTO R_COKEY-HIGH.
            ENDIF.
            IF NOT R_COKEY-HIGH IS INITIAL.
              R_COKEY-SIGN = 'I'.
              R_COKEY-OPTION = 'BT'.
            ELSEIF R_COKEY-HIGH IS INITIAL.
              R_COKEY-SIGN = 'I'.
              R_COKEY-OPTION = 'CP'.
            ENDIF.
            APPEND R_COKEY TO R_COKEY.
          ENDLOOP.
        ENDIF.
      ENDIF.
      IF NOT R_COKEY[] IS INITIAL.
    * break csebdev1.
        REFRESH GT_TECOKT[].
        SELECT COKEY LTEXT
        FROM TECOKT
        INTO TABLE GT_TECOKT
        WHERE COKEY IN R_COKEY AND SPRAS = 'EN'.
    *    %_HINTS ORACLE '("TECOKT","TECOKT~1")'.
      ENDIF.
    **now call the search help
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
    *   DDIC_STRUCTURE         = ' '
          RETFIELD               = 'COKEY'
    *   PVALKEY                = ' '
    *   DYNPPROG               = ' '
    *   DYNPNR                 = ' '
    *   DYNPROFIELD            = ' '
    *   STEPL                  = 0
         WINDOW_TITLE           = 'Division'
         VALUE                  = DYFIELDS-FIELDVALUE
         VALUE_ORG              = 'S'
    *   MULTIPLE_CHOICE        = ' '
    *   DISPLAY                = ' '
    *   CALLBACK_PROGRAM       = ' '
    *   CALLBACK_FORM          = ' '
    *   MARK_TAB               =
    * IMPORTING
    *   USER_RESET             =
        TABLES
          VALUE_TAB              = GT_TECOKT
    *   FIELD_TAB              =
         RETURN_TAB             = LT_RETURN_TAB
    *   DYNPFLD_MAPPING        =
    * EXCEPTIONS
    *   PARAMETER_ERROR        = 1
    *   NO_VALUES_FOUND        = 2
    *   OTHERS                 = 3
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE LT_RETURN_TAB INTO LWA_RETURN_TAB INDEX 1.
      LV_COKEY = LWA_RETURN_TAB-FIELDVAL.
    *break csebdev1.
    ENDFORM.                    " divison_data_get
    *&      Form  upload_excel_file
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM UPLOAD_EXCEL_FILE .
      DATA: LV_INDEX TYPE I.
      FIELD-SYMBOLS <VAL> TYPE ANY.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME                = P_FILE
          I_BEGIN_COL             = 1
          I_BEGIN_ROW             = 8
          I_END_COL               = 18
          I_END_ROW               = 94
        TABLES
          INTERN                  = GT_INTERN_DATA
        EXCEPTIONS
          INCONSISTENT_PARAMETERS = 1
          UPLOAD_OLE              = 2
          OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF NOT GT_INTERN_DATA[] IS INITIAL.
        SORT GT_INTERN_DATA BY ROW COL.
        LOOP AT GT_INTERN_DATA.
          MOVE GT_INTERN_DATA-COL TO LV_INDEX.
          ASSIGN COMPONENT LV_INDEX OF STRUCTURE GWA_MANUAL_DATA TO <VAL>.
          MOVE GT_INTERN_DATA-VALUE TO <VAL>.
          AT END OF ROW.
            APPEND GWA_MANUAL_DATA TO GT_MANUAL_DATA.
            CLEAR GWA_MANUAL_DATA.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " upload_excel_file
    *&      Form  MRU_DATA_GET
    *       text
    *      <--P_SO_MRU_LOW  text
    FORM MRU_DATA_GET  CHANGING LV_MRU.
    **to get the search help for Group
      DATA : LV_LINES TYPE SY-TFILL,
            LT_RETURN_TAB LIKE DDSHRETVAL OCCURS 0,
            LWA_RETURN_TAB LIKE DDSHRETVAL.
    *        lv_mru_p(3) type c.
      RANGES  R_MRU FOR EANLH-ABLEINH.
    **according to the Business area entered
    **  break csebdev1.
      REFRESH R_MRU[].
      DESCRIBE TABLE SO_GSBER LINES LV_LINES.
    **  when user has neither pressed the enter key nor selected the values
    **using search help
      IF LV_LINES = 0.
        CLEAR R_MRU[].
        DYFIELDS-FIELDNAME = 'SO_GSBER-LOW'.
        APPEND DYFIELDS.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME     = SY-CPROG
            DYNUMB     = SY-DYNNR
          TABLES
            DYNPFIELDS = DYFIELDS.
        CONCATENATE DYFIELDS-FIELDVALUE+0(2) '*' INTO R_MRU-LOW.
        DYFIELDS-FIELDNAME = 'SO_GSBER-HIGH'.
        APPEND DYFIELDS.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME     = SY-CPROG
            DYNUMB     = SY-DYNNR
          TABLES
            DYNPFIELDS = DYFIELDS.
        IF NOT DYFIELDS-FIELDVALUE IS INITIAL.
          CONCATENATE DYFIELDS-FIELDVALUE+0(2) '99999999' INTO R_MRU-HIGH.
        ENDIF.
        IF NOT R_MRU-HIGH IS INITIAL.
          R_MRU-SIGN   = 'I'.
          R_MRU-OPTION = 'BT'.
        ELSEIF R_MRU-HIGH IS INITIAL.
          R_MRU-SIGN   = 'I'.
          R_MRU-OPTION = 'CP'.
        ENDIF.
        APPEND R_MRU.
      ENDIF. " end lv_lines =0
      IF LV_LINES > 0.
        IF NOT SO_GSBER[] IS INITIAL.
          LOOP AT SO_GSBER.
            CONCATENATE SO_GSBER-LOW+0(2) '*' INTO R_MRU-LOW.
            IF NOT SO_GSBER-HIGH IS INITIAL.
              CONCATENATE SO_GSBER-HIGH+0(2) '99999999' INTO R_MRU-HIGH.
            ENDIF.
            IF R_MRU-HIGH IS INITIAL.
              R_MRU-SIGN   = 'I'.
              R_MRU-OPTION = 'CP'.
            ELSEIF NOT R_MRU-HIGH IS INITIAL.
              R_MRU-SIGN   = 'I'.
              R_MRU-OPTION = 'BT'.
            ENDIF.
            APPEND R_MRU.
          ENDLOOP.
        ENDIF. " end so_GSBER[]
      ENDIF. " end lv_lines > 0
      IF NOT R_MRU[] IS INITIAL.
    * break csebdev1.
        REFRESH GT_TE422[].
        SELECT TERMSCHL TERMTEXT FROM TE422 INTO CORRESPONDING FIELDS OF
    TABLE GT_TE422 WHERE TERMSCHL IN R_MRU .
      ENDIF.
    **now call the search help
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
    *   DDIC_STRUCTURE         = ' '
          RETFIELD               = 'TERMSCHL'
    *   PVALKEY                = ' '
    *   DYNPPROG               = ' '
    *   DYNPNR                 = ' '
    *   DYNPROFIELD            = ' '
    *   STEPL                  = 0
         WINDOW_TITLE           = 'Group'
         VALUE                  = DYFIELDS-FIELDVALUE
         VALUE_ORG              = 'S'
    *   MULTIPLE_CHOICE        = ' '
    *   DISPLAY                = ' '
    *   CALLBACK_PROGRAM       = ' '
    *   CALLBACK_FORM          = ' '
    *   MARK_TAB               =
    * IMPORTING
    *   USER_RESET             =
        TABLES
          VALUE_TAB              = GT_TE422
    *   FIELD_TAB              =
         RETURN_TAB             = LT_RETURN_TAB
    *   DYNPFLD_MAPPING        =
    * EXCEPTIONS
    *   PARAMETER_ERROR        = 1
    *   NO_VALUES_FOUND        = 2
    *   OTHERS                 = 3
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE LT_RETURN_TAB INTO LWA_RETURN_TAB INDEX 1.
      LV_MRU = LWA_RETURN_TAB-FIELDVAL.
    ENDFORM.                    " MRU_DATA_GET
    <b>b) ZISU_LTR15_TUNE - Actual R15 report</b>
    *& Report  ZISU_LTR15_TUNE                                             *
    REPORT  ZISU_LTR15_TUNE NO STANDARD PAGE HEADING  MESSAGE-ID ZISU
    LINE-SIZE 250 LINE-COUNT 65.
    **Tables
    TABLES :  EVER,
              FKKVKP,
              EANLH.
    SELECTION-SCREEN BEGIN OF BLOCK SELECTION
                              WITH FRAME TITLE TEXT-001 . "no intervals.
    SELECT-OPTIONS: SO_GSBER FOR EVER-GSBER OBLIGATORY,
                    SO_COKEY FOR EVER-COKEY,
                    SO_MRU   FOR EANLH-ABLEINH.
    PARAMETERS:     P_BMNTH(7) TYPE C OBLIGATORY.
    PARAMETERS:     P_CONT TYPE EVER-VERTRAG.
    SELECT-OPTIONS: SO_GPART FOR FKKVKP-GPART.
    SELECTION-SCREEN END OF BLOCK SELECTION.
    SELECTION-SCREEN BEGIN OF BLOCK PROCESS WITH FRAME.
    PARAMETERS:     P_COMPUT RADIOBUTTON GROUP R15.
    PARAMETERS:     P_INCLUD RADIOBUTTON GROUP R15,
                    P_FILE(60) TYPE C.
    SELECTION-SCREEN END OF BLOCK PROCESS.
    *              Start of Type declaration
    TYPES: BEGIN OF ST_TB024 ,
            IND_SECTOR TYPE TB024-IND_SECTOR,
            TEXTLONG TYPE TB024-TEXTLONG,
          END   OF ST_TB024,
          BEGIN OF ST_TECOKT,
            COKEY TYPE TECOKT-COKEY,
            LTEXT TYPE TECOKT-LTEXT,
          END   OF ST_TECOKT,
          BEGIN OF ST_TGSBT,
            GSBER   TYPE TGSBT-GSBER,
            GTEXT   TYPE TGSBT-GTEXT,
          END   OF ST_TGSBT,
          BEGIN OF ST_TE422,
            TERMSCHL  TYPE TE422-TERMSCHL,
            TERMTEXT  TYPE TE422-TERMTEXT,
          END   OF ST_TE422.
    *              Start of data declaration
    DATA: IT_TAB TYPE FILETABLE,
          GD_SUBRC TYPE I.
    DATA : GT_TB024 TYPE STANDARD TABLE OF ST_TB024 WITH HEADER LINE
             INITIAL SIZE 0,
           GT_TECOKT TYPE STANDARD TABLE OF ST_TECOKT
             WITH HEADER LINE,
          GT_TGSBT TYPE SORTED TABLE OF ST_TGSBT
          WITH UNIQUE KEY GSBER WITH HEADER LINE,
          GT_TE422 TYPE TABLE OF ST_TE422 WITH HEADER LINE INITIAL SIZE 0,
          BEGIN OF GWA_EVER,
            VKONT    TYPE EVER-VKONTO,
            ANLAGE   TYPE EVER-ANLAGE,
            ABRSPERR TYPE EVER-ABRSPERR,
          END   OF GWA_EVER,
          GT_EVER LIKE TABLE OF GWA_EVER INITIAL SIZE 0,
          BEGIN OF GWA_EANLH,
          ANLAGE     TYPE EANLH-ANLAGE,
          BRANCHE    TYPE EANLH-BRANCHE,
          END   OF GWA_EANLH,
          GT_EANLH LIKE TABLE OF GWA_EANLH INITIAL SIZE 0,
          BEGIN OF GWA_FKKVKP,
            VKONT   TYPE FKKVKP-VKONT,
            KTOKL   TYPE FKKVKP-KTOKL,
          END   OF GWA_FKKVKP,
          GT_FKKVKP LIKE TABLE OF GWA_FKKVKP INITIAL SIZE 0,
          BEGIN OF GWA_EVER_EANLH_FKKVKP,
            VKONT   TYPE FKKVKP-VKONT,
            ANLAGE   TYPE EVER-ANLAGE,
            ABRSPERR TYPE EVER-ABRSPERR,
            BRANCHE  TYPE EANLH-BRANCHE,
            KTOKL    TYPE FKKVKP-KTOKL,
          END OF GWA_EVER_EANLH_FKKVKP,
          GT_EVER_EANLH_FKKVKP LIKE TABLE OF GWA_EVER_EANLH_FKKVKP
            INITIAL SIZE 0,
          GT_EVER_EANLH_FKKVKP_INACT LIKE STANDARD TABLE OF
            GWA_EVER_EANLH_FKKVKP INITIAL SIZE 0,
          BEGIN OF GWA_ERCH,
            BELNR      TYPE ERCH-BELNR,
            VKONT      TYPE ERCH-VKONT,
          END OF GWA_ERCH,
          GT_ERCH LIKE TABLE OF GWA_ERCH INITIAL SIZE 0,
          BEGIN OF GWA_PRINTDOC,
            OPBEL    TYPE ERDK-OPBEL,
            GPART    TYPE ERDK-PARTNER,
            VKONT    TYPE ERDK-VKONT,
            BUDAT    TYPE ERDK-BUDAT,
            FAEDN    TYPE ERDK-FAEDN,
          END   OF GWA_PRINTDOC,
          GT_PRINTDOC LIKE TABLE OF GWA_PRINTDOC INITIAL SIZE 0,
          BEGIN OF GWA_DBERCHZ1,
            BELNR      TYPE DBERCHZ1-BELNR,
            EIN01      TYPE DBERCHZ1-EIN01,
            V_ABRMENGE TYPE DBERCHZ1-V_ABRMENGE,
          END OF GWA_DBERCHZ1,
          GT_DBERCHZ1 LIKE TABLE OF GWA_DBERCHZ1 INITIAL SIZE 0,
          BEGIN OF GWA_ERCHC,
            BELNR     TYPE ERCHC-BELNR,
            OPBEL     TYPE ERCHC-OPBEL,
            BUDAT     TYPE ERCHC-BUDAT,
          END   OF GWA_ERCHC,
          GT_ERCHC LIKE TABLE OF GWA_ERCHC INITIAL SIZE 0,
    * arrears for inactive consumers.
          BEGIN OF GWA_DFKKOP_INACTIVE_ARR,
              OPBEL       TYPE DFKKOP-OPBEL,
              VKONT       TYPE DFKKOP-VKONT,
              BETRH       TYPE DFKKOP-BETRH,
          END OF GWA_DFKKOP_INACTIVE_ARR,
          GT_DFKKOP_INACTIVE_ARR LIKE TABLE OF GWA_DFKKOP_INACTIVE_ARR
            INITIAL SIZE 0,
          BEGIN OF GWA_ETTIFN,
            ANLAGE    TYPE ETTIFN-ANLAGE,
            OPERAND   TYPE ETTIFN-OPERAND,
            WERT1     TYPE ETTIFN-WERT1,
          END OF GWA_ETTIFN,
          GT_ETTIFN LIKE SORTED TABLE OF GWA_ETTIFN
            WITH NON-UNIQUE KEY ANLAGE OPERAND INITIAL SIZE 0,
          BEGIN OF GWA_DBERDLB,
            PRINTDOC     TYPE DBERDLB-PRINTDOC,
            BILLDOC      TYPE DBERDLB-BILLDOC,
            BILLDOCLINE  TYPE DBERDLB-BILLDOCLINE,
            NETTOBTR     TYPE DBERDLB-NETTOBTR,
          END OF GWA_DBERDLB,
          GT_DBERDLB LIKE TABLE OF GWA_DBERDLB INITIAL SIZE 0,
          BEGIN OF GWA_DBERCHZ1_BILL,
            BELNR       TYPE DBERCHZ1-BELNR,
            BELZEILE    TYPE DBERCHZ1-BELZEILE,
            TVORG       TYPE DBERCHZ1-TVORG,
          END   OF GWA_DBERCHZ1_BILL,
          GT_DBERCHZ1_BILL LIKE TABLE OF GWA_DBERCHZ1_BILL INITIAL SIZE 0,
          BEGIN OF GWA_BILLDOC,
            PRINTDOC TYPE ERDK-OPBEL,
            BILLDOC TYPE DBERDLB-BILLDOC,
          END OF GWA_BILLDOC,
          GT_BILLDOC LIKE TABLE OF GWA_BILLDOC INITIAL SIZE 0,
          BEGIN OF GWA_DBERCHV,
            BELNR    TYPE DBERCHV-BELNR,
            OPERAND  TYPE DBERCHV-OPERAND,
            EZ_ABRMENGE TYPE DBERCHV-EZ_ABRMENGE,
            ABLESGR  TYPE DBERCHV-ABLESGR,
            ABLESGRV TYPE DBERCHV-ABLESGRV,
          END OF GWA_DBERCHV,
          GT_DBERCHV LIKE TABLE OF GWA_DBERCHV INITIAL SIZE 0,
          BEGIN OF GWA_DFKKOP_ARREAR,
            OPBEL     TYPE DFKKOP-OPBEL,
            VKONT     TYPE DFKKOP-VKONT,
            HVORG     TYPE DFKKOP-HVORG,
            TVORG     TYPE DFKKOP-TVORG,
            BUDAT     TYPE DFKKOP-BUDAT,
            BETRH     TYPE DFKKOP-BETRH,
            AUGDT     TYPE DFKKOP-AUGDT,
            XBLNR     TYPE DFKKOP-XBLNR,
          END OF GWA_DFKKOP_ARREAR,
          GT_DFKKOP_ARREAR LIKE TABLE OF GWA_DFKKOP_ARREAR INITIAL SIZE 0,
          BEGIN OF GWA_MASTER_DATA,
            SLNO(4)      TYPE C,
            IND_SECTOR   TYPE TB024-IND_SECTOR,
            TEXTLONG     TYPE TB024-TEXTLONG,
            AC_CODE      TYPE TFK033D-FUN01,
          END   OF GWA_MASTER_DATA,
          GT_MASTER_DATA LIKE TABLE OF GWA_MASTER_DATA INITIAL SIZE 0,
    **      internal table for final prepared data
          BEGIN OF GWA_FINAL_DATA,
              SLNO(4) TYPE C,
              IND_SECTOR      TYPE TB024-IND_SECTOR, " for testing
              INDUSTRY        TYPE TB024-TEXTLONG,
              AC_CODE         TYPE TFK033D-FUN01,
    *    *for urban partners
              UPARTNER        TYPE I , "(6) type n,
              UBAD_METER      TYPE I, "(4) type n,
              UINACTIVE       TYPE I,
              ULOAD(8)        TYPE P DECIMALS 2,
              UUNITS(8)       TYPE P DECIMALS 2,
              UDEMANDS(8)     TYPE P DECIMALS 2,
              UARREARS(8)     TYPE P DECIMALS 2, "FKKMAKO-Msalm,
              UINACT_ARR(8)   TYPE P DECIMALS 2,
              BLANK(10)       TYPE C,
    *    *for rural partners
              RPARTNER        TYPE I , "(6) type n,
              RBAD_METER      TYPE I , "(4) type n,
              RINACTIVE       TYPE I,
              RLOAD(8)        TYPE P DECIMALS 2,
              RUNITS(8)       TYPE P DECIMALS 2,
              RDEMANDS(8)     TYPE P DECIMALS 2,
              RARREARS(8)     TYPE P DECIMALS 2,
              RINACT_ARR(8)   TYPE P DECIMALS 2,
          END OF GWA_FINAL_DATA,
          GT_FINAL_DATA LIKE TABLE OF GWA_FINAL_DATA INITIAL SIZE 0,
          BEGIN OF GWA_MANUAL_DATA,
            COL_1(5)        TYPE C,
            COL_2(10)       TYPE C,
            COL_3(40)       TYPE C,
            COL_4(40)       TYPE C,
            COL_5(10)       TYPE C,
            COL_6(19)       TYPE C,
            COL_7(19)       TYPE C,
            COL_8(19)       TYPE C,
            COL_9(19)       TYPE C,
            COL_10(19)      TYPE C,
            COL_11(19)      TYPE C,
            COL_12(10)      TYPE C,
            COL_13(19)      TYPE C,
            COL_14(19)      TYPE C,
            COL_15(19)      TYPE C,
            COL_16(19)      TYPE C,
            COL_17(19)      TYPE C,
            COL_18(19)      TYPE C,
          END   OF GWA_MANUAL_DATA,
          GT_MANUAL_DATA LIKE TABLE OF GWA_MANUAL_DATA INITIAL SIZE 0.
    ** Variables for grand total of all heads.
    DATA : GV_T_UPART        TYPE I,
           GV_T_RPART        TYPE I,
           GV_T_RINACTIVE    TYPE I,
           GV_T_UINACTIVE    TYPE I,
           GV_UDEF_MTR       TYPE I,
           GV_RDEF_MTR       TYPE I,
           GV_UCON_LOAD(16)  TYPE P DECIMALS 2,
           GV_RCON_LOAD(16)  TYPE P DECIMALS 2,
           GV_UUNITS(16)     TYPE P DECIMALS 2,
           GV_RUNITS(16)     TYPE P DECIMALS 2,
           GV_UDEMAND(16)    TYPE P DECIMALS 2,
           GV_RDEMAND(16)    TYPE P DECIMALS 2,
           GV_UARREAR(16)    TYPE P DECIMALS 2,
           GV_RARREAR(16)    TYPE P DECIMALS 2,
           GV_UINACT_ARR(16) TYPE P DECIMALS 2,
           GV_RINACT_ARR(16) TYPE P DECIMALS 2,
           GV_U_SD_DMD(16)       TYPE P DECIMALS 2,
           GV_R_SD_DMD(16)       TYPE P DECIMALS 2,
           GV_U_SD_ARR(16)       TYPE P DECIMALS 2,
           GV_R_SD_ARR(16)       TYPE P DECIMALS 2,
           GV_UR_PART         TYPE I,
           GV_UR_DEF_MTR      TYPE I,
           GV_UR_CON_LOAD(16) TYPE P DECIMALS 2,
           GV_UR_UNITS(16)    TYPE P DECIMALS 2,
           GV_UR_DEMAND(16)   TYPE P DECIMALS 2,
           GV_UR_ARREARS(16)  TYPE P DECIMALS 2,
           GV_LOWDATE         TYPE SY-DATUM,
           GV_HIGHDATE        TYPE SY-DATUM,
           GV_YEAR   LIKE DBERCHV-EZ_ABRMENGE,
           GV_MONTH  LIKE DBERCHZ1-V_ABRMENGE,
           GV_MNTH_NAME TYPE T247-KTX.
    DATA:
    **total meter rent
          GV_UTOTMETERRENT TYPE P LENGTH 16 DECIMALS 2,
          GV_RTOTMETERRENT TYPE P LENGTH 16 DECIMALS 2,
    **for total surcharge
          GV_UTOTSURCHRG TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
          GV_RTOTSURCHRG TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
    **for total ED
          GV_UTOTED TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
          GV_RTOTED TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
    **for total ED Cess
          GV_UTOTEDCESS TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
          GV_RTOTEDCESS TYPE P LENGTH 16 DECIMALS 2, "dberdlb-nettobtr,
    **for total other misc rev
          GV_UTOTMISCREV  TYPE P LENGTH 16 DECIMALS 2,
          GV_RTOTMISCREV TYPE P LENGTH 16 DECIMALS 2,
    **for total ED of Free agricultural pump
          GV_RTOTEDAGRI TYPE P LENGTH 16 DECIMALS 2,
          GV_UTOTEDAGRI TYPE P LENGTH 16 DECIMALS 2,
    **for ED cess of Free agriculture pump
          GV_RTOTCESSAGRI TYPE P LENGTH 16 DECIMALS 2,
          GV_UTOTCESSAGRI TYPE P LENGTH 16 DECIMALS 2,
    ***data for selection screen data validation
          GV_GSBER TYPE EVER-GSBER,
          GV_COKEY TYPE EVER-COKEY,
          DYFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
          GT_INTERN_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    RANGES: R_COKEY FOR TECOKT-COKEY.
    AT SELECTION-SCREEN.
    AT SELECTION-SCREEN ON SO_GSBER.
      IF NOT SO_GSBER-LOW IS INITIAL.
        SELECT SINGLE GSBER FROM TGSBT INTO GT_TGSBT-GSBER WHERE
        GSBER = SO_GSBER-LOW.
        IF SY-SUBRC <> 0.
          MESSAGE E007.
        ENDIF.
      ENDIF.
      IF NOT SO_GSBER-HIGH IS INITIAL .
        SELECT SINGLE GSBER FROM TGSBT INTO GT_TGSBT-GSBER WHERE
        GSBER = SO_GSBER-HIGH.
        IF SY-SUBRC <> 0.
          MESSAGE E007.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON P_BMNTH.
    **check the validity of Billing month format and for valid billing month
      IF P_BMNTH CO '0123456789/'.
        IF P_BMNTH CP '++++/++'.
          IF P_BMNTH+5(2) > 12.
            MESSAGE E002 WITH 'from'.
          ENDIF.
    ** current year is less than year entered
          IF SY-DATUM(4) < P_BMNTH(4).
            MESSAGE E003 WITH 'from'.
          ELSEIF SY-DATUM(4) = P_BMNTH(4).
    ** month in future
            IF SY-DATUM+4(2) < P_BMNTH+5(2).
              MESSAGE E004 WITH 'from'.
            ENDIF.
          ENDIF.
        ELSE.
          MESSAGE E001 WITH 'from'.
        ENDIF.
      ELSE.
    **  entry have some invalid char
        MESSAGE E010.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-LOW.
    **for geting the CO account assigment key of the entered Business area
      CLEAR: DYFIELDS[], DYFIELDS.
      PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-LOW.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SO_COKEY-HIGH.
      CLEAR: DYFIELDS[], DYFIELDS.
      PERFORM DIVISON_DATA_GET CHANGING SO_COKEY-HIGH.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    *  REFRESH: IT_TAB.
    ***Opens File Open Dialog Box for selecting input file.
    *  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    *    EXPORTING
    *      WINDOW_TITLE     = 'Select File'
    *      DEFAULT_FILENAME = '*.xls'
    *      MULTISELECTION   = ' '
    *    CHANGING
    *      FILE_TABLE       = IT_TAB
    *      RC               = GD_SUBRC.
    *  LOOP AT IT_TAB INTO P_FILE.
    **    so_fpath-sign = 'I'.
    **    so_fpath-option = 'EQ'.
    **    append so_fpath.
    *  ENDLOOP.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'ACT'.
          IF P_INCLUD = ' '.
            SCREEN-INPUT = '0'.
          ELSE.
            SCREEN-INPUT = '1'.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    *              End of Selection screen processing
    TOP-OF-PAGE.
      DATA : LV_TEXT(70) TYPE C.
      FORMAT INTENSIFIED OFF.
      WRITE:/50 'CHHATTISGARH STATE ELECTRICITY BOARD',
            /42 'R-15 REPORT FOR LT CONSUMERS FOR THE MONTH OF',
                 GV_MNTH_NAME NO-GAP,'-' NO-GAP, P_BMNTH(4) NO-GAP,
            180 'PAGE-NO. -', SY-PAGNO LEFT-JUSTIFIED.
      SKIP.
      WRITE:/2 'RAO', 15 ':'.
      LOOP AT GT_TGSBT WHERE GSBER IN SO_GSBER.
        IF STRLEN( LV_TEXT ) > 60.
          WRITE: 16 LV_TEXT, / ''.
          CLEAR LV_TEXT.
        ENDIF.
        CONCATENATE LV_TEXT GT_TGSBT-GSBER '-' GT_TGSBT-GTEXT
          INTO LV_TEXT SEPARATED BY SPACE.
      ENDLOOP.
      WRITE: 16 LV_TEXT.
      CLEAR LV_TEXT.
      WRITE: /2 'Division',15 ':'.
      LOOP AT GT_TECOKT.
        IF STRLEN( LV_TEXT ) > 60.
          WRITE: 16 LV_TEXT, /.
          CLEAR LV_TEXT.
        ENDIF.
        CONCATENATE LV_TEXT GT_TECOKT-COKEY '-' GT_TECOKT-LTEXT
          INTO LV_TEXT SEPARATED BY SPACE.
      ENDLOOP.
      WRITE: 16 LV_TEXT.
      CLEAR LV_TEXT.
      WRITE: /2 'Group',15 ':'.
      LOOP AT GT_TE422 .
        IF STRLEN( LV_TEXT ) > 60.
          WRITE: 16 LV_TEXT, /.
          CLEAR LV_TEXT.
        ENDIF.
        CONCATENATE LV_TEXT GT_TE422-TERMSCHL '-' GT_TE422-TERMTEXT
          INTO LV_TEXT SEPARATED BY SPACE.
      ENDLOOP.
      WRITE: 16 LV_TEXT.
      CLEAR LV_TEXT.
    **legends
    *  write :/ text-028, 15 ':',16 text-029.
    **now write the headings on every page
      SET LEFT SCROLL-BOUNDARY COLUMN 50.
      FORMAT COLOR 1 ON.
      WRITE :/1(244) SY-ULINE.
      WRITE :/1 SY-VLINE,6 SY-VLINE,50 SY-VLINE, 58 SY-VLINE, 59
                '<----------------------------------',
                'U R B A N   A R E A',
                '----------------------------------->'.
      WRITE : 151 SY-VLINE, 152
                  '<----------------------------------',
                  'R U R A L   A R E A',
                  '----------------------------------->',
              244 SY-VLINE.
      WRITE :/1 SY-VLINE,
              2 'Slno',
              6 SY-VLINE,
              7 'Revenue Category',
              50 SY-VLINE,
              51 'A/C',
              58 SY-VLINE,
              59 'Cons-',
              67 SY-VLINE,
              68 'Deff',
              75 SY-VLINE,
              76 'Conn',
              89 SY-VLINE,
              90 'Sold',
              108 SY-VLINE,
              109 'Demand',
              129 SY-VLINE,
              130 'Previous',
              151 SY-VLINE,
              152 'Cons-',
              160 SY-VLINE,
              161 'Deff',
              168 SY-VLINE,
              169 'Conn',
              182 SY-VLINE,
              183 'Sold',
              201 SY-VLINE,
              202 'Demand',
              222 SY-VLINE,
              223 'Previous',
              244 SY-VLINE.
      WRITE :/1 SY-VLINE,
              6 SY-VLINE,
              50 SY-VLINE,
              51 'Code',
              58 SY-VLINE,
              59 'umers',
              67 SY-VLINE,
              68 'mtrs',
              75 SY-VLINE,
              76 'Load-KW',
              89 SY-VLINE,
              90 'Units',
              108 SY-VLINE,
              129 SY-VLINE,
              130 'Arrear',
              151 SY-VLINE,
              152 'umers',
              160 SY-VLINE,
              161 'mtrs',
              168 SY-VLINE,
              169 'Load-KW',
              182 SY-VLINE,
              183 'Units',
              201 SY-VLINE,
              222 SY-VLINE,
              223 'Arrear',
              244 SY-VLINE.
      WRITE :/1(244) SY-ULINE.
      SET LEFT SCROLL-BOUNDARY COLUMN 59.
    *              Start of Data Selection
    START-OF-SELECTION.
      SELECT GSBER GTEXT INTO TABLE GT_TGSBT FROM TGSBT
        WHERE SPRAS = SY-LANGU.
      SELECT IND_SECTOR TEXTLONG INTO TABLE GT_TB024
        FROM TB024 WHERE SPRAS = SY-LANGU
                     AND ( ( IND_SECTOR >= '01' AND IND_SECTOR <= '55' )
                      OR ( IND_SECTOR = '57' OR IND_SECTOR = '58'
                      OR IND_SECTOR = '94' ) ).
      SELECT SINGLE KTX INTO GV_MNTH_NAME FROM T247
       WHERE MNR = P_BMNTH+5(2) AND SPRAS = SY-LANGU.
    ***master data selection
      PERFORM CONSUMER_DATA_SELECTION.
    *&--Get Meter Status Connected Load & MF for each installation
      PERFORM OPERAND_DATA_SELECTION.
    *&--Get the Demand corresponding to each Print documents selected
      PERFORM BILLING_DATA_SELECTION.
    *&--Get the arrears corresponding to each Print document selected
      PERFORM ARREAR_DATA_SELECTION.
    *&--To include Mannual R-15 into computerized R-15.
      IF P_INCLUD = 'X'.
        OPEN DATASET P_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        DO.
          READ DATASET P_FILE INTO GWA_MANUAL_DATA.
          IF SY-SUBRC <> 0.
            EXIT.
          ELSE.
            APPEND GWA_MANUAL_DATA TO GT_MANUAL_DATA.
          ENDIF.
        ENDDO.
        CLOSE DATASET P_FILE.
        DELETE DATASET P_FILE.
      ENDIF.
    END-OF-SELECTION.
    *              End of data Selection
    *            Start of Data Processing
      PERFORM FINAL_TABLE_PREPARE.
      PERFORM FINAL_OUTPUT_PREPARE.
      PERFORM FINAL_OUTPUT_DISPLAY.
    *              End of Data Processing
      PERFORM FREE_MEMORY.
    *&      Form  master_data_selection
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM CONSUMER_DATA_SELECTION .
      DATA: LV_MAX_DAYS TYPE I,
            LV_LAST_DAY(2) TYPE C,
            LV_IMONTH TYPE I,
            LV_IYEAR TYPE I,
            LV_BMNTH TYPE ZERDK_ERCHC-V_ABRMENGE,
            LV_BYEAR TYPE ZERDK_ERCHC-EZ_ABRMENGE,
    *&----Temporary tables for global internal tables.
            LT_DBERCHZ1_TEMP LIKE TABLE OF GWA_DBERCHZ1,
            LWA_DBERCHZ1_TEMP LIKE GWA_DBERCHZ1,
            LT_ERCH LIKE TABLE OF GWA_ERCH,
            LWA_ERCH LIKE GWA_ERCH,
            LT_EVER LIKE TABLE OF GWA_EVER.
    *DATA: lt_ever_fkkvkp like gwa_ever_eanlh_fkkvkp occurs 0.
      LV_IMONTH = P_BMNTH+5(2).
      LV_IYEAR  = P_BMNTH(4).
      LV_BMNTH  = P_BMNTH+5(2).
      LV_BYEAR  = P_BMNTH(4).
      CALL FUNCTION 'RTP_US_API_MAX_DAYS_IN_MONTH'
        EXPORTING
          I_DATE_MONTH = LV_IMONTH
          I_DATE_YEAR  = LV_IYEAR
        IMPORTING
          E_MAX_DAYS   = LV_MAX_DAYS.
      LV_LAST_DAY = LV_MAX_DAYS.
      CONCATENATE P_BMNTH(4) P_BMNTH+5(2)  LV_LAST_DAY INTO GV_HIGHDATE.
      IF SO_GPART[] IS INITIAL.
        SELECT VKONTO ANLAGE ABRSPERR
        INTO TABLE GT_EVER
        FROM EVER
        WHERE GSBER IN SO_GSBER
          AND COKEY IN SO_COKEY
          AND   BUKRS = 'CSEB'
          AND   SPARTE = '01'
          AND   KOFIZ  = '02'.
    **get installation no from contract data and check biling class in eanlh
        IF GT_EVER[] IS INITIAL.
    MESSAGE 'No Business Partner exist for entered selection data' TYPE 'A'.
        ENDIF.
        IF NOT GT_EVER[] IS INITIAL.
          SELECT VKONT KTOKL INTO TABLE GT_FKKVKP
            FROM FKKVKP
            FOR ALL ENTRIES IN GT_EVER
            WHERE VKONT = GT_EVER-VKONT
            AND   GPART IN SO_GPART.
          IF GT_FKKVKP[] IS INITIAL.
         MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
          ENDIF.
        ENDIF.
      ELSE.
        SELECT VKONT KTOKL INTO TABLE GT_FKKVKP
          FROM FKKVKP
          WHERE GPART IN SO_GPART.
        IF NOT GT_FKKVKP[] IS INITIAL.
          SELECT VKONTO ANLAGE INTO TABLE GT_EVER
            FROM EVER
            FOR ALL ENTRIES IN GT_FKKVKP
            WHERE VKONTO  EQ GT_FKKVKP-VKONT
              AND GSBER   IN SO_GSBER
              AND COKEY   IN SO_COKEY
              AND BUKRS   EQ 'CSEB'
              AND SPARTE  EQ '01'
              AND KOFIZ   EQ '02'.
        ENDIF.
      ENDIF.
      IF GT_EVER[] IS INITIAL AND GT_FKKVKP[] IS INITIAL.
        MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
      ENDIF.
      SELECT ANLAGE BRANCHE INTO TABLE GT_EANLH
        FROM EANLH
        FOR ALL ENTRIES IN GT_EVER
        WHERE ANLAGE EQ GT_EVER-ANLAGE
        AND   ABLEINH IN SO_MRU
        AND   AKLASSE EQ'0002'
        AND   AB <= GV_HIGHDATE
        AND   BIS => GV_HIGHDATE.
      IF GT_EANLH[] IS INITIAL.
        MESSAGE 'No Business Partner exist for entered Selection' TYPE 'A'.
      ENDIF.
      SORT : GT_EVER BY VKONT ANLAGE,
             GT_FKKVKP BY VKONT,
             GT_EANLH BY ANLAGE.
      LOOP AT GT_EANLH INTO GWA_EANLH.
        READ TABLE GT_EVER INTO GWA_EVER WITH KEY ANLAGE = GWA_EANLH-ANLAGE.
        IF SY-SUBRC = 0.
          READ TABLE GT_FKKVKP INTO GWA_FKKVKP
            WITH KEY VKONT = GWA_EVER-VKONT.
          IF SY-SUBRC = 0.
            GWA_EVER_EANLH_FKKVKP-VKONT = GWA_EVER-VKONT.
            GWA_EVER_EANLH_FKKVKP-ANLAGE = GWA_EVER-ANLAGE.
            GWA_EVER_EANLH_FKKVKP-ABRSPERR = GWA_EVER-ABRSPERR.
            GWA_EVER_EANLH_FKKVKP-BRANCHE  = GWA_EANLH-BRANCHE.
            GWA_EVER_EANLH_FKKVKP-KTOKL    = GWA_FKKVKP-KTOKL.
            APPEND GWA_EVER_EANLH_FKKVKP TO GT_EVER_EANLH_FKKVKP.
            CLEAR GWA_EVER_EANLH_FKKVKP.
          ENDIF.
        ENDIF.
      ENDLOOP.
      IF GT_EVER_EANLH_FKKVKP[] IS INITIAL.
        MESSAGE 'No Business Partner exist for Selection Data' TYPE 'A'.
      ENDIF.
    *&----get all the billdocuments for the busines partner's contract
    *&----account
      SELECT BELNR VKONT INTO TABLE GT_ERCH
        FROM ERCH
        FOR ALL ENTRIES IN GT_EVER_EANLH_FKKVKP
        WHERE VKONT EQ GT_EVER_EANLH_FKKVKP-VKONT.
    *&----get the BILL MONTH & BILL YEAR FOR THE BILLDOCUMENTS.
      IF NOT GT_ERCH[] IS INITIAL.
        SELECT BELNR EIN01 V_ABRMENGE INTO TABLE GT_DBERCHZ1
          FROM DBERCHZ1
          FOR ALL ENTRIES IN GT_ERCH
          WHERE BELNR EQ GT_ERCH-BELNR
            AND AKLASSE = '0002'
            AND ( ( EIN01 = 'BILL_MNTH1'
            AND V_ABRMENGE = P_BMNTH+5(2) )
            OR ( EIN01 = 'BILL_YEAR1'
            AND V_ABRMENGE = P_BMNTH(4) ) ).
    *&---- GET THOSE BILL DOCUMENTS WHICH ARE FOR THE ENTERED BILL MONTH
        IF NOT GT_DBERCHZ1[] IS INITIAL.
          LOOP AT GT_DBERCHZ1 INTO GWA_DBERCHZ1 WHERE EIN01 = 'BILL_MNTH1'
                                              AND V_ABRMENGE = P_BMNTH+5(2).
            READ TABLE GT_DBERCHZ1 INTO LWA_DBERCHZ1_TEMP
            WITH KEY BELNR = GWA_DBERCHZ1-BELNR EIN01 = 'BILL_YEAR1'
            V_ABRMENGE = P_BMNTH(4).
            IF SY-SUBRC = 0.
              APPEND LWA_DBERCHZ1_TEMP TO LT_DBERCHZ1_TEMP.
              CLEAR: LWA_DBERCHZ1_TEMP.
            ENDIF.
          ENDLOOP.
          GT_DBERCHZ1[] = LT_DBERCHZ1_TEMP[].
        ENDIF.
      ENDIF.
    *&---NOW FIND THE PRINT DOCUMENTS FOR THE SELECTED BILLDOCUMENTS.
      IF NOT GT_DBERCHZ1[] IS INITIAL.
        SELECT BELNR OPBEL BUDAT FROM ERCHC
          INTO TABLE GT_ERCHC
          FOR ALL ENTRIES IN GT_DBERCHZ1
          WHERE BELNR = GT_DBERCHZ1-BELNR
            AND INTOPBEL EQ SPACE
            AND SIMULATED EQ SPACE
            AND INVOICED EQ 'X'.
      ENDIF.
      IF NOT GT_ERCHC[] IS INITIAL.
        LOOP AT GT_ERCHC INTO GWA_ERCHC.
          READ TABLE GT_ERCH INTO GWA_ERCH WITH KEY BELNR = GWA_ERCHC-BELNR.
          IF SY-SUBRC = 0.
            APPEND GWA_ERCH TO LT_ERCH.
            CLEAR GWA_ERCH.
          ENDIF.
          CLEAR GWA_ERCHC.
        ENDLOOP.
      ENDIF.
      GT_ERCH[] = LT_ERCH[].
      FREE: LT_ERCH, LT_DBERCHZ1_TEMP,LWA_DBERCHZ1_TEMP.
      LOOP AT GT_EVER_EANLH_FKKVKP INTO GWA_EVER_EANLH_FKKVKP.
    *  READ TABLE gt_erdk_erchc INTO gwa_erdk_erchc
    *  WITH KEY vkont = gwa_ever_eanlh_fkkvkp-vkont.
        READ TABLE GT_ERCH INTO GWA_ERCH
          WITH KEY VKONT = GWA_EVER_EANLH_FKKVKP-VKONT.
        IF SY-SUBRC <> 0.
          IF GWA_EVER_EANLH_FKKVKP-ABRSPERR = SPACE.
            GWA_EVER_EANLH_FKKVKP-ABRSPERR = '01'.
            MODIFY GT_EVER_EANLH_FKKVKP FROM GWA_EVER_EANLH_FKKVKP
              TRANSPORTING ABRSPERR.
            APPEND GWA_EVER_EANLH_FKKVKP TO GT_EVER_EANLH_FKKVKP_INACT.
          ENDIF.
        ELSE.
          IF GWA_EVER_EANLH_FKKVKP-ABRSPERR <> SPACE.
            GWA_EVER_EANLH_FKKVKP-ABRSPERR = SPACE.
            MODIFY GT_EVER_EANLH_FKKVKP FROM GWA_EVER_EANLH_FKKVKP
              TRANSPORTING ABRSPERR.
          ENDIF.
        ENDIF.
        CLEAR GWA_ERCH.
      ENDLOOP.
      REFRESH GT_TECOKT[].
      IF NOT SO_COKEY[] IS INITIAL.
        SELECT COKEY LTEXT INTO TABLE GT_TECOKT
        FROM TECOKT
        WHERE COKEY IN SO_COKEY
          AND SPRAS = SY-LANGU .
    *    %_HINTS ORACLE '("TECOKT","TECOKT~1")'.
      ENDIF.
      IF NOT SO_MRU[] IS INITIAL.
        SELECT TERMSCHL TERMTEXT INTO TABLE GT_TE422
          FROM TE422
          WHERE TERMSCHL IN SO_MRU.
      ENDIF.
    *FREE lt_ever_fkkvkp[].
    ENDFORM.                    " consumer_data_selection
    *&      Form  Operand_data_selection
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM OPERAND_DATA_SELECTION .
      DATA: LT_EVER_EANLH_FKKVKP_ACT LIKE TABLE OF GWA_EVER_EANLH_FKKVKP.
    *  SORT gt_ever_eanlh_fkkvkp BY vkont.
      CHECK NOT GT_EVER_EANLH_FKKVKP[] IS INITIAL.
    **now depending upon the billing month check the time slice date
    **the last date of the billing month or the range of billing month
    *should fall in between the time slice of the installation
    ** billing month to is space
    **now select operands for processed installation
      LT_EVER_EANLH_FKKVKP_ACT[] = GT_EVER_EANLH_FKKVKP[].
      DELETE LT_EVER_EANLH_FKKVKP_ACT WHERE ABRSPERR NE SPACE.
      IF NOT LT_EVER_EANLH_FKKVKP_ACT[] IS INITIAL.
        SELECT ANLAGE OPERAND WERT1
        FROM ETTIFN
        INTO TABLE GT_ETTIFN
        FOR ALL ENTRIES IN LT_EVER_EANLH_FKKVKP_ACT
        WHERE ANLAGE = LT_EVER_EANLH_FKKVKP_ACT-ANLAGE
          AND OPERAND IN ('MTR_STS','CONN_LOAD','LOAD_CODE','KWH_MF')
          AND ( AB <= GV_HIGHDATE AND BIS >= GV_HIGHDATE ).
    *    %_HINTS ORACLE '("ETTIFN","ETTIFN~003")'.
      ENDIF.
    ENDFORM.                    " Operand_data_selection
    *&      Form  billing_data_selection
    *&------------------------------

    Hi,
    Please do run time analysis as Rob correctly mentioned or do SQL trace(ST05) to find where the program is consuming more time.
    Lanka

  • Problem Developing Abap program to use  Enterprise Service Client Proxy

    Hi I am new to using Webservices but I have successfully created a Client Proxy to consume a web service.  In the Abap Development Workbench and have created a Logical Port for it.  The proxy works fine when I test it using F8.
    However I do not seem to be calling it correctly from my program.  When I run the program in debug no exception is generated but the return structure is empty.
    The method call does not require any data in the input structure.
    The code is as follows :
    REPORT  zweb_test_wsclient.
    DATA: object_ref TYPE REF TO zwebco_bcepsoap,
          input TYPE   zwebget_bceplist_soap_in,
          output TYPE   zwebget_bceplist_soap_out,
          exception TYPE REF TO cx_ai_system_fault.
    START-OF-SELECTION.
      TRY.
          CREATE OBJECT object_ref.
              EXPORTING LOGICAL_PORT_NAME = 'LP1'.
        CATCH cx_ai_system_fault INTO exception.
      ENDTRY.
      TRY.
          CALL METHOD object_ref->get_bceplist
            EXPORTING
              input  = input
            IMPORTING
              output = output.
        CATCH cx_ai_system_fault INTO exception.
      ENDTRY.
    END-OF-SELECTION.
    Can tell me what I am missing or what steps I can take to identify the problem ?
    thanks

    Hello Peter,
    I have the same problem as You. Do you remember the solution?
    A lot of thanks,
    jordi

  • Performance problem in This program

    Hi friends ,
                  Below is the one of the perform in my program which is taking more time .. Can you please suggest me to find a solution to take less time for execution.
    Thanks in Adv .
    Varma ..
    DATA: l_count TYPE i.
      SELECT m~customer
             m~name
             m~payer
             t~txtmd
        INTO TABLE gt_cust2
        FROM /bi0/pcustomer AS m
        JOIN /bi0/tcustomer AS t
          ON mcustomer EQ tcustomer
       WHERE m~objvers   EQ 'A'
         AND m~accnt_grp NE space.
      SORT gt_cust2 BY customer.
      SELECT m~customer
             m~name
             m~payer
             t~txtmd
        INTO TABLE gt_cust
        FROM /bi0/pcustomer AS m
        JOIN /bi0/tcustomer AS t
          ON mcustomer EQ tcustomer
       WHERE m~objvers   EQ 'A'
         AND m~accnt_grp IN s_ktokd
         AND m~payer     NE space.
      IF sy-subrc = 0.
        SORT gt_cust BY customer.
        LOOP AT gt_cust.
          CLEAR l_count.
          LOOP AT gt_cust2 WHERE payer = gt_cust-payer.
            ADD 1 TO l_count.
            IF l_count > 1.
              EXIT.
            ENDIF.
          ENDLOOP.
          gt_soldto-customer = gt_cust-customer.
          gt_soldto-payer    = gt_payer-payer = gt_cust-payer.
          IF l_count > 1.
    Payer found
            CLEAR gt_cust2.
            READ TABLE gt_cust2 WITH KEY customer = gt_cust-payer
                                BINARY SEARCH.
            IF NOT gt_cust2-name IS INITIAL.
              gt_payer-name  = gt_cust2-name.
            ELSE.
              gt_payer-name  = gt_cust2-txtmd.
            ENDIF.
          ELSE.
    Stand alone customer
            gt_soldto-payer = gt_payer-payer = p_nonpyr.
            gt_payer-name   = p_nonpnm.
          ENDIF.
          COLLECT: gt_soldto,
                   gt_payer.
        ENDLOOP.
        SORT: gt_soldto,
              gt_payer.
      ENDIF.

    hi,
    just remove joins and use for all entries.
    if sy-subrc = 0.
    use delete adjacent duplicates from itab comparing key fields.(it will increase performance)
    then write another select statement.
    endif.
    some tips:
    Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    Avoid for all entries in JOINS
    Try to avoid joins and use FOR ALL ENTRIES.
    Try to restrict the joins to 1 level only ie only for tables
    Avoid using Select *.
    Avoid having multiple Selects from the same table in the same object.
    Try to minimize the number of variables to save memory.
    The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    Avoid creation of index as far as possible
    Avoid operators like <>, > , < & like % in where clause conditions
    Avoid select/select single statements in loops.
    Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.
    Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
    Avoid using ORDER BY in selects
    Avoid Nested Selects
    Avoid Nested Loops of Internal Tables
    Try to use FIELD SYMBOLS.
    Try to avoid into Corresponding Fields of
    Avoid using Select Distinct, Use DELETE ADJACENT
    Go through the following Document
    Check the following Links
    Re: performance tuning
    Re: Performance tuning of program
    http://www.sapgenie.com/abap/performance.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTunin

  • DELIVERY & GI PROBLEM SD:ABAP PROGRAM

    HAI FRIENDS
      I HAVE CREATED ONE SALES ORDER. NOW I WANT DELIVERY(VL02N) AND GOODS ISSUER FOR THAT SALES ORDER. I WANT BDC RECORDING
    Program ID       : ZRFC_RUSHORDER
    Transaction Code : Z*
    Author           : Veerendra kumar E
    Description      : RFC For Sales Process using Session Method calling
                       3 Transactions VA01,VL23 & VF06
    Project          : KURLON
    Version          : 1.0
    Change History
        Date   |   Programmer   |   Corr. #   |   Description
               |                |             |
               |                |             |
    FUNCTION ZRFC_RUSHORDER .
    ""Local interface:
    *"  EXPORTING
    *"     VALUE(SUBRC) LIKE  SYST-SUBRC
    *"  TABLES
    *"      MESSTAB STRUCTURE  BDCMSGCOLL OPTIONAL
    *"      RO_HEADER STRUCTURE  ZSD_HEADER
    *"      RO_ITEM STRUCTURE  ZSD_ITEM
           INTERNAL TABLES,STRUCTURES & VARIABLES
    *TABLES : ZSO_CREATE_TEXT.
    DATA: CTU      LIKE  APQI-PUTACTIVE,
          MODE     LIKE  APQI-PUTACTIVE,
          UPDATE   LIKE  APQI-PUTACTIVE,
          GROUP    LIKE  APQI-GROUPID,
          USER     LIKE  APQI-USERID,
          KEEP     LIKE  APQI-QERASE,
          HOLDDATE LIKE  APQI-STARTDATE,
          NODATA   LIKE  APQI-PUTACTIVE.
    DATA : SORDER_FINAL LIKE VBAK-VBELN,
           SORDER(15)   TYPE C,
           V_CODE(2)    TYPE C,
           V_PLANT     LIKE EKPO-WERKS,
           YEAR_CONVERSION(1) TYPE C.
    DATA : WA_ZRUSH_ORDER LIKE ZRUSH_ORDER.
    DATA : V_DATE LIKE SY-DATUM,
           V_TIME LIKE SY-UZEIT.
    DATA : SESSION_NAM(30) TYPE C.
           CTU = ' '.
           MODE = 'N'.
           USER = SY-UNAME.
           CONCATENATE SY-UNAME '_' SY-DATUM '_' SY-UZEIT INTO
                                                   SESSION_NAM.
           GROUP = 'RUSH_ORDER'.
           KEEP = 'X'.
           UPDATE = 'L'.
           HOLDDATE = ''.
           NODATA = '/'.
    SUBRC = 0.
    *CREATING SESSSION
    PERFORM OPEN_GROUP      USING GROUP USER KEEP HOLDDATE CTU.
    LOOP AT RO_HEADER.
    MOVE RO_HEADER-SORDER TO SORDER.
    V_PLANT = SORDER+0(4).
    SELECT SINGLE CODE INTO V_CODE FROM ZPLANT_NUMER_IBS WHERE PLANT = V_PLANT.
    IF SORDER+4(4) = '2005'.
         YEAR_CONVERSION = 'E'.
    ELSEIF SORDER+4(4) = '2006'.
         YEAR_CONVERSION = 'F'.
    ELSEIF SORDER+4(4) = '2007'.
         YEAR_CONVERSION = 'G'.
    ELSEIF SORDER+4(4) = '2008'.
         YEAR_CONVERSION = 'H'.
    ELSEIF SORDER+4(4) = '2009'.
         YEAR_CONVERSION = 'J'.
    ELSEIF SORDER+4(4) = '2010'.
         YEAR_CONVERSION = 'K'.
    ELSEIF SORDER+4(4) = '2011'.
         YEAR_CONVERSION = 'L'.
    ELSEIF SORDER+4(4) = '2012'.
         YEAR_CONVERSION = 'M'.
    ELSEIF SORDER+4(4) = '2013'.
         YEAR_CONVERSION = 'N'.
    ELSEIF SORDER+4(4) = '2014'.
         YEAR_CONVERSION = 'P'.
    ELSEIF SORDER+4(4) = '2015'.
         YEAR_CONVERSION = 'Q'.
    ELSEIF SORDER+4(4) = '2016'.
         YEAR_CONVERSION = 'R'.
    ELSEIF SORDER+4(4) = '2017'.
         YEAR_CONVERSION = 'S'.
    ELSEIF SORDER+4(4) = '2018'.
         YEAR_CONVERSION = 'T'.
    ELSEIF SORDER+4(4) = '2019'.
         YEAR_CONVERSION = 'U'.
    ELSEIF SORDER+4(4) = '2020'.
         YEAR_CONVERSION = 'V'.
    ELSEIF SORDER+4(4) = '2021'.
         YEAR_CONVERSION = 'W'.
    ELSEIF SORDER+4(4) = '2022'.
         YEAR_CONVERSION = 'X'.
    ELSEIF SORDER+4(4) = '2023'.
         YEAR_CONVERSION = 'Y'.
    ELSEIF SORDER+4(4) = '2024'.
         YEAR_CONVERSION = 'Z'.
    ELSEIF SORDER+4(4) = '2025'.
         YEAR_CONVERSION = 'A'.
    ELSEIF SORDER+4(4) = '2026'.
         YEAR_CONVERSION = 'B'.
    ELSEIF SORDER+4(4) = '2027'.
         YEAR_CONVERSION = 'C'.
    ENDIF.
    CONCATENATE  YEAR_CONVERSION V_CODE SORDER+8(7) INTO SORDER_FINAL.
    CLEAR YEAR_CONVERSION.
    CLEAR V_CODE.
    CLEAR V_PLANT.
    Text Element Creation for Sales order.
    ZSO_CREATE_TEXT-SORDER      = SORDER_FINAL.
    ZSO_CREATE_TEXT-LR_NUMBER   = RO_HEADER-LR_NUMBER.
    ZSO_CREATE_TEXT-TRANSPORTER = RO_HEADER-TRANSPORTER.
    ZSO_CREATE_TEXT-Z003        = RO_HEADER-Z003.
    ZSO_CREATE_TEXT-Z004        = RO_HEADER-Z004.
    INSERT ZSO_CREATE_TEXT.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '0101'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'VBAK-SPART'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'VBAK-AUART'
                                    'ZKSO'.  "AUART_001.
      PERFORM BDC_FIELD       USING 'VBAK-VKORG'
                                    RO_HEADER-VKORG.  "VKORG_002.
      PERFORM BDC_FIELD       USING 'VBAK-VTWEG'
                                    RO_HEADER-VTWEG.    "VTWEG_003.
      PERFORM BDC_FIELD       USING 'VBAK-SPART'
                                    RO_HEADER-SPART.    "SPART_004.
    Sales Order Date insertion.......
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=KKAU'.
      PERFORM BDC_FIELD       USING 'VBAK-VBELN'
                                    SORDER_FINAL.
      PERFORM BDC_FIELD       USING 'KUAGV-KUNNR'
                                    RO_HEADER-SP.
      PERFORM BDC_FIELD       USING 'KUWEV-KUNNR'
                                    RO_HEADER-SH.
      PERFORM BDC_FIELD       USING 'VBKD-BSTKD'
                                    RO_HEADER-REF_PO.
      PERFORM BDC_FIELD       USING 'VBKD-ZTERM'
                                    RO_HEADER-ZTERM.
      WRITE RO_HEADER-SODATE TO RO_HEADER-SODATE.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4002'.
      perform bdc_field       using 'BDC_OKCODE'
                                  '=T\03'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'VBAK-AUDAT'.
      PERFORM BDC_FIELD       USING 'VBAK-AUDAT'
                                    RO_HEADER-SODATE.  "Document Date
      PERFORM BDC_FIELD       USING 'VBKD-PRSDT'
                                    RO_HEADER-SODATE.  "Pricing Date
    Billing Screen    ***********************
      perform bdc_dynpro      using 'SAPMV45A' '4002'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/EBACK'.
      perform bdc_field       using 'BDC_CURSOR'
                                  'VBKD-FKDAT'.
      PERFORM BDC_FIELD       USING 'VBKD-FKDAT'
                                    RO_HEADER-SODATE.  "Billing date
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=KKO1'.
      PERFORM BDC_FIELD       USING 'KUAGV-KUNNR'
                                    RO_HEADER-SP.     "KUNNR_006.
      PERFORM BDC_FIELD       USING 'KUWEV-KUNNR'
                                    RO_HEADER-SH.     "KUNNR_007.
      PERFORM BDC_FIELD       USING 'VBKD-BSTKD'
                                    RO_HEADER-REF_PO. "BSTKD_008.
      PERFORM BDC_FIELD       USING 'RV45A-KETDAT'
                                    RO_HEADER-SODATE. "Delivery Date.
      PERFORM BDC_FIELD       USING 'VBKD-ZTERM'
                                    RO_HEADER-ZTERM.     "ZTERM_011.
    ************************Added for test 25-02******************
      PERFORM BDC_FIELD       USING 'RV45A-KETDAT'        " CNGD FROM 'KEDAT' TO 'KETDAT'.
                                    RO_HEADER-SODATE.     "REQ DELVY DATE.
      PERFORM BDC_FIELD       USING 'VBKD-PRSDT'          "CNGD FROM 'RV45A' TO 'VBKD'.
                                    RO_HEADER-SODATE.     "PRICING DATE.
    ************************Added for test 25-02******************
    *Dont DELETE, For Future Use of Inco terms 1 & 2.
    *PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                 'VBKD-INCO2'.
    *PERFORM BDC_FIELD       USING 'VBKD-INCO1'
                                 RO_HEADER-INCO1.  "INCO1_012.
    *PERFORM BDC_FIELD       USING 'VBKD-INCO2'
                                 RO_HEADER-INCO2.  "INCO2_013.
    Header condition types......................................
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5002'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=V69A_KOAN'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'KOMV-KSCHL(05)'.
    IF RO_HEADER-KSCHL1 IS NOT INITIAL.
      PERFORM BDC_DYNPRO      USING  'SAPMV45A' '5002'.
      PERFORM BDC_FIELD       USING  'BDC_OKCODE'
                                     '=V69A_KOAN'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KSCHL(04)'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KBETR(02)'.
      PERFORM BDC_FIELD       USING  'KOMV-KSCHL(02)' RO_HEADER-KSCHL1.
      PERFORM BDC_FIELD       USING  'KOMV-KBETR(02)' RO_HEADER-KBETR1.
    ENDIF.
    IF RO_HEADER-KSCHL2 IS NOT INITIAL.
      PERFORM BDC_DYNPRO      USING  'SAPMV45A' '5002'.
      PERFORM BDC_FIELD       USING  'BDC_OKCODE'
                                     '=V69A_KOAN'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KSCHL(04)'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KBETR(02)'.
      PERFORM BDC_FIELD       USING  'KOMV-KSCHL(02)' RO_HEADER-KSCHL2.
      PERFORM BDC_FIELD       USING  'KOMV-KBETR(02)' RO_HEADER-KBETR2.
    ENDIF.
    IF RO_HEADER-KSCHL3 IS NOT INITIAL.
      PERFORM BDC_DYNPRO      USING  'SAPMV45A' '5002'.
      PERFORM BDC_FIELD       USING  'BDC_OKCODE'
                                     '=V69A_KOAN'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KSCHL(04)'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KBETR(02)'.
      PERFORM BDC_FIELD       USING  'KOMV-KSCHL(02)' RO_HEADER-KSCHL3.
      PERFORM BDC_FIELD       USING  'KOMV-KBETR(02)' RO_HEADER-KBETR3.
    ENDIF.
    *change on 11.04.2006 for adding rounding off condition type.
    IF RO_HEADER-KSCHL4 IS NOT INITIAL.
      PERFORM BDC_DYNPRO      USING  'SAPMV45A' '5002'.
      PERFORM BDC_FIELD       USING  'BDC_OKCODE'
                                     '=V69A_KOAN'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KSCHL(04)'.
      PERFORM BDC_FIELD       USING  'BDC_CURSOR'
                                     'KOMV-KBETR(02)'.
      PERFORM BDC_FIELD       USING  'KOMV-KSCHL(02)' RO_HEADER-KSCHL4.
      PERFORM BDC_FIELD       USING  'KOMV-KBETR(02)' RO_HEADER-KBETR4.
    ENDIF.
      PERFORM BDC_DYNPRO      USING  'SAPMV45A' '5002'.
      PERFORM BDC_FIELD       USING  'BDC_OKCODE'
                                     '/EBACK'.
    Dont DELETE, For Future Use  of : Sales Person Data.................
    *PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
    *PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   '=HEAD'.
    *perform bdc_dynpro      using 'SAPMV45A' '4002'.
    *perform bdc_field       using 'BDC_OKCODE'
                                 '=T\08'.
    *perform bdc_dynpro      using 'SAPMV45A' '4002'.
    *perform bdc_field       using 'BDC_OKCODE'
                                 '=PAAN'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'GVS_TC_DATA-REC-PARTNER(09)'.
    *perform bdc_field       using 'GV_FILTER'
                                  'PARALL'. "GV_FILTER_024.
    *perform bdc_field       using 'GVS_TC_DATA-REC-PARVW(09)'
                                  'VE'."REC-PARVW_09_025.
    *perform bdc_field       using 'GVS_TC_DATA-REC-PARTNER(09)'
                                  '0'. "REC-PARTNER_09_026.
    *perform bdc_dynpro      using 'SAPMV45A' '4002'.
    *perform bdc_field       using 'BDC_OKCODE'
                                 '/EBACK'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'GVS_TC_DATA-REC-PARTNER(09)'.
    *perform bdc_field       using 'GV_FILTER'
                                 'PARALL'. "GV_FILTER_027.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=POAN'.
      PERFORM BDC_FIELD       USING 'KUAGV-KUNNR'
                                    RO_HEADER-SP.     "KUNNR_006.
      PERFORM BDC_FIELD       USING 'KUWEV-KUNNR'
                                    RO_HEADER-SH.     "KUNNR_007.
      PERFORM BDC_FIELD       USING 'VBKD-BSTKD'
                                    RO_HEADER-REF_PO. "BSTKD_008.
    *FETCHING LINE ITEM DATA.
        LOOP AT RO_ITEM WHERE  SORDER =  RO_HEADER-SORDER.
          PERFORM BDC_DYNPRO   USING   'SAPMV45A'     '4001'.
          PERFORM BDC_FIELD    USING   'BDC_OKCODE'   '=POAN'.
          PERFORM BDC_FIELD    USING    'RV45A-MABNR(02)'  RO_ITEM-MATNR.
          PERFORM BDC_FIELD    USING    'RV45A-KWMENG(02)' RO_ITEM-QTY.
         PERFORM BDC_FIELD    USING    'VBAP-VRKME(02)' RO_ITEM-UOM. " For Future Use
          PERFORM BDC_FIELD    USING    'VBAP-WERKS(02)'  RO_ITEM-PLANT.
          PERFORM BDC_FIELD    USING    'VBAP-LGORT(02)'  RO_ITEM-SLOC.
          PERFORM BDC_FIELD    USING    'VBAP-CHARG(02)'  RO_ITEM-BATCH.
    *FREE DELIVERY CHECK CHANGING OF ITEMCATEGORY : TANN.
    IF RO_ITEM-KBETR1 IS INITIAL AND RO_ITEM-KBETR2 IS INITIAL.
    PERFORM BDC_FIELD       USING 'VBAP-PSTYV(02)'
                                  'ZANN'.
    ELSE.
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    Condition Types For The Items
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   '=PKO1'.
    PERFORM BDC_FIELD       USING 'RV45A-VBAP_SELKZ(01)' 'X'.
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=V69A_KOAN'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'KOMV-KSCHL(02)'.
    Condition Type 1...........
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL1.
    PERFORM BDC_FIELD       USING 'KOMV-KBETR(02)' RO_ITEM-KBETR1.
    Condition Type 2...........
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=V69A_KOAN'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'KOMV-KSCHL(02)'.
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL2.
    PERFORM BDC_FIELD       USING 'KOMV-KBETR(02)' RO_ITEM-KBETR2.
    Condition Type 3.............
    IF RO_ITEM-KSCHL3 IS NOT INITIAL.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=V69A_KOAN'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'KOMV-KSCHL(02)'.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM BDC_FIELD       USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL3.
        PERFORM BDC_FIELD       USING 'KOMV-KBETR(02)' RO_ITEM-KBETR3.
    ENDIF.
    Condition Type 4..............
    IF RO_ITEM-KSCHL4 IS NOT INITIAL.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=V69A_KOAN'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'KOMV-KSCHL(02)'.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM BDC_FIELD       USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL4.
        PERFORM BDC_FIELD       USING 'KOMV-KBETR(02)' RO_ITEM-KBETR4.
    ENDIF.
    Condition Type 5...............
    IF RO_ITEM-KSCHL5 IS NOT INITIAL.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=V69A_KOAN'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'KOMV-KSCHL(02)'.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM BDC_FIELD       USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL5.
        PERFORM BDC_FIELD       USING 'KOMV-KBETR(02)' RO_ITEM-KBETR5.
    ENDIF.
    Condition Type 6...............
    IF RO_ITEM-KSCHL6 IS NOT INITIAL.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=V69A_KOAN'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'KOMV-KSCHL(02)'.
        PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM BDC_FIELD       USING 'KOMV-KSCHL(02)' RO_ITEM-KSCHL6.
        PERFORM BDC_FIELD       USING 'KOMV-KBETR(02)' RO_ITEM-KBETR6.
    ENDIF.
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '5003'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/EBACK'.
    ENDIF.
    ENDLOOP.
    Saving The Sales Document
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
    PERFORM BDC_FIELD      USING 'BDC_OKCODE'   '=SICH'.
    PERFORM BDC_TRANSACTION TABLES MESSTAB
    USING                          'VA01'
                                    CTU
                                    MODE
                                    UPDATE.
    perform bdc_dynpro      using 'SAPMV50A' '4004'.
    perform bdc_field       using 'BDC_CURSOR'                              'LIKP-VBELN'.
    perform bdc_field       using 'BDC_OKCODE'                              '/00'.
    *perform bdc_field       using 'LIKP-VBELN'         LIKP-VBELN."         '7012000733'.
    perform bdc_dynpro      using 'SAPMV50A' '1000'.
    perform bdc_field       using 'BDC_OKCODE'                              '=SICH_T'.
    *perform bdc_field       using 'LIKP-BLDAT'       RO_HEADER-SODATE.      '27.06.2006'.
    perform bdc_field       using 'BDC_CURSOR'                              'LIKP-WADAT_IST'.
    perform bdc_field       using 'LIKP-WADAT'   RO_HEADER-SODATE.  "       '26.05.2006'.
    *perform bdc_field       using 'LIKP-WAUHR'                              '00:00:00'.
    perform bdc_field       using 'LIKP-BTGEW'                              '10'.
    perform bdc_field       using 'LIKP-GEWEI'                              'KG'.
    perform bdc_field       using 'LIKP-WADAT_IST' RO_HEADER-SODATE."       '26.05.2006'.
    PERFORM BDC_TRANSACTION TABLES MESSTAB
    USING                          'VL02N'
                                    CTU
                                    MODE
                                    UPDATE.

    Hi,
      From the explanation given, I think if you change the transaction from VL02N to VL01N this should work, because the delivery has not been created yet,
    Regards,

  • How Can I perform the external abap programe transmit the internal table in

    Hi,all
    In Sapscript,I want calculate a internal table and return the changed table to Sapscript
    I know used the transmit result variable for example:
    /:PERFORM GET_MAKTX IN PROGRAM ZXX
    /:USING &MATNR&
    /:CHANGING &MAKTX&
    /:ENDPERFORM.
    How can I set Using with a table?
    Thanks
    Sun

    Hi,
    As per my knowledge it is not possible to pass the entire table at a time using PERFORM in PROGRAM ,,, USING and CHANGING.
    Solutions:
    1)  If possible do the same thing in the Print Program:
        using CONTROL_FORM call element and print in the script
    2) if you know the all table entries.:  Pass all records at time:
    Ex: PERFORM Pxxxx in PROGRAM PROGXXXX
          USING <MATNR1>
                    <MATNR2>
                    <MATNR3>..............
          CHANGING < MAKTX1>
                            <MAKTX2>
                             <MAKTX3>............
    ENDPERFORM

  • The performance of ABAP programs

    Hey Experts , how can one analyze the performance of ABAP programs apart from using the generic tools such as Trace etc.

    Hi Chakradhar,
    Overview & Introduction
    The runtime analysis tool allows you to examine the performance of any ABAP programs, such as reports, subroutines, function modules or classes, that you create in the ABAP workbench. It saves its results in performance data files, which you can display as lists. You can use these results to identify runtime-intensive statements, to combine table accesses, and show the hierarchy of program calls.
    Normally you use the runtime analysis tool to measure the runtime of complex program segments or complete transactions (if you want to measure the runtime of smaller program segments or individual ABAP statements you can use the ABAP statement GET RUN TIME FIELD ).
    However, we use only simple
    The Programs to be Analyzed
    Let's assume I am a very newbie in ABAP and I have written a tiny little program which is doing the following:
    reading data from a database table
    storing that data in an internal table
    display that data on a list (at the start of the program you have to specify certain key values; only matching data should be displayed later on).
    So here it comes (and it seems to work as designed ...)
    REPORT  y_wlog_atra_1.
    PARAMETERS: p_carrid TYPE sbook-carrid DEFAULT 'LH',
                p_connid TYPE sbook-connid DEFAULT '0400'.
    DATA: wa_sbook TYPE sbook,
          itab_sbook TYPE STANDARD TABLE OF sbook.
    *SELECT * FROM sbook INTO wa_sbook.*
      CHECK: wa_sbook-carrid = 'LH' AND
             wa_sbook-connid = '0400'.
      APPEND wa_sbook TO itab_sbook.
    ENDSELECT.
    LOOP AT itab_sbook INTO wa_sbook.
      WRITE: /,
             wa_sbook-carrid,
             wa_sbook-connid,
             wa_sbook-fldate,
             wa_sbook-bookid,
             wa_sbook-customid,
             wa_sbook-custtype.
    ENDLOOP.
    A nice colleague has thrown a glance at my source code. He has given the hint to use a WHERE clause with the SELECT statement instead of the CHECK statement for reasons of better performance.
    So I have written another program:
    REPORT  y_wlog_atra_2.
    *SELECT * FROM sbook INTO wa_sbook*
      WHERE carrid = 'LH' AND
            connid = '0400'.
      APPEND wa_sbook TO itab_sbook.
    ENDSELECT.
    I am curious about the performance now. Let's compare the 2 variants with the ABAP Runtime Analysis tool.
    ABAP Runtime Analysis: Tool & Procedure
    To start it, choose Test --> Runtime Analysis in the SAP Menu, or use transaction SE30 .
    The runtime analysis procedure consists of two parts:
    Recording performance data (upper part of the screen)
    Analyzing the performance data (lower part of the screen; this part only appears if there are performance data files in place)
    The procedure for the first part (Recording performance data):
    We go to the initial screen of the runtime analysis (transaction code SE30 ) and specify the name of the first program (Y_WLOG_ATRA_1) in the relevant input field. After that we press the button Execute .
    The selection screen of the program Y_WLOG_ATRA_1 (including the 2 input fields) is displayed. At the bottom of the screen we are informed that the measurement has been started. We continue by clicking the Execute button.
    Later on we will see that a file (containing performance data) has been created in parallel.
    Now we repeat that procedure for our second program (Y_WLOG_ATRA_2).
    The second step is the analysis of the generated performance data.
    To do that we have to go to the initial screen of the Runtime Analysis tool again. On the bottom part of the screen you can specify those performance data files you want to analyze.
    You can see some information related to the last measurement run (in our case that was program (Y_WLOG_ATRA_2). By pressing the button Other File we are able to select those performance data files we like to analyze.
    I want to see all the files I have created (user BCUSER).
    I get the relevant list with 2 lines (related to the performance data files of the programs Y_WLOG_ATRA_1 and Y_WLOG_ATRA_2).
    Based on that list you can display the distinct performance data per line. You have to click in the column Object Type of the relevant line.
    As a start the tool displays the evaluation overview (showing the cumulated execution times for the ABAP, database and system-level).
    Here comes the evaluation overview for program Y_WLOG_ATRA_1
    We can do the same for the other program Y_WLOG_ATRA_2
    By comparing the perfomance data of the 2 programs we clearly see that I have done well with listening to the advice of my colleague. The performance of the second program is dramatically better.
    In the next step you can forward to a more detailed display of the performance data (Hitlists). That listing shows the different granular execution steps ( according to your filter adjustments ). Here you can easily identify the most time-consuming progam units.
    And it will also be a good idea to glance at the Tips & Tricks corner. You will find many valuable suggestions about good performance definitely.
    Please use the below link to see the Screen shots of the screens
    [http://searchsap.techtarget.com/tip/0,289483,sid21_gci1265920,00.html|Performance Analysing]

Maybe you are looking for

  • Visual Administrator stops at 99%

    Hi All, We have new system (ECC 6.0) ready with ABAP + JAVA stacks. I can log in to R/3 system (ABAP) and when i enter url <http://servername:50100>, it takes me to start page. I can log in to see System Information using j2ee_admin user id. My insta

  • Anglican iCal calendar

    I have been trying to search for an iCal calendar for any Anglican church holidays, but coming up empty.  Was hoping someone might point me in the right direction. Thanks

  • Getting Rid of Standard Colored Links Around Image Links

    I have included several images on my CS4 Dreamweaver site that link to other pages, sites, etc. when clicked. An unexpected and annoying standard blue (active), purple (visited), etc. link border appears around the image when viewed in IE and AOL bro

  • Having trouble changing hyperlink color

    Hey everyone. I've been working on customizing one of the default themes and I can't seem to change the color of the hyperlinks to better suit my page. The desired color only shows up when I put the mouse over the hyperlink itself, rather than being

  • IMAP rejecting password

    On both my Snow Leopard laptop and my ancient G4 running Tiger my MobileMe/iCloud mail account is rejecting my password. I can still get to my mail via my browser but not thru Mail. Any advice appreciated.