Generate 2 line items with posting keys in same table while using  FM .

Dear Expert ,
For T-code f-65 ,I have to park a FI Document  .i tried with PRELIMINARY_POSTING_FB01 for parked Document . But  i am not  successfully park the document .
with the help of F-65 the data Segregate between Tables VBSEGS and VBSEGD with respecting Posting key . but with this Fm entire entry is displaying in table VBSEGS .For example it generated two line items with posting keys '15' and '40' and these both are displayed in VBSEGS whereas posting key '15' has to be displayed in VBSEGD.
when i check this Document in FBV0 Error reflect " G/L Account 0012000 1001 Does not Exist ".
Here my code -
DATA:   XT_BKPF LIKE  BKPF OCCURS 0 WITH HEADER LINE ,
        XT_BSEG LIKE  BSEG OCCURS 0 WITH HEADER LINE ,
        XT_BSEG1 LIKE  BSEG OCCURS 0 WITH HEADER LINE ,
        XT_BSEC LIKE  BSEC OCCURS 0 WITH HEADER LINE ,
        XT_BSET LIKE  BSET OCCURS 0 WITH HEADER LINE ,
        XT_BSEZ LIKE  BSEZ  OCCURS 0 WITH HEADER LINE ,
        XT_BKORM  LIKE  BKORM OCCURS 0 WITH HEADER LINE ,
        XT_THEAD  LIKE  THEAD OCCURS 0 WITH HEADER LINE ,
        XT_SPLTTAB  LIKE  ACSPLT  OCCURS 0 WITH HEADER LINE ,
        XT_SPLTWT LIKE  WITH_ITEMX  OCCURS 0 WITH HEADER LINE .
DATA :    XTEXT_UPDATE  LIKE  BOOLE-BOOLE VALUE SPACE,
          XTEXT_ITEM_UPDATE LIKE  BOOLE-BOOLE VALUE SPACE,
          XI_UF05A  LIKE  UF05A,
          XI_XCMPL  TYPE  XFELD VALUE 'X',
          XFS006_FB01 LIKE  FS006 ,
          XI_TCODE  LIKE  T020-TCODE  VALUE 'F-65',
          XI_PARGB  LIKE  RF05A-PARGB        ,
          XI_TCODE_INT  TYPE  TCODE           .
