Lookup selected batch in Sales Order on UDF field

Hi,
I have made an udf on sales order row level.
Now i want to see in that udf u_batch the selected batchnumber in de row in the sales order.
I use this query FMS but this is giving me a list , i want to see just the selected batch , after selecting it with CTRL-TAB in quantity field of SO.
this is my query:
SELECT T0.[DistNumber] FROM [dbo].[OBTN]  T0 INNER JOIN OITM T1 ON T0.ItemCode = $[$38.1.0]
THX
Mark
Edited by: M. Hageman on Jun 15, 2010 11:16 AM

You  can use this FS to get the batch(es) allocated to an order line:
Select  bb.DistNumber
FROM [dbo].[OITL]  l
INNER JOIN [dbo].[ITL1]  b ON b.LogEntry = l.LogEntry
inner join OBTN bb on b.MdAbsEntry=bb.AbsEntry
Where l.DocType=17 and l.DocEntry=$[ORDR.DocEntry] and l.DocLine=$[RDR1.LineNum]
BUT this works only after adding the order, because the allocation data is stored only then!

Similar Messages

  • Problem in importing Sales Order with udf in the rows

    Dear All,
    I am having problem in importing Sales Order with udf in the rows. I mean it is getting imported but the udf values in the rows is not getting updated. But the udf values in the header is getting updated. I am using SAP 8.8 Pl 10.
    Can anyone guide me what to do in this scenario?
    Regards,
    Gary

    So , Login to DTW .
    with the Desired Database and Login Credentials.
    Goto - > Templates - > Customized Templates
    Select The Object .
    Right Click on the object needed and choose Create Template for the Structure .
    Then use this template for import .
    Hope it helps
    Thanks
    Ashish Ranjan

  • Reserve Batch in Sales order

    Hi Friends,
    We have Automatic batch determination at delivery level and when i give some batch at Sales order level to reserve, syetem in not considering that and issuing the same batches in delivery at the time of automatic batch determination at delivery level.
    I want batch determination at delivery level but if any batch that is given at sales order level should get ignored at the time of Automatic batch determination at delivery.Can any one share your experience or add some information how to proceed with.
    Thanks & Have a nice day.
    Sree.Manam

    Hi,
    I am not sure what level of authorization is assigned to the users, who create the sales order. If they have authorization to use MSC2N -Change batch, then my first suggestion is, if no auto batch search strategy is used in sales order,
    1) Add a batch characteristic called "reservation status" which can have values 1) reserved for sales order and 2) not reserved. Once the user selects the batch in the sales order, the user then can change the batch status as reserved for sales order using MSC2N. Similarly in the batch search strategy you can have the same characteristics and the user can select the value not reserved for the characteristics "reservation status". This way the batches assigned in the sales orders can be kept away from getting selected in the delivery document.
    If the user does not have the authorization to use MSC2N and if the sales order also uses the same batch search strategy then my second suggestion is,
    2) To use the quantity proposal field in the batch search strategy type.
    You can develop and add a routine to check whether the batch selected is assigned to a order or not.
    If the batch is allocated to a sales order, then the auto determination proposal can leave that batch from the proposal.
    Regards,

  • Error when selecting batch during prod order creation

    Hi Gurus,
    When selecting batch for production orders components, an error prompted 'Invalid batch, does not match the selection criteria in batch determinat.'
    After checking, it is because the classification is not maintained. So I need to re-create in MSC2N.
    The question is, how/where should I change back the configurations on checking the batch classification during prod ord?
    Thank you.

    Kumar,
    Please let me know how many Component items are there in the BOM? Out of which how many are Phantom assembly?
    It looks like when the BOM is copied to the order it is crossing 9999 items.
    I would suggest you to use an intermediate order/material to reduce this number.
    I think there was an OSS notes for this to extend the number of character length for BOM items numbering (POSNR).
    Hope this helps...Reward your points,
    Regards,
    Prasobh

  • How to make a field in sales order a required field

    Hi,
    How do i make a certain field in sales order a required field. I want to make the assignment field in accounting tab a required field. How do i configure this.
    Thank you.
    Rachelle

    In you know the Transaction and screen Variant Configurations.
    Use T-code SHD0
    Put your Sales Order t-code There : Va01
    Then Select the feilds or tabs whatever you want as mandatory , optional.
    Customize as per your requirement and save the variant.
    Next GO to the Sales Document types :
    There In the Transaction flow you will find at variant feild.
    Assign this variant there.
    Next when ever you do sales Order for that Document type the feilds will be taken in the fashion of the variant.
    regards,
    SAP SD

  • Update Sales Order line item field

    Need to update a field mfrgr of VBAP table with some user defined values on selection screen parameter.
    I have selected all the Sales order line items in an internal table which need to be updated.
    How can I use the update command with set expression to do the same ? If yes how ? if no what is the best way to do the same.

    I am using the following command and it doesnt work as it says cannot use AND command.
              loop at it_vbfa.
                    UPDATE  VBAP
                    WHERE VBELN = it_vbfa-vbeln
                    and   posnr = it_vbfa-vbelv
                    SET MFRGR = P_MFRGR.
                    IF SY-SUBRC = '0'.
                       COMMIT WORK.
                    ENDIF.
              endloop.
    Any pointers ? What am I doing wrong.

  • Sales order CARRIER TEXT field

    Hi,
    I am creating query through SQVI, I would like to use sales order carrier text field with the query.please advice which table and field should I use for query ?
    Thanks in advance

    Sorry, by mistake I posted the message again.
    Pls ignore it.
    Hi JK,
    Where are u entering the sales order carrier data. Is it Header Data or Item Data. Is it a long text?
    Please give more details.
    Regards,
    Vinod

  • How to Generate sales orders with custom Fields using BAPI_BUSPROCESSND_CREATEMULTI

    Hi,
    I need to generate sales orders with custom fields on table CRMD_ORDERADM_H using BAPI_BUSPROCESSND_CREATEMULTI, after changing the structure BAPI_TE_CRMD_ORDERADM_H, and feed the  EXTENSIONIN table of the BAPI with data, the order is created, but any value on custom fields.
    After debuging, I saw that the BAPI search for structure conversion in table CRMC_OBJECTS_GEN, but we haven't entry with BAPI_TE_CRMD_ORDERADM_H in this table. is that the problem ?, Is there any way to fix it?
    Best Regards,
    Salah.

    That depends on where do you have the customer fields, check the table CRMD_CUSTOMER_H, if your custom fields are there, you need to use the changing parameter CUSTOMER_HEAD, I guess your already checked that one, right? but there's no custom fields, well...AET/EEWB doesn't enhance the strcuture of the BAPI, so you should do it manually, check the note following note for further details.
    988410 - FAQ: User-defined fields in the BAPI
    If you don't have access to the SAP Marketplace, in resume you should create an append on the structure BAPIBUS20001_CUSTOMER_H and include the following strcutrue CI_EEW_CUSTOMER_H
    Cheers!
    Luis

  • MRP Generated production orders greys out Sales Order and Customer fields

    Hi there,
    The MRP generated production orders greys out the Sales Order and Customer fields for some reasons. These fields are really important as they link the production order to the sales order and the customer's purchase order. Could the SAP team please fix this or advise alternative way of getting the sales order and customer info on production order? Thanks.

    Hello
    MRP only poulated this fields in case the material master has been set up with a strategy group hich is make to order (normally 20). Otherwise MRP summarizes all the requirements from different Customer orders and creates a production order
    Stephan

  • MRP - Sales order and customer fields grey-out

    Hi there,
    The Sales order and customer fields are grey-out for all MRP generated production orders. Can the SAP programmers please get this fixed? It should either read in the sales order number and the customer number or allow user to type in the sales order, just like the manually created production order.
    cheers

    Hello Gordon,
    If production is make-to-order rather than make-to-stock, the MRP should read in the sales order number and the customer, since it is specific to the sales order. Even for make-to-stock production, where it cannot read in the specific sales order number, it should at least not grey out the field, don't you think so? By greying out the field, users are not allowed to type in the sales order number even when the production order directly relates to a particular sales order. As such, we are not able to link it back to the sales order where other info such as customer's purchase order, etc... can be found.
    Could you please advise alternative way of linking MRP generated production orders to the sales orders? thanks

  • EAN/UPC field in sales order is grey field

    Dear all,
    when i am creating Sales Order, EAN/UPC field is grey field i cannot enter any value in that.
    I want to used these field, then how i can use these field.
    Also is there any specific purpose for the EAN/UPC field,where it is used.
    Regards,
    PM

    PM,
    What our Friend said is correct it comes from Material master- Basic data 1 view. But for this you will have to do proceed with configuration settings in
    IMG --> Logistics General --> Settings for Key Fields --> International Article numbers (EAN)
    a. You will have to define number of ranges for EANs/UPCs
    b. Define Prefixes
    c. Define Attributes - (Define number or EAN CAtegories) its here you need to maintain internal or external
    d. Define no ranges for perishables
    you can maintain data internally or externally based on your config settings. I have tried it in my material master maintained EA - perishable EA Category in MM automatically an internal no got assigned in EAN field after saving i raise a sales order the no. is reflecting in my sales order item details under sales tab - field.
    try it..
    Regards
    Sathya

  • BAPI SALES ORDER CHANGE CUSTOM FIELD

    Hello Gurus,
    I am trying to update a custom field for sales order. The field name is zfield1 in vbak. The field is added to vbakkom, vbakkomx, vbakkoz, vbakkozx, BAPE_VBAK, BAPE_VBAKX. I guess i need to use the EXTENSIONIN table to populate this field's values to change it with the BAPI. But I not sure exactly how to populate the fields. Can someone tell me how exactly i need to do this?
    Also the documentation says fill Extensionin this way.
    STRUCTURE VALUEPART1 1234561234567890123
    BAPE_VBAP 0000004711000020 XYZ
    BAPE_VBAPX 0000004711000020 X
    What is the 1234561234567890123? Is it a field?
    Thanks,
    KB

    Hi,
    Check this example..I am updating the VBAP field..Instead you can replace it for VBAK..
    PARAMETERS: P_VBELN TYPE VBAK-VBELN.
    DATA: T_LINE LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
    DATA: T_LINEX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
    DATA: T_EXTEN LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.
    DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: BAPE_VBAP LIKE BAPE_VBAP.
    DATA: BAPE_VBAPX LIKE BAPE_VBAPX.
    DATA: ORDER_HEADERX LIKE BAPISDH1X.
    ORDER_HEADERX-UPDATEFLAG = 'U'.
    T_LINE-ITM_NUMBER = '000010'.
    APPEND T_LINE.
    T_LINEX-ITM_NUMBER = '000010'.
    T_LINEX-UPDATEFLAG = 'U'.
    APPEND T_LINEX.
    BAPE_VBAP-VBELN = P_VBELN.
    BAPE_VBAP-POSNR = '000010'.
    <b>BAPE_VBAP-<b>YYFREETEXT</b> = '02'.</b>
    T_EXTEN-STRUCTURE = 'BAPE_VBAP'.
    T_EXTEN+30 = BAPE_VBAP.
    APPEND T_EXTEN.
    BAPE_VBAPX-VBELN = P_VBELN.
    BAPE_VBAPX-POSNR = '000010'.
    <b>BAPE_VBAPX-YYFREETEXT = 'X'.</b>
    T_EXTEN-STRUCTURE = 'BAPE_VBAPX'.
    T_EXTEN+30 = BAPE_VBAPX.
    APPEND T_EXTEN.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_inx = ORDER_HEADERX
    tables
    return = T_RETURN
    ORDER_ITEM_IN = T_LINE
    ORDER_ITEM_INX = T_LINEX
    EXTENSIONIN = T_EXTEN.
    COMMIT WORK.
    Thanks,
    Naren

  • Table for sales order change by field

    Dear Friends,
    I want to get the data @ table level for the list of sales orders with changed by field. Can you please tell which table/s for sales order change by field can be used?
    Thanks,
    pinky

    Hi
    You can get the changes for SALES ORDER item in CDPOS table
    Goto SE16 and find the changes.
    hope it will serve your purpose.
    thanks,
    santosh

  • Stored Procedure for Delivery based on Sales Order Title UDF

    Dear All,
    I have made a  UDF in the Sales Order Title as U_SOApproved which has been set with valid Values for the field as 1 - Yes and 2 - No and set default value for field set as 2.
    Now I want to have Stored Procedure by which whenever a delivery is made based on a Sales Order for Document Series Named Retail if in the above udf which is there in Sales Order is not set as 1 - Yes the system should not allow the add the delivery in the system.
    I know there is a option in Sales Order itself having a approved tick box but if I implement it then it would be applicable for all document series which I don't want. I want to have a check on a particular document series e.g Retail only.
    Please help in this regard.
    Regards,
    Kamlesh

    I'm actually looking for a complete block , I want to force the user to type a value in the GrossBuyPr.
    I have the following SP that I tried to modified to work for invoices but is not working
    DECLARE @numlinii int
    IF @transaction_type IN (N'A', N'U') AND (@Object_type IN (15)) AND (@num_of_cols_in_key = 1)
    BEGIN
    IF (@Object_type = 15)
    BEGIN
    SELECT TOP 1 @numlinii = (LineNum +1) FROM DLN1 INNER JOIN OITM ON DLN1.ItemCode = OITM.ItemCode AND (OITM.InvntItem N'N')
    WHERE DLN1.DocEntry = @list_of_cols_val_tab_del AND (ISNULL(GrossBuyPr, 0) = 0)
    ORDER BY Linenum ASC
    IF (ISNULL(@numlinii, 0) 0)
    BEGIN
    SET @error = 10
    SET @error_message = N'Value of field NNNNN in line No. ' + CONVERT(nvarchar(4), @numlinii) + N' is = 0 !'
    GOTO error_mesg
    END
    END -- ODLN (15)
    END
    Any ideas ?

  • De-allocate batch from sales order

    How do you de-allocate a Batch from the Sales Order , so that it becomes available to another Order?
    I removed the Batch from the sales order and saved the order. A confirmation without the batch was created . However when I tried to determine the same batch in another Order it was not available.
    I then rejected the line item and saved the order , and it allowed me to pick up the batch in a second order.
    ATP quantity was available however the batch was not getting recognized till I rejected the order.
    Any ideas on why this case?
    Thanks,
    Asha

    Hi,
    This is because, when you ran Availability check, the batch was already reserved for the sales order. So once you remove the batch number, you should run availability check once again. Dont forget that if you are giving some other batch number to teh order now, the batch should have some stock.
    So, after changing or deleting the batch number, run availability check once and then save the order. Then create the second sales order and assign the batch number. It will take the batch.

Maybe you are looking for