Workflow identification in Sales Order Exit

Hi,
In my Sales order exit, under some conditions Iam raising an error message, when the order is being created in background this order will move to workflow. Now if any one process this order through the workflow i want to allow the order to get posted with out raising my exception.
   So I would like to know how I can identify whether my order is being posted through the workflow or directly, in the Sales order exit code.
Thanks in advance friends,
Anvitha.

Hi friends,
Thanks for your response.
Checking whether the order is posted in Background or foreground doesn't solve my problem, because my order may be posted in Background or foreground. But when the order is processed through workflow, the processing option depends on the configuration of the Workflow object type. So SY-BATCH doesn't serve my purpose.
   Coming to using SY-UNAME, I observed that the value during the Order process through Workflow is the UserID who process it. So i can't distinguish it.
Friends, any one had any other option to identify whether the order is being posted through Workflow.
please help me out.
Regards,
Anvitha.

Similar Messages

  • Insert code in prgram to check sales order exits in your own program

    Hi Experts
    I want to insert a coding in IDOC , can anyone write in abap coding and show .....The program is to check if sales order for category PSTYV ( CATEGORY ) for items ...
    if found set flag true else set flag false...
    Eg
    clear flag
    insert code
    to check s/o for ZTAC item found
    if found
    set flag = true
    else
    set flag = false
    So how can I write a a code in ABAP
    Thanks in advanced
    Piroz

    Hi Fracis
    Thanks for your advice I did in this way ,  Is there any correction required
    form look_sap_saleord  using    p_in_string
                                    p_material_in          " Material No exits
                                    p_site_in              " plant
                           changing p_out_saleord_e        " sales order
                                    p_out_material_e       " Mat No
                                    p_out_order_e          " Prod Order
                                    p_out_wemng_e          " QTY goods received for order item
                                    p_out_psmng_e.         " Ordered Qty Item
      data: lva_prodord like afpo-aufnr,   " Production Order
            lva_prodmat like afpo-matnr,   " Material Number
            lva_saleord like vbkd-vbeln,   " Sales Order
            lva_pstyv   like vbap-pstyv,   " Category
            lva_wemng   like afpo-wemng,   " Quantity of goods received for the order item
            lva_psmng   like afpo-psmng,   " Ordered Qty Item
            lva_count   type i.            " counter validation
    CHECK FOR SALES ORDER IN VBAP IF EXITS
    GO TO DELIVERES
    ELSE CHECK REQUIRED PRODUCTION ORDER
           ihrez_e Ship to party
    check single if the sales order exits
      select vbeln from vbkd into vbkd-vbeln
        where ihrez_e eq p_in_string.
      Is the sales order exits for ZTAN Category ?
        select vbeln from vbap into vbap-vbeln
          where vbeln eq vbkd-vbeln and
                werks eq p_site_in and
                matnr eq p_material_in and
                pstyv = 'ZTAN'.
        The sales order is for the specified plant.
          lva_saleord = vbap-vbeln.
          lva_prodmat = vbap-matnr.
          exit.
        endselect.
      when an order for this plant has been found.
        if not lva_saleord is initial.
        exit.
        endif.
      endselect.
      check not lva_saleord is initial.
      select count(*) into lva_count from vbap
        where vbeln = lva_saleord.
      if lva_count eq 1.
        select vbeln matnr aufnr pstyv
        into (lva_saleord, lva_prodmat, lva_prodord, lva_pstyv) from vbap
          where vbeln = lva_saleord and
                matnr = p_material_in and
                pstyv = 'ZTAN'.
          exit.
        endselect.
      else.
        select vbeln matnr aufnr pstyv
        into (lva_saleord, lva_prodmat, lva_prodord, lva_pstyv) from vbap
          where vbeln = lva_saleord
          and matnr   = p_material_in.
          exit.
        endselect.
      endif.
       move: lva_saleord to p_out_saleord_e,           " sales order
             lva_prodord to p_out_order_e,             " production order
             lva_prodmat to p_out_material_e,          " material no
             lva_psmng   to p_out_psmng_e,             " QTY Ordered
             lva_wemng   to p_out_wemng_e.             " Qty Received goods
            lva_wemng   to p_out_wemng_e.             " Quantity of goods received for the order item
    endform.                    " look_sap_sales ord
    Regards

  • Ignore Production order if sales order exits

    Hi Experts
    I want to check some validation for sales order , The system goes in this way  ...I have to modify in this way
    we are extracting the command orders from Command QC System and inserting into SAP . Once it is extracted the Interface coding was written.....to extract sales order, production order etc.,
    Now I want to check only those records in which category are ZTAN. because some time in our company they will sold pigments which does not contain production order directly it will check for qty and delivered to customer.
    Select * from VBAP where VBELN = 'SALES ORDER' and
             MATNR = 'Material nO' and
             PSTYV = 'ZTAN'
    This is because it should not check the production order in AFPO table it must directly go to create deliveries etc for that I created to check sales order ignoring production order So can anyone help me to modify the below coding to check only sales order bu
    SALES ORDER EXITS MODIFICATION****************
    *&      Form  find_sap_salord Exits
          Find an SAP production order for a material.
         -->P_IN_STRING    COMMAND order number
         -->P_MATERIAL_IN  Material number in
         -->P_SITE_IN      Material number in
         <--P_OUT_SALEORD  Sales order number
         <--P_OUT_MATERIAL Material number out
         <--P_OUT_ORDER    Production order number
    form look_sap_saleord  using    p_in_string         " 
                                    p_material_in       " Material No exits
                                    p_site_in           " plant
                           changing p_out_saleord       " sales order
                                    p_out_material      " Material No
                                    p_out_order         " Prod Order
                                    p_out_wemng         " Qty of Goods Rec for Order Item
                                    p_out_psmng.        " Ordered Qty Item
      data: lva_prodord like afpo-aufnr,   " Production Order
            lva_prodmat like afpo-matnr,   " Material Number
            lva_saleord like vbkd-vbeln,   " Sales Order
            lva_pstyv   like vbap-pstyv,   " Category
            lva_wemng   like afpo-wemng,   " Quantity of goods received for the order item
            lva_psmng   like afpo-psmng,   " Ordered Qty Item
            lva_count   type i.            " counter validation
           ihrez_e Ship to party       
      select vbeln from vbkd into vbkd-vbeln
       where ihrez_e eq p_in_string.
      select vbeln from vbap into vbap-vbeln
        where vbeln eq p_in_string.
      Is the order for the specified plant?
        select vbeln from vbap into vbap-vbeln
          where vbeln eq vbap-vbeln and
                matnr eq vbap-p_material_in and
                pstyv in ('ZTAN')
          and   werks eq p_site_in.
        The order is for the specified plant.
          lva_saleord = vbap-vbeln.
          exit.
        endselect.
      Exit when an order for this plant has been found.
        if not lva_saleord is initial.
          exit.
        endif.
      endselect.
      check not lva_saleord is initial.
      select count(*) into lva_count from afpo
        where kdauf = lva_saleord.
      if lva_count eq 1.
        select aufnr matnr wemng psmng
        into (lva_prodord, lva_prodmat, lva_wemng, lva_psmng) from afpo
          where kdauf = lva_saleord.
          exit.
        endselect.
      else.
        select aufnr matnr wemng psmng
        into (lva_prodord, lva_prodmat, lva_wemng, lva_psmng) from afpo
          where kdauf = lva_saleord
          and matnr   = p_material_in.
          exit.
        endselect.
      endif.
      move: lva_saleord to p_out_saleord,
            lva_prodord to p_out_order,
            lva_prodmat to p_out_material,
            lva_psmng   to p_out_psmng,
            lva_wemng   to p_out_wemng.
    endform.                    " find_sap_prodord
    END OF MODIFICATION 22/09/2008*******

    Thanks  thread close
    Piroz

  • Enable the approval workflow for the Sales Orders (Standard)

    Dear All,
    I need to enable the approval workflow for the Sales Orders (Standard). How can I do this? Please update
    The version of apps is 11i
    many thanks in advance...
    Edited by: santark on Oct 27, 2010 3:47 PM

    Dear All,
    I need to enable the approval workflow for the Sales Orders (Standard). How can I do this? Please update
    The version of apps is 11i
    many thanks in advance...
    Edited by: santark on Oct 27, 2010 3:47 PM

  • Check sales order exits for category ZTAC

    Hi Experts
    I have a requirement to modify the iDOC interfaced program,
    In the routien which checks for the existence of a production order, I have to modify the following
    1.  Inspect each item on the sales order
    2. If (and only if) there is atleast one item with a category of "ZTAC" then check for a production order otherwise processing the order in the usual manner.
    Could anyone tell me how to check (Is there a sales order) if no then display error message if yes then is there a production order if no display error message if yes Create confirmation .......................
    I want to know how to write a coding to check sales order exits from table VBAP,VBAK Etc., .
    Thanks in Advanced
    Regards
    Piroz

    Hi Prabhu
    Thanks for your email and response but I need to check this in program for IDOC ....Modification
    Insert code in this way
    check sales order for category = 'ZTAN' inspect for each item on sales order
    and if you found item with cateogry ZTAN then check for production order otherwise go asual manner
    I WANT TO WRITE A CODING HERE **********************
      if production order required then check
                    for each item on sales order item list
                          with item category = 'ZTAC' then
                                     return true
                                next
                                  end function
      VBAP TABLE field VBELN and PSTYV (ZTAC,ZTAN Etc)
    Eg of coding
    if lva_saleord is initial
            select single * from vbap into l_saleord
              where vbelv = lva_saleord
              and   vbeln = lva_vbeln and
              exit.
            endselect.
          endif.
    I want to write a small program in between to check the sales order exits if it is then I have to go to deliveries ...................
    Regards
    Eslam

  • New Workflow for returned sales order modified from updating the billin

    now i am creating Created Workflow for returned sales order modified from updating the billing block to the delivery block.tell me how to do this.ca n use here the control approval process.

    Thread locked.
    Beginner questions are very welcome, but your question makes it obvious that you didn't even bother looking at the help or searching on SDN.
    Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] on how to post a good question and make a little effort yourself before expecting people to give up their time to help you.

  • Calling a Sales Order Change BAPI in a Sales Order Exit

    Functional Requirement:
    While creating a Sales Order with Reference to another Sales Order, on saving the new sales order, change something in the referenced sales order.
    I am trying to achieve the same by doing the following:
    In the standard SAP user exit called during saving the new sales order USEREXIT_SAVE_DOCUMENT I am calling the BAPI BAPI_SALESORDER_CHANGE on the referenced Sales Order.
    However the BAPI is unable to change the other sales order giving an error Enter the document number. I am specifying the Document Number while calling the BAPI, so I know that is not the error.
    I just wish to know whether it is technically possible to call a BAPI to update another Sales Order while we are currently saving one Sales Order.

    Hi Girish,
    If it works correctly when run seperately and you are sure the data passed into the BAPI is exactly the same then it may be something like table locks or similar causing your original problems...
    What about packaging up your working Z program into a custom function module and calling that from within USEREXIT_SAVE_DOCUMENT as a seperate task (IN NEW TASK) and building in a slight delay of say 5 seconds at the start of your code?
    I'll be honest, this isn't an ideal solution but might be sufficient to resolve your issues.  I'd be inclined to see if you could just run your Z program as a background process every 5 minutes or so to capture any changes and perform updates but if this is a no no from your functional people I'm not sure what else to suggest sorry.  I've never personally had to update a document from within the save routine of another document so can't give any advice based on my own experiences sorry.
    Gareth.

  • Ordered Qty in Sales order exit USEREXIT_CHECK_VBAP is not working

    Hi All,
      In a requirement, I changed the ordered quantity in a Sales order in the exit USEREXIT_CHECK_VBAP to a desired quantity.For eg: Some one has entered a quantity 5 and pressed enter, my program logic in that exit changed that quantity to 10, after saving it get reflected in VBAP-KWMENG as 10, uptill this it fine.
      Now the problem is when I want to see the same saved Sales Order through VA02 its show me the previously entered qty as 5 not 10.
      Kindly let me know if there is anything am missing.
      Kindly help me out.
    Thanks
    Bhagat

    write your code in the below
          FORM USEREXIT_SAVE_DOCUMENT_PREPARE                           *     
          This userexit can be used for changes or checks, before a     *     
    FORM userexit_save_document_prepare.                                        
    ENDFORM.                    "USEREXIT_SAVE_DOCUMENT_PREPARE

  • Workflow trigger at Sales order Item level

    Hello all,
    Please let me know if it is possible to trigger a approval workflow when a quantity of an item is greater than certain amount, while creation of sales order. If yes, then what are steps involved.
    Thanks in advance,
    Sandesh

    Hi you can code it in routine USEREXIT_SAVE_DOCUMENT of program MV45AFZZ
    You can access your values of item table here,check whether the quantity is greater than the amount and if true then
    Call the work flow using function module SAP_WAPI_START_WORKFLOW

  • Workflow for blocked sales orders

    HI all,
    I have a requirement in sales in service order .
    when a credit check is done for a customer ,sales order will get blocked  and
    in the service order for the corresponding sales order will get a status with Not OK. To release the block on this we need to manualy change the status in VKM3 and subsequently in service order (IW32).
    My requirement is to do automatic change in the service order status when ever we do release the flag in VKM3.
    I think with work flow we can achieve this.
    Any standard functionality is supported using workflow for this requirement?
    Please help me how to proceed.
    Thank you all..

    Hi Ravi,
    Yes this is possible using workflow!
    I just simulated your scenario and there are no events when you release the sales order but the other good news is that there is a change doucment that is written. The field CMGST in the table VBUK gets updated with the value D which is "released by credit representative". Using this you can configure your own event.
    However to do this following are the steps you would have to follow:
    1. Copy the business object BUS2032 to ZBUS2032 through transaction SWO1.
    2. Add an event called as "Released" to this.
    3. Generate this new copied version of the BO
    4. Delegate the copied Business Object to BUS2032. You can do this in the initial screen of SWO1 by going to the menu "Settings->Delegate". This is the inverse of inheritance through which you will be adding the properties of the subtype(ZBUS2032) to the main type(BUS2032) at runtime
    5. Use transaction SWED and SWEC to configure your own event and raise it when the change document is written. Do remember that you will have to put an entry in the "Field restrictions" table in the transaction SWEC to trigger your own event when the Sales Order is released.
    6. In transaction SWEC you can put in the change document object as "VERKBELEG" derived from CDHDR table. The business object as BUS2032 and the new event you created in the subtype. Since you have delegated the same it will be available for use for the main type.
    7. In the field restrictions put in the table as VBUK and the field CMGST and the old value is * and the new value as D.
    8. Once you do this the event will be raised once you release the sales order.
    9. You can check the same through the event trace SWEL(Remember to swtich on the event trace through SWELS if it is off)
    10. Now you will have to write a function module to change the status of the service order using the OBJNR of the service order and table JEST or use the standard function module STATUS_CHANGE_EXTERN. <b><b>Please remember that you can change a User status because system statuses are changed by the system. However you can change the system status by updating the table but I guess that is not like how the system changes it. When the system itself changes the status then there might be certain follow on documents that are created.</b></b>
    12. Now you will have to encaspulate this FM in a method of the business object.
    13. You will have to use the ZBUS2032 to add your own method which calls this function module. Hope you have the reference to the service order from the sales order.
    14. Now have a task or a workflow which has a single step which inturn calls this method and trigger the workflow or the task using the event.
    That might solve the problem you have
    Best regards,
    Sudhi

  • Sales Order Exit For Item Texts

    Hello all,
    I am having a very wierd issue with sales orders.
    I am creating an exit to redeterming item category of line item via the item usage field.
    The item usage field is a user defined field on the "Additional Data B" in the Sales Order.
    In MV45AFZZ, I am able to set the item category after the item usage is entered.
    Now the Item text nodes in the "Texts" tab at line item level depend on the item category.
    Thus item category ABCD has text T1 T2 & T3 assigned to it
    while item category EFGH has text T1 & T5 Assigned.
    My issue is that when the item category is changed from ABCD to EFGH, if one goes to the "Texts" Tab at line item level, the nodes shown are the same as those for item category ABCD.
    I cant find any exit to redetermine the text sequence.
    I tried USEREXIT_MOVE_FIELD_TO_TVCOM_I & TVCOM_H but they dont seem to work.
    I would really be very grateful for any help/ideas on how to get this resolved.
    Many Thanks,
    Preet

    Hello,
    Actually I dont need to either rename the text or change the contents (please correct me if wrong).
    Basically if PSTYV (itm_cat) = ABCD then text id's
    0001      Desc1
    0002      Desc2
    0003      Desc3
    0004      Desc4
    are shown.
    If PSTYV = 'EFGH' then text id's
    ID Node    Description
    0001       Desc1
    0006       Desc6
    0008       Desc8
    are to be shown ( this is what I want ).
    However right now if I change Item category from ABCD to EFGH then the nodes on the "Text Tab are
    0001       Desc1
    0002       No Description Shown
    0003       No Description Shown
    0004       No Description Shown
    0006       Desc6
    0008       Desc8
    I cant get a screenshot which would probably explain it better.
    In short is there any way of not displaying specific test-id's in the long texts for line items.
    I realise its a Friday here but any help will be deeply ..deeply appreciated.
    Many Thanks,
    Preet

  • Workflow Requirement on sales order change

    Hi all,
    I have been assigned to a workflow object where if there is a change in sales order VA02 the mail should be send to external gmail id and SBWP ( sap inbox ). Now using tcode SWELS, i have captured business object that is BUS2032 and in that business object there is a event changed and method is also there. Now how should i proceed with this development ? Where i will have to have mention my workflow no that whenever any change in SO , the workflow get triggered? I have created node HTTP in SCOT tcode ...still mail is now going to gmail id,why is it so?
    Please help me out
    Thanks
    Parag

    Hi,
    Now how should i proceed with this development ?
    1) Goto SWDD, in the Basic Data > Start event, map the event for that BO
    2) In the workflow Create a 'Send Mail' Step' to send the external Mail
    First Understand the workflow and its concept from the [link1|https://wiki.sdn.sap.com/wiki/x/0qo] [link2|http://help.sap.com/printdocu/core/print46c/en/data/pdf/PSWFL/PSWFL.pdf] [link3|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0bbdb3c-d640-2a10-d3b2-e4d9b90536a6] & [Link4|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0cef150-e18d-2a10-e998-f16f7ec1cd9f], then build your workflow
    Where i will have to have mention my workflow no that whenever any change in
    SO , the workflow get triggered?
    Once you map the BO and Event in the, Basic Data > Start event, workflow will trigger automatically
    I have created node HTTP in SCOT tcode ...still mail is now going to gmail id,
    why is it so?
    Did you already created the workflow? If yes can you explain, where you facing the problem
    Regards,
    Surjith

  • Sale Order Exits

    *Hi Friends,*
    *Thanks in Advance.*
    *After saving my Sale Order... the system giving the Message 'Sale Order Saved' and remains in the Same Screen in a Refresh Mode.*
    *Actually my client requirement is .that they want to navigate to VA01 Transaction after saving the Sale Order.*
    *Is there any User Exit or any Customizing Work or any Enhancement or Enhancement Spot.*
    *Regards:*
    *Sridhar*

    Hey u can get an enhancement or an exit thats easy but with out any enhancement you can do this provided if you an add another requirement to this.One instance where it goes back to that screen when u make output as print immediately.If the client also has a requirement of printing a sales order immediately u can achieve this else you need to go through an enhancement.
    Pls let me know if i am clear

  • Sales order exit - changing pricing conditions

    Hi Gurus
        We have an issue where a customer was given $0 pricing on an item within their price list, but when an order is created, the system prices the item at List Price.   Upon investigation, it was discovered that SAP cannot maintain pricing at $0 because the item categories are looking for a net value. We decided that we would create a user exist that would change the item category on the items and price that item as u201Cfree of chargeu201D for these customers. We did work on the user exit u201Csave_document_prepareu201D and were able to change the item category in sales order screen but the pricing  conditions shows net values in that tab. The question here is how to update the pricing conditions when we change the item category for each item
    Thanks
    Ganesh

    Hi Ganesh,
    For this Goto the User-Exit MV45AFZZ & From there Goto FORM USEREXIT_MOVE_FIELD_TO_VBAP.
    Now here write your condition.
    The data(Pricing details) is available in XKOMV. and The Item is in VBAP...
    Now Check if the Item & Customer are same in a Simple If Condition.. If same the Clear XKOMV[]. Thats it..  
    It Clears Teh Pricing Conditions all to 0.
    If you still have Net value & Netprice,, Then Clear the NETWR & NETPR fields As well in Header(VBAK) & Item(VBAP) as well..
    Thanks & Regards,
    Dileep .C

  • Workflow fo returned sales order modified from updating the billing block t

    please tell me how to find returned sales order modified from updating the billing block to delivery block and how to create blocks here.i want to know updating means what is happening here.

    Thread locked.
    Beginner questions are very welcome, but your question makes it obvious that you didn't even bother looking at the help or searching on SDN.
    Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] on how to post a good question and make a little effort yourself before expecting people to give up their time to help you.

Maybe you are looking for

  • How do I simply replace a clip in this situation...

    I have a video clip in my timeline that has been trimed at head and tail. It has a couple of pieces of audio attached to it. I want to replace it with a newer version of the clip witout disrupting my timeline. None of the Replace options put it in th

  • Invoive booked amount for a Purchase Order  for a vendor

    how is Invoive booked amount for a Purchase Order against the respective vendor in available in tables

  • Could not resolve to a component implementation

    I'm using Flex Builder 2 Version 2.0.143459 (Geez, couldn't you just make it 2.0.144?) and I am running Eclipse version 3.2.1 and I have Flex Charting 2 installed also. Now, I downloaded the example for "dashboard" that has the various graphs, and wh

  • 10.3 still not available q10

    Hi, iam using unlocked BBQ10 in pakisan, the problem which iam facing is still no sign on 10.3 update on my phone i have tried the sim in and out procedure with mobile network switched off still no luck, i would like to know why and what is the reaso

  • Website program for mac

    Hello everybody, I'm looking for a program to make a website. I wanted to make it in flash, but I'm getting the idea that mac and flash hates each other. Are there any suggestions? I'm not at computer wiz, I'm not stupid, but lets pretend I am. An ea