DATA P_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
XT_BKPF-BUKRS     =     'CP01'.
XT_BKPF-GJAHR     =     2011.
XT_BKPF-BLART     =     'DZ'.
XT_BKPF-BLDAT     =     SY-DATUM.
XT_BKPF-BUDAT     =     SY-DATUM.
XT_BKPF-MONAT     =     '06'.
XT_BKPF-CPUDT     =     SY-DATUM.
XT_BKPF-WWERT     = SY-DATUM.
XT_BKPF-USNAM     =     'ABAPER'.
XT_BKPF-TCODE     =     'F-65'.
APPEND XT_BKPF.
XT_BSEG-BUKRS     =     'CP01'.
XT_BSEG-GJAHR     =     '2011'.
XT_BSEG-BUZEI = '001'.
XT_BSEG-BSCHL = '40'.
XT_BSEG-KOART = 'S'.
XT_BSEG-SHKZG = 'S' .
XT_BSEG-GSBER     =     'CPLN'.
XT_BSEG-BUPLA = 'CP01'.
XT_BSEG-WRBTR     =     10000.
XT_BSEG-PSWSL = 'INR'.
XT_BSEG-ZUONR = 'CH. 123456'.
XT_BSEG-HKONT = '241000'.
APPEND XT_BSEG .
CLEAR  XT_BSEG.
Vendor line item - required even for header only - BSEG table
XT_BSEG-BUKRS     =     'CP01'.
XT_BSEG-GJAHR     =     '2011'.
XT_BSEG-BUZEI = '002'.
XT_BSEG-BSCHL = '15'.
XT_BSEG-KOART = 'S'.
XT_BSEG-SHKZG = 'H' .
XT_BSEG-GSBER     =     'CPLN'.
XT_BSEG-BUPLA = 'CP01'.
XT_BSEG-WRBTR     =     10000.
XT_BSEG-PSWSL = 'INR'.
XT_BSEG-ZUONR = 'CH. 123456'.
XT_BSEG-HKONT = 'PC04000001'.
APPEND XT_BSEG .
CLEAR  XT_BSEG.
  CALL FUNCTION 'PRELIMINARY_POSTING_FB01'
   EXPORTING
     TEXT_UPDATE            = XTEXT_UPDATE
     TEXT_ITEM_UPDATE       = XTEXT_ITEM_UPDATE
  I_UF05A                =
     I_XCMPL                = XI_XCMPL
  FS006_FB01             =
      I_TCODE                = XI_TCODE
  I_PARGB                =
  I_TCODE_INT            =
  IMPORTING
    XEPBBP                 = CHECK_A
    TABLES
      T_BKPF                 = XT_BKPF
      T_BSEG                 = XT_BSEG
      T_BSEC                 = XT_BSEC
      T_BSET                 = XT_BSET
      T_BSEZ                 = XT_BSEZ
  T_BKORM                =
  T_THEAD                =
  T_SPLTTAB              =
  T_SPLTWT               =
          EXCEPTIONS
            ERROR_MESSAGE = 1.
  P_RETURN-ID         = SY-MSGID.
  P_RETURN-TYPE       = SY-MSGTY.
  P_RETURN-NUMBER     = SY-MSGNO.
  APPEND P_RETURN.
     p_return-MESSAGE_V1 = XSYMSGV.
  IF SY-SUBRC = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT = 'X'.
  ENDIF.
  WRITE :/ sy-subrc , sy-MSGV1 .
Thanks ,
Ashish Gupta

Hi Raghuram,
I found a very important SAP Note 103051, details are below.
An IDoc processed by function module IDOC_INPUT_INVOIC_MM (of category INVOIC01) must not refer to the same purchase order item in several invoice items. This is also valid if for a goods receipt-related invoice verification several delivery notes belong to the same purchase order item.
Depending on the system settings and the situation, various error messages can occur (for example, FD240 'Order item ... selected more than once' or M8050 'Balance not zero: & debits: & credits: &').
In this situation module IDOC_INPUT_INVOIC_MRM generates error message M8321 'Document contains same order item more than once'.
For example, this situation occurs if you work with individual batch valuation and the SD billing document executes a batch split for different batches which belong to the same purchase order item and delivery.
Other terms
INVOIC, SAPLIEDI,  M8047, M8, 321
Reason and Prerequisites
This is because of the program design.
Solution
There is no solution for IDOC_INPUT_INVOIC_MM.
Module IDOC_INPUT_INVOIC_MRM (only as of Release 4.0) for the logistics invoice verification can distinguish different goods receipts by means of the delivery note number. For this purpose, GR-related invoice verification must be active.
Owing to this symptom, billing documents for single batch valuation with batch split cannot be settled in MM-EDI inbound processing. The settlement generates exactly the situation described (several invoice items for the same purchase order item). In this case, the only solution is to deactivate the billing of the batch sub-items in SD Customizing and to calculate the main item only.
Hope this helps.
Reward if helpful.
Thanks

