To change the Purchase order header and line item text

Hi everybody,
I need to upload the PO Header and item text for the combinaion of PO and a material.
Please help???

Hi,
Try this beloe code
      Length of the PO item text
      If the length > 132 Chars
  BAPI Function module for changing PO item Text
  commiting the bapi change
SORT t_bapi BY ebeln ebelp.
  LOOP AT t_ebeln INTO wa_ebeln.
    LOOP AT t_bapi INTO wa_bapi WHERE ebeln = wa_ebeln-ebeln.
      REFRESH t_return.
      READ TABLE t_input INTO wa_input
        WITH KEY ref_num = wa_bapi-ref_num
                 item = wa_bapi-ebelp.
      IF sy-subrc EQ 0.
        APPEND wa_input TO t_output.
        w_len = STRLEN( wa_input-text ).
        wa_potextitem-po_number = wa_bapi-ebeln.
        wa_potextitem-po_item = wa_bapi-ebelp.
        wa_potextitem-text_id = 'F01'.
        wa_potextitem-text_form = '*'.
        wa_potextitem-text_line = wa_input-text+0(132).
        APPEND wa_potextitem TO t_potextitem.
        IF w_len > 132.
          wa_potextitem-po_number = wa_bapi-ebeln.
          wa_potextitem-po_item = wa_bapi-ebelp.
          wa_potextitem-text_id = 'F01'.
          wa_potextitem-text_form = '='.
          wa_potextitem-text_line = wa_input-text+132(123).
          APPEND wa_potextitem TO t_potextitem.
        ENDIF.
      ENDIF.
    ENDLOOP.
    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder = wa_bapi-ebeln
      TABLES
        return        = t_return
        potextitem    = t_potextitem.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait   = ' '
      IMPORTING
        return = wa_bapiret2.
Regards
Krishna

