Update the database structure from entity Framework Model

Hello !
I'm using VB.net , EF6 with SQL server 2008R2 database.
This is the situation :
I have created the application. Using wizard I have created the Entity model from an existing database.
A client start using this application using this database on his computer.
After some month , I made some modifications on the database and I have updated the model on my application .
Now I have a new .exe file that has the new model from the new database.
I put the new .exe file on the client computer.
Now on his computer : The .exe file has the new database model , but the sql server database has the old structure.
I want to know : Is possible to update the database structure from the entity model on application ?
I want to add a command on application that can make ( if is possible ) this update , so the database become up to date according to entity model ?
Thank you !

Hello,
From your description, it seems that you want to apply a migration for a database first approach, unfortunately, as far as I know, EF Migrations is a product targeted at Code First and doesn't support Database First operations. A workaround I know is to
use update-scripts. If your database structure would be changed frequently, it is recommended to use the Code First approach which would have a better workaround for migrations, for details, you could refer to this
video,
 and with the
Entity Framework Power Tools, it is easy to create a code first based project form an existing database.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Regardig error while updating the database table

    hi experts,
       i m trying to update the database table from the values containig in my internal table  ,,,but the system is giving this error plz help me::::
    The type of the database table and work area (or internal table)
    "ITAB_UPDATE" are not Unicode convertible. Unicode convertible.          
    my internal table name itab_update and the database table name yitab.i m using this statement::
        modify yitab from itab_update.

    Hi
    1. You  have to Declare the Itab with the same structure as DB table.
    2. Use the statement
        Modify <DBtable> from TABLE <itab>.
    or
       Update <DBtable> from TABLE <itab>.
    Hope this will solve.
    Reward .....if so.
    Regards.

  • Rfc enabled function module for the updating the database table

    Hi,
            I need one rfc enabled function module for the updating the database table from the legacy system.currently i am using the rfc_read_table to read the database table.similarly i need for the update.

    Hi
    I believe you need to create one by yourself
    Max

  • "Object reference not set to an instance of an object." in Visual Studio 2012 Entity Framework Model-First

    Hello
    We're trying to use a Model-First with Entity Framework in Visual Studio, targeting an Oracle XE 11g installation.
    No matter from what angle we're approaching the issue, we always end up with an "Object reference not set to an instance of an object" in Visual Studio:
    First way:
    - Add new ADO.NET Entity Framework Model to a .NET Framework 4.5 project
    - Empty model
    - Add some entities and associations
    - Set Database Generation Workflow to "Generate Oracle Via T4 (TPT).xaml"
    - Set DDL Generation Template to "SSDLToOracle.tt"
    - Generate Database From Model
    - VS asks for DB connection ==> Click "New Connection"
    - Enter the connection properties to the Oracle XE database. "Test Connection" tells me the connection is okay.
    - Click OK. Visual Studio shows the following error message:
    (here's the image if it's not visible: https://dl.dropboxusercontent.com/u/35614983/vs2012_oracle_ef_error.png)
    We also tried to generate the model in VS2010 and then manually transform it to an EF5 / VS2012 model. At the "Generate Database from Model" step, the same error appeared.
    We also tried to generate the model from database (Database-First approach). Same error.
    My configuration:
    - Windows 7 Ultimate 64-bit
    - Installed Oracle client: ODTwithODAC1120320_32bit.zip, so the version is 11.2.0.3.20
    - Visual Studio 2012 Update 3 (11.0.60610.01)
    Thanks for any hints!
    EDIT: I just read that ODP.NET doesn't seem to support Entity Framework 5, so I tried a new project with Entity Framework 4.1, but I get the same errors.
    EDIT 2: On a 32-bit Windows 7 virtual machine, everything works fine. Seems the problem is only there on my 64-bit Windows 7 machine.

    Sorry for the delay on this one. Let me know if you are still seeing this and I will see if we can get more diagnostic info somehow.
    That error is basically an exception fault. It means a bug or a misconfiguration of Oracle Developer Tools. Can you try to reinstall ODT and see if you notice any unusual errors during install.. and see if a reinstall fixes the problem?

  • The Database Structure Has Been Modified

    Good Day!
    Just want to ask what is the probable reason why upon using SAP, there is a system message " The database structure has been modified. In order to resume the process, all open windows will be closed. Continue?"  Even upon user log in , this system message appear affecting other user's data entry. Upon adding of the document (of other users when this system message appear), all the UDFs are missing, causing their data entry to be inaccurate since you cannot update row level once the document has been added.
    Hope to hear from you soon.
    Thanks
    Sandra

    Hello ...
    This error message appears every time that has altered the structure of the database, either by creating a new field of user or user table, so it is inevitable that appear the same.
    Now, it is necessary as a measure, to control who has access to make these changes, and that they are made without users.
    I hope it will help
    Best regards,

  • Calling Oracle stored procedure with out param of user define type from Entity Framework 5 with code first

    Guys i am using Entity Framework 5 code first (I am not using edmx) with Oracle and all works good, Now i am trying to get data from stored procedure which is under package but stored procedure have out param which is user define type, Now my question is
    how i will call stored procedure from entity framework
    Thanks in advance.

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • Master-Detail table on the JSF is unable to update the database

    Hi all,
    In my ADF application I am using a master-deatail relationship datasource. I have to enter the detail rows for a master table row and submit the detail rows it should update the
    database. For this I created a master-detail table and dragged the same on to my JSF page as ADF Forms. I created the forms as ADF Form included all the buttons and submit button. I
    dragged CreateInsert operation from the detail table datacontrol on to the detail form. When I enter the detail and click on submit the data is not getting submitted in the database.
    Please help me in this.
    Thankd In Advance.

    There is no such thing as an iPhone 's3'.  There is a 3G which can only be updated to iOS 4.2.1 and a 3GS which can be updated to iOS 6.1.3.
    Which model iPhone is this?
    Identifying iPhone models

  • The database structure has been modified - how to check if it happend?

    Hello,
    I have a question. How to check if the database structure has been modified? I know that there is shown a messagebox after creating table and adding some fields, but sometimes this message appear after some seconds. The problem is that I want to create table and UDO for this table, and until database structure is not modified I got an error message. If I wait and DB strucuture modifies then UDO is creating correctly.
    My question is - does anyone know how to check if database structure has been modified?
    Regards,
    Hmg

    Hi Szymon,
    I guess you are stuck up in a kinda scenario, where in, you will be populating a form with values, before the structure modifies, if this is going to be your problem, I can help you out with a work around.
    In the beginning of the process, before the creation of the UDO or tables, set a boolean value to false, and once all UDO's and Tables are created, only then, should you make it true and only after the boolean becomes true, you should proceed with populating the values from the screen.
    I really ament sure what your problem is, but one of my guys faced this problem, I then, thought even you might have a similar problem.
    Satish.

  • Fatal Error: The schema version of the database is from a newer version of WSUS

    Hello,
    CM2012 R2 RTM on Server2012 R2 RTM with SQL2012 SP1
    installed SQL, WSUS and then CM.
    When finished adding WSUS, there was a post installation message but I skipped it and continued to CM installation, as suggested on some blogs. WSUS in CM seems to be a real mystery... and there are multiple workarounds and suggestions. 
    Now my CM is ready to GO. Configured discovery, boundaries. All components appear green OK. My hand shaked when I click on post Deployment message related to WSUS in server manager. So I clicked it. And received: Post Deployment Failed. There is
    a path to log file. The error:
    Fatal Error: The schema version of the database is from a newer version of WSUS
    than currently installed.  You must either patch your WSUS server to at least
    that version or drop the database. WSUS was installed with SQL DB.
    What do you suggest?
    Thanks.
    Please see full log:
    2013-12-01 06:58:24  Postinstall started
    2013-12-01 06:58:24  Detected role services: Api, Database, UI, Services
    2013-12-01 06:58:24  Start: LoadSettingsFromXml
    2013-12-01 06:58:24  Start: GetConfigValue with filename=UpdateServices-Services.xml item=ContentLocal
    2013-12-01 06:58:24  Value is true
    2013-12-01 06:58:24  End: GetConfigValue
    2013-12-01 06:58:24  Start: GetConfigValue with filename=UpdateServices-Services.xml item=ContentDirectory
    2013-12-01 06:58:24  Value is D:\sources\wsus
    2013-12-01 06:58:24  End: GetConfigValue
    2013-12-01 06:58:24  Content directory is D:\sources\wsus
    2013-12-01 06:58:24  Start: GetConfigValue with filename=UpdateServices-DB.xml item=InstanceName
    2013-12-01 06:58:24  Value is confman
    2013-12-01 06:58:24  End: GetConfigValue
    2013-12-01 06:58:24  SQL instance name is confman
    2013-12-01 06:58:24  End: LoadSettingsFromXml
    Post install is starting
    2013-12-01 06:58:24  Start: Run
    2013-12-01 06:58:24  Fetching WsusAdministratorsSid from registry store
    2013-12-01 06:58:24  Value is S-1-5-21-1033354796-2088831985-1429053453-1003
    2013-12-01 06:58:24  Fetching WsusReportersSid from registry store
    2013-12-01 06:58:24  Value is S-1-5-21-1033354796-2088831985-1429053453-1004
    2013-12-01 06:58:25  Configuring content directory...
    2013-12-01 06:58:25  Configuring groups...
    2013-12-01 06:58:26  Starting group configuration for WSUS Administrators...
    2013-12-01 06:58:26  Found group in regsitry, attempting to use it...
    2013-12-01 06:58:28  Writing group to registry...
    2013-12-01 06:58:28  Finished group creation
    2013-12-01 06:58:28  Starting group configuration for WSUS Reporters...
    2013-12-01 06:58:28  Found group in regsitry, attempting to use it...
    2013-12-01 06:58:28  Writing group to registry...
    2013-12-01 06:58:28  Finished group creation
    2013-12-01 06:58:28  Configuring permissions...
    2013-12-01 06:58:28  Fetching content directory...
    2013-12-01 06:58:28  Fetching ContentDir from registry store
    2013-12-01 06:58:28  Value is D:\sources\wsus
    2013-12-01 06:58:28  Fetching group SIDs...
    2013-12-01 06:58:28  Fetching WsusAdministratorsSid from registry store
    2013-12-01 06:58:28  Value is S-1-5-21-1033354796-2088831985-1429053453-1003
    2013-12-01 06:58:28  Fetching WsusReportersSid from registry store
    2013-12-01 06:58:28  Value is S-1-5-21-1033354796-2088831985-1429053453-1004
    2013-12-01 06:58:28  Creating group principals...
    2013-12-01 06:58:28  Granting directory permissions...
    2013-12-01 06:58:28  Granting permissions on content directory...
    2013-12-01 06:58:29  Granting registry permissions...
    2013-12-01 06:58:29  Granting registry permissions...
    2013-12-01 06:58:29  Granting registry permissions...
    2013-12-01 06:58:29  Configuring shares...
    2013-12-01 06:58:29  Configuring network shares...
    2013-12-01 06:58:29  Fetching content directory...
    2013-12-01 06:58:29  Fetching ContentDir from registry store
    2013-12-01 06:58:29  Value is D:\sources\wsus
    2013-12-01 06:58:29  Fetching WSUS admin SID...
    2013-12-01 06:58:29  Fetching WsusAdministratorsSid from registry store
    2013-12-01 06:58:29  Value is S-1-5-21-1033354796-2088831985-1429053453-1003
    2013-12-01 06:58:29  Content directory is local, creating content shares...
    2013-12-01 06:58:29  Creating share "UpdateServicesPackages" with path "D:\sources\wsus\UpdateServicesPackages" and description "A network share to be used by client systems for collecting all software packages (usually applications)
    published on this WSUS system."
    2013-12-01 06:58:29  Deleting existing share...
    2013-12-01 06:58:29  Creating share...
    2013-12-01 06:58:29  Share successfully created
    2013-12-01 06:58:29  Creating share "WsusContent" with path "D:\sources\wsus\WsusContent" and description "A network share to be used by Local Publishing to place published content on this WSUS system."
    2013-12-01 06:58:29  Deleting existing share...
    2013-12-01 06:58:29  Creating share...
    2013-12-01 06:58:29  Share successfully created
    2013-12-01 06:58:29  Creating share "WSUSTemp" with path "C:\Program Files\Update Services\LogFiles\WSUSTemp" and description "A network share used by Local Publishing from a Remote WSUS Console Instance."
    2013-12-01 06:58:29  Deleting existing share...
    2013-12-01 06:58:29  Creating share...
    2013-12-01 06:58:29  Share successfully created
    2013-12-01 06:58:29  Finished creating content shares
    2013-12-01 06:58:29  Stopping service WSUSService
    2013-12-01 06:58:29  Stopping service W3SVC
    2013-12-01 06:58:32  Configuring database...
    2013-12-01 06:58:32  Configuring the database...
    2013-12-01 06:58:32  Establishing DB connection...
    2013-12-01 06:58:32  Checking to see if database exists...
    2013-12-01 06:58:32  Database exists
    2013-12-01 06:58:32  Switching database to single user mode...
    2013-12-01 06:58:32  Loading install type query...
    2013-12-01 06:58:32  DECLARE @currentDBVersion       int
    DECLARE @scriptMajorVersion     int = (9600)
    DECLARE @scriptMinorVersion     int = (16384)
    DECLARE @databaseMajorVersion   int
    DECLARE @databaseMinorVersion   int
    DECLARE @databaseBuildNumber    nvarchar(10)
    IF NOT EXISTS(SELECT * FROM sys.databases WHERE name='SUSDB')
    BEGIN
        SELECT 1
    END
    ELSE
    BEGIN
        SET @currentDBVersion = (SELECT SchemaVersion FROM SUSDB.dbo.tbSchemaVersion WHERE ComponentName = 'CoreDB')
        SET @databaseBuildNumber = (SELECT BuildNumber FROM SUSDB.dbo.tbSchemaVersion WHERE ComponentName = 'CoreDB')
        DECLARE @delimiterPosition INT = CHARINDEX('.', @databaseBuildNumber)
        IF (@delimiterPosition = 0)
        BEGIN
            RAISERROR('Invalid schema version number', 16, 1) with nowait
            return
        END
        SET @databaseMajorVersion = SUBSTRING(@databaseBuildNumber, 1, @delimiterPosition - 1)
        SET @databaseMinorVersion = SUBSTRING(@databaseBuildNumber, (@delimiterPosition + 1), (10 - @delimiterPosition))
        IF @currentDBVersion < 926
        BEGIN
            SELECT 3
        END
        ELSE
        BEGIN
            IF (@scriptMajorVersion > @databaseMajorVersion OR
               (@scriptMajorVersion = @databaseMajorVersion AND @scriptMinorVersion > @databaseMinorVersion))
            BEGIN
                SELECT 2
            END
            ELSE IF (@scriptMajorVersion = @databaseMajorVersion AND
                     @scriptMinorVersion = @databaseMinorVersion)
            BEGIN
                SELECT 0
            END
            ELSE
            BEGIN
                SELECT 4
            END
        END
    END
    2013-12-01 06:58:33  Install type is: UnsupportedFuture
    2013-12-01 06:58:33  DB is a higher version than the config scripts
    2013-12-01 06:58:33  Swtching DB to multi-user mode......
    2013-12-01 06:58:33  Finished setting multi-user mode
    2013-12-01 06:58:33  Microsoft.UpdateServices.Administration.CommandException: The schema version of the database is from a newer version of WSUS
    than currently installed.  You must either patch your WSUS server to at least
    that version or drop the database.
       at Microsoft.UpdateServices.Administration.ConfigureDB.CheckForUnsupportedVersion(DBInstallType installType, Boolean dbExists)
       at Microsoft.UpdateServices.Administration.ConfigureDB.ConnectToDB()
       at Microsoft.UpdateServices.Administration.ConfigureDB.Configure()
       at Microsoft.UpdateServices.Administration.PostInstall.Run()
       at Microsoft.UpdateServices.Administration.PostInstall.Execute(String[] arguments)
    Fatal Error: The schema version of the database is from a newer version of WSUS
    than currently installed.  You must either patch your WSUS server to at least
    that version or drop the database.
    "When you hit a wrong note it's the next note that makes it good or bad". Miles Davis

    Gerry,
    1. I uninstalled WSUS, removed DB, restarted. And reinstall WSUS again. This time MS Management Console of WSUS could not be started. I did it after WSUS was added following your blog pix.
    I checked c:\program files\update services, there were couple of missing directories by comparison what was in case when I installed WSUS after SQL but before CM: Tools, Shema, and another A.. something. I saw this issue on NOOB. And people copied these
    directories from previous installation.
    How we can explain this behavior on RTM version?
    Then I uninstalled it again. And give another try... Here I found another interesting thing. Please compare your slide number 5 from your link and attached one. You can see that on Add Roles and Features Wizard page are missing items. Some
    of them were found in next screen of my installation (I am using RTM server) but one API and Power shell  cmdlets were not listed on final screen before start install. May be those are note important...
    I reinstall again... and the MS Management Console fails again. Exactly the same thing that I saw during 2 weeks of trying to make works. Don't see what I can screw up here.
    What about missing directories after reinstalling WSUS. Is that normal? And in IIS there is no WSUS.
    I don't see here any difficult thing, just simple wizard... But it not works. Second CM server.
    What I do wrong here to create a failure of MMC. There is any blog with examples of RTM Server 2012 and CM RTM. All stuff is 2012. So kind of guesses and no precise thing to do...
    Sorry for my cry :). The only solution is to call MS and pay $250 for SUCH a trivial thing that not works.
    Any help? Please see pics. Can you confirm that you have the same or more directories in Update Services
    Thanks.
    API and Power Shell Cmdlets feature missed if compare with yours slides.
    "When you hit a wrong note it's the next note that makes it good or bad". Miles Davis

  • Using Tabstrip update the database table

    Hi Guy's,
    I created two screens(100 & 110).
    Click 1 pushbutton HRP1000 related information is displayed.
    Click 2 pushbutton it displays HRP1001 relatd information.
    worked to read the data from the Database tables and output displayed sucessfuly .   However i want to entered data in those fields wants to update to database table.
    Please friends help me how to work this senario.
    Thanks and Regards,
    Sai.

    Hi Guy's,
    To update the database records, wrote the logic in PAI
       WHEN 'SAVE'.
        INSERT HRP1001.
    INSERT INTO HRP1001  VALUES wa_P2.
    it displaying an error message " the work area wa_p2 is not long enough.
    and also i tried using it_p2
    it displaying an error message " you can't use internal table as work area".
    Please help me friends  it is very urgent.
    Thanks and Regards,
    Sai.

  • Update the database table

    Hi All,
      i need to do  direct update to the database table and the table has apprx 60,000 records . i am getting all records from database table to internal table and has to chnage the one of the field value and pass it to the database table .  So  i am looping  the internal table and what is the best approach to update the database table is it to  use UPDATE Pa0001 SET KOSTL = it_0001-KOSTL from table it_0001  each time in the loop to update each record  and commit work which hits database for each record or use the statement UPDATE  pa0001 from table it_0001 and if count = 1000 then  COMMIT work in this way it will hit the database for every 1000 records . Appreciate your suggestions,
    Thanks,
    Latha.

    My Code to update PA0006 is :
    DATA:  t_pa0006 TYPE STANDARD TABLE OF pa0006 INITIAL SIZE 0,
           wa_pa0006 LIKE LINE OF t_pa0006,
           w_lin TYPE i.
    FIELD-SYMBOLS:  <fs_pa0006> LIKE LINE OF t_pa0006.
    SELECT * FROM pa0006 INTO TABLE t_pa0006 WHERE uname = 'PKHAROR'.
    LOOP AT t_pa0006 ASSIGNING <fs_pa0006>.
      <fs_pa0006>-stras = 'My Street'.
    ENDLOOP.
    DESCRIBE TABLE t_pa0006 LINES w_lin.
    UPDATE pa0006 FROM TABLE t_pa0006.
    IF sy-subrc EQ 0.
      COMMIT WORK.
      WRITE:/ w_lin, ' Records have been updated..'.
    ENDIF.
    Reward points for useful answers
    Regards
    Pradeep
    Regards
    Pradeep

  • An error occurred while attempting to update the database

    Hi
    the update from 2.82 to 2.9.0 fails for me with following message
    An error occurred while attempting to update the database.
    the update log ends like this
    [Microsoft][ODBC SQL Server Driver][SQL Server]DELETE failed because the
    following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify
    that SET options are correct for use with indexed views and/or indexes on
    computed columns and/or filtered indexes and/or query notifications and/or XML
    data type methods and/or spatial index operations.
    1> 2> 3> [16:56:20] RunShellCommand: Command: osql exited with code: 1
    [16:56:20] RunShellCommand: Exit code indicates failure.
    [16:56:20] UpdateDatabase: Failed to run database update script.
    hope that anyone can solv this for me

    It seems that my problem is with one of ldapservers.
    When the periodic update runs.
    then there will be error periodic update failed
    log file mdm_error looks like this
    [00:01:46] Failed running query:
    IF NOT EXISTS(SELECT LDAPContainerName FROM LDAPContainers WHERE LDAPContainerName=? AND LDAPServerSAKey = ?)
    BEGIN INSERT INTO LDAPContainers(LDAPContainerName, DisplayName, LDAPContainerType, ParentContainerSAKey,
    LDAPServerSAKey, LDAPMemberType, AllowHandsOffEnrollment) VALUES (?,?, 2,
    (SELECT LDAPContainerSAKey FROM LDAPContainers WHERE LDAPContainerName =? AND LDAPServerSAKey =?) , ?, 1, 1) END
    SQLError:
    I think this is the reason that the upgrade fails.
    How can i solve this?

  • Can we move the Organisation structure from DEV to Quality to Production?

    Hi Experts,
    Can we move the Organisation structure from DEV to Quality to Production?
    If yes, I believe that we have to change  backend details at some areas.
    Please any one provide procedure and precautions for doing this, In general how we have to proceed?
    Thanks
    Reshma

    Hello Reshma,
    See program documentation from PFAL transaction (ALE distribution of HR Master Data).
    You will need:
    - an evaluation path,
    - a distribution models for sender DEV > receiver QUAL and sender QUAL > receiver PROD for correct message type.
    Regards.
    Laurent.

  • Update the database.

    Hi,
    I have a (server 1) 10.2.0.3 on RHEL. I have upgraded it to (server 2) 11.2.0.1.0 on Windows 2003 Server. Tis was done three months back. The user have tested server 2 and said it is OK. Now they are ready to make it "the production" one. Now I have to update the database. (since during the period of testing, the server 1 was production and have more updated data.) How would I do that? Do I have to delete the old database on server 2, again create a new database, and then do the exp and imp? or is there another way?
    Thanks,

    Make a full export but only import the application schema's.
    Before doing that you have to drop the application schema user (cascade) and create the user again.
    The related tablespaces will still be there but they are empty because of dropping the schema user.
    After that you can import only the application schema's from the full export.
    Finally your production database is still the same but the application schema is updated with the latest data from the export dump.

  • Field value is getting double while updating the database table

    Hi Experts,
    A simple doubt :
    there is a standard program through which a zfunction module is getting triggered, through this zfunction module i am updating the database table.
    Now what happening is one of the field(KCQTY) value in database is getting double at a time when i am executing the Program with same variant only.
    I have also done the CLEAR & REFRESH internal tables starting of the Function module.
    Can you please help me out.
    Max points wil be awarded.
    thanks
    rico.

    Hi Nicole,
    this is the part of the coding where you can see how the field KCQTY is getting moved in the loop statement.
      DELETE IT_CE20002B_815 WHERE
          KONDA = SPACE  OR
          WERKS = SPACE  OR
          VVB01001 < 0.
        LOOP AT IT_CE20002B_815.
          INDX = SY-TABIX.
          CONCATENATE IT_CE20002B_815-PERBL0(4) IT_CE20002B_815-PERBL5(2)
                                                    INTO MONAT.
       MOVE itab_ce20001b-perbl TO monat.
          CLEAR S815.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                           BINARY SEARCH.
            SELECT SINGLE * FROM S815 WHERE VRSIO = '000'
                                         AND SPMON = MONAT
                                         AND KONOB = 'APO'
                                         AND MVGR2 = IT_CE20002B_815-KONDA
                                         AND PRODH = IT_CE20002B_815-PRDHA
                                         AND WERKS = IT_CE20002B_815-WERKS.
                                        AND VTWEG EQ CO_VTWEG_99.
    BREAK SAMEE.
          IF SY-SUBRC EQ 0.
    Eintrag in S810 existiert
            IF S815-AEMENGE <= IT_CE20002B_815-VVB01001.
    wenn die Auftragseingangsmenge kleiner gleich der Kontingentsmenge
    wird die Kontingentmenge in das Steploop übernommen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
    *Liste ausgeben
             PERFORM AUSGABE4.
              PERFORM AUSGABE4_815.
            ELSE.
    Ausgabe Fehlermeldung, wenn die Auftragsmenge größer als die
                           Kontingentmenge ist.
    *Liste mit fehlermeldungen ausgeben, Kontingent trotzdem übernehmen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
             PERFORM AUSGABE_FEHLER4.
              PERFORM AUSGABE_FEHLER4_815.
            delete it_ce20002b index indx.
            continue.
            ENDIF.
          ELSE.
    Es existiert kein Eintrag in S810, dann direkt eingeben
            MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.
            MODIFY IT_CE20002B_815 INDEX INDX.
    *Liste ausgeben (Kein Eintrag in S810)
           PERFORM EINTRAG2.
            PERFORM EINTRAG2_815.
          ENDIF.
    *Übergabestructur für die Weiterverarbeitung durch das Copymanagement
    *im Functionsbaustein wird gefüllt.
          W_T_DATA_815-SPMON = MONAT.   "itab_ce20001a-perbl.
          W_T_DATA_815-KONOB = CO_KONOB_APO.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                          BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_T_DATA_815-MVGR2 = CO_MVGR2_999.
          ELSE.
            W_T_DATA_815-MVGR2 = IT_CE20002B_815-KONDA.
          ENDIF.
          W_T_DATA_815-WERKS = IT_CE20002B_815-WERKS.
          W_T_DATA_815-PRODH = IT_CE20002B_815-PRDHA.
         W_T_DATA_815-VTWEG = '99'.
         W_T_DATA_815-KUNNR = '9999999999'.
          W_T_DATA_815-KCQTY = IT_CE20002B_815-VVB01001.
          W_T_DATA_815-BASME = IT_CE20002B_815-VVB01_ME.
    JR181005 - begin of ins.
         w_t_data_810-matkl = it_ce20002b-matkl.
    JR181005 - end of ins.
          APPEND W_T_DATA_815 TO TAB_DATA.
          CLEAR IT_CE20002B_815.
        ENDLOOP.
    thanks for reply
    rico

Maybe you are looking for