Form - Perform and ABAP coding

Hi:
I have a requirement to get vendor address from database and print on the form. I could print only one field only Name1, but not details like Street or country Etc are not getting printed. Even if we pass multiple variables as input and putput variables using perform of form, I think we need to declare only one input as INTTAB  STRUCTURE ITCSY and one out put variable as OUTTAB  STRUCTURE ITCSY in the ABAP program. In the program I am using Index option like 1, 2 and modifying details of OUTTAB. Is it correct?.
Still I am unable to print complete address on the form.
For this I am unsing Perfom option in the form.
Can you please help in the following:
1) Can I pass one value vendor from form using perform and get back a structure from ABAP program?.
2) I am using following:
         DEFINE &VENDOR_NAME& = ' '
         DEFINE &VENDOR_STREET& = ' '
         PERFORM GET_DATA IN PROGRAM Z_TEST
                   USING &VENDOR_NO&
                   CHANGING &VENDOR_NAME&
                   CHANGING &VENDOR_STREET&
         ENDPERFORM.
For Printing I am using inthe form
                    &VENDOR_NAME&
                    &VENDOR_STREET&
In the ABAP program I am using
FORM GET_DATA TABLES INTTAB  STRUCTURE ITCSY
                     OUTTAB1 STRUCTURE ITCSY.
  IF SY-SUBRC EQ 0.
    SELECT SINGLE NAME1 STR_SUPPL1
       FROM ADRC
       INTO (V_NAME1,V_STR_SUPPL1)
       WHERE ADDRNUMBER = V_ADRNR.
    IF SY-SUBRC EQ 0.
*- Name1
      READ TABLE OUTTAB1 INDEX 1.
      MOVE V_NAME1 TO OUTTAB1-VALUE.
      MODIFY OUTTAB1 INDEX SY-TABIX.
*- Street
      READ TABLE OUTTAB1 INDEX 2.
      MOVE V_STR_SUPPL1 TO OUTTAB1-VALUE.
      MODIFY OUTTAB1 INDEX SY-TABIX.
  ENDIF.
Can you please check above code and let me know if I am doing mistake anywhere?..like passing variables, printing variables on the form and ABAP sub-routine etc.
Please do not copye again same code what is find in SAP ABAP help.
Thanks in advance for your help.
Thanks,
Rama

Naren:
Your code did not work...
Sorry I did not paste my complete code(when I posted message )as too much code might be confusing. Please find my code below:
FORM GET_DATA TABLES INTTAB  STRUCTURE ITCSY
                     OUTTAB1 STRUCTURE ITCSY.
  DATA: V_ADRNR          LIKE LFA1-ADRNR,
            V_NAME1          LIKE ADRC-NAME1,
            V_STR_SUPPL1 LIKE ADRC-STR_SUPPL1,
            V_LIFNR             LIKE LFA1-LIFNR.
  READ TABLE INTTAB INDEX 1.
  V_LIFNR =  INTTAB-VALUE.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT  = V_LIFNR
    IMPORTING
      OUTPUT = V_LIFNR.
  SELECT SINGLE ADRNR
    INTO V_ADRNR
    FROM LFA1
     WHERE LIFNR = V_LIFNR.
  IF SY-SUBRC EQ 0.
    SELECT SINGLE NAME1 STR_SUPPL1
       FROM ADRC
       INTO (V_NAME1,V_STR_SUPPL1)
       WHERE ADDRNUMBER = V_ADRNR.
    IF SY-SUBRC EQ 0.
*- Name1
      READ TABLE OUTTAB1 INDEX 1.
      MOVE V_NAME1 TO OUTTAB1-VALUE.
      MODIFY OUTTAB1 INDEX SY-TABIX.
*- Name1
      READ TABLE OUTTAB1 INDEX 2.
      MOVE V_STR_SUPPL1 TO OUTTAB1-VALUE.
      APPEND OUTTAB1.
    ELSE.
      READ TABLE OUTTAB1 INDEX 1.
      MOVE 'NO NAME' TO OUTTAB1-VALUE.
      MODIFY OUTTAB1 INDEX SY-TABIX.
    ENDIF.
  ENDIF.
ENDFORM.
I am not sure where the mistake can be in the SAP-Form or in the ABAP Subroutine code....
Thanks,
Rama