Similar Messages

  • How to cancel the sales order - header and line status are in Entered Stage

    Dears,
    I have some sales order to be cancelled in which the header and line status are in *"Entered"*. I am not able to cancel these sales order.
    Also note that these orders are for maintenance service.Once i book these orders the lines will change to closed status.
    So it is not possible to book and cancel the lines.
    Kindly me to resolve this.

    926530 wrote:
    Boss,
    If i do Action-->cancel on header, it just makes the qty to zero.But the header and line status still showing as entered.It will not cancel the order.
    The problem for me is that these lines are coming in my monthly reports. This is what your question says...be more specific as what is your issue..which in turn is your problem
    How to cancel the sales order - header and line status are in Entered Stage
    Coming to your Action-->cancel...as far as i know ...the header status will change to canceled..
    unless until you have some processing constraints in place...which is stopping you...
    HTH
    Mahendra

  • PO header and line item text in smartform

    HI,
    In my smartform I am fetching the 'PO header text', 'item text', and 'material text' for PO with "Include text"( by passing text name, object id etc..) with "no error if no text is maintained" checkbox checked
    This is working fine In the development servers....
    but when I moved these requests to quality servers...the above mentioned texts are not getting displayed in the smartform...while Texts are maintained in PO.
    What can be the problem??

    I guess there cant be any problem with the Include text . The problem can be either the text is not maintained or may be the include is not getting executed.
    See if you have any conditions in the condition tab.
    Check it in the debug mode and let me know if includ text is getting executed but value is not getting populated,
    Better you can do one thing
    Take the generated functional module name let us suppose your FM nae is /1BCDWB/SF00000100 then add SAPL   as below
    /1BCDWB/SAPLSF00000100
    Now go to SE38 and give this Program name and in the program find the code with the Text id .
    Supose your Text id is 'ZTXT'.
    find with this this ID and  find which function module is used to get your text.
    Put break point on the FM and now execute the form.
    Check whether values text is getting populated .
    Thnanks,
    Nageswar
    Reward if problem solved

  • MIGO-sales order number and line item not validated for 501E mvt in MIGO.

    Hi All,
    In MIGO i am trying to post for 501E(specisl stock=order on hand) movement type, here i am entering the material and in the where TAb even if I enter wrong sales order number or wrong sales order line item number. the system allows to post .
    its not validating the material against the sales order number and line item number that is entered to check whether that material really exists in that particular sales order or not.
    is there a way to fix this?
    Thanks
    Mahendra

    hi
    i dont think vvalidation is possibel
    as the system dont know whaich material is assigned to which SO
    as we r takeing the stock without PO
    if u want to validate then system can validate the quantity that is also with use of some user exit
    correct me if i am wrong

  • IDOC generation to change the Purchase Order

    Hello Experts,
    I am developing the program for changing the purchase order through IDOC.
    We will get the file from legacy sytem with control and header and detail record.
    So when ever the there is EOR as last field in the detail record. Im updating the IDOC_DATA and  calling functin IDOC_INBOUND_SINGLE.
    SO when ever there is mulitiple line items changes for single PO.
    we will get the file like that for last detail record we will get EOR as last field for last line tiem .
    So i m grouping in to  one control and one header and one or more detail record and passing to the IDOC_DATA calling functin IDOC_INBOUND_SINGLE.
    At this time i m getting error like that header segement is missing
    Please help me to solve this issue. Any one worked on similar type of issue please help me.

    Cannot see your program of course but check that you populated the header segements.
    What does  IDOC_INBOUND_SINGLE expect, does it expect a particular Idoc type? in that case you gotta build that first from your file.
    Is IDOC_DATA all that this function requires, what are the other input parameters?
    regards

  • How to extend Project Task in the Purchase Order header?

    Hi everybody,
    I am facing a problem I am sure is not so hard, but I cannot find my way through it.
    So, my objective is to extend the Purchase Order Header with the Project Task ID.
    I created the extension field first, as below:
    But I just cannot find how to populate it automatically from the data in the Project Task field.
    I tried a Relation in a BO extension going through the AccountingBlockAssignement, but it seems to not be functional.
    I also tried to make a Reference to the extension field and created an Event After Modify like:
    this.projecttaskpo = this.ExtensionForPO.content
    The Project Task PO is my reference to the extension field created in the Cloud Solution.
    And the ExtensionForPO is my relation to the TaskID:
    import AP.Common.GDT;
    import AP.Purchasing.Global as Purchasing;
    import AP.ProjectManagement.Global as ProjectManagement;
    import AP.IS.CodingBlock.Global as Coding;
    [Extension] businessobject AP.Purchasing.Global:PurchaseOrder {
      [Relation(Coding:AccountingCodingBlockDistribution.AccountingCodingBlockAssignment.ProjectTaskKey.TaskID)]
      [Label("Project ID")] element ExtensionForPO : TaskID;
        node Item {
    I am pretty sure this is not so hard, but I can't figure how to do it.
    The Task ID is in the Line Item so I do not understand why it could be so hard to add it in the Purchase Order Header.
    Moreover, when I try to make the path directly from the PurchaseOrder, like:
    PurchaseOrder.Item.ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.ProjectTaskKey.TaskID
    It returns to me that the association between Item and ItemAccountingCodingBlockDistribution is not a node. I know that, but it would be perfect if I could directly go from the Purchase Order BO to the Project Reference and the Project Tasks. But I cannot do that.
    Any help on this would be greatly appreciated as it is quite a recurring request from customers.
    I could have a misunderstanding in the process of doing it, or even in the code as I am a pure development newbie, so I m open to all propositions.
    Thank you all.
    Have a nice day.
    Jacques-Antoine

    Jacques-Antoine,
    You can't directly translate a repeating node or element (such as an Item or a Project Task from the Accounting Coding Block of an Item) to a singular node or element.
    The reason is that, though your use case may have the elements assumed to be the same for all items, this isn't necessarily the case, so ByDesign won't assume that you can use that kind of logic.
    The simplest approach would be to do an On-Save at the Root node of the Purchase Order along the following lines:
    this.projecttaskpo = this.Item.GetLast().ItemAccountingCodingBlockDistribution.AccountingCodingBlockAssignment.ProjectTaskKey.TaskID;
    i wouldn't actually recommend this code.
    You'd need validations for IsInitial, IsSet, and those kinds of functions.
    i'd at least use some foreach loop to check that all the accounting coding blocks were for the same task, raise warnings if they weren't, etc.

  • Change of Sales Order  automatically changes the purchase order

    Hi 
       I am working on a scenario where a  as soon as a sales order is created it will also create a purchase order on plant which will supply the item to the plant on which sales order is created.This works fine.
    Now when I change sales order( order qty ,requested delivery date, new item added) . On saving the sales order it should change the purchase order which has already been created by updating the schdule lines in the purchase order with new values from the sales order. It is all in same SAP instance.
    Here are possible ways I can think of:-
    1 Change of SO will create a SO IDOC . The SO IDOC should supply required values to the PO Idoc . The PO IDOC should get posted to SAP to change the existing PO.  Client does not have XI so we cant use XI for conversion.
    2 Changing a SO will trigger workflow.The Workflow executes ABAP program which takes data from SO and calls BAPI to change the purchase order and sends notification that PO has changed.   Which BAPI?
    Any thoughts are welcome. We are on 4.7 and we dont have XI. So please do not suggest XI based solution.
    Prashanta

    Prashanta,
    For your 2nd part of question, you can use 'BAPI_PO_CHANGE' to change the PO.
    Thanks

  • Change the Purchase Order : Item - Conditions value

    Hi,
    How to change the Purchase Order : Item - Conditions value.
    In my PO, Item conditions shows the SKTO - Cash Discount value is 0. I want to change the Discount value 10.
    How can i change it??

    Hi,
    Goto the Transaction code MN05 and give the CONDITION TYPE SKTO and change the value
    MN05 is the Transaction code for Purchase order  condition types.
    Please check and revert back if you need more details.
    regards,
    santosh

  • A report which shows the purchase order MM and the linked vendor invoice

    Hi All,
    I wonder if ther's a SAP standard report which shows the purchase order MM and the linked vendor invoice (the FI document)  with the Net due date.
    Could anyone help me?
    Thanks
    G.Rossi

    Hi,
    ME80FN with PO History View
    ME2N with Scope of List "ALLES"

  • Table containeing both the purchase order number and the sales order number

    hi all!!!
    what is table that contains both the purchase order number and sales order number corresponding to that purchase order number.
    Moderator message: please search before posting.
    Edited by: Thomas Zloch on Jan 31, 2012

    Hi Sunny,
    Yes they are same. You will be creating a purchase order in ME21n. After creating purchase order you will shown a number for that order.
    Reward points if useful.
    Thanks,
    Swamy Kunche

  • Is the purchase order number and purchase document numer both are same

    is the purchase order number and purchase document numer both are same or different?
    thanks.

    Hi Sunny,
    Yes they are same. You will be creating a purchase order in ME21n. After creating purchase order you will shown a number for that order.
    Reward points if useful.
    Thanks,
    Swamy Kunche

  • What's the difference of Item Class value:Header and Line Item in AME Rule

    Hi All,
    when creating a Rule or Attribute,there is a Item Class property,which contains Header and Line Item two values.
    Can anybody pls help me clarify the difference?
    thx,
    edmund.

    This information can be found in the Approvals Management implementation guide in metalink. The part number for this document is B31622-02
    Regards

  • LSMW program to upload the sales order with multiple line items.

    Dear SD and PP Gurus,
    I am new to creating LSMW Program.
    I want to create a LSMW program to upload the sales order with multiple line items. I have read on SDN that it can be done on two phases. First Create Header Data than line items. IS IT TRUE??, Or
    Is there any procedure by which we can load the sales orders with multiple line items in a single run (part).
    I want to use Batch process, not a BAPI or IDOC procedure.
    I have created a program with
    object 0090
    Method 0000
    Program Name RVINVB10
    Program Type D
    Source Structure 1 - For Header and Source Structure 2  for Line Items.
    Mapped Field INDET (With Fix Value 1), ORDERTYPE, SALESORG, DISTCHANNEL, DIVISION, CUSTOMER, PONUMBER , DELVDATE, PRCGDATE, PMTTERM
    INCOT1 INCOT2 with Source Structure - 1 and
    Field INDENT (With Fix Value 2),  ITEMNO, MATCODE, MATQTY, SUOM, PLANT, BATCH, AMOUNT with Structure-2
    than maintained Structure relation ship, field Mapping, Specified Files, Assigned files, Read Data and other process,
    At final stage (Start Direct Input program RVINVB10) it is giving a message - Table name not allowed.
    Please tell me where I am wrong.
    Thanks in advance.
    DSC

    Dear SD Gurus n Experts,
    I have solved the above problem. But there is another problem appearing regarding the date format. Now system generating a message: Date . . is not valid.
    While I am using Date: YYYYMMDD format in flat file, which is SAP's Standard Format.
    In SDN Link: LSMW upload Sales Order using VA01/VA02     I have found that there are some date fields which are mandatory to filled. Here I have mapped
    VDATU - Requested delivery date,  BSTDK - Customer purchase order date,  PRSDT - Date for pricing and exchange rate,  BSTDK_E - Ship-to party's PO date, FKDAT - Billing Date, KORDT - Delivery Date,
    and PRGRS - Date type is Constant = D
    Can any one tell me, where is the priblem.
    With thanks,
    DSC

  • Sales order no and line item no in account assignment tab of line item no.

    Hi All,
    When we display a sales order and go to line item --> Account assignment tab --> we can see sales order no and line item no in that screen. We want to know from where this existing no. in that field is populating from.
    We want to know this as we want to check feasibility of changing sales order and item no to maintenance contract no and line item no. ( Maintenance contract we have to pick from notification)
    If anybody has any idea about this do let me know as this is urgent requirment.
    Effort will be rewarded.
    Thanks in advance.
    Edited by: Satish Bharambe on Jul 4, 2008 10:38 AM

    Hi Satish,
    You mean Accounting assignment tab-->In Settlement rule details
    If yes the order number which is coming in that field Sales order and for which sale order you are looking that details both are the same numbers(i.e Nothing but sales order number).
    When you create sales order system will give number of the sales order the number will come in this place.
    I hope it will help you,
    Regards,
    Murali.

  • Displaying header and line items

    Hi,
    i) i have a fieldname i.e text and its value to display in the bodypage  (body)..
    i want to display the text and its value only if the value is there.. otherwise it should not be displayed and a blank line also should not appear
    in smartforms we can handle that in conditions in the corresponding node, how we do the same in adobe forms?
    ii) suppose i have header and line items and for each header item i want to display the line items, both r in 2 tables how can we handle this
    Thanks

    Hi Shekar,
    The following solutions useful if you are using printbased forms.
    1. To display the field if the value is there.
    ->In the Context you can define the condtion on the filed.
    ->You can write a script on the subform superior to the field
    [code]      if ( $.field.rawValue == <value> ) then
                $.field.presence = “hidden”
          endif [/code]
    2. Header and item table
    In the SFP context drag the header table from interface.drag the item table from interface on the DATA in the header table. it will placed at the end of the header table. Now select the item table select where clause in the properties ( at the bottom of the screen ).there you create a line for condition using create button. drag the field from header table field ( say header-matnr ) on the right side and then drag the same field from the item table ( say item-matnr) in the left side.This will filter the item records relevent for header record.
    refer the message
    Re: Adobe IF Attachments

Maybe you are looking for