Increase Subordinate CA validity

Hy,
I want to build a Subordinate CA but using a different validity period. As you know the default it's 5 years (SubCA template), and I want to make it 10 years.
So before I installed the Subordinate Certification Authority on the second server I created a capolicy.inf file and put put this in:
   [Version]
   Signature="$Windows NT$"
   [RequestAttributes]
   CertificateTemplate = MySubCA
On the Root CA I duplicated the defaut certificate and name this MySubCA with a period of 10 years, then publish this certificate on the certificate templates. Now I install my Subordinate CA and save the request file, went to Root CA and issue the certificate,
but the new certificate period it's two years. I oppened the certificate an looked at details and the certificate template that issue this one it's ok is the one I created earlier. I can't make this work until a issue the command on the  Root CA:
certutil -setreg CA\ValidityPeriodUnits 10
But now all my certificate will have 10 years validity. So my question as you can asume is:
How can I make this work using capolicy.inf file and the new template, without modifying the registry
Thanks

In
     enterprise CA environment , Subordinate CA Validation Period was limited
     as 5 years in the SubCA template by default. All template store here:
          "CN=Certificate Templates ,CN=Public Key
     Services,CN=Services,CN=Configuration,DC=ForestRoot,DC=com"
          To modify them, login your DC ,
          launch "Active Directory Sites and
     Services". On the View menu, click "Show Services
     Node".
          goto "CN=Certificate Templates ,CN=Public Key
     Services,CN=Services,CN=Configuration,DC=ForestRoot,DC=com"
          Find out template "SubCA" , Right click it , click
     Properties
          Switch to "Properties Editor " Tab, edit
     pKIExpirationPeriod, modify the value, For
     example, hexadecimal number 00803c48d1cbf4ff = decimal number
     10
          Save it and restart certsvc.
          you will see Validation Period of SubCA template is 10 years, Now!