Similar Messages

  • Make changes to auto generated line items when posting invoice thru MIRO?

    Hi All,
    My requirement is to make some changes in line items data when posting invoice through MIRO transaction.
    I have written a substitution for the same, The issue is that some line items get automaticaly created (i.e inter company posting). I need to make changes to these line items as well but substitution is not being triggered for these auto generated line items.Is there any way by which I can update in these line items as well ?
    further do we have any internal table which holds all the line items at runtime....to which I can refer and make the changes. I have searched but could not find one.
    Can anybody provide some inputs on this.
    Thanks,
    Lucky.

    Hi Kaushik,
    Thanks for your reply.
    I am using BADI INVOICE_UPDATE but here we will not be having line items which are auto generated.
    When we do inter company posting, line items are automatically created and these are not avaliable in the BADI. I am not sure if we can trap these line items any where.....the possible alternative which I can think of is to use memory reference and modify the internal table which holds all the items but unfortunately I am not able to find any such internal table to refer to at run time ...have u got any idea on this?
    Thanks,
    Lucky.

  • How to create a PDF with substituted key-value and table-values using a template language

    I have about 50 key-values and 10 table-values that I want to substitute into a formatted report template (language can be anything standard, would create a small number of these templates) and then use an Adobe tool to substitute the values into the template and produce a PDF. Preferably the template language would permit some basic conditional logic (if <key #> has value <value> then <show key label here> and <key value here> in close spatial proximity on the form) and permit embedding of a static graphic logo, text with fonts/styles, etc. to produce a polished report but also handle pagination (e.g. enable page breaks or numbering) to be handled automatically.
    What is a recommended template language and product to accomplish this?

    Are you thinking of something like a blank form that you can enter information into, save, and send to another user? If so, what you want is possible. If you want more information, post again and include more details about how you want to use it and how the recipient will use it.

  • Report for G/L line items with both debit & credit posting accounts

    Hi,
       My client requires a G/L line items report. It can be possible thru fs10n or fbl3n etc. But he wants to see both the credit and debit accounts in the same line.
    for ex: if I open a expense account and show the report of individual documents, he wants to see the corresponding credit item to which bank/cash account it got credited to.
    we showed them to double click on that document and goto document overview. but they dont want in that way.
    they want to see all the line items with both postings in the same sheet for all line items.
    valuable replies will be fairly rewarded.
    thanks,
    chaitanya

    Hi,
    U can use the following TCodes...
    - S_ALR_87012287
    - S_ALR_87012289
    - S_ALR_87012291
    But i am not sure if your client will be happy...
    This is a very common req and the only solution possible is to have a customized report for the client..
    Hope its clear..
    Cheers
    Raghu

  • GL Line Item with Tax Base Amount Posting

    Dear Expert,
    I have a GL account with tax and CO object. And, I am using BAPI_ACC_DOCUMENT_POST to do the GL posting. I would like to post the GL line item with tax base amount as it will show in FB03 line item, the posting is successful but no base amount is in GL line item in FB03. (I can manually post it in Tcode FB50).
    Any idea on this and what is the problem? Appreciate if can help..
    Thank you.
    Best Regards,
    Weng

    Hello Weng,
    I also looked on SAP notes. 
    There is a note with much information about Tax Postings with accounting BAPIs and it's a consulting note.  The note number is 626235.
    Regards,
    Rae Ellen Woytowiez
    Edited by: Rae Ellen Woytowiez on Dec 21, 2010 10:11 PM

  • Customer line items with balance carry forward no opening balance

    Hello FI Experts,
    We have ticket where the user is using a Z* Report for Customer line items with balance carry forward. In 31.01.2007 user has posted some legacy data, latter he was executing this Z* report then user can see the values posted on the same day (31.01.2007) as line items. But he was executing the report on 01.02.2007 then he was not able to see the line item as well as the values posted on 31.01.2007 as opening balance as on 01.02.2007. But if we run the report as on 01.01.2008 then we are able to see the values which are carry forwarded as opening balances. Did anyone have worked on this type of scenario?
    Requirement Here Is:  The values that have been posted on 31.03.2007 which are still open line items should get displayed as opening balance as on 01.02.2007.
    Thanks for helping on this issue.

    Hi,
      Any report will get data from Tables. Please check whether the table you have used to develop this report has opening balance.
    Balance will be carry forwarded only when you run the balance carry forward program. Check whether this was run for the date you have specified. This can be done in the year end.
    If you are checking in the middle of the year, then the balance will not be carry forwarded.
    Regards,
    B. Radhika.

  • Unable to delete line item with 0 quantity in Invoice.

    Hi Experts,
    I came across a Invoice which reflects in VF04 as pending Billing due list. When i checked at the inter company Invoice i came across a line item with "0" quantity and price as zero, interestingly the replinishment cross company delivery document  for the same line item for "0" quantity had a Batch assigned to it.
    Now the issue is cusotmer has selected the line item with XX quantity and have selected the accounting document to be generated but the line item with "0 was left over and now still reflects in VF04.
    Customer does not want to reverse the full cycle to resolve the issue since the document was created a year back.My Question  is can we get the line item with "0" quantity to clear accounting so that it will not reflect in VF04.If so what will be process to do that.
    Thanks in Advance to advice.
    Regards,
    Sridhar.R

    Hi,
    It is  not possible to delete this line item, you can discuss with your client and delete it from the table.
    And now coming to the reasons why it has come into the invoice & Delivery
    1. The Batch Item category must have been configured as relevant for billing...check this and make it irrelevant if the client does not do batch specific billing. --- This will stop the batches from coming into the invoice.
    2.  Check for the batch item category in delivery if Zero quanity is allowed...if it is allowed make it not allowed and make it an Error message, whenever there is a zero quantity system will give a message.

  • How to assign profit center to automatically generated line items

    Hi, Experts,
                       My problem is that I want system automatically assign profit center to automatically generated line items.
                       Eg.
                             (Vat is @ 10%)
                                        Transaction                             Amount                            Profit Center                    
                              Purchase                   Dr                    Rs.1000/-                           XYZ
                              Vat                             Dr                    Rs.100/-
                              To Vendor                  Cr                                      Rs 1100/-
    Here I have to assign Profit Center in VAT G/L by double clicking on it, in reality, system should automatically assign profit center to VAT G/L same as to purchase, because this vat amount belongs to same purchase G/L.
    Kindly help me
    Thanks in advance

    Hi,
    1. In which SAP version you are working ? Are you using SAP 4.7 or ECC 6.0. ?
    2. If you are in ECC 6.0, have you activated New G/L ?
    3. Segment reporting is happening with Profit Center is one of the scenario ?
    Auto updation of Profit Center will depend upon these conditions. Accordingly one can provide you the solution.
    Regards,
    Shridhar

  • PO Line Item with Open Quantity

    HI all,
    How should i select a PO line item with Open Quantity? Is it possible to post GR for a PO which is set for Delivery Complition but still has Open Quantity ..
    please help me how to check for OPEN QUANTITY.
    Thanks,
    Ravi.

    Hi all,
    Thanks for your answer, but can you be some more specific on what calculations need to be done.
    I need to Post a GR for all PO where PO line items have Open Quantity.
    Thanks
    ravi.

  • Manual account clear but can see line item after post document

    Hi Guru!
         I have post account clear with transaction code F-03  with open item zero balance such as
    account 214001 balance +500
    account 214001 balance -500
    when I simulate entry the system not show line item for post document but can post it . I want to know why ?
    thank you very much .

    Dear,
    This is standard behaviour...if line item which you are clearing have zero balance then system will not show any line items since open itemss are cleared....
    when you have tolerance difference or the residual posting then only system will show the line item....
    Regards,
    Chintan Joshi

  • Vendor Line item with Opening and Closing Balances report regarding

    Dear All,
    I need a report for vendor line items with Opening and Closing balances.
    Thanks in advance
    Sateesh

    Hi
    Try S_ALR_87012082 - Vendor Balances in Local Currency
    Regards
    Sanil Bhandari

  • How to pull PO line item with "Block" indicator

    Hi all
    In ME2N, how do I pull all the PO line items with the "block" indicator set?
    I couldn't find a field in dynamic selection.
    Thanks in advance!

    HI,
    1. In ME2N -
    >Go to EDIT menu and then select Dynamic Selections (Shift+F4).
    Next select Purchasing Document item and double click on deletion indicator.
    Select the indicator and excute.
    Hope it helps..
    regards

  • I have a problem regarding sales order line item with confimed quanity

    Hi Experts,
    I have a problem regarding sales order line item with confimed quanity with '0'  with delivery block but confirming the sales order quantity once the order is released from credit check.
    The situation arises as per the below scenarios.
    Scenario - 1 -  When the sales order has two line item - one line item with confirmed qunaity in the schedule line and for the 2nd line item there is no available stock for the Material xxxxxx.
    Initially the sales order is created for the line item 2 with confirmed quantity = 0, and having the delivery block = 01 for the Material xxxxxx  and the order is set with credit check.  Once the order is relased from the credit check.  The quanity for the item 2 where the confirmed quantity will be = 0 ( Where it is not changing the confirmed quantity)
    Scenario -2-  Updating the order qunaity for the line item 2 as (9Pcs) it will goes to credit check and save the order.
    Maintain the stock for the line item 2 ( 5 Pcs).
    Once the order is released from the credit check.  Then  for the line item 2 the confirm quanity will be seting to 5 Pcs with Delivery blcok 01.
    This should not happen, When the credit check is released even though if it has stock based on the delivery blockl it should set the confirmed quanity to Zero.
    Can you please help me how to solve this issue.
    Looking forward for your reply.
    Thanks and Regards,

    Hi,
    I agree with your point.  In the sales order When the complete delivery check box is enabled where the confimed qty is set to zero, it is fine but when we save the orderr it goes to credit check.  Once we release the order using VKM3 where in the sales order the confimed quantity is setting to 5,  But it should set to Zero quantity.  Quatity should not be get confirmed it should be Zero Quantity. 
    Further in SPRO - customizing in the deliveries blocking reasons - It has a tick mark in the confirmation blcok.  But we dont want to remove the - Confirmation Block tick mark
    Please any one can help me if you have any solution to solve this problem.
    Thanks and Regards.

  • PO Release Strategy not changed after deletion of few line items with less

    Subject : PO Release Strategy not changed after deletion of few line items with less Total PO
    Dear Friends
    We have issue with PO Release strategy. We have created the PO. with release strategy  with multiple approvers.  After approval of first approval manager , one of the PO line item got deleted and Total PO value is reduced . The new PO value should have changed the PO release strategy. But it is not changed. Old release strategy only showing in the PO which is wrong. 
    Details of the PO
    PO no 4500000123 with 5 line items Total PO value : 100,000 USD Release strategy : AB
    PO line item 5 deleted. Now total PO value changed to 50,000 USD and the PO release strategy should have been changed to AA but not changed. Still showing PO release strategy AB only.
    Are there any OSS notes available to correct his bug.
    Please let me know if you need more details
    Thanks in Advance
    Thanks
    MVS

    Hi,
    release indicators  change it to 4.It may works. Please explore to all 6 indicators..........
    i.e,
    1-cannot be changed
    2-changable,no new determination of strategy
    3-changable,new release in case of strategy
    4-changable,new release in case of strategy or value change
    5-changable,new release if new strategy/outputted
    6-changable,new release if new strategy or value changed/ outputted......
    And check   Characteristic description and value in Classification  of Release strategies ........
    I hope this will help you. Thanking you.
    Regards,
    Venkat.

  • Can we clear more line items with different currency within one Vendor

    Dear All,
    Please guide us the following issue is
    Can we clear two line items with different currency within one Vendor (i.e., Down Payment entry passed in EUR and Invoice in JPY).
    Thanks in advance.
    Regards
    Srinivas

    Hi
    I suppose this should be possible in F-44, for any difference in forex enter a new line item 'Charge off diff.' to Dr/Cr Forex gain/loss account
    Thank You,

Maybe you are looking for