I need an urgent help for  Xquery tranformation failed on OSB.

I have made an xq then imported it into my proxyService, but when I call my proxyService I get the following error.
here is the response of my proxyService call.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>BEA-382513: ALSB Replace action failed updating variable "body": Error parsing XML: {err}XP0006: "element {http://schemas.xmlsoap.org/soap/envelope/}Body { {http://www.w3.org/2004/07/xpath-datatypes}untypedAny }": bad value for type element {http://skat.dk/begrebsmodel/2009/01/15/}EFIBetalingOrdningMisligholdt_I { {http://www.w3.org/2001/XMLSchema}anyType }</faultstring>
<detail>
<con:fault xmlns:con="http://www.bea.com/wli/sb/context">
<con:errorCode>BEA-382513</con:errorCode>
<con:reason>ALSB Replace action failed updating variable "body": Error parsing XML: {err}XP0006: "element {http://schemas.xmlsoap.org/soap/envelope/}Body { {http://www.w3.org/2004/07/xpath-datatypes}untypedAny }": bad value for type element {http://skat.dk/begrebsmodel/2009/01/15/}EFIBetalingOrdningMisligholdt_I { {http://www.w3.org/2001/XMLSchema}anyType }</con:reason>
<con:location>
<con:node>RouteNode1</con:node>
<con:path>request-pipeline</con:path>
</con:location>
</con:fault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

are you replacing the body-tag instead the first child of the body, in your case EFIBetalingOrdningMisligholdt_I
first do a test like
in your xquery return something like
<EFIBetalingOrdningMisligholdt_I></EFIBetalingOrdningMisligholdt_I>
in your proxy service do something like
replace ./* in body with ....your xquery call result
and see if this works
i think your replacing content at the wrong 'level'

Similar Messages

  • Kindly advice me, I have iphone 5s and I forgot the log-in password (passcode), I tried to open it but my phone give 60 min. to let me try after I fail for first one. I dont sync. with icloud or itunes. Please I NEED YOUR URGENT HELP!!

    Kindly advice me, I have iphone 5s and I forgot the log-in password (passcode), I tried to open it but my phone give 60 min. to let me try after I fail for the first one. I dont sync. with icloud or itunes. Please I NEED YOUR URGENT HELP!! MY IPHONE IS STILL STUCK.

    I can't, look at this image

  • How to convert PO sapscript layout to pdf - need VERY URGENT Help

    Dear All,
    Requirement: PO sapscript layout after some modifications (say, ZMEDRUCK) has to be converted to pdf. Through me9f user will be able to give ranges of PO numbers and can view the print preview for the po. After that on clicking the print button we get the printout of the pos one after another based on the user input of PO numbers.
    Our requirement is that when the user will click on the "Print Preview" of po (rather than pressing the print button) it i.e. PO sapscript layout has to get converted to pdf.
    If you have already encountered this scenario, could you please send me the source code regarding this at the earliest. If you want to email it to my personal id, please let me know so that I can give it to you. Thank you.
    It will be very beneficial for mine if you can send me some source code in this regard. (FYI. We want only “Print output” of PO sapscript. So, Print Program /SMB40/FM06P [after copying it to our ZSMB40/FM06P program] need to be modified for downloading the PO into PDF where there is no FMs like OPEN_FORM, WRITE_FORM, CLOSE_FORM. So already available source code in SAP forums can not help me.)). Kindly help me at the earliest. It’s VERY URGENT…
    Thank you.
    Thanks & Regards
    Sudipta

    Hi Chaith,
    Could you please provide me the source code regarding this at the earliest.
    We want only “Print output” of PO sapscript. So we need to modify only the Print Program SAPFM06P after copying it to ZSAPFM06P for downloading of modified PO (ZMEDRUCK) sapscript layout into PDF.
    I am already having some source code from sdn portral. I am attaching it herewith. But it's not working as some constants and variable values need to be given. We want to take download of PO into PDF from ME9F transaction itself.
    Could you please provide necessary values in the missing constants and variables and kindly resend the corrected modified Source code to me so that I can run the same code to  download the modified PO ZMEDRUCK into PDF . Need YOUR URGENT HELP...
    DATA: l_druvo LIKE t166k-druvo,
            l_nast  LIKE nast,
            aux_nast LIKE nast,
            l_from_memory,
            l_doc   TYPE meein_purchase_doc_print,
            ent_screen TYPE c,
            ent_retco TYPE i,
            toa_dara TYPE toa_dara,
            arc_params LIKE arc_params,
            aux_form LIKE tnapr-fonam.
      DATA: otf LIKE itcoo OCCURS 0 WITH HEADER LINE,
            lt_docs      TYPE TABLE OF docs,
            pdf_bytecount TYPE i,
            nom_archivo TYPE string.
      aux_form = 'ZMEDRUCK'.
      l_from_memory = c_true.
      SELECT *
        FROM nast
        INTO aux_nast
        UP TO 1 ROWS
        WHERE kappl = c_po     " Purchase Order
        AND   objky = t_datos-ebeln
        AND   aktiv = space
        ORDER BY erdat DESCENDING eruhr DESCENDING.
      ENDSELECT.
      aux_nast-sort1 = c_swp.
      CLEAR ent_screen.
      CLEAR ent_retco.
      IF aux_nast-aende EQ space.
        l_druvo = c_1.
      ELSE.
        l_druvo = c_2.
      ENDIF.
    l_druvo = '2'.
      CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
        EXPORTING
          ix_nast        = aux_nast
          ix_screen      = ent_screen
        IMPORTING
          ex_retco       = ent_retco
          ex_nast        = l_nast
          doc            = l_doc
        CHANGING
          cx_druvo       = l_druvo
          cx_from_memory = l_from_memory.
      CHECK ent_retco EQ 0.
      CALL FUNCTION 'ECP_PRINT_PO'
        EXPORTING
          ix_nast        = l_nast
          ix_druvo       = l_druvo
          doc            = l_doc
          ix_screen      = ent_screen
          ix_from_memory = l_from_memory
          ix_toa_dara    = toa_dara
          ix_arc_params  = arc_params
          ix_fonam       = aux_form                            
        IMPORTING
          ex_retco       = ent_retco.
      CLEAR otf.
      CALL FUNCTION 'READ_OTF_FROM_MEMORY'
        EXPORTING
          memory_key   = l_nast-objky  " PO Number
        TABLES
          otf          = otf
        EXCEPTIONS
          memory_empty = 1
          OTHERS       = 2.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize           = pdf_bytecount
        TABLES
          otf                    = otf
          doctab_archive         = lt_docs
          lines                  = pdfout
        EXCEPTIONS
          err_conv_not_possible  = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
      CONCATENATE c_dest t_datos-ebeln c_ext INTO nom_archivo.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize = pdf_bytecount
          filename     = nom_archivo
          filetype     = c_bin
        IMPORTING
          filelength   = pdf_bytecount
        TABLES
          data_tab     = pdfout.

  • Need urgently help for OBIEE Installation (11g)

    Hi all,
    I am having problems trying to install Oracle Business Intelligence 11g on Windows 7.
    The Installation Wizard hangs on the step: Domain Configuration (0%). The Creating Domain shows In progress.
    The log under the Inventory directory shows me only following:
    INFO: Ending the inventory Session
    INFO: Using an existing InstallAreaControl for this Inventory Session with existing access level 1
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    I really don't know what to do. I am searching for a solution on Internet, but I don't find it.
    I need urgently help. I would appreciate someone could help me.
    We can do together via Webex or something similar. It doesnt worth it for me to type here and wait till someone give me an answer (if any), trying to find out how I did.
    I hope to find the help I need. I am desperated :-(

    Can I install the OBIEE 10g version?I am not sure but i think OBIEE is not certified with windows 7. i could not find any MOS doc confirming same. Please log a call with oracle to confirm this.
    would it work fine with the Oracle Database 11g and the RCUs?. Yes OBIEE 10g will work with oracle database 11g.
    Thanks,
    JD

  • No more connections available to this remote computer...Urgent Help for File server...

    Hi Guys,
    I need urgent help regards to our school File server which is having "No more connection to this remote computer error"
    on SMB Shares where I usually authenticate with a domain username it used to work fine since till 3 weeks ago.
    Now I can browse the SMB shares with only IP... Netbios gets straight away this error message from non-domain joined pc's where the computer needs to connect to the SCCM distribution point on this file server.
    Strangely, Domain joined pc's does not have this problem at all they can use Netbios or IP no problem at all. But someone from a standalone laptop or desktop who needs to access shares through netbios gets this message.
    Can someone help me please?
    I did check DNS yet there is no problem on DNS I checked PTR record for the server to make sure it is not turned in to multihome accidently but nothing at all.
    I also did a NETMON where I captured the data from server and the client I get these errors:
    205 4:54:35 PM 16/12/2013
    7.3299179 10.2.1.96
    10.2.0.13 TCP
    TCP:Flags=......S., SrcPort=49312, DstPort=Microsoft-DS(445), PayloadLen=0, Seq=1771710719, Ack=0, Win=8192 ( Negotiating scale factor 0x2 ) = 8192
    {TCP:22, IPv4:21}
    206 4:54:35 PM 16/12/2013
    7.3299668 10.2.0.13
    10.2.1.96 TCP
    TCP:Flags=...A..S., SrcPort=Microsoft-DS(445), DstPort=49312, PayloadLen=0, Seq=2167618331, Ack=1771710720, Win=8192 ( Negotiated scale factor 0x8 ) = 2097152
    {TCP:22, IPv4:21}
    207 4:54:35 PM 16/12/2013
    7.3301468 10.2.1.96
    10.2.0.13 TCP
    TCP:Flags=...A...., SrcPort=49312, DstPort=Microsoft-DS(445), PayloadLen=0, Seq=1771710720, Ack=2167618332, Win=16425 (scale factor 0x2) = 65700
    {TCP:22, IPv4:21}
    208 4:54:35 PM 16/12/2013
    7.3301468 10.2.1.96
    10.2.0.13 SMB
    SMB:C; Negotiate, Dialect = PC NETWORK PROGRAM 1.0, LANMAN1.0, Windows for Workgroups 3.1a, LM1.2X002, LANMAN2.1, NT LM 0.12, SMB 2.002, SMB 2.???
    {SMBOverTCP:23, TCP:22, IPv4:21}
    209 4:54:35 PM 16/12/2013
    7.3307974 10.2.0.13
    10.2.1.96 SMB2
    SMB2:R   NEGOTIATE (0x0), GUID={8447F237-5219-D48A-40C0-29092450C68E}
    {SMBOverTCP:23, TCP:22, IPv4:21}
    210 4:54:35 PM 16/12/2013
    7.3314064 10.2.1.96
    10.2.0.13 SMB2
    SMB2:C   SESSION SETUP (0x1) {SMBOverTCP:23, TCP:22, IPv4:21}
    211 4:54:35 PM 16/12/2013
    7.3318815 10.2.0.13
    10.2.1.96 SMB2
    SMB2:R  - NT Status: System - Error, Code = (22) STATUS_MORE_PROCESSING_REQUIRED  SESSION SETUP (0x1), SessionFlags=0x0
    {SMBOverTCP:23, TCP:22, IPv4:21}
    212 4:54:35 PM 16/12/2013
    7.3324012 10.2.1.96
    10.2.0.13 SMB2
    SMB2:C   SESSION SETUP (0x1) {SMBOverTCP:23, TCP:22, IPv4:21}
    215 4:54:35 PM 16/12/2013
    7.3339977 10.2.0.13
    10.2.1.96 SMB2
    SMB2:R  - NT Status: System - Error, Code = (109) STATUS_LOGON_FAILURE  SESSION SETUP (0x1)  
    {SMBOverTCP:23, TCP:22, IPv4:21}
    216 4:54:35 PM 16/12/2013
    7.3341805 10.2.1.96
    10.2.0.13 TCP
    TCP:Flags=...A.R.., SrcPort=49312, DstPort=Microsoft-DS(445), PayloadLen=0, Seq=1771711788, Ack=2167619070, Win=0 (scale factor 0x2) = 0
    {TCP:22, IPv4:21}
    217 4:54:35 PM 16/12/2013
    7.3357089 10.2.1.96
    10.2.0.13 TCP
    TCP:Flags=......S., SrcPort=49313, DstPort=Microsoft-DS(445), PayloadLen=0, Seq=2943201172, Ack=0, Win=8192 ( Negotiating scale factor 0x2 ) = 8192
    {TCP:27, IPv4:21}
    218 4:54:35 PM 16/12/2013
    7.3357422 10.2.0.13
    10.2.1.96 TCP
    TCP:Flags=...A..S., SrcPort=Microsoft-DS(445), DstPort=49313, PayloadLen=0, Seq=3718656547, Ack=2943201173, Win=8192 ( Negotiated scale factor 0x8 ) = 2097152
    {TCP:27, IPv4:21}
    219 4:54:35 PM 16/12/2013
    7.3359768 10.2.1.96
    10.2.0.13 TCP
    TCP:Flags=...A...., SrcPort=49313, DstPort=Microsoft-DS(445), PayloadLen=0, Seq=2943201173, Ack=3718656548, Win=16425 (scale factor 0x2) = 65700
    {TCP:27, IPv4:21}
    220 4:54:35 PM 16/12/2013
    7.3359768 10.2.1.96
    10.2.0.13 SMB2
    SMB2:C   NEGOTIATE (0x0), GUID={8213462D-2600-D1B1-11E3-65FC4BCDE707}
    {SMBOverTCP:28, TCP:27, IPv4:21}
    221 4:54:35 PM 16/12/2013
    7.3364173 10.2.0.13
    10.2.1.96 SMB2
    SMB2:R   NEGOTIATE (0x0), GUID={8447F237-5219-D48A-40C0-29092450C68E}
    {SMBOverTCP:28, TCP:27, IPv4:21}
    222 4:54:35 PM 16/12/2013
    7.3369702 10.2.1.96
    10.2.0.13 SMB2
    SMB2:C   SESSION SETUP (0x1) {SMBOverTCP:28, TCP:27, IPv4:21}
    223 4:54:35 PM 16/12/2013
    7.3373474 10.2.0.13
    10.2.1.96 SMB2
    SMB2:R  - NT Status: System - Error, Code = (22) STATUS_MORE_PROCESSING_REQUIRED  SESSION SETUP (0x1), SessionFlags=0x0
    {SMBOverTCP:28, TCP:27, IPv4:21}
    224 4:54:35 PM 16/12/2013
    7.3377060 10.2.1.96
    10.2.0.13 SMB2
    SMB2:C   SESSION SETUP (0x1) {SMBOverTCP:28, TCP:27, IPv4:21}
    227 4:54:35 PM 16/12/2013
    7.3390552 10.2.0.13
    10.2.1.96 SMB2
    SMB2:R  - NT Status: System - Error, Code = (109) STATUS_LOGON_FAILURE  SESSION SETUP (0x1)  
    {SMBOverTCP:28, TCP:27, IPv4:21}
    Regards,
    Gokhan

    Solution has been found, 
    After doing bit of a backtrack, site DC's were out of sync with PDC with time.
    Also Time service was shutdown on PDC which has been enabled and pointed to the Australian pool ntp IP address.
    Everything is back on track now.
    Regards,
    Gokhan Cil

  • IN NEED OF URGENT HELP

    My mac's battery recently died. I went on to use it with the charger on at all times. Recently, the charger became a bit broken and then when I nudged it, the mac turned off. When I tried to turn it on again, there was a kernel panic. So as usual, I restarted it, but this time, there was a progress bar underneath the apple logo. I'm panicking, until now my mac still doesn't start up. HELP PLEASE

    OK, so there's no Amazon in Australia, but I'm sure that there are a number of Mac-centric hardware suppliers? You need to go shopping for a hard drive from one of those online (or brick-and-mortar) shops. For hard drives, I like HGST (made by Hitachi). You may want to get a drive larger than your current drive since internal drives are pretty cheap right now. I would suggest shopping for an HGST that is at least 500GB and that offers a 7100rpm speed rather than 5400rpm (which is likely what you have now).
    Because your disk is damaged, there's really no way for you to backup your data now. Which is why you'll want to buy a USB enclosure for it (here's one that I have four of - look for something similar - anywhere from $10-20 USD). The reason that you're going to want the enclosure is to try to rescue SOME data from it - when you get your new drive installed and a system installed on it, you should try to plug the old drive in the enclosure up to your machine and see if it will even mount - if it does, you can just copy the data over: if it doesn't, you'll need something such as DiskWarrior - $100 USD but it's the only thing I know of that can even attempt to rescue data from a damaged drive.
    Google some Australian websites for "HGST 7200rpm" and the size that you need. You're going to want a 2.5" x 9.5mm form factor.
    Call back when you find something....
    Clinton

  • Need PP Functional help for some legacy fields

    Hi all,
    I am a BW consultant. I need to replicate in SAP-BW some reports that are currently in a legacy system (non SAP). I have identified the functional area for those reports as PP. I need a little functional help from you guys to find out what some fields in the legacy system mean in SAP. Once I know the R/3 fields (and source tables if someone can tell me), I can move forward with mapping those fields into BW objects and the rest of the process.
    The reason why I am seeking help from here is, unfortunately our functional team is not available right now and their availability is indefinite. So I just want to keep myself busy till they are back.
    Well, here are the fields that I need help for (for now)
    The report is for Daily summary of activities at a plant
    Work order process
    Work order type
    Daily Created Bags
    Daily Capacity Bags (Bags per Hour Rate* Available Hours)
    Daily Count of Work Order Number
    Goods issued for work order completion
    Goods finished
    Please help me identify what R/3 fields (and their tables) correspond to the above legacy fields
    Points WILL be assigned for helpful answers
    Thank you

    Hi,
    Work order process - I assume this is the set of operations for the order - AFVC (table)
    Work order type      - AUFK - (Field) AUART data needs to be fetched for AUFNR(Work order number)
    Daily Created Bags - MSEG - data needs to be fetched for BWART = 101 or 102 and AUFNR(Work order number)
    Goods issued for work order completion - MSEG- data needs to be fetched for  BWART = 261 and AUFNR(Work order number)
    Goods finished - MSEG - data needs to be fetched for BWART = 101 or 102 and AUFNR(Work order number)
    Regards,
    Prasobh

  • Needed urgent help for user creation in security manager in ODI 11g

    Hi Gurus,
    I have an urgent requirement in ODI security manager and i am completely helpless. We need specific steps for the user creation with sufficient priviledges. The detailed requirements are:
    1. There is a group of users under the framework team and these users should be able to edit the Knowledge modules only. All other objects (e.g. projects, interface, procedures or development related objects) should only be in read only mode for them.
    2. There is a group of users under the development team. The priviledges of these users should be mutually exclusive to that of the framework team users. i.e. the development team should be able to edit or delete all development related objects (e.g. projects, interface, proc etc.) but the knowledge modules should only be in read only mode for them.
    Now I will explain what i have tried out:
    I am working on ODI 11.1.1.5.
    I have created a user with NG DESIGNER and CONNECT profile. Dragged and dropped all the projects on the user and selected all methods in all repositories (check sign). However when i connect with that user i cannot open the KMs (as far as development team is concerned its fine) but i can also not open interfaces as well as procedures (which is not acceptable from development point of view).
    Also when i tried creating a user from the framework team point of view i could not see any option related to KMs (To give edit priviledge).
    Please help me out guys. I have also searched oracle documentation and believe me the security manager section is not very good. If you guys can help me out with specific steps it would be great (I have tried the hints given in oracle documentation and they dont work, the ODI security manager behaves strangely :-(
    Thanks in advance,
    SB

    Similar requirement here guys. Any pointers. I was able to achieve this by restricting development user from supervisor access. In that case the development user can not edit the interfaces. Any known defefct?

  • Need urgent Help for Kernel upgrade......

    Hi Gurus,
    I have recently upgraded SAP kernel from  Release 6.40 Patch 109 to Release 6.40 Patch 175. My System is SAP ERP Central Component 5.0 and Release is 6.40 and Kernel Stataus is showing below details:
    Kernel release    640
    Compilation       SunOS 5.8 G
    Patch Level       175
    ABAP Load         1521
    CUA load          16
    Mode              opt
    ~
    I have total 8 Application servers. today I have genereated EWA report and in that report, for SAP kernel section it has reported that <b>"You are running different SAP kernel releases on your instances. This situation may lead to severe problems and is not supported by SAP.
    Recommendation: Use only one kernel release for all instances."</b>
    Actaully I have updated kernel in my central instance (/sapmnt/<SID>/exe) and this directory is NFS mount in all the application server. So I am not sure why the SAP EWA is repoting this that you are running difference SAP Kerenl release.
    If this is correct then how to rectify it ? what action I need to take to resolve this ?
    Appreciate your help.
    Thanks & Regards
    Basis

    I will plan to do that as early as possible. Even I
    am going to write to SAP to release that note in
    english for better understanding.
    yes - that note should be translated giving the importance.
    My question is: Am I on HIGH ALERT for this issue ?
    Since it is production server, will it going to
    affect my system in any aspect ??
    No, you will just see a slightly higher usage of "nfsd" when you start the application servers for the first time since they will all copy parts of the kernel locally.
    2nd thing, This is applicable only to NW ? Because I
    have upgraded SAP Kernel to Patch 175 to other R/3
    system having more application server, but I didn't
    get this comment in my EWA report ?
    The comment isn´t related to to usage of sapcpe. The comment means, that you have at least one application server, that uses local binaries with a different patchlevel instead of those on the central instance. I would consider that more critical. Maybe you installed one of the servers later and used a newer installation CD set which creates that new structure for using sapcpe by default... don´t know, just a guess. To check, go to SM51 and select each server and press on "Release Information", you will see which one is affected.
    This week I am planning to upgrade kernel for 4.6D
    release to Patch 2307. Will this be gona issue for
    that also ?
    Kernels lower than 6.10 use a different approach (the "ctrun directory" mentioned in that note) - technically it´s the same. The installation guides for 4.6c should tell you how to set that up.
    Markus

  • I need urgent help for the logic

    hi all,
    Initially, the requirement was to create PO regardless the Purchase Requisition based on the formula
    If (Open Qty + Current Stock) < Safety Stock ==>> THEN A PO NEEDS TO BE CREATED
    This is absolutely fine, this created the PO as per the above condition.
    OUR REQUIREMENT
    Modify the same program to create PO's only if there is any PR for that material . Meaning, turn all the PR's into PO. Also, when creating PO, the delivery date should be = (Current date - 7 days) when creating a PO for an PR(I think the table name is VETVG.)  Nothing else. We need to change the  IF condition in the following code .
    so can any one let me that what modification i need to do ie what logic i should use to get the requirement fullfilled.
    *Report  Z_STO_SAFETY_STOCK                                            *
    Program Name : Z_STO_SAFETY_STOCK                                    *
    Date         : 09.03.2007                                            *
    Programmer   : Rajdeep Kumar
    Last Change  : Van Tran                22/03/2007                    *
    Specification:                                                       *
    Program Type : Report                                                *
    Description  : Create STO requirement for Plant
    Transaction  : None                                                  *
    Input Files  : None                                                  *
    Output Files : None                                                  *
    Scheduling Issues :                                                  *
    Run Frequency :                                                      *
    Mod#    Date          By            Description                      *
    New   09.03.2007   Rajdeep Kumar     Created                         *
                       DEVK905890                                        *
    M01   20.03.2007   Rajdeep Kumar     Material Group Added to         *
                       DEVK905892        Selection Screen                *
    *Update 05.04.2007   DEVK906082        Added two new selection         *
                                         fields beskz and sobsl          *
                                         and is select statement         *
    REPORT  z_sto_safety_stock NO STANDARD PAGE HEADING.
    *&                       TABLES
    TABLES:
            t001w,
          marc.                                               " M01
            marc,                                               " M01
            mara.                                               " M01
    *&                     DATA DECLARATION
    DATA: BEGIN OF it_marc OCCURS 0,
            matnr LIKE marc-matnr,
            werks LIKE marc-werks,
            eisbe LIKE marc-eisbe,
          bstmi LIKE marc-bstmi,
            bstrf LIKE marc-bstrf,
            beskz LIKE marc-beskz,
            sobsl LIKE marc-sobsl,
          END OF it_marc.
    DATA: BEGIN OF it_mard OCCURS 0,
            matnr LIKE mard-matnr,
            werks LIKE mard-werks,
            labst LIKE mard-labst,
          END OF it_mard.
    DATA: BEGIN OF it_po OCCURS 0,
            ebeln LIKE ekko-ebeln,
            werks LIKE ekpo-werks,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            matnr LIKE ekpo-matnr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF it_po.
    DATA: BEGIN OF it_po_2 OCCURS 0,
            matnr LIKE ekpo-matnr,
            werks LIKE ekpo-werks,
            ebeln LIKE ekko-ebeln,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF it_po_2.
    DATA: BEGIN OF it_po_pend OCCURS 0,
            matnr LIKE ekpo-matnr,
            werks LIKE ekpo-werks,
            pendi LIKE eket-menge,
          END OF it_po_pend.
    DATA: BEGIN OF wa_join OCCURS 0,
            ebeln LIKE ekko-ebeln,
            werks LIKE ekpo-werks,
            ebelp LIKE ekpo-ebelp,
            loekz LIKE ekpo-loekz,
            etenr LIKE eket-etenr,
            matnr LIKE ekpo-matnr,
            menge LIKE eket-menge,
            wemng LIKE eket-wemng,
          END OF wa_join.
    DATA : BEGIN OF itab_marc_mard OCCURS 0,
             werks  LIKE marc-werks,
             matnr  LIKE marc-matnr,
             eisbe  LIKE marc-eisbe,
           bstmi  LIKE marc-bstmi,
             bstrf  LIKE marc-bstrf,
             beskz  LIKE marc-beskz,
             sobsl  LIKE marc-sobsl,
             labst  LIKE mard-labst,
             menge  LIKE ekpo-menge,
             ordqty LIKE ekpo-menge,
           END OF itab_marc_mard.
    DATA: BEGIN OF it_sto OCCURS 0,
          werks LIKE mard-werks,
          matnr LIKE mard-matnr,
          orqty LIKE ekpo-menge,
          eisbe LIKE marc-eisbe,
        bstmi LIKE marc-bstmi,
          bstrf LIKE marc-bstrf,
          beskz LIKE marc-beskz,
          sobsl LIKE marc-sobsl,
          labst LIKE mard-labst,
          pendi LIKE eket-menge,
          END OF it_sto.
    DATA: ws_poheader            LIKE   bapimepoheader.
    DATA: ws_poheaderx           LIKE   bapimepoheaderx .
    DATA: ws_ebeln               TYPE   mepoheader-ebeln.
    DATA: ws_posnr               LIKE   ekpo-ebelp.
    DATA: ws_etenr               LIKE   eket-etenr VALUE '0001'.
    DATA: ws_purchaseorder       LIKE   ekko-ebeln.
    DATA: ws_flg1                TYPE   c. " VALUE 'X'.
    DATA: ws_flg2                TYPE   c.
    DATA: ws_flg3                TYPE   c.
    *-- For Handling Error Messages in BAPI
    DATA: tbl_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    *-- For Item Details
    DATA: tbl_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
    DATA: tbl_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
    DATA: tbl_posched LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
    DATA: tbl_poschedx LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
    *&                       CONSTANTS
    CONSTANTS:   ws_flg            TYPE   c   VALUE 'X'.
    CONSTANTS:   c_unistruct(2)    TYPE   c   VALUE 'Z3'. "For UNISTRUCT STO
    *&                      SELECTION-SCREEN
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_werks FOR t001w-werks,
                  s_matnr FOR marc-matnr.                     " M01
                    s_matnr FOR marc-matnr,                     " M01
                    s_matkl FOR mara-matkl,                     " M01
                    s_beskz FOR marc-beskz,
                    s_sobsl FOR marc-sobsl.
    PARAMETERS:     p_test  TYPE check.
    SELECTION-SCREEN : END OF BLOCK b1.
    *&                      START OF SELECTION EVENT
    START-OF-SELECTION.
    Get the Safety Stock & Minimum Lot Size for the materials
      PERFORM get_plant_data.
    Get the Quantities in stock
      PERFORM get_stock_data.
    Determine the open quantities for the materials concerned
    [EKKO, EKET, EKPO]
      PERFORM get_open_quantities.
    PERFORM open_quantities.
    Determine overall the quantities required for each material
      PERFORM determine_mat_qty_required.
    Print the details
      PERFORM print_details.
      IF p_test EQ space.
      PO is created for each plant.
      Create the PO required.
        PERFORM create_po.
      Create the PO's for each plant with the materials required
       PERFORM create_header_item.
      Bapi call to create a Purchase order
       PERFORM create_purhase_order.
      ENDIF.
    END-OF-SELECTION.
    TOP-OF-PAGE.
      PERFORM print_header.
    *&      Form  get_plant_data
          To get the Safety Stock
    -->  p1        text
    <--  p2        text
    FORM get_plant_data .
    start                                                     " M01
    SELECT      matnr werks eisbe bstmi
    INTO TABLE  it_marc
    FROM        marc
    WHERE       matnr IN s_matnr AND
                werks IN s_werks AND
                eisbe GT 0.
    end                                                       " M01
    start                                                     " M01
      SELECT      marc~matnr werks eisbe bstrf beskz sobsl
                                                              " bstmi
      INTO TABLE  it_marc
      FROM        marc AS marc
      INNER JOIN  mara AS mara
      ON          maramatnr EQ marcmatnr
      WHERE       marc~matnr IN s_matnr AND
                  werks      IN s_werks AND
                  matkl      IN s_matkl AND
                  beskz      IN s_beskz AND
                  sobsl      IN s_sobsl AND
                  eisbe      GT 0.
    end                                                       " M01
    ENDFORM.                    " get_plant_data
    *&      Form  get_stock_data
         To get the Current Stock
    -->  p1        text
    <--  p2        text
    FORM get_stock_data .
      DATA: BEGIN OF lt_mard OCCURS 0,
              matnr LIKE mard-matnr,
              werks LIKE mard-werks,
              lgort LIKE mard-lgort,
              labst LIKE mard-labst,
            END OF lt_mard.
      CHECK NOT it_marc[] IS INITIAL.
      SELECT      matnr werks lgort labst
      INTO TABLE  lt_mard
      FROM        mard
      FOR         ALL ENTRIES IN it_marc
      WHERE       matnr EQ it_marc-matnr AND
                  werks EQ it_marc-werks.
      SORT lt_mard BY matnr werks.
      LOOP AT lt_mard.
        AT NEW werks.
          it_mard-matnr = lt_mard-matnr.
          it_mard-werks = lt_mard-werks.
        ENDAT.
        it_mard-labst = it_mard-labst + lt_mard-labst.
        AT END OF werks.
          APPEND it_mard.
          CLEAR  it_mard.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_stock_data
    *&      Form  open_quantities
          text
    -->  p1        text
    <--  p2        text
    FORM open_quantities .
    Storing MARC and MARD data in an internal table to find the open
    quantities
      LOOP AT it_marc.
        itab_marc_mard-matnr = it_marc-matnr.
        itab_marc_mard-werks = it_marc-werks.
        itab_marc_mard-eisbe = it_marc-eisbe.
      itab_marc_mard-bstmi = it_marc-bstmi.
        itab_marc_mard-bstrf = it_marc-bstrf.
        itab_marc_mard-beskz = it_marc-beskz.
        itab_marc_mard-sobsl = it_marc-sobsl.
        READ TABLE it_mard WITH KEY matnr = it_marc-matnr.
        IF sy-subrc EQ 0.
          itab_marc_mard-labst = it_mard-labst.
        ENDIF.
        APPEND itab_marc_mard.
        CLEAR itab_marc_mard.
      ENDLOOP.
      CHECK NOT itab_marc_mard[] IS INITIAL.
    Join EKKO EKPO
      SELECT a~ebeln
             b~ebelp
             b~werks
             b~matnr
             b~menge
             c~etenr
             c~wamng
             INTO CORRESPONDING FIELDS OF TABLE it_po
      FROM ekpo AS b
      INNER JOIN ekko AS a
      ON aebeln = bebeln
      INNER JOIN eket AS c
      ON bebeln = cebeln AND bebelp = cebelp
      FOR ALL ENTRIES IN itab_marc_mard
      WHERE b~matnr = itab_marc_mard-matnr AND
            b~werks IN s_werks .
      DATA : t_menge TYPE ekpo-menge . "local variable
    *Store the contents of it_po to the work area to get the minimum order
    *quantity
      wa_join[] = it_po[].
      LOOP AT it_po.
    delete the entries where MENGE = WAMNG
        DELETE it_po WHERE menge = it_po-wemng.
        LOOP AT wa_join WHERE matnr = it_po-matnr
                               AND werks = it_po-werks.
          t_menge = t_menge + wa_join-menge.
        ENDLOOP.
        it_po-menge = t_menge.
        MODIFY TABLE it_po TRANSPORTING menge.
        CLEAR  :t_menge.
      ENDLOOP.
    Once you get the quantities delete the repeating materials for the
    plant.
      DELETE ADJACENT DUPLICATES FROM it_po COMPARING werks matnr.
      SORT it_po BY matnr.
      LOOP AT itab_marc_mard.
        READ TABLE it_po WITH KEY matnr = itab_marc_mard-matnr
            APPEND it_sto.
        ELSE.
          WRITE:/ 'There are no open quantities to create Purchase order'.
        ENDIF.
        CLEAR it_sto.
      ENDLOOP.                         werks = itab_marc_mard-werks BINARY
    SEARCH.
        itab_marc_mard-ordqty = itab_marc_mard-labst + it_po-menge .
         If Open quantiy + Current Stock < Safety Stock
        IF itab_marc_mard-ordqty LE itab_marc_mard-eisbe.
         Minimum order qty = Safety Stock - (Open qty + current stock)
          itab_marc_mard-ordqty = itab_marc_mard-eisbe - ( it_po-menge +
    itab_marc_mard-labst )  .
           Move all the contents to the internal table it_sto ie Plant,
    Material and the Min Order Qty
           so that we can create PO based on this internal table
          it_sto-matnr = itab_marc_mard-matnr.
          it_sto-werks = itab_marc_mard-werks.
          it_sto-orqty = itab_marc_mard-ordqty.
    ENDFORM.                    " open_quantities
    *&      Form  CREATE_HEADER_ITEM
          text
    FORM create_header_item.
      LOOP AT it_sto.
    *--- Document date with flag
        ws_poheader-doc_date             = sy-datum.
        ws_poheaderx-doc_date            = ws_flg.
    *--- Document type with flag
        ws_poheader-doc_type             = 'Z3'(c01).
        ws_poheaderx-doc_type            = ws_flg.
    *--- Purchasing group with Flag
        ws_poheader-pur_group            = '005'.   " hardcoded
        ws_poheaderx-pur_group           =  ws_flg.
    *--- Purchasing Organization with flag
        ws_poheader-purch_org            = '2000'.
        ws_poheaderx-purch_org           = ws_flg.
    *--- Supply plant with flag
        ws_poheader-suppl_plnt           = '2000'.
        ws_poheaderx-suppl_plnt          = ws_flg.
    *--- Company Code with flag
        ws_poheader-comp_code            = '2000'.
        ws_poheaderx-comp_code           = ws_flg.
    *<--- assinging new item No.
        ws_posnr = ws_posnr + 10.
    *POPULATE ITEM DATA.
        tbl_poitem-po_item                 = ws_posnr.
        tbl_poitem-material                = it_sto-matnr.
        tbl_poitem-item_cat                = 'U'(c02).
        tbl_poitem-plant                   = it_sto-werks.
        tbl_poitem-quantity                = it_sto-orqty.
        APPEND tbl_poitem.
        CLEAR  tbl_poitem.
    *POPULATE ITEM FLAG TABLE
        tbl_poitemx-po_item                = ws_posnr.
        tbl_poitemx-po_itemx               = ws_flg.
        tbl_poitemx-material               = ws_flg.
        tbl_poitemx-plant                  = ws_flg.
        tbl_poitemx-item_cat               = ws_flg.
        tbl_poitemx-quantity               = ws_flg.
        APPEND tbl_poitemx.
        CLEAR  tbl_poitemx.
      ENDLOOP.
    ENDFORM.                    "CREATE_PO
    *&      Form
          text
    -->  p1        text
    <--  p2        text
    FORM create_purhase_order .
      CLEAR:  tbl_poitem,
              tbl_poitemx,
              ws_poheader,
              ws_poheaderx.
      REFRESH:  tbl_poitem,
                tbl_poitemx.
      CLEAR  : tbl_return.
      REFRESH: tbl_return.
    *<--- Bapi to create Purchase order
      IF NOT tbl_poitem[] IS INITIAL.
        CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            poheader         = ws_poheader
            poheaderx        = ws_poheaderx
          IMPORTING
            exppurchaseorder = ws_purchaseorder
          TABLES
            return           = tbl_return
            poitem           = tbl_poitem
            poitemx          = tbl_poitemx.
        READ TABLE tbl_return WITH KEY type = 'E'.
    *<--- Bapi to commit the changes
        IF sy-subrc <> 0.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
        ENDIF.
      ENDIF.
      LOOP AT tbl_return.
    *<--- Ignore the warning messages
        IF tbl_return-type = 'W'.
          CONTINUE.
        ENDIF.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        IF tbl_return-type = 'S'.
          FORMAT COLOR COL_POSITIVE ON.
        ELSEIF tbl_return-type = 'W'.
          FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
        ELSEIF tbl_return-type = 'E'.
          FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
        ENDIF.
        WRITE:/3 tbl_return-type,12 tbl_return-id,20(85)  tbl_return-message
               86(10) tbl_return-field,95(20) tbl_return-system.
        FORMAT COLOR OFF.
      ENDLOOP.
    ENDFORM.                    " create_purhase_order
    *&      Form  get_open_quantities
          text
    -->  p1        text
    <--  p2        text
    FORM get_open_quantities .
      CHECK NOT it_mard[] IS INITIAL.
      SELECT      ekkoebeln ekpoebelp ekpowerks ekpomatnr
                  ekpomenge eketetenr eket~wemng
                  INTO CORRESPONDING FIELDS OF TABLE it_po
      FROM        ekko AS ekko
      INNER JOIN  ekpo AS ekpo
      ON          ekpoebeln EQ ekkoebeln
      INNER JOIN  eket AS eket
      ON          eketebeln EQ ekpoebeln AND
                  eketebelp EQ ekpoebelp
      FOR         ALL ENTRIES IN it_mard
      WHERE       ekko~bstyp EQ 'F'             AND
                  ekko~bsart EQ 'Z3'            AND
                  ekko~bsakz EQ 'T'             AND
                  ekko~loekz EQ space           AND
                  ekpo~matnr EQ it_mard-matnr   AND
                  ekpo~werks EQ it_mard-werks   AND
                  ekpo~loekz EQ space           AND
                  ekpo~elikz EQ space.
      SORT it_po BY ebeln ebelp etenr.
    delete entries where the schedule is complete, else copy to new table
      LOOP AT it_po.
        IF it_po-wemng GE it_po-menge.
          DELETE it_po.
        ELSE.
          MOVE-CORRESPONDING it_po TO it_po_2.
          APPEND it_po_2.
          CLEAR  it_po_2.
        ENDIF.
      ENDLOOP.
      SORT it_po_2 BY matnr werks.
    To determine the pending quantities of the materials at plant level
      LOOP AT it_po_2.
        AT NEW werks.
          it_po_pend-matnr = it_po_2-matnr.
          it_po_pend-werks = it_po_2-werks.
        ENDAT.
        it_po_pend-pendi = it_po_pend-pendi + it_po_2-menge - it_po_2-wemng.
        AT END OF werks.
          APPEND it_po_pend.
          CLEAR  it_po_pend.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_open_quantities
    *&      Form  determine_mat_qty_required
          text
    -->  p1        text
    <--  p2        text
    FORM determine_mat_qty_required .
      DATA: lv_eisbe LIKE marc-eisbe,
            lv_labst LIKE mard-labst,
            lv_menge LIKE eket-menge,
          lv_bstmi_old LIKE marc-bstmi,
            lv_bstrf_old LIKE marc-bstrf,
            lv_beskz_old LIKE marc-beskz,
            lv_sobsl_old LIKE marc-sobsl,
            lv_pendi LIKE eket-menge,
            lv_total_conf     LIKE ekpo-menge,
          lv_bstmi          LIKE marc-bstmi,
          lv_min_qty        LIKE marc-bstmi,
            lv_bstrf          LIKE marc-bstrf,
            lv_min_qty        LIKE marc-bstrf,
            lv_qty_req        LIKE mard-labst,
            lv_remainder      TYPE i.
      LOOP AT it_marc.
      safety stock
        lv_eisbe = it_marc-eisbe.
       lv_bstmi_old = it_marc-bstmi.
         lv_bstrf_old = it_marc-bstrf.
         lv_beskz_old = it_marc-beskz.
         lv_sobsl_old = it_marc-beskz.
        READ TABLE it_mard
        WITH KEY matnr = it_marc-matnr
                 werks = it_marc-werks
                 BINARY SEARCH.
        IF sy-subrc EQ 0.
        qty onhand
          lv_labst = it_mard-labst.
        ELSE.
          CLEAR lv_labst.
        ENDIF.
        READ TABLE it_po_pend
        WITH KEY matnr = it_marc-matnr
                 werks = it_marc-werks
                 BINARY SEARCH.
        IF sy-subrc EQ 0.
        PO pending qty
          lv_pendi = it_po_pend-pendi.
        ELSE.
          CLEAR lv_pendi.
        ENDIF.
      Total qty on hand & PO qty pending
        lv_total_conf = lv_labst + lv_pendi.
      Now determine if a PO is required for the material concerned.
        IF lv_total_conf < lv_eisbe.
          it_sto-matnr = it_marc-matnr.
          it_sto-werks = it_marc-werks.
          it_sto-eisbe = lv_eisbe.
        it_sto-bstmi = lv_bstmi_old.
          it_sto-bstrf = lv_bstrf_old.
          it_sto-beskz = lv_beskz_old.
          it_sto-sobsl = lv_sobsl_old.
          it_sto-labst = lv_labst.
          it_sto-pendi = lv_pendi.
        Actual Qty Required
          lv_qty_req = lv_eisbe - lv_total_conf.
         IF it_marc-bstmi IS INITIAL.
           IF it_marc-bstrf IS INITIAL.
            it_sto-orqty = lv_qty_req.
          ELSE.
           lv_bstmi = it_marc-bstmi.
           lv_min_qty = it_marc-bstmi.
             lv_bstrf = it_marc-bstrf.
             lv_min_qty = it_marc-bstrf.
            DO.
              IF lv_qty_req <= lv_min_qty.
                lv_qty_req = lv_min_qty.
                it_sto-orqty = lv_qty_req.
                EXIT.
              ELSE.
               lv_min_qty = lv_min_qty + lv_bstmi.
                 lv_min_qty = lv_min_qty + lv_bstrf.
              ENDIF.
            ENDDO.
          ENDIF.
          APPEND it_sto.
          CLEAR  it_sto.
        ENDIF.
      ENDLOOP.
      SORT it_sto BY werks matnr.
    ENDFORM.                    " determine_mat_qty_required
    *&      Form  print_details
          text
    -->  p1        text
    <--  p2        text
    FORM print_details .
      LOOP AT it_sto.
        WRITE:/ it_sto-werks UNDER text-h01,
                it_sto-matnr UNDER text-h02,
                it_sto-orqty UNDER text-h03,
                it_sto-eisbe UNDER text-h04,
              it_sto-bstmi UNDER text-h05,
                it_sto-bstrf UNDER text-h05,
                it_sto-labst UNDER text-h06,
                it_sto-pendi UNDER text-h07.
      ENDLOOP.
    ENDFORM.                    " print_details
    *&      Form  print_header
          text
    -->  p1        text
    <--  p2        text
    FORM print_header .
      WRITE:  AT 001 text-h01,
                 015 text-h02,
               030 text-h03,
               050 text-h04,
               070 text-h05,
               090 text-h06,
               110 text-h07.
                 030 text-h03 RIGHT-JUSTIFIED,
                 050 text-h04 RIGHT-JUSTIFIED,
                 070 text-h05 RIGHT-JUSTIFIED,
                 090 text-h06 RIGHT-JUSTIFIED,
                 110 text-h07 RIGHT-JUSTIFIED.
      NEW-LINE.
    ENDFORM.                    " print_header
    *&      Form  create_po
          text
    -->  p1        text
    <--  p2        text
    FORM create_po .
    *-Document date with flag
      ws_poheader-doc_date             = sy-datum.
      ws_poheaderx-doc_date            = ws_flg.
    *-Document type with flag
      ws_poheader-doc_type             = 'Z3'(c01).
      ws_poheaderx-doc_type            = ws_flg.
    *-Purchasing group with Flag
      ws_poheader-pur_group            = '005'.   " hardcoded
      ws_poheaderx-pur_group           =  ws_flg.
    *-Purchasing Organization with flag
      ws_poheader-purch_org            = '2000'.
      ws_poheaderx-purch_org           = ws_flg.
    *-Supply plant with flag
      ws_poheader-suppl_plnt           = '2000'.
      ws_poheaderx-suppl_plnt          = ws_flg.
    *-Company Code with flag
      ws_poheader-comp_code            = '2000'.
      ws_poheaderx-comp_code           = ws_flg.
      LOOP AT it_sto.
        AT NEW werks.
          CLEAR  tbl_poitem.
          CLEAR  tbl_poitemx.
          CLEAR  tbl_return.
          CLEAR  tbl_posched.
          CLEAR  tbl_poschedx.
          REFRESH tbl_poitem.
          REFRESH tbl_poitemx.
          REFRESH tbl_return.
          REFRESH tbl_posched.
          REFRESH tbl_poschedx.
          CLEAR ws_posnr.
        ENDAT.
        ws_posnr = ws_posnr + 10.
      Item Data
        tbl_poitem-po_item                 = ws_posnr.
        tbl_poitem-material                = it_sto-matnr.
        tbl_poitem-item_cat                = 'U'(c02).
        tbl_poitem-plant                   = it_sto-werks.
        tbl_poitem-quantity                = it_sto-orqty.
        APPEND tbl_poitem.
        CLEAR  tbl_poitem.
      Item X Data
        tbl_poitemx-po_item                = ws_posnr.
        tbl_poitemx-po_itemx               = ws_flg.
        tbl_poitemx-material               = ws_flg.
        tbl_poitemx-plant                  = ws_flg.
        tbl_poitemx-item_cat               = ws_flg.
        tbl_poitemx-quantity               = ws_flg.
        APPEND tbl_poitemx.
        CLEAR  tbl_poitemx.
      Schedule Data
        tbl_posched-po_item = ws_posnr.
        tbl_posched-sched_line = '0001'.
        tbl_posched-delivery_date = sy-datum.
        tbl_posched-quantity = it_sto-orqty.
        APPEND tbl_posched.
        CLEAR  tbl_posched.
      Schedule Data X
        tbl_poschedx-po_item = ws_posnr.
        tbl_poschedx-po_itemx = ws_flg.
        tbl_poschedx-sched_line = '0001'.
        tbl_poschedx-sched_linex = ws_flg.
        tbl_poschedx-delivery_date = ws_flg.
        tbl_poschedx-quantity = ws_flg.
        APPEND tbl_poschedx.
        CLEAR  tbl_poschedx.
        AT END OF werks.
        Create the PO
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader         = ws_poheader
              poheaderx        = ws_poheaderx
            IMPORTING
              exppurchaseorder = ws_purchaseorder
            TABLES
              return           = tbl_return
              poitem           = tbl_poitem
              poitemx          = tbl_poitemx
              poschedule       = tbl_posched
              poschedulex      = tbl_poschedx.
          LOOP AT tbl_return WHERE type EQ 'E' OR type EQ 'A'.
            EXIT.
          ENDLOOP.
        If Loop is false - then no error occurred
          IF sy-subrc NE 0.
          No Errors - Commit
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = 'X'.
          ENDIF.
          SKIP.
          LOOP AT tbl_return.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
            IF tbl_return-type = 'E' OR tbl_return-type = 'A'.
              FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
            ELSEIF tbl_return-type = 'W'.
              FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
            ELSE.
              FORMAT COLOR COL_POSITIVE ON.
            ENDIF.
            WRITE:/3 tbl_return-type,12 tbl_return-id,20(85)
    tbl_return-message,
                   86(10) tbl_return-field,95(20) tbl_return-system.
            FORMAT COLOR OFF.
          ENDLOOP.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " create_po

    Hi,
    first you can store these 2 dates into some internal table sat it_sobid  and it_ObjectID.Now
    sort  it_sobid ascending.
    loop at  it_ObjectID.
    Read date from  it_sobid  binary search index sy-index.
    it_ObjectID-date =  it_sobid-date.
    flag = 'y'.
    endloop.
    you can write some logic like this. Its just a rough idea you can modify according to ur need.
    Regards,
    Ravi

  • Urgent need of your help for multiple JTables Print from a single JPanel

    I need your help to print multiple table content from JPanel
    JTables are generated dynamically in a JPanel or JPanels. I need to take print as it is in JPanel

    Alternatively you could write a simple class to print JTables with a series of calls to paintString( myString), and various calls to fillRect(...) tfor asthetics. It is quite simple. I currently use such a class that I wrote in under 200 lines of code that has a very professional look, and the print jobs are less than half the size of printing the JTable directly.
    The idea being that it takes a JTable as a parameter ( and maybe other params to control color, style, font, etc... ). It would have one primary method, print() which actually handles the printing, It may also uses other methods to control the look of the application.
    A problem I have faced with printing a JTable directly is ensuring that the botom row on each page and the top row on every page after the first one lines up correctly. After a while it was simply easier, and more customizable, to write my own print class.
    AC

  • Need urgent help for solving issue with my audio output.

    It seems that all of sudden my integrated speakers started to make buzzing sound for a minute of a sec. and the sound comes randomly only during playback.  Same thing also happens even on headphone. So any suggestions? Why it is happening?? 

    Hi
    Try to update the driver from hp.com website for Audio & Bios.
    Last step is to run a recovery on the unit before this please back up your data as it will be lost.
    If still does not work speaker on the unit has gone bad needs to be replaced.
    If your notebook is still under warranty, contact HP and arrange to have the speaker replaced.
    Let us know how it goes!
    *Although I am an HP employee, I am speaking for myself and not for HP.
    ****Click the White Kudos star to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    Regards
    Manjunath
    Let us know how it goes!
    "I work for HP."
    ****Click the (purple thumbs up icon in the lower right corner of a post) to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    Regards
    Manjunath

  • Need urgent Help for setting up iCal Server

    I will move the iCal portion here, maybe I will get some help.
    Okay first my setup:
    Two XServe with the latest 10.5 (one is the backup)
    Six Mac Pros with Leopard
    Three Macbook Pros with Snow Leopard
    All Macs are on an Windows 2003 Active Directory network. Also we have our accounts locally (on each workstation and laptop).
    *So I have installed the advanced settings for the Server OS.
    *Created a account for every user on the server
    *The FTP, Web (for the local webpage), Open Directory and iCal services are on. (iCal would only activate with Open Directory service??)
    *The iCal server destination (for the calendars) are on a separate drive with +Ignore Permissions+
    Still can not link a account through iCal with the server!
    Could somebody give me a walkthrough how to setup the iCal server?
    Oh yeah another issue I had I can't get the calendaring checkbox in the user account to stick! Is this just a bug?

    Hi Umesh,
    I would not use the repository on a database that was cloned. In my experience this leads to problems.
    A better way is to clone the database and then create a new repository on the clone:
    1. export the repository on the windows server to an mdl file
    2. unregister all target users on solaris
    3. drop the repository on solarais
    4. create a new repository on solaris
    5. Import the data from the mdl file you exported in step 1
    6. register target users
    7. configure and register the locations
    This way requires some manual work, but I do not see another way.
    Regards,
    Carsten.

  • Need urgent help for (Message file sp1 lang .msb not found)

    sir
    c:\oracle9i this is my database folder name
    c:\oraform this is my form folder name
    which one my oracle_home name
    sir i test this command
    c:\ set ORACLE_HOME=c:\ORACLE9I
    c:\ set ORACLE_SID=AAMIR
    c:\ sqlplus / as sysdba
    AND RUN SQL PLUS THEN SYSTEM GIVE ME THIS ERROR
    incorrect environment variable plus_dflt program execution error
    please give me idea how i run my system
    thank

    Duplicate post:
    ''Urgent'' incorrect environment variable plus_dflt program execution erro

  • Need very urgent help

    Hi every1,
    i am in a very bad situation as i am very new to AS3, so i
    need some help from any one who can help me out of this.
    I have created a FLV Player using FLVPlayback Component
    everything is working fine but the only problem is the rewind and
    forward button behaves very strange when i test it on web page
    residing in a webserver.
    In brief i want to say that the rewind and forward control in
    the application works alright when i play it in my local machine
    but when i take the file to a web sever and play it the controls
    behave very strange (when i click on the forward and rewind button
    it just takes me to the end of the movie and to the start of the
    movie at one shot which should not be the purpose of the rewind and
    forward button).
    So, somebody please look at my code below and i will be very
    thank full to the person who can send me the correct code.
    The code for the rewind and forward control is higlighted in
    the below code. please help... .very urgent..........
    import fl.video.*;
    var flvSou:String;
    var dynText:String;
    myflv.autoPlay = true;
    onscreen_play_btn.visible = false;
    onscreen_replay_btn.visible = false;
    if (myflv.playing) {
    onscreen_play_btn.visible = false;
    onscreen_replay_btn.visible = false;
    //myflv.source = "Call_to_action.flv";
    myflv.source = root.loaderInfo.parameters.flvSou;
    dynTxt.text = String(root.loaderInfo.parameters.dynText);
    slash_txt.text = "/";
    myflv.playPauseButton = playPause_btn;
    myflv.stopButton = stop_btn;
    myflv.muteButton = mute_btn;
    myflv.volumeBar = volume_bar;
    myflv.volume = .6;
    myflv.forwardButton = forward_btn;
    myflv.backButton = back_btn;
    myflv.seekBar = seek_bar;
    myflv.bufferingBar = buffering_bar;
    myflv.fullScreenButton = fullscreen_btn;
    //========================= Actions for Button Controls
    =========================//
    //========================= Actions for Play and Pause Button
    =========================//
    playPause_btn.pause_mc.addEventListener(MouseEvent.CLICK,
    clickHandlerPause);
    function clickHandlerPause(event:MouseEvent):void {
    //trace("clickHandler detected an event of type: " +
    event.type);
    //trace("the event occurred on: " + event.target.name);
    trace("u clicked pause button");
    onscreen_play_btn.visible = true;
    //myflv.alpha = .5; // uncomment later
    playPause_btn.play_mc.addEventListener(MouseEvent.CLICK,
    clickHandlerPlay);
    function clickHandlerPlay(event:MouseEvent):void {
    //trace("clickHandler detected an event of type: " +
    event.type);
    //trace("the event occurred on: " + event.target.name);
    trace("u clicked play button");
    onscreen_play_btn.visible = false;
    //myflv.alpha = 100; // uncomment later
    if (onscreen_replay_btn.visible==true) {
    onscreen_replay_btn.visible=false;
    //========================= Actions for Play and Pause Button
    =========================//
    //========================= Actions for FLVPlayback
    =========================//
    myflv.addEventListener(MouseEvent.CLICK,
    clickHandlerPauseFlv);
    function clickHandlerPauseFlv(event:MouseEvent):void {
    //trace("clickHandler detected an event of type: " +
    event.type);
    //trace("the event occurred on: " + event.target.name);
    trace("u clicked video component button");
    trace(myflv.totalTime);
    if (myflv.playing==true) {
    myflv.pause();
    onscreen_play_btn.visible = true;
    //myflv.alpha = .5; // uncomment later
    } else {
    myflv.play();
    onscreen_play_btn.visible = false;
    onscreen_replay_btn.visible = false;
    //myflv.alpha = 100; // uncomment later
    //========================= Actions for FLVPlayback
    =========================//
    //========================= Actions for Fullscreen Button
    =========================//
    fullscreen_btn.addEventListener(MouseEvent.CLICK,onFullScreenButtonClick);
    function onFullScreenButtonClick(event:MouseEvent):void {
    stage.displayState = StageDisplayState.FULL_SCREEN;
    //or set it to normal like: stage.displayState =
    StageDisplayState.NORMAL;
    //========================= Actions for Fullscreen Button
    =========================//
    //========================= Actions for onScreenPlay Button
    =========================//
    onscreen_play_btn.addEventListener(MouseEvent.CLICK,onScreenPlayButtonClick);
    function onScreenPlayButtonClick(event:MouseEvent):void {
    trace("working");
    if (myflv.playing==true) {
    myflv.pause();
    } else {
    myflv.play();
    //myflv.alpha = 100; // uncomment later
    onscreen_play_btn.visible = false;
    //========================= Actions for onScreenPlay Button
    =========================//
    //========================= Actions for onScreenReplay Button
    =========================//
    onscreen_replay_btn.addEventListener(MouseEvent.CLICK,onScreenReplayButtonClick);
    function onScreenReplayButtonClick(event:MouseEvent):void {
    trace("working");
    myflv.play();
    //myflv.seek(0);
    onscreen_replay_btn.visible = false;
    if (onscreen_play_btn.visible==true) {
    onscreen_play_btn.visible=false;
    //========================= Actions for onScreenReplay Button
    =========================//
    //========================= Actions for Stop Button
    =========================//
    stop_btn.addEventListener(MouseEvent.CLICK, StopButtonClick);
    function StopButtonClick(event:MouseEvent):void {
    myflv.seek(0);
    //myflv.autoRewind = true;
    //myflv.stop();
    onscreen_replay_btn.visible = true;
    //========================= Actions for Stop Button
    =========================//
    //========================= Actions for Button Controls
    =========================//
    //========================= Actions for Displaying Elapsed
    and Total Time =========================//
    myflv.addEventListener(MetadataEvent.METADATA_RECEIVED,
    cp_listener);
    function cp_listener(eventObject:MetadataEvent):void {
    //trace("Elapsed time in seconds: " + myflv.playheadTime);
    //trace("Total time is: " + eventObject.info.duration);
    var rounded:int = Math.round(eventObject.info.duration);
    var minutes:int = Math.floor(rounded/60);
    var seconds:int = rounded%60;
    flvTotalTime_txt.text = eventObject.info.duration;
    flvTotalTime_txt.text = (minutes<10 ? "0" :
    "")+minutes+":"+(seconds<10 ? "0" : "")+seconds;
    //flvElapsedTime_txt.text = String(myflv.playheadTime);
    stage.addEventListener(Event.ENTER_FRAME, updateTime);
    function updateTime(ev:Event):void {
    var rounded:int = Math.round(myflv.playheadTime);
    var minutes:int = Math.floor(rounded/60);
    var seconds:int = rounded%60;
    flvElapsedTime_txt.text = String(myflv.playheadTime);
    flvElapsedTime_txt.text = (minutes<10 ? "0" :
    "")+minutes+":"+(seconds<10 ? "0" : "")+seconds;
    //========================= Actions for Displaying Elapsed
    and Total Time =========================//
    myflv.addEventListener(Event.COMPLETE, com_listener);
    function com_listener(eventObject:Event):void {
    trace("movie complete");
    myflv.stop();
    onscreen_replay_btn.visible = true;
    back_btn.addEventListener(MouseEvent.CLICK, BackButtonClick);
    function BackButtonClick(event:MouseEvent):void {
    myflv.play();
    //myflv.autoRewind = true;
    //myflv.stop();
    onscreen_replay_btn.visible = false;
    /************************************ THE CODE FOR FORWARD
    AND REWIND CONTROL STARTS HERE *****************************/
    var id1:Number;
    forward_btn.addEventListener(MouseEvent.MOUSE_DOWN,
    ForwardButtonDown);
    function ForwardButtonDown(event:MouseEvent):void {
    //forward_btn.onPress = function() {
    //mklik_flv.pause();
    var dest1:Number = myflv.playheadTime;
    id1 = setInterval(function ():void {
    myflv.seek(dest1 += 2);
    }, 100);
    forward_btn.addEventListener(MouseEvent.MOUSE_UP,
    ForwardButtonUp);
    function ForwardButtonUp(event:MouseEvent):void {
    //forward_btn.onRelease = function() {
    //myflv.play();
    clearInterval(id1);
    // ************************ Forward Button Function
    // ************************ Rewind Button Function
    var id2:Number;
    back_btn.addEventListener(MouseEvent.MOUSE_DOWN,
    BackButtonDown);
    function BackButtonDown(event:MouseEvent):void {
    //back_btn.onPress = function() {
    //mklik_flv.pause();
    var dest2:Number = myflv.playheadTime;
    id2 = setInterval(function ():void {
    myflv.seek(dest2 -= 2);
    }, 100);
    back_btn.addEventListener(MouseEvent.MOUSE_UP, BackButtonUp);
    function BackButtonUp(event:MouseEvent) {
    //back_btn.onRelease = function() {
    //mklik_flv.play();
    clearInterval(id2);
    }

    how long is your flv (in seconds), if allowed to play without
    ff/rewind/pause?

Maybe you are looking for