Similar Messages

  • Increasing Root CA validity period

    Hi,
    I have a single tier PKI on Windows 2008 R2. Currently, there is no capolicy.inf file. I'd like to increase the Root CA validity from 10 to 15 years. What is the proper way to do this?  Can I just create a capolicy.inf file that contains the below info
    or will it need more options in it? If the below is correct, do I renew with a new key pair or with same pair? i have seen mixed results in my searches?
    [Version]
    Signature="$Windows NT$"
    [Certsrv_Server]
    RenewalKeyLength=2048
    RenewalValidityPeriod=Years
    RenewalValidityPeriodUnits=15

    It is described here: http://blogs.technet.com/b/csstwplatform/archive/2009/08/24/extending-root-ca-certificate-lifetime.aspx
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • Difference between BPC 5 and 7 ms

    Hello all,
    I have found documents about the bpc 7ms but however im looking for whats the difference between bpc 5 and bpc 7ms systems, new features and so on. Do anyone have information about this. Please Share =)
    Cheers
    Jojo

    hI,
    Right now BPC 5.1 is going on in the market, and BPC 7.0 NW version is in rampup.
    BPC 5.1 is the Microsoft version which uses the microsoft tools (Excel,powerpoint,etc) and the backend is SQL server, while BPC7.0 will be having both Microsoft version and Netweaver version.Here Microsoft version will be same as for BPC 5.1 with some advancements,while for NW version the backend will be BI.
    Between BPC 7.0NW and BPC 5.1
    What is In
    Integration with NetWeaver BI
    Increased dimensionality
    New Validations engine
    Integration with BI Accelerator
    Improved dynamic templates
    Lifecycle Management (transports)
    Statistics framework for monitoring
    64-bit ABAP A/S support
    Database neutrality
    Debugging capabilities (ABAP only)
    What is Out
    BPFs
    Books
    Drill-Through
    Dynamic Hierarchy Editor
    Insight
    SQL-Logic in Script Logic
    Some EV functions
    Ability to rename a member, delete a member being used, reduce the length of a property
    Custom Menus
    Thanks,
    Anila

  • WLM integration with SUN ldap

    Hi everyone,
    I cant integrate SUN LDAP with the WLM, I configured it as the manual says, I can authenticate the user, but when the user tries to checkout a task, I got the following exception:
    [#|2006-10-17T11:12:11.459-0400|SEVERE|IS5.1.1|javax.enterprise.system.container.web|_ThreadID=33; ThreadName=http18001-Processor4;|StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
    com.stc.bpms.wlm.TaskException
         at com.stc.bpms.wlm.TaskManager.reserveTask(TaskManager.java:668)
         at com.stc.wlm.web.worklist.CheckoutAction.executeWLMAction(CheckoutAction.java:80)
         at com.stc.wlm.web.worklist.WLMAction.execute(WLMAction.java:49)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:748)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         at sun.reflect.GeneratedMethodAccessor454.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:318)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         at com.stc.wlm.web.worklist.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:89)
         at sun.reflect.GeneratedMethodAccessor455.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:318)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:261)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:261)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:180)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
         at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
         at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:272)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
         at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:161)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
         at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:173)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:979)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:692)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:647)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:691)
         at java.lang.Thread.run(Thread.java:595)
    |#]
    Any idea? The doc is not clear about the attributes Manager, Subordinate, and email, I set them to Manager=manager, Subordinate=(any valid attribute, I use "secretary") and email=mail.
    thanks in advance,
    Edgar.

    Hi TE,
    These are the only lines that the LDAP log in the access.log:
    [27/Oct/2006:11:49:15 -0400] conn=36493 op=63 msgId=64 - SRCH base="" scope=0 filter="(objectClass=*)" attrs=ALL
    [27/Oct/2006:11:49:15 -0400] conn=36493 op=63 msgId=64 - RESULT err=0 tag=101 nentries=1 etime=0
    [27/Oct/2006:11:49:15 -0400] conn=36493 op=64 msgId=65 - SRCH base="ou=people,o=qoslabs,dc=lab" scope=1 filter="(uid=csagan)" attrs="manager"
    [27/Oct/2006:11:49:15 -0400] conn=36493 op=64 msgId=65 - RESULT err=0 tag=101 nentries=1 etime=0
    Any idea?
    Regards,
    Edgar Maya

  • How to set TimeOut period in Portal

    Hi,
    I am running a report in the portal which is taking more than 1 min to display the results. After this one min the page is getting timedout. Can any one please let me know how to administrate the timeout interval. I found this link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b7/60b54066ea8531e10000000a1550b0/frameset.htm
    but where in the portalapp.xml should I set the parameter "com.sap.portal.page.PageTimeout".
    Thanks,
    Sudhir

    Hi Sudhir
    This link will help you:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b7/60b54066ea8531e10000000a1550b0/frameset.htm
    Maybe you could consider changing the page properties to increase the cache validity.
    Check the following thread for more details:
    iView Session Timeout
    Cheers.
    Please award points for helpful answers.

  • Expected type [NUMBER] found [STRING] (["member"]) in function[operator@div

    Hi,
    I am trying to recalculate a figure based on an annual percentage. The script is
    FIX(yr2011, Plan, CC_4363,draft)
    "AC_&&&&&& Salary" ="AC_&&&&&&Salary"* ("pay increase%"/100)
    endfix
    endexclude
    I receive the error "expected type [NUMBER] found [STRING] (["AC_&&&&&&"]) in function[operator@div"
    I looked at this forum and someone suggested using the @match function. I tried
    "AC_&&&&&& Salary" ="AC_&&&&&& Salary"* (@match(Accounts," pay increase%")/100);
    This validated but the salary figure disappeared.
    The reason I am not loading at monthly (level zero) is due to a business requirement. I am having to spread the figures down the months from the total year but if the total year is wrong or missing the montly data obviously disappears too.
    Thanks,
    Nathan

    A few questions:
    1) I see an ENDEXCLUDE, but no starting EXCLUDE. How does that relate to the code?
    2) Do you really have member names with six ampersands in them? Is that even an allowed character? I guess it is but it looks odd as & is the character used to define the usage of an Essbase Substitution Variable. Okay, that was a comment, not a question, I guess.
    3) Do you have a Pay Increase% in every month? Or is it annual?
    3) Why don't you stick the salary value to be allocated into another Account, e.g., "Annual Salary" and place it in a single month. Then your code could look like:
    FIX(yr2011, Plan, CC_4363,draft, "Jan":"Dec")
    "AC_&&&&&& Salary" ="Annual Salary"->"BegBalance" * ("pay increase%"->"BegBalance" / 100)
    endfix
    I created a BegBalance member which you may not have -- chose Dec or Jan as your home for Annual Salary and Pay Increase and go from there. I also forced the calc to happen at the month level -- I am assuming you have months in your app, but maybe not. Salt to taste.
    Regards,
    Cameron Lackpour

  • Systemd + fsck -- default timeout is not enough

    systemd-fsck tries for check my ~ 1 TB ext3 partition, but it fails: machine gets turned off because the check seems to reach some systemd timeouts (despite 15 minutes seems reasonable long for it at first):
    -- Reboot --
    Dec 09 19:08:52 hostname systemd-journal[169]: Journal stopped
    Dec 09 19:08:52 hostname systemd[1]: Shutting down.
    Dec 09 19:08:52 hostname systemd[1]: Forcibly powering off as result of failure.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for Network Manager.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for A lightweight DHCP and caching DNS server.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for Login Service.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for Graphical Interface.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for Multi-User System.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for GNOME Display Manager.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for D-Bus System Message Bus.
    Dec 09 19:08:52 hostname systemd[1]: Dependency failed for Permit User Sessions.
    Dec 09 19:08:52 hostname systemd[1]: Timed out starting Basic System.
    Dec 09 19:08:52 hostname systemd[1]: Job basic.target/start timed out.
    Dec 09 18:53:53 hostname systemd-fsck[300]: /dev/sdb5 has been mounted 24 times without being checked, check forced.
    I failed to google it or find in man pages how to change timeout for basic.target/start -- increasing it looks valid in this particular case. Does anyone know how to do that or has another idea how to get fs checked on boot?

    being hit by the same issue, does this help?
    [root@olivia ~]# systemctl show basic.target | grep Path
    FragmentPath=/usr/lib/systemd/system/basic.target
    [root@olivia ~]# vi /usr/lib/systemd/system/basic.target
    # change 15min to 35min, save and exit
    [root@olivia ~]# systemctl daemon-reload

  • REQUESTED AN ONLINE NUMBER AND WON'T MOVE PAST "PE...

    Skype:
    My online number request 567290751 won't move past pending.  My credit card information is valid as my minute balance was increased and payment validated - today.  This is my third time trying to purchase an online number and I don't understand what the problem is?
    Thank you in advance,
    Benjamin Roodhouse 

    Dtrmnd14 please see Troubleshoot AIR installation | Windows - http://helpx.adobe.com/air/kb/troubleshoot-air-installation-windows.html for steps on how to resolve most install issues with Adobe AIR.

  • Certificate Authority root CA increased validity problem

    Dear all,
    I was successfully able to create in Certificate Services root CA for 20 years, issued a certificate and login using smartcard using the following procedure:
    1. I increased the CA lifetime to 20 years by using this link http://www.expta.com/2010/08/how-to-create-certificates-with-longer.html
    Created the file CAPolicy.inf in %SYSTEMROOT% with following content
    [Version]
    Signature=”$Windows NT$”
    [certsrv_server]
    RenewalValidityPeriod=Years
    RenewalValidityPeriodUnits=20
    2. Renew CA root using this guide  https://technet.microsoft.com/en-us/library/cc780374(v=ws.10).aspx
    Console Root -> Certification Authority -> select domain -> Right click -> All Tasks -> Renew CA certificate
    3. Delete from
    Console Root -> Certificates (local computer) -> Trusted Root Certification Authority -> Certificates the *WINSC-CA that has the previous lower validity, and from 
    Certificates (local
    computer) -> Personal, the *WINSC-CA that was lower validity
    4. I performed a reboot here
    5. Change in Console Root -> Certificate Templates -> Smartcard Logon Custom Template (my custom duplicate template) -> Properties -> Validity 10 years
    6. Change in registry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\CertSvc\Configuration\<CAName>\ValidityPeriod
    to value 10 for 10 years.
    7. Request a new certificate from CA webpage http://ipofdomain/certsrv and let the webpage write it to smartcard (I was making
    sure there is no other certificate on the smartcard)
    8. Try to log in. At this point it should throw an erorr that smartcard logon is not supported for this account type. This
    is becuase we need to enroll it again for domain authentication
    9. Console Root -> Certificates (local Computer) -> Personal -> Right click -> All Tasks -> Request new Certificate
    -> Next -> Active Directory Enrollment -> Next -> Select Domain Controller Authentication -> Enroll -> Finish.
    Now you should be able to login using your smartcard and 10 years generated certificate.
    Though I have a
    problem at step 3, after CA server reboots the *WINSC-CA certificate with lower validity is restored automatically, but the certificates are generated for 10 years.
    What am I doing
    wrong ? How can I delete the lower validity root CA ?

    Hi,
    Thanks for your post.
    Did you try to restart the CertSrv service to check the result after you create and save the CAPolicy.inf file?
    Regards.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Server 2012 CDP PKI Setup on Subordinate CA - Active Directory Certificate Services could not create an encryption certificate

    Hi,
    When I check pkiview.msc on my 2012 Subordinate CA I get the error shown in the first picture below. I'm also getting errors similar to below in the event log:
    "Active Directory Certificate Services could not create an encryption certificate.  Requested by contoso\admin1.  The revocation function was unable to check revocation because the revocation server was offline. 0x80092013 (-2146885613 CRYPT_E_REVOCATION_OFFLINE)."
    I'm assisting in setting up a 2 tier PKI infrastructure using Windows 2012. The root CA looks good, but we're getting errors on the subordinate. The server was working, but we discovered that the server would only issue certificates with a maximum of a 1
    year expiry date - obviously no good, so we decided to run through the following commands on the root CA (as recommended byhttp://www.techieshelp.com/subordinate-ca-increase-certificate-validity/)
    certutil -setreg ca\ValidityPeriodunits "Years"
    certutil -setreg ca\ValidityPeriod "5"
    restarted AD certificate services on the root and subordinate CA.Then did the following on the subordinate CA:
    1.On the Subordinate CA create a new CA request by right clicking the server in ADCS and select New Request.
    2.Supplied the original request file from the subordinate CA (I couldn't find a way of generating a new request file)
    3.Issued the certificate using the Root CA.
    4.On the Subordinate CA ADCS installed new CA cert.
    However, I keep on getting CDP or AIA errors on my subordinate CA.Also I'm missing a CDP field value when I look at the certificate listed in the personal and trusted certification authority store on my subordinate CA.
    In addition, when I look at my CDP locations in Certificate Authority, I see a lot of CDPs, but I'm not sure if I need them all - I suspect I could just get away with LDAP, the C:\windows path and a single http:// path.
    I've tried renewing the existing certificate and CRL on my subordinate CA, but that didn't work either.
    Please advise.
    Thanks

    Ok, the process to renew the subordinate CA is incorrect. Once the registry setting to change the validity period was made on the root CA, the root CA ADCS service needs to be restarted. That is the only time those keys are read. Then:
    1) On the subordinate CA, open the CA tool, right click the CA and select Renew CA Certificate. You can use the same key, no need to create a new one. It will create a NEW certificate request file
    2) Copy that to the Root CA and submit like you would have done during the initial install
    3) Approve the request and export the issued certificate
    4) On the subordinate CA, in the CA tool, right click the CA and choose Install CA Certificate.
    You can not reuse request files.
    Mark B. Cooper, President and Founder of PKI Solutions Inc., former Microsoft Senior Engineer and subject matter expert for Microsoft Active Directory Certificate Services (ADCS). Known as “The PKI Guy” at Microsoft for 10 years.

  • How do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA certfificate i can't open web pages with this, how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC CA certfificate i can't open web pages with this

    how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA ?

    Hi
    I am not suprised no one answered your questions, there are simply to many of them. Can I suggest you read the faq on 'how to get help quickly at - http://forums.adobe.com/thread/470404.
    Especially the section Don't which says -
    DON'T
    Don't post a series of questions in  a single post. Splitting them into separate threads increases your  chances of a quick answer.
    PZ
    www.pziecina.com

  • Any way to bypass server certificate validation in AIR client?

    Is there any way to bypass certificate validation and server identification for secure Channels or ChannelSets? I am aware of the existing workaround to import my own certificate into the user's CA chain, but I feel that having greater control on the client-side is preferred.
    If there is not a way to bypass client-side certificate validation I will be filing this as a feature request at http://bugs.adobe.com
    Thanks,
    Karl
    When producing a client-server solution it is occasionally useful to override the default behavior of HTTPS certificate validation and server identification. I would like to request the ability to override these systems in the AIR environment for applications installed with the "UNRESTRICTED" system access option.
    Simply allowing the use of self-signed certificates without verification (perhaps signified by a secure protocol identifier other than "https") would provide adequate functionality, but some users may desire finer control.
    This issue is partly addressed by bugs FP-711 and FP-214 but I feel it is important that any enhancement include the BlazeDS Channel in the case that the AIR application has unrestricted system access.
    When deploying an AIR client application which is securely connected to a network appliance which is controlled by the same developer it is desirable to bypass the overhead of acquiring a PKI issued certificate for every customer. Independent, open-source, and not-for-profit developers could see increased ability to adopt the AIR platform with this improvement.
    When deploying a network appliance to be used with an AIR application the requirement for a PKI issued certificate complicates the deployment of the network appliance by requiring DNS access, and thereby requiring Internet connectivity. Some customer sites require network isolation.
    It is possible to generate a developer-specific certificate and import that certificate into the AIR client host's Trusted Root Certification Authorities list. This workaround deteriorates PKI best practices and complicates the installation of AIR software. It is not possible to depend solely on the ".air" packaging for installation with the added requirement to install a new CA on the user's host.
    Java provides the requested functionality by allowing developers to provide their own implementations of javax.net.ssl.TrustManager for verification and javax.net.ssl.HostnameVerifier for identification. We have used this technique to communicate over the SDEE protocol with Cisco IDS devices which do not usually have PKI issued certificates.

    Hi Robert,
    No specific option to controle TOP/First features use.
    However other options exist to control IQ resources.
    Eg. Query_temp_sopace_limit, Query_Time, Max_IQ_Threads_Per_Connection, Max_Cartesian_Result.
    Regards,
    Tayeb.

  • Interface validation

    Hi
    This is my existing interface ,I need to do a validation on Unique id,which i need to add to custom table ZBACKS_GIPD.
    Check if there is same unique id within the upload file.
    Check from table ZBACKS_GIPD if the same Unique ID already exists ,
    Update log file with error message :"Duplicate record"
    Please let me know where I need to add this validation in the below code.
    REPORT ZBAB005 LINE-SIZE 255
                   LINE-COUNT 58(2)
                   NO STANDARD PAGE HEADING
                   MESSAGE-ID 00.
    TABLES: MARA,        "Material master
            MARC,        "Plant Data for Material
            MBEW,        "Material Valuation
            T001K,       "Valuation area
            t100,        "Messages
            kna1,        "Customer master
            SKB1,        "G/L account
            BKPF,        "FIN doc
            zprdordhdr,  "production order header
            ZSTDLOADING, "BACKS-SAP Interface - Generic ProdOrd costing data
            ZBACKS_GIPD. "BACKS-SAP Interface - Material Consumption
    Short name of the interface name
    DATA: INTFNAME(4) value 'GIPD'. "Good Issues for Prod. Order
    include zbab000. "Common procedures for files handling
    SELECTION-SCREEN BEGIN OF BLOCK 6 WITH FRAME TITLE TEXT-006.
      parameters: p_usafl obligatory default 'E'. "Usgae indicator
      parameters: p_chk_ui as checkbox "check invalid usage ind "UATK922842
                    default space.                              "UATK922842
      parameters: p_chk_pd as checkbox "check period of the posting date
                    default 'X'.                                "UATK923027
    SELECTION-SCREEN END OF BLOCK 6.
    SELECTION-SCREEN BEGIN OF BLOCK 7 WITH FRAME TITLE TEXT-007.
    parameters: fb70mode default 'N'.
    parameters: fb50mode default 'N'.
    SELECTION-SCREEN END OF BLOCK 7.
    SELECTION-SCREEN BEGIN OF BLOCK 8 WITH FRAME TITLE TEXT-008.
    parameters:
      p_nor  radiobutton group rad1, "new posting
      p_rep2 radiobutton group rad1. "report (flag '2')
    select-options:
      recno for zbacks_gipd-recno    "record number
        default '1' obligatory.
    SELECTION-SCREEN END OF BLOCK 8.
    DATA: BEGIN OF TAB OCCURS 1000,
             WERKS(04),  "plant
             AUFNR(25),  "production order number
             MATNR(18),  "material
             ERDAT(10),  "BACKS tx date
             MENGE_as_string(17),  "qty
             USAFL(01),  "consumption/usage indicator
             SAKNR(10),  "G/L account number (this is from user's data file,
                         "use SAKNR_FOR_POSTING to post mat. doc instead)
           EXPCD(02),  "expenses code
             IDNUM(35),  "BACKS Identification number
             kunnr(10),  "customer number
    The below 3 fields have no use in SAP transactions
    however they are included in the data file from BACKS.
    Just store them in ZBACKS_GIPD for future use if required
             USACD(10),  "usage code
             ORDCD(10),  "order code
             LOSTY(03),  "loss type
             COTAX(13),  " like zbacks_gipd-cotax, "consumption tax
             MWSKZ(02),  " like zbacks_gipd-MWSKZ, "tax code
    The below fields are not included in the BACKS incoming data file
    They are only for the processing of this program
             RECNO(10),  "record number in the uploaded data file
             FAILF(01),  "Status flag (0=OK, see documentation for details)
             MSGNR(01),                     "message number
             MSGTX(200),                    "message text
             menge(13) type p decimals 3, "qty as numeric
             BUKRS        like t001-bukrs,  "company code
             PRCTR        like marc-prctr,  "profit center
             matkl        like mara-matkl,  "material group
             unitstdcost  type p decimals 3,"standard cost (per 1 EA)
             matloading   type i,           "material loading
             runum        like zprdordhdr-runum,"prod. order running number
           SAKNR        like zexpense-saknr, "account no.
             KOSTL        like zexpense-kostl, "cost center
             saknr_for_posting like bseg-saknr,"G/L acct after validation
             erdat_raw(10),                    "BACKS tx date (MM/DD/YYYY)
    **>>1104
           post_seq_ORIG like DATATYPE-INTEGER4,
           "(5) type n,          "random number: posting order
           post_seq_RAND like DATATYPE-INTEGER4,
           "(5) type n,          "random number: posting order
    **>>1104
             MATDOC(10),     "material document
             MATDOCITEM(4),  "material document item number
             Direction(1),   "I=Issue, R=Reverse (based on the +/- of MENGE)
             ladra like zbacks_gipd-ladra, "material loading rate
             hdr_SUBPR like zprdordhdr-SUBPR, "Sub-con Prodorder "UATK922842
    the below 2 fields are added to resolve 1-yen issue        "DEVK914235
             STOCKQTY like ZBACKS_GIPD-STOCKQTY,    "total stock (from MBEW)
             SALK3    like ZBACKS_GIPD-SALK3,      "total value before issue
             ISSUESTPRS like ZBACKS_GIPD-ISSUESTPRS,"unit std cost
          END OF TAB.
    data: START_RECNO like ZBACKS_GIPD-recno.
    DATA: BEGIN OF BDCDATA OCCURS 100.
          INCLUDE STRUCTURE BDCDATA.
    DATA: END OF BDCDATA.
    data: begin of msgtab occurs 0.
          INCLUDE STRUCTURE BDCMSGCOLL.
    data: end of msgtab.
      Constants used in A/C & Inv postings                               *
    for JV posting
    CONSTANTS:
      CONST_SAKNR_WIP_LABOUR_OH like BSEG-SAKNR "G/L act: WIP-Labour & O/H
        value '0000141000',
      CONST_SAKNR_WIP_MAT_LOAD like BSEG-SAKNR  "G/L act: WIP Matl. Loading
        value '0000543004',
      CONST_SAKNR_WIP_MAT like BSEG-SAKNR            "G/L act: WIP matl
        value '0000140000',
      CONST_SAKNR_OTHER_INCOME like BSEG-SAKNR       "G/L act: Other income
        value '0000725000', "was: '0000400310',
      CONST_SAKNR_WIP_MAT_SUB_CON like BSEG-SAKNR    "G/L act: Mat supplied
        value '0000126001'.                          "to subcontractor
    for material movement (inventory posting)
    CONSTANTS:
       CONST_LGORT like mseg-LGORT      "storage location
         value 'STR1',
       CONST_CHARG like mseg-charg      "batch number
         value 'BACKS'.
    for AR customer invoice for sub-contractor
    CONSTANTS:
       CONST_TAX_RATE     type p decimals 2 value '0.05',     "i.e. 5%
       CONST_PENALTY_RATE type p decimals 2 value '0.2'.      "i.e. 20%
      Structures & internal tables for BAPI - Material movement          *
    Header segment with control information
    DATA: BEGIN OF GOODSMVT_HEADER OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_HEAD_01.
    DATA: END OF GOODSMVT_HEADER.
    DATA: BEGIN OF GOODSMVT_CODE OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_CODE.
    DATA: END OF GOODSMVT_CODE.
    DATA: BEGIN OF GOODSMVT_ITEM OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_ITEM_CREATE.
    DATA: END OF GOODSMVT_ITEM.
    DATA: BEGIN OF REMSG OCCURS 0.
          INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF REMSG.
    DATA: BEGIN OF GOODSMVT_HEADRET OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_HEAD_RET.
    DATA: END OF GOODSMVT_HEADRET.
    *DATA: MATDOC LIKE BAPI2017_GM_HEAD_RET-MAT_DOC.
    DATA: DOCYEAR LIKE BAPI2017_GM_HEAD_RET-DOC_YEAR.
      Structures & internal tables for BAPI - Account Doc Posting        *
    DATA: DOCUMENTHEADER like BAPIACHE08.
    DATA: BEGIN OF ACCOUNTGL occurs 0.
          include structure BAPIACGL08.
    DATA: END OF ACCOUNTGL.
    DATA: BEGIN OF CURRENCYAMOUNT occurs 0.
          include structure BAPIACCR08.
    DATA: END OF CURRENCYAMOUNT.
    DATA: BEGIN OF RETURN occurs 0.
          include structure BAPIRET2.
    DATA: END OF RETURN.
      Misc. internal tables and variable for error logging               *
    DATA: BEGIN OF ERRTX OCCURS 0,
          MSGTX(110).
    DATA: END OF ERRTX.
    DATA: ERR(1) TYPE C.
        TTLQTY(12) TYPE P,
        SUCQTY(12) TYPE P,
        FALQTY(12) TYPE P.
      Calculation variables for sub-contractor                           *
      data: ar_amt_vendor   type p decimals 0.
      data: ar_amt_penalty  type p decimals 0.
      data: ar_amt_total    type p decimals 0.
      data: ar_amt_tax      type p decimals 0.
      data: ar_amt_vendor_as_text(13).
      data: ar_amt_penalty_as_text(13).
      data: ar_amt_total_as_text(13).
      data: ar_amt_tax_as_text(13).
    data: last_werks like tab-werks. "plant
    data: last_matnr like tab-matnr. "to avoid locking problem -> Sleep if
                               "the current p/n is the same as the last one
    data: last_direction.
    DATA: FI_DOC_TEXT(50).   "contains: 1-35:  BACKS ID
                             "          36-50: Quantity
    data: begin of tab_by_matnr occurs 0.
          include structure tab.
    data: end of tab_by_matnr.
    data: MATDOC_AND_ITEM(16). "to put in reference fields
      Data for mat doc item rearrangement                                *
    *Max. no. of items in a single material doc.
    *This number must be less than the half of the FI doc. item limit (999)
    constants:
      c_max_mat_doc_items type i value '400'.
    last flag to indicate if a break is required
    data: l_last_matnr     like tab-matnr.     "last material
    data: l_last_direction like tab-direction. "last direction (+ or -)
    data: l_last_werks     like tab-werks.     "last plant
    count the no. of items (to check against the max. no. of item limit)
    data: l_matnr_counter type i.
      Start and End date of the allowed posting priod                    *
    data: g_period_start_date like sy-datum. "first date of current period
    data: g_period_end_date   like sy-datum. "end date of current period
      Stock info before Goods issue (to solve 1-yen issue)               *
    data: G_SALK3(16) type p decimals 0. "total stock value
    data: G_LBKUM like mbew-lbkum.      "total stock qty
         T O P   O F   P A G E
    TOP-OF-PAGE.
    CALL FUNCTION 'Z_PRINT_REPORT_HEADING'
         EXPORTING
                I_WERKS = 'IHK1'
                I_LINSZ = SY-LINSZ
                I_CPROG = SY-CPROG
                I_TITLE = SY-TITLE.
    WRITE: /1(006)  'Plant'                color 1,
             (025)  'Production Order No'  color 1,
             (018)  'Material'             color 1,
             (010)  'CreDate'              color 1,
             (015)  'Qty'                  color 1,
             (010)  'Usage Ind.'           color 1,
             (010)  'G/L Acct.'            color 1,
             (025)  'BACKS ID'             color 1,
             (010)  'Cust.No.'             color 1,
             (001)  'Fail Flag'            color 1,
             (100)  'Message'              color 1.
    ULINE.
      START - OF - SELECTION                                             *
    START-OF-SELECTION.
    if p_chk_pd = 'X'. "check preiod is needed    "UATK923027
      perform start_end_date_of_period.  "calculate period start/end date
      if   g_period_start_date is initial     "if the start/end date is not
        or g_period_end_date   is initial.    "determined, stop the program
        write: / 'Period start/end date not determined, program stopped.'.
        stop.
      endif.
    endif.
    if p_nor = 'X'.
      PERFORM COMMON_SETUP_FILENAMES. "auto setup filenames by current date
      PERFORM COMMON_UPLOAD_FILES.    "upload input files: TXT and FLG
      PERFORM CONVERSION_DATA.
    elseif p_rep2 = 'X'.
      perform read_data_from_GIPD.
    endif.
    PERFORM CHECK_DATA.
    PERFORM MAIN_UPDATE.
    PERFORM PRINT_OUTPUT.
    PERFORM COMMON_DOWNLOAD_FILES.  "download the log & status file
      FORM READ_DATA_FROM_GIPD                                         *
    form read_data_from_GIPD.
      select * from zbacks_gipd
        where failf = '2'
          and recno in recno.
        clear tab.
        clear result_total. "reset the record counter
        tab-werks = zbacks_gipd-WERKS.         "plant
        tab-aufnr = zbacks_gipd-AUFNR.         "production order no.
        tab-matnr = zbacks_gipd-MATNR.         "material
        tab-erdat = zbacks_gipd-BUDAT.         "transaction date
        tab-recno = zbacks_gipd-recno.
        TAB-MENGE = zbacks_gipd-menge.         "qty
        TAB-USAFL = zbacks_gipd-usafl.         "usage/consumption ind.
             TAB-EXPCD            "Expenses code
        TAB-SAKNR = zbacks_gipd-saknr.         "G/L account number
        TAB-IDNUM = zbacks_gipd-idnum.         "BACKS identification no.
        TAB-KUNNR = zbacks_gipd-kunnr.         "Customer Number
        TAB-USACD = zbacks_gipd-usacd.         "usage code
        TAB-ORDCD = zbacks_gipd-ordcd.         "order code
        TAB-LOSTY = zbacks_gipd-losty.         "loss type
        TAB-COTAX = zbacks_gipd-cotax.         "consumption tax
        TAB-MWSKZ = zbacks_gipd-mwskz.         "tax code
        tab-runum = zbacks_gipd-runum.         "running number
        tab-failf = zbacks_gipd-failf.     "failure flag
        tab-msgnr = zbacks_gipd-failf.     "failure flag
        tab-matdoc = zbacks_gipd-docm1.    "material doc
        tab-msgtx = 'Repost 2nd step'.
       tab-erdat_raw = tab-erdat. "keep the MM/DD/YYYY format
       CONCATENATE TAB-ERDAT6(4) TAB-ERDAT0(2) TAB-ERDAT+3(2)
              INTO TAB-ERDAT.
         concatenate tab-erdat+4(2) '/'
                     tab-erdat+6(2) '/'
                     tab-erdat+0(4)
                   into tab-erdat_raw.
    *Process only a particular set of usage indicator first
        if tab-usafl = p_usafl.
          APPEND TAB.
          result_total = result_total + 1. "Increase the record counter
        endif.
      endselect.
      write: / 'Re-processing records for usage indicator', p_usafl.
    endform.
      FORM CONVERSION_DATA                                               *
    FORM CONVERSION_DATA.
      data: saknr_len type i. "field length of GL acct
      data: kunnr_len type i. "field length of cust no.
      describe field tab-saknr length saknr_len.
      describe field tab-kunnr length kunnr_len.
      clear result_total. "reset the record counter
      LOOP AT STR_TXT.
         CLEAR TAB.
         SPLIT STR_TXT-SLINE AT '|'
          INTO TAB-WERKS            "plant
               TAB-AUFNR            "production order no.
               TAB-MATNR            "material
               TAB-ERDAT            "transaction date
               TAB-MENGE_as_string  "qty
               TAB-USAFL            "usage/consumption ind.
             TAB-EXPCD            "Expenses code
               TAB-SAKNR            "G/L account number
               TAB-IDNUM            "BACKS identification no.
               TAB-KUNNR            "Customer Number
               TAB-USACD            "usage code
               TAB-ORDCD            "order code
               TAB-LOSTY            "loss type
               TAB-COTAX            "consumption tax
               TAB-MWSKZ            "tax code
         tab-erdat_raw = tab-erdat. "keep the MM/DD/YYYY format
         CONCATENATE TAB-ERDAT6(4) TAB-ERDAT0(2) TAB-ERDAT+3(2)
                INTO TAB-ERDAT.
         tab-menge = tab-menge_as_string. "convert to numeric field
    *set tab-msgnr to 1 for invalid usage indicator
    *so that the error records will be included in the error log
         if p_chk_ui = 'X'.
           perform check_usage_indicator.
         endif.
    *Process only a particular set of usage indicator first
    *{Gary Tang 02/10/2003 UATK922842 also include MSGNR=1 (invalid usage
    *incicator records
         if tab-usafl = p_usafl "this is the target usage indicator
            or tab-msgnr = '1'. "this is 1 because of invalid usage ind.
    *}Gary Tang 02/10/2003 UATK922842
    add leading zero to numeric GL acct no.
    e.g. data file: 230330 --> convert to: 0000230330
           CALL FUNCTION 'Z_PURE_NUMERIC_ADD_LEADING_0'
             EXPORTING
               INPUT_FIELD        = tab-saknr
               TARGET_LEN         = saknr_len
             IMPORTING
               OUTPUT_FIELD       = tab-saknr
    add leading zero to numeric cust num
    e.g. data file: 3100001 --> convert to: 0003100001
    e.g. data file: NEC-JP  --> no conversion: NEC-JP
           CALL FUNCTION 'Z_PURE_NUMERIC_ADD_LEADING_0'
             EXPORTING
               INPUT_FIELD        = tab-kunnr
               TARGET_LEN         = kunnr_len
             IMPORTING
               OUTPUT_FIELD       = tab-kunnr
           APPEND TAB.
           result_total = result_total + 1. "Increase the record counter
         endif.
      ENDLOOP.
      write: / 'Processing records for usage indicator', p_usafl.
    ENDFORM.
      FORM CHECK_DATA                                                    *
    FORM CHECK_DATA.
       if p_nor = 'X'.
         PERFORM GET_NEXT_RECNO.
       endif.
       LOOP AT TAB.
          perform check_data_on_period."record date must in current period
          perform check_data_on_zprdordhdr. "production order header
          perform check_data_on_mara.  "material master (general)
          perform check_data_on_marc.  "material master (plant)
          perform check_data_on_t001k. "company code vs plant
          perform check_data_on_mbew.  "Material Valuation
          perform check_usage_indicator. "usage indicator
          perform check_sub_contract.  "must have customer number
          perform check_data_on_kna1.  "customer number
          perform check_data_on_skb1.  "G/L account
          perform check_menge.         "quantity
        perform check_expense.       "for eXpenses
          perform calculate_materail_loading.
        perform gen_random_posting_sequence.
          if p_nor = 'X'.
            PERFORM INSERT_TABLE_ZBACKS_GIPD.
          endif.
          MODIFY TAB.
      endloop.
      if p_nor = 'X'.
    print the last record number for reference
      write: / 'ZBACKS_GIPD record number (RECNO) to   :',
                ZBACKS_GIPD-RECNO.
      skip 1.
      endif.
    endform.
      FOMR Gen_random_posting_sequence                                   *
    *form gen_random_posting_sequence.
    tab-post_seq_ORIG = SY-TABIX.
    if tab-msgnr = '1'. "no need to go further if already rejected
       tab-post_seq_RAND = 0.
    else.
       CALL FUNCTION 'RANDOM_I4'
         EXPORTING
           RND_MIN         = 1
           RND_MAX         = 50000
         IMPORTING
           RND_VALUE       = tab-Post_seq_RAND
    endif.
    *endform.
      FOMR CHECH_MENGE                                             *
    form check_MENGE.
      if tab-menge > 0.      "Issue qty > 0
        tab-direction = 'I'. "Issue (i.e. decrease the inventory)
      elseif tab-menge < 0.  "Issue qty < 0
        tab-direction = 'R'. "Reverse (i.e. increase the inventory
      elseif tab-menge = 0.  "Issue qty = 0 ==> Strange case, error!
        TAB-MSGNR = '1'.
        tab-msgtx = 'Qty is 0. Nothing to post!'.
      endif.
    endform.
      FOMR CHECH_USAGE_INDICATOR                                         *
    form check_usage_indicator.
      case tab-usafl.
        when 'I'. "Inhouse production
        when 'E'. "External procurement
        when 'X'. "Expense
        when 'T'. "transfer to sub-contractor
        when 'S'. "sale to sub-contractor
        when 'C'. "consign to sub-contractor
      when '?'. "add new usage indicator here if needed!
        when others. "illegal value! reject the record
          TAB-MSGNR = '1'.
         concatenate 'Invalid usage indicator'
           into tab-msgtx separated by space.
          tab-msgtx = 'Invalid usage indicator'.
      endcase.
    endform.
    *form check_expense.
    check not tab-msgnr = '1'. "no need to go further if already rejected*
    check tab-usafl = 'X'. "only for expense
    SELECT SINGLE ZEXPENSE~SAKNR
                   ZEXPENSE~KOSTL
       into (TAB-SAKNR,
             TAB-KOSTL)
       FROM ZEXPENSE
       WHERE ZEXPENSE~WERKS = TAB-WERKS
         AND ZEXPENSE~EXPCD = TAB-EXPCD.
    IF SY-SUBRC <> 0.
       TAB-MSGNR = '1'.
       TAB-MSGTX = 'Expense code not found (ZEXPENSE)'.
    endif.
    *endform.
      FOMR CALCULATE_MATERIAL_LOADING                                    *
    form calculate_materail_loading.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    *Material loading is calculated for all records
    *Though posting only required for usage 'E'
    check tab-usafl = 'E'. "only for External procurement need to post
      select single ZSTDLOADING~LADRA  "loading %
        into ZSTDLOADING-LADRA         "loading %
        from ZSTDLOADING               "standard loading info.
        where WERKS = tab-werks        "plant
          and MATGP = tab-matkl+0(2)   "customer code
        and LADTY = tab-usafl.       "usage code
          and LADTY = 'P'.             "material loading
      if ( sy-subrc <> 0 ).
       or ( zstdloading-LADRA is initial ). "DEVK909574
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Mat. loading % not found or = 0% (ZSTDLOADING)'.
      else.
        tab-ladra = zstdloading-ladra. "store the loading rate into table
    *{Gary Tang 02/10/2003                                     "UATK922842
    round the qty*stdcost to integer before multiplying the loading rate
        tab-matloading         "type is integer (result will be rounded off)
          = tab-menge          "qty
    tab-unitstdcost.   "std cost (of 1 EA)
         * ZSTDLOADING-LADRA "material loading percentage (%)
         / 100.              "because material loading is in %
       tab-matloading         "type is integer (result will be rounded off)
          = tab-matloading
    ZSTDLOADING-LADRA "material loading percentage (%)
           / 100.              "because material loading is in %
    *}Gary Tang 02/10/2003                                     "UATK922842
      endif.
    endform.
      FORM CHECK_DATA_ON_SKB1                                            *
    form check_data_on_SKB1.
      data: saknr_as_numeric(10) type n. "for leading zero
      check not tab-msgnr = '1'. "no need to go further if already rejected
      case tab-usafl.
      when 'I' or 'E' or 'C'.
        if not tab-saknr is initial.
          TAB-MSGNR = '1'.
          concatenate 'G/L Account no. should be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        else.
          tab-saknr_for_posting = CONST_SAKNR_WIP_MAT.
        endif.
      when 'T' or 'S'.
        if not tab-saknr is initial.
          TAB-MSGNR = '1'.
          concatenate 'G/L Account no. should be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        else.
          tab-saknr_for_posting = CONST_SAKNR_WIP_MAT_SUB_CON.
        endif.
      when 'X'. "G/L acct is required for eXpense
        if tab-saknr is initial.
          TAB-MSGNR = '1'.
          concatenate 'G/L Account no. is REQUIRED for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        else.
          CATCH SYSTEM-EXCEPTIONS CONVT_NO_NUMBER = 4.
            SAKNR_AS_NUMERIC = TAB-SAKNR.
          endcatch.
          if sy-subrc = 4.
            TAB-MSGNR         = '1'.
            TAB-MSGTX         = 'Invild G/L acct no. (should be numeric)'.
          endif.
          select single skb1~saknr
            into skb1-saknr
          from skb1
          where skb1~bukrs = tab-bukrs
            and skb1~saknr = saknr_as_numeric. " tab-saknr.
          if sy-subrc = 0.
            tab-saknr_for_posting = saknr_as_numeric. " tab-saknr.
          else.
            TAB-MSGNR = '1'.
            TAB-MSGTX = 'G/L Account no. not found (SKB1)'.
          endif.
        endif.
      endcase.
    endform.
      FORM CHECK_DATA_ON_PREIOD                                          *
    form check_data_on_period.
      check p_chk_pd = 'X'.      "check period option is selected
      check not tab-msgnr = '1'. "no need to go further if already rejected
      if   tab-erdat < g_period_start_date "record in past period, reject!
        or tab-erdat > g_period_end_date.  "record in future period, reject!
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Record date is not in open period.'.
      endif.
    endform.
      FORM CHECK_DATA_ON_MBEW                                            *
    form check_data_on_mbew.
      data: local_stprs like mbew-stprs. "std price
      data: local_peinh like mbew-peinh. "price unit
      check not tab-msgnr = '1'. "no need to go further if already rejected
    *Standard cost is checked for all records
    *Though calculation is only required for usage 'E'
    check tab-usafl = 'E' "for External procurement
        or tab-usafl = 'T' "for Transfer to sub-contractor
        or tab-usafl = 'S'."for Sale to sub-contractor
      select single stprs              "std price
                    peinh              "price unit
              into  (local_stprs,      "std price
                     local_peinh)      "price unit
        from mbew                      "material valuation
        where matnr = tab-matnr        "material
          and bwkey = tab-werks.       "plant
      if ( sy-subrc <> 0 )             "record not round
        or ( local_stprs = 0 ).        "std cost = 0 (should not happen)
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Standard cost not found or = 0 (MBEW)'.
      else.                            "calculate the cost of 1 EA
        tab-unitstdcost = local_stprs / local_peinh * 100.
      endif.
    endform.
      FORM CHECK_DATA_ON_ZPRDORDHDR                                      *
    form check_data_on_zprdordhdr.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    Production order is not required for usage indicator 'T' or 'S'
    Even the number is provided, it may or may not exist in ZPRDORDHDR
    Therefore, all checking on production order can be skipped for T & S
    (11/11/2002, confirmation from Stephen Chung, Miura-san, Sato-san)
      check tab-usafl <> 'T'  "Transfer to sub-contract
        and tab-usafl <> 'S'  "Sales to sub-contract
    Confirmed by Miura-san on 11/30/2002
    Production order no. is also not required for 'X' (Expense)
        and tab-usafl <> 'X'. "Expenses
      if tab-aufnr is initial.
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Production order number is missing'.
        exit.
      endif.
      select single zprdordhdr~aufnr
        into zprdordhdr-aufnr
        from zprdordhdr
        where zprdordhdr~werks = tab-werks
          and zprdordhdr~aufnr = tab-aufnr.
      if sy-subrc <> 0.
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Production order number not found (ZPRDORDHDR)'.
      else.
        select max( zprdordhdr~runum )
          into tab-runum
          from zprdordhdr
          where zprdordhdr~werks = tab-werks
            and zprdordhdr~aufnr = tab-aufnr.
       if tab-runum is initial.
         TAB-MSGNR = '1'.
         TAB-MSGTX = 'Production order number not found (ZPRDORDHDR)'.
       else.
          select single
             stats   "production order status
             SUBPR   "Sub-contracting Production Order
            into (zprdordhdr-stats,
                  tab-hdr_SUBPR)    "save into internal table TAB directly!
            from zprdordhdr
            where zprdordhdr~werks = tab-werks
              and zprdordhdr~aufnr = tab-aufnr
              and zprdordhdr~runum = tab-runum.
          if ( zprdordhdr-stats <> 'O' )
            and ( zprdordhdr-stats <> 'C' ).
            TAB-MSGNR = '1'.
            concatenate 'No tx is allowed, production order in status'
            zprdordhdr-stats into tab-msgtx separated by space.
          endif.
       endif.
      endif.
    endform.
      FORM CHECK_DATA_ON_MARA                                            *
    form check_data_on_mara.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    get cost center that is from profit center in MARC
      SELECT SINGLE MARA~MATKL                   "material group
        into MARA-MATKL                          "material group
        FROM MARA                                "Material master
        WHERE MATNR = TAB-MATNR.                 "material
      IF SY-SUBRC = 0.
        TAB-MATKL = MARA-MATKL.                  "material group
      ELSE.
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Material not found (mat.gp./cust code missing) (MARA)'.
      ENDIF.
    ENDFORM.
      FORM CHECK_DATA_ON_MARC                                            *
    form check_data_on_marc.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    get cost center that is from profit center in MARC
      SELECT SINGLE PRCTR
        into MARC-PRCTR
        FROM MARC  "Plant Data for Material
        WHERE MATNR = TAB-MATNR  "material
          AND WERKS = TAB-WERKS. "plant
      IF SY-SUBRC EQ 0.
        TAB-PRCTR = MARC-PRCTR.  "profit center
      ELSE.
        TAB-MSGNR = '1'.
        TAB-MSGTX =
          'Mat. not found in plant. (Profit center missing) (MARC)'.
      ENDIF.
    ENDFORM.
      FORM CHECK_DATA_ON_KNA1                                            *
    form check_data_on_kna1.  "customer number
    data: kunnr_as_numeric(10) type n.
    data: kunnr_as_string(10).
      check not tab-msgnr = '1'. "no need to go further if already rejected
      check not tab-kunnr is initial.
    IF NOT TAB-KUNNR CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,-_#'.
       kunnr_as_numeric = tab-kunnr.
       kunnr_as_string = kunnr_as_numeric.
    else.
       kunnr_as_string = tab-kunnr.
    ENDIF.
      select single kna1~kunnr
        into kna1-kunnr
        from kna1
      where kunnr = kunnr_as_string. " tab-kunnr.
        where kunnr = tab-kunnr. "customer no. (w/ leading zero if numeric)
      if sy-subrc <> 0.
        TAB-MSGNR = '1'.
        concatenate 'Customer number' tab-kunnr 'not found (KNA1)'
          into tab-msgtx separated by space.
      ENDIF.
    endform.
      FORM CHECK_Sub_contract                                            *
    form check_sub_contract.
      check not tab-msgnr = '1'. "no need to go further if already rejected
      if tab-kunnr is initial.
        if ( tab-usafl = 'T' )
          or ( tab-usafl = 'S' ).
          TAB-MSGNR = '1'.
          concatenate 'Cust number should not be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        endif.
      else.
        if ( tab-usafl <> 'T' )
          and ( tab-usafl <> 'S' ).
          TAB-MSGNR = '1'.
          concatenate 'Cust. number should be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        endif.
      endif.
    endform.
      FORM CHECK_DATA_ON_t001k                                           *
    form check_data_on_t001k.
      check not tab-msgnr = '1'. "no need to go further if already rejected
      select single * from t001k  "Valuation area
        where bwkey = tab-werks.  "plant
      if sy-subrc = 0.
        tab-bukrs = t001k-bukrs.  "company code
      else.
        TAB-MSGNR = '1'.
        concatenate 'Company code not found for plant'
                    tab-werks '(T001K)'
          into tab-msgtx separated by space.
      endif.
    endform.
      FORM POST_GOODS_ISSUE                                              *
    form post_goods_issue.
      perform UPDATE_GI_FOR_COST_CTR.
    clear FI_DOC_TEXT.
    FI_DOC_TEXT+0(35) = tab-idnum.
    write: tab-menge to FI_DOC_TEXT+35(15) right-justified.
    write: / '**', tab-matdoc, '**'.
    endform.
      FORM MAIN_UPDATE                                                   *
    FORM MAIN_UPDATE.
    data: current_lock_matnr like mara-matnr.
    *>>1104
    sort tab by post_seq_RAND ascending.
    *>>1104
    Direction: I=Issue, R=Reverse
    Do reverse first since it will increase invenotry
      sort tab by direction  descending "R first, then I
                  werks      ascending
                  matnr      ascending. "Sort by plant and then material
      if p_nor = 'X'. "new posting first step
    read the first record into the last flag to avoid problem when
    processing the 1st record
        loop at tab where msgnr <> '1'. "skip the rejected records
          last_matnr = tab-matnr.
          last_direction = tab-direction.
          last_werks = tab-werks.
          exit.
        endloop.
      loop at tab where msgnr <> '1'. "skip the rejected records
        if ( tab-werks <> last_werks )
          or ( tab-matnr <&

    Yes I had solved this

  • Temporarily Increase Customer credit limit for va01

    Hi,
    My requirement is we want increase credit limit for customers for 1 or 2 days in temporarily basic or va01 order release purpose .
    I maintained customer wise temporary credit & valid from and to dates in a z-table. How to solve this problem without using credit management FD32.
    regards,
    moon.

    Your requirement to increase Credit LImit of Customer for 1 - 2 days based on a Z-Table is not possible in SAP Standard. Also you dont want to use FD32.
    Now in OVA8, Under Checks you have three Boxes for User 1, 2, & 3. There are the Enchancement Points give by SAP for you to implement your Z-Requirment in Credit Management.
    You Requirement will have to be mapped in a Z-Development, speak to your ABAPer & he can write a code in User Exit which will refer your Z-Table & do the needful.
    Hope this helps,
    Thanks,
    Jignesh Mehta

  • Error while validating Business Rule (Error Cause: nativeGetNewTLA Rule)

    Hi, I am receiving an error while validating business rules
    An error occurred in: Rule:HypLive.Plan1.Product Interest
    A validation error was received from the Planning server 'http://abc:8300/HyperionPlanning/servlet/HspAppManagerServlet?appname=HypLive'.
    'Error:
    Error Cause: nativeGetNewTLA Rule HypLive.Plan1.Product Interest'.

    Are you able to validate the rule in EAS (or Calc Manager)?
    Normally nativeGetNewTLA Rule is followed by out of memory errors like java.lang.OutOfMemoryError,
    Increase the heap size to 1024, re start Planning and try validating it again.
    Cheers..!!

Maybe you are looking for

  • Order number, order type combination is unique.

    Dear All, I am getting the following error, while creating a Sales Order: Order number, order type combination is unique. Order number generated by the sequence for this order type already exists. Please contact your System Administrator. Is this a p

  • Allocation table for consignment PO

    Friends,   We are creating allocation table . When doing the follow on document, We want to create PO with consignment Item category. What are the settings to accompolish this. Article is created with consignment control 1 and source of suppy D Consi

  • IDOC Analysis

    HelloGurus, I have list of about 500 failed Idocs in staus "51" failed. Obviously the Data(e.x Material, plant would be available in the segments of these IDOCS . My question is Are there in tables through which we can get below information a)Idocs n

  • File read write affect my execution speed..

    Hi friends,               I am facing one problem regarding excel tab file.thats i have one instrument its generates the 100 data in one minute which data is needed to log in Excel tab file.  In this case i need to display the serial no of each data,

  • Reader store payment problem:(

    Hi, I am from Turkey and I bought my reader from USA but unfortunately I cannot buy any books from reader store because my credit card address and number belongs to Turkey and in order to be able to buy I should use an American card and address. It i