Similar Messages

  • Performance of ABAP coding very poor

    Hi gurus,
    I'm a newbie in ABAP programming.
    Currently, I managed to write an ABAP coding for BW to load data from a source DSO to target DSO.
    We are using BW 3.5.
    In the source, we have YTD amount as Key Figures.
    In the start routine, we use ABAP coding to calculate the Monthly value and Last 12 Months value.
    Monthly value is defined as: current month YTD - last month YTD (except when current month = January, then monthly value for January = YTD value for January)
    Last 12 months value is calculated for example as follow:
    for March 08, then Last 12 months value is April 07-March08
    Thus the formula for last 12 Months value is:
               YTD current month current year + YTD month12 last year - YTD current month last year
    I used internal table to read and store all of the information
    However, I need to read 3 times from internal table to get all of the necessary value to calculate the monthly value and last 12 months value.
    The performance is very low. The system runs for 40 minutes to read and calculate 15500 data.
    Therefore if you can perhaps give some hint/tip/tricks how to improve the performance of the code, it will be highly appreciated.
    Thank you very much in advance.
    Best regards,
    Fen
    My code is as follow:
    Define internal table to hold last year & current year data:
      DATA: LCYEARDATA type sorted table of /bic/aZABC3_O00
            with unique key /BIC/ZABC_ENTI /BIC/ZABC_ACC
            /BIC/ZABC_SUBA /BIC/ZABC_VERS CALMONTH
            with header line.
    Create variables needed to hold last month/year values.
      DATA: CALMONTHLOW TYPE /BI0/OICALMONTH.
      DATA: CALMONTHHIGH TYPE /BI0/OICALMONTH.
      DATA: CALYEARTHISYEAR TYPE /BI0/OICALYEAR.
      DATA: CALYEARLASTYEAR TYPE /BI0/OICALYEAR.
      DATA: CURRENTMONTH TYPE /BI0/OICALMONTH2.
      DATA: CURRENTMONTHLASTYEAR TYPE /BI0/OICALMONTH.
      DATA: LASTMONTH TYPE /BI0/OICALMONTH.
      DATA: CALMONTH12LASTYEAR TYPE /BI0/OICALMONTH.
      DATA: LASTMOYTD type /BI0/OIAMOUNT.
      DATA: LAST12MONTH TYPE /BI0/OIAMOUNT.
      DATA: YTDLASTYEAR type /BI0/OIAMOUNT.
      DATA: FIRSTRUN type N.
      DATA: MONTHLYVALUE type /BI0/OIAMOUNT.
      DATA: YTDMONTHLASTYEAR type /BI0/OIAMOUNT.
      DATA: AMOUNT type /BI0/OIAMOUNT.
    Set initial value of all variables to 0.
      CALMONTHLOW = 0.
      CALMONTHHIGH = 0.
      CALYEARTHISYEAR = 0.
      CALYEARLASTYEAR = 0.
      CURRENTMONTH = 0.
      CURRENTMONTHLASTYEAR = 0.
      LASTMONTH = 0.
      LASTMOYTD = 0.
      LAST12MONTH = 0.
      YTDLASTYEAR = 0.
      YTDMONTHLASTYEAR = 0.
      FIRSTRUN = 0.
      MONTHLYVALUE = 0.
      CALMONTH12LASTYEAR = 0.
    Loop through data package.
      LOOP AT DATA_PACKAGE.
        IF DATA_PACKAGE IS NOT INITIAL.
    First run:
          IF FIRSTRUN = 0.
    Get current year from any line in the data package.
            CALYEARTHISYEAR = DATA_PACKAGE-CALMONTH(4).
            FIRSTRUN = 1.
          ENDIF.
    Calculate last year (i.e. data package year - 1).
            CALYEARLASTYEAR = CALYEARTHISYEAR - 1.
    Calculate current month
            CURRENTMONTH = DATA_PACKAGE-CALMONTH+4(2).
    *Set CALMONTHLOW and CALMONTHHIGH as time period to fill the internal
    *table:
            CONCATENATE CALYEARLASTYEAR CURRENTMONTH INTO CALMONTHLOW.
            CONCATENATE CALYEARTHISYEAR CURRENTMONTH INTO CALMONTHHIGH.
    Fill internal table with Last Years data and Current Year data:
            select *
              from /bic/aABC2_O00
              into table LCYEARDATA
              WHERE CALMONTH >= CALMONTHLOW
                AND CALMONTH <= CALMONTHHIGH
                AND /BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
                AND /BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
                AND /BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
                AND /BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS.
    Continue with the looping
    Get last month from current month.
            LASTMONTH = DATA_PACKAGE-CALMONTH - 1.
    *CHECK IF CURRENTMONTH = JAN then LastmonthYTD amount = 0, else read
    *from the internal table.
    *CURRENTMONTH = DATA_PACKAGE-CALMONTH+4(2). (this variable has been set
    *above)
            IF CURRENTMONTH = '01'.
              LASTMOYTD = 0.
            ELSE.
              READ TABLE LCYEARDATA
                WITH KEY
                /BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
                /BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
                /BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
                /BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS
                  CALMONTH = LASTMONTH.
              IF sy-subrc IS INITIAL.
                LASTMOYTD = LCYEARDATA-AMOUNT.
              ENDIF.
            ENDIF.
    *Calculate Monhtly value for this month (to later be stored in data
    *package)
            MONTHLYVALUE = DATA_PACKAGE-AMOUNT - LASTMOYTD.
    Count value for Last 12 Months:
    1: Get the YTD Month12 Last Year & YTD CurrentMonth Last Year.
            CONCATENATE CALYEARLASTYEAR CURRENTMONTH INTO
            CURRENTMONTHLASTYEAR.
            CONCATENATE CALYEARLASTYEAR '12' INTO CALMONTH12LASTYEAR.
            READ TABLE LCYEARDATA
               WITH KEY
                /BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
                /BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
                /BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
                /BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS
                 CALMONTH = CALMONTH12LASTYEAR.
            IF sy-subrc IS INITIAL.
              YTDLASTYEAR  = LCYEARDATA-AMOUNT.
            ENDIF.
            READ TABLE LCYEARDATA
              WITH KEY
                /BIC/ZABC_ENTI = DATA_PACKAGE-/BIC/ZABC_ENTI
                /BIC/ZABC_ACC = DATA_PACKAGE-/BIC/ZABC_ACC
                /BIC/ZABC_SUBA = DATA_PACKAGE-/BIC/ZABC_SUBA
                /BIC/ZABC_VERS = DATA_PACKAGE-/BIC/ZABC_VERS
                CALMONTH = CURRENTMONTHLASTYEAR.
            IF sy-subrc IS INITIAL.
              YTDMONTHLASTYEAR  = LCYEARDATA-AMOUNT.
            ENDIF.
    2. Specify YTD This month.
        AMOUNT = DATA_PACKAGE-AMOUNT.
    *3: Last 12 Months = (YTD Last Year - YTD Month Last Year) + YTD This
    *Month
           LAST12MONTH = YTDLASTYEAR - YTDMONTHLASTYEAR + YTDTHISMONTH.
           LAST12MONTH = YTDLASTYEAR - YTDMONTHLASTYEAR + AMOUNT.
    Save MONTHLYVALUE and LAST12MONTH to the DATA_PACKAGE.
            DATA_PACKAGE-/BIC/ZAMTMO = MONTHLYVALUE.
            DATA_PACKAGE-/BIC/ZAMTLTM = LAST12MONTH.
            modify DATA_PACKAGE.
            ENDIF.
          ENDLOOP.
        ABORT = 0.

    Hi,
    Just check these blogs to improve performance...
    The SQL Trace (ST05) u2013 Quick and Easy
    The SQL Trace (ST05) – Quick and Easy
    The ABAP Runtime Trace (SE30) - Quick and Easy
    The ABAP Runtime Trace (SE30) -  Quick and Easy
    Regards,
    Sachin

  • Is ABAP expression FORM - PERFORM can be used in SAP BI 7.0 transformation

    Hello
    Is ABAP expression FORM - PERFORM can be used in SAP BI 7.0 transformations or method odf class is a recommended approach?
    Thanks

    SAP BI 7.x Transformations use OO ABAP where the logic that you enter into the tranformational routines (Start Routine, Characteristic Routines and End Routine) are inside METHODS. PERFORM and FORM are procedural-based ABAP and cannot be used in METHODS.
    CLASS-METHOD and Function Modules are your best bets for processing outside of the transformational routine. As for performance, we use both and haven't found any signicant difference between the two (our custom Function Modules usually perform only slight better than our custom METHODS).

  • Performance Check - ABAP and Database color bars

    Hello everyone,
    When i go for the performance check of my object, i see Database in red bar and ABAP in green bar.
    The smaller the difference between these two bars, the better.
    But what does the color mean ? ( Somethimes the smaller bar is Red )
    Thanks

    Here is the explanation (depends % of total) in [sap library - SE30|http://help.sap.com/saphelp_nw2004s/helpdata/en/c6/617d2ae68c11d2b2ab080009b43351/frameset.htm]
    >
    shalaxy s wrote:
    > The smaller the difference between these two bars, the better.
    NO, it depends completely of what does your program!

  • View past transation performance of ABAP and portal

    I would like to know where I can find past statistics on transaction performance for both an ABAP stack and a java like a portal system.
    I am familiar with NWA on java but I don't know where to find a performance period for inbound transaction and how many seconds it tooks to process.
    Also I would like to know the transaction where I can find how long it took for a transaction for a particular period or a particular user.
    I know under admin--> workload there is a large bunch of information but I need to find transaction performance and I can't seem to find it under this tcode.
    Thanks
    Weyland Y.

    Weyland,
    You need to enable Portal Activity Report for Enterprise Portal 7.0 and then you will be able to see it.
    Check this link and SAP Note 1084379
    [http://help.sap.com/saphelp_nw04/helpdata/en/48/6aa9429b930b31e10000000a1550b0/content.htm]
    Thanks,
    Digesh
    Edited by: digeshjoshi on Dec 15, 2009 4:32 PM

  • Develop forms using Adobe Forms and ABAP Web Dynpro

    Hi, 
    Could someone help me on how to learn forms development using Adobe Forms and ABAP Web Dynpro?  Any suggestion on Tutorials / Books / other helpful hints please?
    I have good knowledge of Smart Forms and used these to generate PDF Attachments via emails.
    Thanks.
    Regards
    Keshav

    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/d-f/faq%20on%20interactive%20forms%20based%20on%20adobe%20software.faq

  • Perform and Form statements

    Hello,
    can anyone give egs of using PERFORM and FORM statement. what do these statements do actually.
    thanks.

    See this sample for PERFORM ... USING...CHANGING
    DATA : c1 TYPE i, c2 TYPE i, res TYPE i.
    c1 = 1.
    c2 = 2.
    <b>PERFORM sum USING c1 c2 CHANGING res.</b>
    WRITE:/ res.
    **& Form sum
    ** text
    form sum using p_c1 p_c2 changing value(p_res).
    p_res = p_c1 + p_c2.
    endform. " sum
    Note the difference between the above and below perform.
    DATA : c1 TYPE i, c2 TYPE i, res TYPE i.
    c1 = 1.
    c2 = 2.
    <b>data: subroutinename(3) VALUE 'SUM'.
    PERFORM (subroutinename) IN PROGRAM Y_JJTEST1 USING c1 c2 CHANGING res</b>.
    WRITE:/ res.
    **& Form sum
    text
    form sum using p_c1 p_c2 changing value(p_res).
    p_res = p_c1 + p_c2.
    endform. " sum
    ANother sample for simple perform
    PERFORM HELP_ME.
    FORM HELP_ME.
    ENDFORM.
    <b>... TABLES itab1 itab2 ...</b>
    TYPES: BEGIN OF ITAB_TYPE,
             TEXT(50),
             NUMBER TYPE I,
           END OF ITAB_TYPE.
    DATA:  ITAB TYPE STANDARD TABLE OF ITAB_TYPE WITH
                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 100,
           BEGIN OF ITAB_LINE,
             TEXT(50),
             NUMBER TYPE I,
           END OF ITAB_LINE,
           STRUC like T005T.
    PERFORM DISPLAY TABLES ITAB
                    USING  STRUC.
    FORM DISPLAY TABLES PAR_ITAB STRUCTURE ITAB_LINE
                 USING  PAR      like      T005T.
      DATA: LOC_COMPARE LIKE PAR_ITAB-TEXT.
      WRITE: / PAR-LAND1, PAR-LANDX.
      LOOP AT PAR_ITAB WHERE TEXT = LOC_COMPARE.
      ENDLOOP.
    ENDFORM.
    Hope this helps.
    Reward points if this helps u.

  • OO ABAP and BSP coding standards

    Hi,
    Can anyone send me the documnet for OO ABAP and BSP coding standards.
    Points will be rewarded.
    Regards
    Sandeep Reddy

    Hi,
    Can anyone send me the documnet for OO ABAP and BSP coding standards.
    Points will be rewarded.
    Regards
    Sandeep Reddy

  • Difference between 3X and 7X routine in term of ABAP coding

    Hi to all,
    Please can any one tell me?
    What is difference between 3X and 7X routine, in technical aspect (ABAP coding).
    I shall be thankful to you for this.
    Regards
    Pavneet Rana

    Hi Rana,
    Check the below link
    [Differences in Routine Concepts in BW3.x n Bi7.0|http://help.sap.com/saphelp_nw2004s/helpdata/en/44/bd9b5be97c112ce10000000a11466f/content.htm]
    Regards
    KP

  • What is difference among F5 and F6 and F7 in ABAP coding?

    what is difference among F5 and F6 and F7 in ABAP coding ?  Can u give me any example regarding this thread ?

    Some additional info which can be quite helpful.
    a watchpoint is an indicator in a program that tells the ABAP runtime processor to interrupt the program at a particular point. Unlike breakpoints, however, watchpoints are not activated until the contents of a specified field change. Watchpoints, like dynamic breakpoints, are user-specific, and so do not affect other users running the same program. You can only define watchpoints in the Debugger.
    Use
    You set watchpoints in the Debugger to monitor the contents of specific fields. They inform you when the value of a field changes. When the value changes, the Debugger interrupts the program.
    Features
    · You can set up to five watchpoints in a program.
    See also Setting Watchpoints.
    · You can also specify the conditions under which a watchpoint is to become active.
    · You can specify a logical link for up to five (conditional) watchpoints.
    See also Specifying Logical Links.
    · You can define watchpoints as either local or global. If you define a global watchpoint, it is active in all called programs. Local watchpoints are only active in
    the specified program.
    · You can change and delete watchpoints.
    See Changing Watchpoints
    · You can use watchpoints to display changes to the references of strings, data and object references, and internal tables.
    See Memory Monitoring with Watchpoints
    Breakpoints
    Apart from being able to execute an ABAP program in the Debugger, you can also start the Debugger call by the choosing a breakpoint. This is achieved by setting one or more of these breakpoints in the program. A breakpoint is a signal at a particular point in the program that tells the ABAP runtime processor to interrupt processing and start the Debugger. The Debugger is activated when the program reaches this point.
    There is also a special kind of breakpoint called a watchpoint. When you use watchpoints, the Debugger is not activated until the contents of a particular field change. For more information, refer to the chapter Watchpoints.
    Breakpoint Variants
    The Debugger contains different breakpoint variants:
    Static
    A user-specific breakpoint is inserted in the source code as an ABAP statement using the keyword BREAK-POINT. A non user-specific breakpoint is set in the ABAP Editor using the BREAK user name statement.
    Directly set
    dynamic breakpoints
    Can be set in the ABAP Editor or the Debugger by double-clicking a line, for example. Dynamic breakpoints are always user-specific, and are deleted when you log off from the R/3 System.
    Breakpoints
    at statements
    The Debugger stops the program immediately before the specified statement is executed.
    Breakpoints
    at subroutines
    The Debugger stops the program immediately before the specified subroutine is called.
    Breakpoints at function modules
    The Debugger stops the program immediately before the specified function module is called.
    Breakpoints at methods
    The Debugger stops the program immediately before the specified method is called.
    Breakpoints at exceptions and system exceptions
    The Debugger stops the program immediately after a system exception, that is, after a runtime error has been intercepted.
    Static Breakpoints
    Static breakpoints are always user-independent if there is no specification of a user name. Once a user has inserted the statement BREAK-POINT or BREAK name in an ABAP program, the system always interrupts the program at that point for that user or only for the user name. This procedure is only useful in the development phase of an application when program execution is always to be interrupted at the same place. For more information, refer to the chapter Static Breakpoints.
    In HTTP sessions, a static breakpoint is skipped if you did not set additional dynamic HTTP breakpoints in the editor of a BSP page. Instead, a corresponding system log entry is written, which can be checked using transaction SM21.
    Dynamic Breakpoints
    Dynamic breakpoints are user-specific. Therefore, you should use them if you only want the program to be interrupted when you run it yourself, not when it is being executed by other users. All dynamic breakpoints are deleted when you log off from the R/3 System.
    Dynamic breakpoints are more flexible than static breakpoints because you can deactivate or delete them at runtime. They have the following advantages:
    · You do not have to change the program code.
    · You can set them even when the program is locked by another programmer.
    · You can define a counter that only activates the breakpoint after it has been reached.
    Special dynamic breakpoints are useful when you want to interrupt a program directly before a particular ABAP statement, a subroutine, or an event, but do not know exactly where to find it in the source code. Event here is used to refer to the occurrence of a particular statement, for example, or calling up a method. Special dynamic breakpoints are user-specific. You can only set them in the Debugger. For more information, refer to the chapter Dynamic Breakpoints.
    In HTTP sessions, the system stops both at static and dynamic breakpoints if a dynamic breakpoint was set in the editor of a BSP page before program execution.
    Lifetime and Transfer of Breakpoints
    A static breakpoint remains intact as long as the BREAK-POINT or BREAK-POINT name statement is not removed from the source code. Without saving, dynamic breakpoints only remain intact in the relevant internal session. However, they remain in effect during the entire user session if they are saved by choosing the menu path Breakpoints ® Save in the ABAP Debugger. For more details on the subject of user sessions and modes, refer to Modularization Techniques in the ABAP keyword documentation.
    If you call an HTTP session during a user session, only the HTTP breakpoints are loaded when the HTTP session is started. You activate HTTP debugging in the ABAP Editor by choosing Utilities ® Settings ® HTTP Debugging. Depending on the setting, the system then displays either the HTTP or standard breakpoints in the Editor.
    If you call an update session during a user session, breakpoints that were defined beforehand in the calling processing unit are copied to the new update session, where they can be displayed under Breakpoints. If, in the ABAP Debugger, you check Update Debugging under Settings and then, for example, call the update module func using CALL FUNCTION func IN UPDATE TASK, a new window is opened in which you can debug this function module in the update session. All the breakpoints that were set in the calling processing unit can also be processed here.
    we can keep them at :
    Statements
    Subroutines
    Function Module Calls
    at Methods
    System Exceptions
    break point :
    we can start debugging from that point or if we keep break point at some place we can directly got ot htat point using f6.
    watch point: for example if we have to check the output for 4000 records based on a field value i.e.for vendor number 'in'we have to check then we will create watchpoint on field LIFNR value '2000'. then we can directly go to vendor whose numbe ris 2000

  • What is LUW? How do we use it in SAP ABAP coding?

    Hi Friends,
    Kindly explain me what is LUW with examples and how do we use it in our ABAP coding with scenarios why and when we use it?
    Regards,
    Pradeep

    Hi,
    SAP LUW
    Die Verbuchungsverwaltung
    The Open SQL statements INSERT, UPDATE, MODIFY, and DELETE allow you to program database changes that extend over several dialog steps. Even if you have not explicitly programmed a database commit, the implicit database commit that occurs after a screen has been processed concludes the database LUW. The following diagram shows the individual database LUWs in a typical screen sequence:
    Under this procedure, you cannot roll back the database changes from previous dialog steps. It is therefore only suitable for programs in which there is no logical relationship between the individual dialog steps.
    However, the database changes in individual dialog steps normally depend on those in other dialog steps, and must therefore all be executed or rolled back together. These dependent database changes form logical units, and can be grouped into a single database LUW using the bundling techniques listed below.
    A logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW is called an SAP LUW. Unlike a database LUW, an SAP LUW can span several dialog steps, and be executed using a series of different work processes. If an SAP LUW contains database changes, you should either write all of them or none at all to the database. To ensure that this happens, you must include a database commit when your transaction has ended successfully, and a database rollback in case the program detects an error. However, since database changes from a database LUW cannot be reversed in a subsequent database LUW, you must make all of the database changes for the SAP LUW in a single database LUW. To maintain data integrity, you must bundle all of you database changes in the final database LUW of the SAP LUW. The following diagram illustrates this principle:
    Database Logical Unit of Work (LUW)
    From the point of view of database programming, a database LUW is an inseparable sequence of database operations that ends with a database commit. The database LUW is either fully executed by the database system or not at all. Once a database LUW has been successfully executed, the database will be in a consistent state. If an error occurs within a database LUW, all of the database changes since the beginning of the database LUW are reversed. This leaves the database in the state it was in before the transaction started.
    The database changes that occur within a database LUW are not actually written to the database until after the database commit. Until this happens, you can use a database rollback to reverse the changes. In the R/3 System, database commits and rollbacks can be triggered either implicitly or using explicit commands.
    Implicit Database Commits in the R/3 System
    A work process can only execute a single database LUW. The consequence of this is that a work process must always end a database LUW when it finishes its work for a user or an external call. Work processes trigger an implicit database commit in the following situations:
    When a dialog step is completed
    Control changes from the work process back to the SAP GUI.
    When a function module is called in another work process (RFC).
    Control passes to the other work process.
    When the called function module (RFC) in the other work process ends.
    Control returns to the calling work process.
    When a WAIT statement interrupts the work process.
    Control passes to another work process.
    Error dialogs (information, warning, or error messages) in dialog steps.
    Control passes from the work process to the SAP GUI.
    Explicit Database Commits in the R/3 System
    There are two ways to trigger an explicit database commit in your application programs:
    Call the function module DB_COMMIT
    The sole task of this function module is to start a database commit.
    Use the ABAP statement COMMIT WORK
    This statement starts a database commit, but also performs other tasks (refer to the keyword documentation for COMMIT WORK).
    Implicit Database Rollbacks in the R/3 System
    The following cases lead to an implicit database rollback:
    Runtime error in an application program
    This occurs whenever an application program has to terminate because of an unforeseen situation (for example, trying to divide by zero).
    Termination message
    Termination messages are generated using the ABAP statement MESSAGE with the message type A or X. In certain cases (updates), they are also generated with message types I, W, and E. These messages end the current application program.
    Explicit Database Rollbacks in the R/3 System
    You can trigger a database rollback explicitly using the ABAP statement ROLLBACK WORK. This statement starts a database rollback, but also performs other tasks (refer to the keyword documentation for COMMIT WORK).
    From the above, we can draw up the following list of points at which database LUWs begin and end.
    A Database LUW Begins
    Each time a dialog step starts (when the dialog step is sent to the work process).
    Whenever the previous database LUW ends in a database commit.
    Whenever the previous database LUW ends in a database rollback.
    A Database LUW Ends
    Each time a database commit occurs. This writes all of the changes to the database.
    Each time a database rollback occurs. This reverses all of the changes made during the LUW.
    Database LUWs and Database Locks
    As well as the database changes made within it, a database LUW also consists of database locks. The database system uses locks to ensure that two or more users cannot change the same data simultaneously, since this could lead to inconsistent data being written to the database. A database lock can only be active for the duration of a database LUW. They are automatically released when the database LUW ends. In order to program SAP LUWs, we need a lock mechanism within the R/3 System that allows us to create locks with a longer lifetime (refer to The R/3 Locking Concept).
    The bundling technique for database changes within an SAP LUW ensures that you can still reverse them. It also means that you can distribute a transaction across more than one work process, and even across more than one R/3 System. The possibilities for bundling database changes within an SAP LUW are listed below:
    The simplest form of bundling would be to process a whole application within a single dialog step. Here, the system checks the user’s input and updates the database without a database commit occurring within the dialog step itself. Of course, this is not suitable for complex business processes. Instead, the R/3 Basis system contains the following bundling techniques.
    Bundling using Function Modules for Updates
    If you call a function module using the CALL FUNCTION... IN UPDATE TASK statement, the function module is flagged for execution using a special update work process. This means that you can write the Open SQL statements for the database changes in the function module instead of in your program, and call the function module at the point in the program where you would otherwise have included the statements. When you call a function module using the IN UPDATE TASK addition, it and its interface parameters are stored as a log entry in a special database table called VBLOG.
    The function module is executed using an update work process when the program reaches the COMMIT WORK statement. After the COMMIT WORK statement, the dialog work process is free to receive further user input. The dialog part of the transaction finishes with the COMMIT WORK statement. The update part of the SAP LUW then begins, and this is the responsibility of the update work process. The SAP LUW is complete once the update process has committed or rolled back all of the database changes.
    For further information about how to create function modules for use in update, refer to Creating Function Modules for Database Updates
    During the update, errors only occur in exceptional cases, since the system checks for all logical errors, such as incorrect entries, in the dialog phase of the SAP LUW. If a logical error occurs, the program can terminate the update using the ROLLBACK WORK statement. Then, the function modules are not called, and the log entry is deleted from table VBLOG. Errors during the update itself are usually technical, for example, memory shortage. If a technical error occurs, the update work process triggers a database rollback, and places the log entry back into VBLOG. It then sends a mail to the user whose dialog originally generated the VBLOG entry with details of the termination. These errors must be corrected by the system administrator. After this, the returned VBLOG entries can be processed again.
    For further information about update administration, see Update Administration
    This technique of bundling database changes in the last database LUW of the SAP LUW allows you to update the database asynchronously, reducing the response times in the dialog work process. You can, for example, decouple the update entirely from the dialog work process and use a central update work process on a remote database server.
    Bundling Using Subroutines
    The statement PERFORM ON COMMIT calls a subroutine in the dialog work process. However, it is not executed until the system reaches the next COMMIT WORK statement. Here, as well, the ABAP statement COMMIT WORK defines the end of the SAP LUW, since all statements in a subroutine called with PERFORM ON COMMIT that make database changes are executed in the database LUW of the corresponding dialog step.
    The advantage of this bundling technique against CALL FUNCTION... IN UPDATE TASK is better performance, since the update data does not have to be written into an extra table. The disadvantage, however, is that you cannot pass parameters in a PERFORM... ON COMMIT statement. Data is passed using global variables and ABAP memory. There is a considerable danger of data inconsistency when you use this method to pass data.
    Bundling Using Function Modules in Other R/3 Systems
    Function modules that you call using CALL FUNCTION... IN BACKGROUND TASK DESTINATION... are registered for background execution in another R/3 System when the program reaches the next COMMIT WORK statement (using Remote Function Call). After the COMMIT WORK, the dialog process does not wait for these function modules to be executed (asynchronous update). All of the function modules that you register in this way are executed together in a single database LUW. These updates are useful, for example, when you need to maintain identical data in more than one database.
    For further details, refer to the keyword documentation.
    For more details of RFC processing, refer to the Remote Communications section of the Basis Services documentation.
    Pls. reward if useful....

  • ABAP-Coding for EVERY Key figure in infocube 0RT_C02

    Hello gurus;
          Does anybody know which is the reason for Abap-coding for every key figure in infocube 0rt_c02 from InfoSource 2lis_13_vditm?
    Thanks in advanced!
    Csr

    Hi,
    this is done like this in the business content because the extractor is providing the data with a process key; this process key is then translated into meaningfull business objects (key figures);
    fro instance ProcessKey 202 in application SD is reflecting Credit memos:
    * Credit Memo
      IF COMM_STRUCTURE-PROCESSKEY = '202'
        AND COMM_STRUCTURE-BWAPPLNM EQ 'SD'.
    * currency convert
        IF COMM_STRUCTURE-COST <> 0.       "Value in document UNIT
          PERFORM LOC_CURR_CONVERT
            USING    COMM_STRUCTURE-COST   "Value in doc UNIT
                     COMM_STRUCTURE-TRANS_DATE     "Date for exchange
                     COMM_STRUCTURE-DOC_CURRCY     "Document Currency
                     COMM_STRUCTURE-LOC_CURRCY     "Local currency
    *                COMM_STRUCTURE-EXCHG_RATE     "Exchanging rate
                     COMM_STRUCTURE-/BIC/ZEXRATEAC "Exchanging rate Acctn
            CHANGING RESULT.
    * the KPI's must be turned to positive because the SD-extractors
    * allways deliver them neg. if it's a process back (e.g. return order)
          RESULT = RESULT * ( -1 ).
          UNIT = COMM_STRUCTURE-LOC_CURRCY.
    * if the returncode is not equal zero, the result will not be updated
          RETURNCODE = 0.
        ELSE.
    * if the returncode is not equal zero, the result will not be updated
          RETURNCODE = 4.
        ENDIF.
      ELSE.
    * if the returncode is not equal zero, the result will not be updated
        RETURNCODE = 4.
      ENDIF.
    the above routine is quite self explaining the code.
    hope this helps...
    Olivier.
    Message was edited by:
            Olivier Cora

  • Abap coding in SQ02

    Hello,
    Since it's not possible to add IT2051 to the AdHoq Query, I was trying to create an additional structure and wrote a little program for retrieving absence data. The problem I get is that the output only shows results for 1 day and not for the entire period I select in the selection screen of PQAH. Anybody has a suggestion or some information how to add coding properly to SQ02?
    Here is the code I used:
    Data: pers_avail type table of pdpsp with header line,
          it_pers_avail type table of pdpsp with header line,
          wa_pers_avail like line of pers_avail.
    CALL FUNCTION 'HR_READ_TIMEDATA_PSP'
      EXPORTING
       BEGIN_DATE                  = PN-BEGDA
       END_DATE                    = PN-ENDDA
        PERSON_ID                   = P0001-PERNR
      PERSON_TYP                  = 'P'
      RP_BUILD_PSP_ERROR          = ' '
      TABLES
        PERS_AVAIL                  = PERS_AVAIL
    EXCEPTIONS
      NO_CAPACITY_AVAILABLE       = 1
      NO_INTEGRATION_ACTIV        = 2
      TIMEINFO_ERROR              = 3
      OTHERS                      = 4
    IF SY-SUBRC = 0.
    Loop at Pers_avail.
      dailyworkschedule = PERS_AVAIL-tprog.
      DAYOFWS = PERS_AVAIL-datum.
    Endloop.
    Thanks !!
    Philip
    Else.
      Clear dailyworkschedule.
    Endif.

    Hi,
    Wish it was simple as that i am fairly good at queries i do a bit of coding as well on queries, i want to use an inner join for performance reasons. If any1 could help me with that and have used Inner joins ABAP Coding please let me know
    Thanks
    Adeel

  • Data Archiving and ABAP

    Hi All,
    I am an ABAPer and recently came accross the process of data archiving..
    Can anyone tell me what significance data archiving has w.r.t ABAP.Are they interrelated at any point??
    Waiting for Reply..
    Shilpa

    Hi Shilpa,
    As a developer you must be aware of the fact that what ever application are provided by SAP they all are using codes written in ABAP in background .
    Similarly we have a tool Archive Developent Kit (ADK) provided by SAP that uses various programs written in ABAP grouped in the form of Archive object to perform Archiving Successfully in any system.
    Yes Archiving and ABAP both are interrelated and an ABPER can very well understand how actually there programs functions at runtime while we Archive data from the database.
    Another imporeant thing is apart from the standard Archive Objects provided by SAP sometimes  requiremnets comes for  custom Objects to be created which requires good indepth knowledge of ABAP.
    I hope my answer will help you understand the assosiation of ABAP and Data Archiving.
    For more you can go through the below link ::
    http://help.sap.com/saphelp_47x200/helpdata/en/8d/3e4d22462a11d189000000e8323d3a/frameset.htm
    -Supriya

  • How could JAVA API and ABAP API useful to MDM.

    Hi Experts,
    How could JAVA API and ABAP API useful to MDM, and any coding in Java or ABAP is required in MDM.

    Hi Reema,
    Java API and ABAP API are verry usefull to MDM to integrate MDM with other SAP componants like SAP R\3, EP etc. :
    It dose not required any coding in MDM infact in JAVA API coding can be done on NWDS(Netweaver Developer Studio).And for ABAP API coding is done on SAP R\3 System in ABAP editor.
    JAVA API:
    By using Java API MDM client operations can be performed.For one need to install NWDS and to deploy some .jar files and with the help of standard classes and interfaces it can be connected to MDM server and various operations like create repository ,connect to repository ,Data mainuplation etc.
    ABAP API:
    Suppose you have an Expert abaper and you want him to perform MDM operations.In that case he need not to learn MDM basic Data types infact by doing some settings on R\3 and MDM server side an ABAPer  can perform
    MDM Cnsole and MDM Data Manager level operations.
    you can go through these links
    http://help.sap.com/javadocs/MDM/SP06/overview-summary.html
    /people/bv.pillai/blog/2006/11/28/installing-mdmtech-add-on-and-configuring-the-mdm4a-mdm-for-abap-api
    Here the coding is done on SAP R\3 system.
    hope it will give you some idea about Java API and ABAP API
    Reward if helpful
    Thanks ,
    Vinay Yadav

Maybe you are looking for

  • GL A/C with Detailed Transactions

    I have prepare a report which showing the GL A/C with Detailed Transactions. I need the link about GL tables with PO, AP and AR tables can anybody help me in this regard thanks in advance sadiq

  • Authenticating a user using JCO

    Hi, I was authenticating a user in SAP using the following code:    System.out.println("\n\nVersion of the JCO-library:\n" + "---- \n"                     + JCO.getMiddlewareVersion());             Properties props = new Properties();             pro

  • [SOLVED] Chromium + pepper = Video @ double speed

    I am using the latest stable chromium, with the pepper-stable package from the AUR recommended in the Chromium wiki. I moved to Chromium as Flash is no longer being developed for Firefox....And Firefox 26 crashes a lot, and randomly, including with a

  • Another cannot back-up error

    I've had this phone about 9 months (2nd handset due to hardware failure already) And im getting this error message "iTunes could not backup the iphone because the backup is corrupt or not compatible with this iphone, delete all backups for this iphon

  • How to install iTunes plugins???

    I have read that you are just supposed to put it in the iTunes plugins folder and I have done everything to find it, but I can't find it!! Can anyone help me find my iTunes plugin folder? If I even have one?