Free goods by a program

How to create a sales order with free goods with an abap function?
Now, I'm creating a sales order with  function 'SD_SALESDOCUMENT_CREATE' but don't know how to include free goods.
I would like to use a manual condition type to introduce free goods with a program.
Thanks in advance.

check the following code, it may be useful
SORT I_CR BY BUKRS  KNUMA VKORG VTWEG SPART.
*Generate Cr. Memo request Sales area wise.
  LOOP AT I_CR.
*Do not conider the record which net scheme amount is lessthan or equal
*to zero
    IF I_CR-NSAMT > 0.
      L_ITEM = L_ITEM + 1.
      CLEAR IT_ORIT.
      IT_ORIT-ITM_NUMBER = L_ITEM.
      IT_ORIT-MATERIAL = I_CR-MATNR.
   IT_ORIT-BILL_BLOCK = ''.
      IT_ORIT-TARGET_QTY = '0'.
      IT_ORIT-MATL_GROUP = I_CR-MATKL.
      APPEND IT_ORIT.
      CLEAR IT_ITINX.
      IT_ITINX-ITM_NUMBER = 'X'.
      IT_ITINX-MATERIAL = 'X'.
   IT_ITINX-BILL_BLOCK = 'X'.
      IT_ITINX-TARGET_QTY = 'X'.
      IT_ITINX-MATL_GROUP = 'X'.
      APPEND IT_ITINX.
      CLEAR IT_ORPT.
      IT_ORPT-PARTN_ROLE = 'AG'.
      IT_ORPT-PARTN_NUMB = I_CR-KUNAG.
      APPEND IT_ORPT.
     CLEAR L_VAL.
     L_VAL = I_CR-MG_NSAMT.
     L_FK = I_CR-FKIMG.
     DIVIDE I_CR-FKIMG BY I_CR-MG_FKIMG.
     L_VAL = L_VAL * I_CR-FKIMG.
     DIVIDE L_VAL BY L_FK.
     CLEAR L_FK.
      IT_COND-ITM_NUMBER = L_ITEM.
      IT_COND-COND_TYPE = 'ZBLD'.
      IT_COND-COND_VALUE = I_CR-NSAMT.
      IT_COND-CURRENCY = 'INR'.
      APPEND IT_COND.
      IT_CONDX-ITM_NUMBER = L_ITEM.
      IT_CONDX-COND_TYPE = 'ZBLD'.
      IT_CONDX-UPDATEFLAG = 'U'.
      IT_CONDX-COND_VALUE = 'X'.
      IT_CONDX-CURRENCY = 'X'.
      APPEND IT_CONDX.
      AT END OF SPART.
        L_FLAG = 'X'.
      ENDAT.
      IF L_FLAG = 'X'.
        IT_HEADER-REFOBJTYPE = 'BUS2094'.
        IT_HEADER-DOC_TYPE = 'ZCMR'.
        IT_HEADER-SALES_ORG = I_CR-VKORG.
        IT_HEADER-DISTR_CHAN = I_CR-VTWEG.
        IT_HEADER-DIVISION = I_CR-SPART.
        IT_HEADER-ORD_REASON = 'Z15'.
        IT_HEADER-BILL_BLOCK = ' '.
       IT_HEADER-TELEPHONE  = 'AUTO'.
        IT_HEADX-DOC_TYPE = 'X'.
        IT_HEADX-SALES_ORG = 'X'.
        IT_HEADX-DISTR_CHAN = 'X'.
        IT_HEADX-DIVISION = 'X'.
        IT_HEADX-ORD_REASON = 'X'.
        IT_HEADX-UPDATEFLAG = 'I'.
        IT_HEADX-BILL_BLOCK = 'X'.
       IT_HEADX-TELEPHONE = 'X'.
        PERFORM SUB_CALL_BAPI.
        REFRESH : IT_HEADER, IT_ORIT, IT_ORPT, IT_ITINX,
                  IT_COND, IT_CONDX.
        CLEAR : IT_HEADER, IT_ORIT, IT_ORPT, IT_ITINX,
                L_VKORG, L_VTWEG, L_SPART, L_FLAG, L_ITEM,
                IT_COND, IT_CONDX,L_FLAG.
      ENDIF.
    ENDIF.
  ENDLOOP.
*&      Form  SUB_CALL_BAPI
      text
-->  p1        text
<--  p2        text
FORM SUB_CALL_BAPI .
  DATA: L_ERR(1),
        L_VBELN LIKE ZSD_RBT_ELG_INV-VBELN,
        L_FLAG1(1),
        L_ERR1(1),
        L_FLAG2(1),
        L_ERR2(1),
        L_VAL1 LIKE ZSD_RBT_ELG_INV-NETWR.
  DATA: ARKTX(15) TYPE C VALUE 'VBRP-ARKTX(&1)'.
  DATA: C(2) VALUE '&1'.
  DATA: COUNTER(2) TYPE N.
SET UPDATE TASK LOCAL.
  REFRESH: IT_RET.
  CLEAR: L_ERR, L_VBELN, L_VAL1, L_FLAG1.
  CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
    EXPORTING
  SALESDOCUMENT                 =
     SALES_HEADER_IN               = IT_HEADER
     SALES_HEADER_INX              = IT_HEADX
  SENDER                        =
  BINARY_RELATIONSHIPTYPE       = ' '
  INT_NUMBER_ASSIGNMENT         = ' '
  BEHAVE_WHEN_ERROR             = ' '
  LOGIC_SWITCH                  = ' '
  BUSINESS_OBJECT               = ' '
  TESTRUN                       =
  CONVERT_PARVW_AUART           = ' '
  STATUS_BUFFER_REFRESH         = 'X'
   IMPORTING
     SALESDOCUMENT_EX              = L_VBELN
  SALES_HEADER_OUT              =
  SALES_HEADER_STATUS           =
   TABLES
     RETURN                        = IT_RET
     SALES_ITEMS_IN                = IT_ORIT
     SALES_ITEMS_INX               = IT_ITINX
     SALES_PARTNERS                = IT_ORPT
  SALES_SCHEDULES_IN            =
  SALES_SCHEDULES_INX           =
     SALES_CONDITIONS_IN           = IT_COND
     SALES_CONDITIONS_INX          = IT_CONDX
  SALES_CFGS_REF                =
  SALES_CFGS_INST               =
  SALES_CFGS_PART_OF            =
  SALES_CFGS_VALUE              =
  SALES_CFGS_BLOB               =
  SALES_CFGS_VK                 =
  SALES_CFGS_REFINST            =
  SALES_CCARD                   =
  SALES_TEXT                    =
  SALES_KEYS                    =
  SALES_CONTRACT_IN             =
  SALES_CONTRACT_INX            =
  EXTENSIONIN                   =
  PARTNERADDRESSES              =
  SALES_SCHED_CONF_IN           =
  ITEMS_EX                      =
  SCHEDULE_EX                   =
  BUSINESS_EX                   =
  INCOMPLETE_LOG                =
  EXTENSIONEX                   =
  CONDITIONS_EX                 =
  PARTNERS_EX                   =
  TEXTHEADERS_EX                =
  TEXTLINES_EX                  =
  BATCH_CHARC                   =
  CLEAR L_ERR.
  LOOP AT IT_RET.
    IF IT_RET-TYPE EQ 'E'.
      LEAVE TO LIST-PROCESSING.
      WRITE:/ 'BAPI ERROR', IT_RET-MESSAGE.
      L_ERR = 'X'.
    ELSEIF IT_RET-TYPE = 'S'
           AND IT_RET-ID = 'V1'.
      LEAVE TO LIST-PROCESSING.
      WRITE:/ IT_RET-MESSAGE.
    ENDIF.
  ENDLOOP.
  IF L_ERR IS INITIAL.
    CLEAR L_ERR.
    COMMIT WORK.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
   WAIT          =
IMPORTING
   RETURN        =

Similar Messages

  • What are some good free virus and malware programs?

    what are some good free virus and malware programs?

    The common census by the old timers on the forum is that you should not have any AV software on your Mac cause its not needed, yet the forums are full of people that have been infected with Malware which the same people help clean afterwards.
    This totally befuddles me.   I take care of quite a few macs and in the past few years have installed Anti Virus software on them and other than Sophos not catching the latest kinds of Malware that are out in the wild, I have not experienced any of the problems that the so called experts claim that they do.
    Over the past few months I have migrated over 50 Macs from using Sophos to now using aVast Free Anti Virus for Mac.  Other than getting more alerts of Windows viruses being found in Mail there has been no downside whatsover.
    I believe in the old saying that an ounce of prevention is worth more than a pound of cure. So with that I will recommend that you should have some sort of Anti Virus software on your Mac.  As I said prior, for now I an recommending avast Anti Virus for Mac.  This will protect your Mac from getting infected with malware before you have to come back and ask the experts here how to fix your Mac and get rid of the malware.
    When doing a scan I recommend that you only have it set to only show infections.  Since it cannot read some compressed files and reports them as an error.

  • Divide discount of free goods between several items (SO)

    Hi gurus,
    I need to split the cost of the free good between the items generating it, i.e. if the customer buy 5pcs of Mat A and 4pcs of Mat B he gets 1pcs of Mat C for free. He will only see the original price for the "main" items and zero for the free good but intenally the profit margin of the "main" materials should be deducted with the cost of the free good and the free good should have full profit margin as if it was sold for full price.
    I'm aware that this is not standard SAP functionality and that I probably need to change a user exit in program MV45AFZZ.
    Please help me with this problem! Any advice or tips are highly appreciated.
    Best regards,
    Mia

    Is it possible to solve this problem by modifying a user exit? I was considering creating a new pricing condition which should be inflicted between the net value and profit margin by the user exit so that the customer only sees the original values for the main materials but the profit margins are reduced with the price of the free goods directly in the order. Is this doable?
    /Mia

  • Issue of Free Goods

    Dear All
    I have some is my current assignment-Customer is buying some material say "A" want "B,C" as exclusive free goods
    is it possible to give two free at a time in same order ?
    I only know one exlusive free good can be give to one material with combination of customer ( Customer/Material)
    Looking for some inputs regarding the issue.
    Can you plz suggest me if there is any possiblities for BOM?
    Many Thanks
    Rakesh Naveen

    Dear Rakesh,
    Be informed that free goods is not currently supported in combination with material structures (e.g. product selection,     
    bills of material, variants with BOM explosion), see note 796926.   
    Determination of free goods is performed in include FV45PF0N_NATRAB_SELECTION and the check is hardcoded. You will have to modify the program to get that functionality, but be carfull that any modification won't be supported by SAP, see note 170183.                
    I hope it can help you.
    Ruy Castro

  • Setting up Free Goods in CRM 5.0 Standalone

    Dear Friends,
    We are trying to set up Free Goods in our CRM 5.0 standalone environment. What we want to realize is that, if customer buys product A, product B will be added to the order automatically as free of charge. So far we have no idea how to get this set up in the system.
    In R/3 you can specify 'requirement' in each condition type. In the 'requirement' section you can add a small ABAP program that might realize the functionality. However, it doesn't seem to be the case in CRM.
    Please advise. Many thanks!
    Leon

    Hi,
    While defining the Condition types in IMG system will ask the Application and Usage,select the applicatioin CRM, Usage is Free goods.
    CRM Standalone condition records maintain from the  Transaction code
    /SAPCND/GCM - Condition Maintenance, after entering this code give the Application CRM than select your Free goods condition type maintain the values.
    Relationship maintains in the condition records only, Once you select the Free godds conditin type than all required coloumns will pop up enter your product and Qty with the offered free goods product.
    Regards
    Naren..

  • Pricing error in free goods position

    Hi all,
    I have a strange error when save a sales order with position about free material.
    During the creation I can see the pricing scheme correct, with all the condition (price, subtotal, rebates of 100%, ecc.), but after I save the order, when I display again the sales order, the pricing scheme for the free goods position not cointains any condition (no price, no discount, ecc.) but only the subtotals.
    I don't understand what the system doing during saving document.
    The free goods position have a custom category type of position; for this, in the pricing scheme I apply a discount of 100% to make free the position.
    The user tell me about this problem only when he try to bill the order, because when he creates the shipping, he didn't have any problem.
    Can someone help me?
    Thanks in advance
    Alessandra

    Hi Allessandra,
    When the free goods are determined and priced properly while creating the document, there should not be any problem with the configuration settings. The problem is that something inintended is happening when the document is saved. Please ask your ABAPer to debug that and I guess some changes might have taken place in the program SAPMV45A (MV45AFZZ)and check for the coding in the Userexits
    USEREXIT_SAVE_DOCUMENT and USEREXIT_SAVE_DOCUMENT_PREPARE.
    Pleae try this way and you may get the solution.
    Thanks
    Ravi

  • PO Document Type for Free Goods only

    Good day,
    Business Scenario: Client wants to track FreeGoods made. To solve this, we have created PO document type "Free Goods PO"
    Current: I choose Free Goods PO, input materials and then tick the FG indicator.
    Question: Is it possible that for this document type, every material I put, the indicator is automatically ticked? And that only free goods can be placed in this document type?
    Thank you,
    Simon

    Simon,
    You will need someone with a developer key to be able to implement the code.  However, in the main PO processing program SAP has created spots where customers can add custom code for situations like this. 
    If you go to transaction SE81, you can select the MM module.  From there click the "Select subtree +/-" button (will highlight MM in yellow).  After that click "Information System".  This will bring you to the developer workbench where you can review all of the enhancement spots and user exits in the MM module.
    If you expand Enhancements, and click on Enhancement Spots, a selection screen should appear to the right.  In enhancement spot enter 'es_saplmepo' and execute.  Double click on the enhancement spot.  That will produce the list of all of the enhancement points within that main program.  There are ones specific to the header fields as well as item fields.
    If you scroll down to "item_process_main_01" and double click it will bring you into the code where the above if statement can be added (for some reason it doesn't bring be right to the item_process_main_01 spot so i have to scroll to find it).
    As the program is running it will hit your enhancement and process that as it is going.  A developer can provide more details.
    Hope this helps,
    Matt

  • Free Goods Quantity Control

    Greetings all SD Gurus,
    Would really appreciate some advice here. Currently I have a free goods condition ( exclusive ) - NA00 for a material set in such way that :
    For every 100 items ordered , there will be 5 free items of the same material.
    The condition is working fine. But users wanted the quantity field for the free item to be program is such way that they can decrease the quantity of free items from 5 but they can't increase the free items to more than 5.
    My question is - can this be configured in SPRO without creating a program in userexit . If yes, how do I go around it ? Or is there any other alternatives ?
    Many thanks in advance.
    Warmest Regards,
    Ed Ong

    Hi Ashish,
    Thanks for your suggestion but unfortunately, it's not applicable for the requirement. What the user wanted was a checking procedure to run during the manual changes of quantity in free goods before the doc was saved.
    Regards,
    Ed

  • Free goods out put.

    Hi gurus,
    Please give the solution for my issue.
         Create free goods Determination procedure and in output for billing in the system should not display the free good item in Print preview.
    Regards
    DvsK.

    Dear Kumar,
    Please take help of ABAPer to make the changes or put the logic as per your requirement in the invoice output program.
    I hope this will help you,
    Regards,
    Murali.

  • Free goods qty

    If i change the quantity in the free goods item manually in the sales order, system should not allow. where is the control for that?
    Those who have really worked on free goods, pls help.
    regards
    vikas chhabra

    you can attain this by using user exit.
    Go to program MV45AFZZ and use "Userexit_filed_modification"
    USEREXIT_SAVE_DOCUMENT_PREPARE
    u need to take abapers help in this for coding.
    Hope this will solve ur issue.

  • Unchange Free Goods Quantity in sales order

    Dear SD Expert,
                 I have set free goods condition for example buy 10 and get 2 free.
    Program work perfectly. However, when user change free goods item from 2 to 3. System show the information message V1737. And user still can change the quantity of free goods item.
    My client would like system to not allow change quantity in free goods item.
    Could you suggest me on this point, please?
    Best Regards,
    Prach

    all V1 message need to do in through Standard Ehancement in Program itself
    ask your Technical team ask him to find out the Ehancement -- copy that and change to explample  W501 to E501
    this will work i have done recently
    <<point beggiing removed>>
    Edited by: Rob Burbank on Sep 9, 2010 4:34 PM

  • URGENT - BAPI_SALESORDER_SIMULATE- FREE GOODS - ORDER_CONDITION_EX

    Hi Gurus,
    I am using standard Function module : BAPI_SALESORDER_SIMULATE to simulate pricing conditions.
    I am trying to figure out the reason for the function module: BAPI_SALESORDER_SIMULATE not giving values in CONDITIONS EX when I use it to <b>simulate free goods</b> .
    <b>It is only not giving ORDER_CONDITION_EX for free goods materials.</b>
    BAPI simulates Bill of material, regular orders properly.
    Example : one material has on free good .
    Should give output in ORDER_CONDITION_EX
    It is giving an output in ORDER_ITEMS_OUT - two materials line item 10 , 15 .
    However in ORDER_CONDITION_EX it does not return anything , number of entries is zero .
    What could be the reason. What is the correct input for the BAPI for it to give conditions in ORDER_CONDITION_EX for free goods.
    I know my data for input are correct as I can make a sale order with the same data.
    Please help me at the earliest to solve this problem.
    <b>BAPI’s reference : standard BAPI_SALESORDER_SIMULATE'</b>
    CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'
    EXPORTING
    ORDER_HEADER_IN = order_header_in
    CONVERT_PARVW_AUART = ' '
    DELAY = 0
    IMPORTING
    SALESDOCUMENT =
    ORDER_HEADER_EX =
    SOLD_TO_PARTY =
    SHIP_TO_PARTY =
    BILLING_PARTY =
    RETURN =
    ORDER_HEADER =
    TABLES
    ORDER_ITEMS_IN = order_items_in
    ORDER_PARTNERS = order_partners
    ORDER_SCHEDULE_IN = order_schedule_in
    ORDER_CONDITIONS_IN =
    ORDER_ITEMS_OUT =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CFGS_BLOB =
    ORDER_CCARD =
    ORDER_CCARD_EX =
    ORDER_SCHEDULE_EX =
    ORDER_CONDITION_EX = order_condition_ex
    ORDER_INCOMPLETE =
    MESSAGETABLE = messagetable
    EXTENSIONIN =
    PARTNERADDRESSES =
    WMDVSX =
    WMDVEX =
    AVAIL_OUT =
    ORDER_SCHEDULE_IN2 =
    ORDER_SCHEDULE_EX2 =
    ORDER_ITEMS_IN2 =
    ORDER_PARTNERS2
    Program being developed based on this BAPI
    selection-screen begin of block b1 with frame title text-001.
    parameters : p_kunnr like kna1-kunnr,
    p_matnr like vbap-matnr,
    p_vkorg like vbak-vkorg,
    p_vtweg like vbak-vtweg,
    p_spart like vbak-spart.
    selection-screen end of block b1.
    data: doctype like bapisdhead-doc_type value 'OR',
    itemno like bapiitemin-itm_number value '000010',
    quantity(13) type N value '0000000000001',
    partnertype like knvp-parvw value 'AG'.
    data :count type i.
    data : begin of order_condition_ex occurs 0.
    include structure bapicond.
    data: end of order_condition_ex.
    data: begin of order_header_in.
    include structure bapisdhead.
    data: end of order_header_in.
    data: begin of order_items_in occurs 1.
    include structure bapiitemin.
    data: end of order_items_in.
    data: begin of order_partners occurs 1.
    include structure bapipartnr.
    data:end of order_partners.
    data: begin of order_schedule_in occurs 1.
    include structure bapischdl.
    data:end of order_schedule_in.
    data: begin of messagetable occurs 0 .
    Include structure bapiret2.
    data: end of messagetable.
    order_header_in-doc_type = doctype.
    order_header_in-sales_org = p_vkorg.
    order_header_in-distr_chan = p_vtweg.
    order_header_in-division = p_spart.
    order_header_in-purch_date = sy-datum .
    order_header_in-req_date_h = sy-datum.
    order_items_in-itm_number = itemno.
    order_items_in-material = p_matnr.
    order_items_in-req_qty = quantity.
    append order_items_in.
    order_schedule_in-itm_number = itemno.
    order_schedule_in-req_qty = quantity.
    append order_schedule_in.
    order_schedule_in-req_date = sy-datum.
    order_partners-partn_role = partnertype.
    order_partners-partn_numb = p_kunnr.
    append order_partners.
    order_partners-itm_number = itemno.
    CALL FUNCTION 'Z_BAPI_SALESORDER_SIMULATE'
    EXPORTING
    ORDER_HEADER_IN = order_header_in
    CONVERT_PARVW_AUART = ' '
    DELAY = 0
    IMPORTING
    SALESDOCUMENT =
    ORDER_HEADER_EX =
    SOLD_TO_PARTY =
    SHIP_TO_PARTY =
    BILLING_PARTY =
    RETURN =
    ORDER_HEADER =
    TABLES
    ORDER_ITEMS_IN = order_items_in
    ORDER_PARTNERS = order_partners
    ORDER_SCHEDULE_IN = order_schedule_in
    ORDER_CONDITIONS_IN =
    ORDER_ITEMS_OUT =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CFGS_BLOB =
    ORDER_CCARD =
    ORDER_CCARD_EX =
    ORDER_SCHEDULE_EX =
    ORDER_CONDITION_EX = order_condition_ex
    ORDER_INCOMPLETE =
    MESSAGETABLE = messagetable
    EXTENSIONIN =
    PARTNERADDRESSES =
    WMDVSX =
    WMDVEX =
    Z_AVAIL_OUT =
    ORDER_SCHEDULE_IN2 =
    ORDER_SCHEDULE_EX2 =
    ORDER_ITEMS_IN2 =
    ORDER_PARTNERS2

    this is not solving it Ashish ,
    I am using a BAPI: Z_BAPI_SALESORDER_SIMULATE, this Bapi is similar to the BAPI_SALESORDER_SIMULATE. It has customizations that are similar to the customizations done for order in the SAP system at my organization.
    Checking CONDITIONS EX , for free goods
    I am using Function module :Z_BAPI_SALESORDER_SIMULATE to simulate pricing conditions.
    I am trying to figure out the reason for the function module: Z_BAPI_SALESORDER_SIMULATE not giving values in CONDITIONS EX when I use it to simulate free goods .
    It is only not giving ORDER_CONDITION_EX for free goods materials.
    BAPI simulates Bill of material, regular orders properly.
    Example : one material has on free good .
    Should give output in ORDER_CONDITION_EX
    It is giving an output in ORDER_ITEMS_OUT - two materials line item 10 , 15 .
    However in ORDER_CONDITION_EX it does not return anything , number of entries is zero .
    I know my data for input are correct as I can make a sale order with the same data.
    In the Output in the MESSAGETABLE I get the message
    T ID NUM MESSAGE
    W V4 160 Minimum quantity 1 EA of free goods has not been reached
    Please help me with : What is the reason for this message? I am able to make a sale order with the same data
    I am using exactly the same data in VA01 to create a sale order as I am using to test this BAPI: Z_BAPI_SALESORDER_SIMULATE
    Please help me at the earliest to solve this problem
    BAPI INPUT :
    ORDER_HEADER_IN OR
    CONVERT_PARVW_AUART
    Tables Value
    ORDER_ITEMS_IN 1 Entry
    ORDER_PARTNERS 2 Entries
    ORDER_SCHEDULE_IN 1 Entry
    ORDER_CONDITIONS_IN 0 Entries
    ORDER_ITEMS_OUT 0 Entries
    ORDER_CFGS_REF 0 Entries
    ORDER_CFGS_INST 0 Entries
    ORDER_CFGS_PART_OF 0 Entries
    ORDER_CFGS_VALUE 0 Entries
    ORDER_CFGS_BLOB 0 Entries
    ORDER_CCARD 1 Entry
    ORDER_CCARD_EX 0 Entries
    ORDER_SCHEDULE_EX 0 Entries
    ORDER_CONDITION_EX 0 Entries
    ORDER_INCOMPLETE 0 Entries
    MESSAGETABLE 0 Entries
    EXTENSIONIN 0 Entries
    PARTNERADDRESSES 1 Entry
    WMDVSX 0 Entries
    WMDVEX 0 Entries
    Z_AVAIL_OUT 0 Entries
    ORDER_SCHEDULE_IN2 0 Entries
    ORDER_SCHEDULE_EX2 0 Entries
    ORDER_ITEMS_IN2 0 Entries
    ORDER_PARTNERS2 0 Entries
    BAPI Output is :
    Import parameters Value
    ORDER_HEADER_IN OR I have this filled in
    CONVERT_PARVW_AUART
    DELAY 0
    Export parameters Value
    SALESDOCUMENT
    ORDER_HEADER_EX OR
    SOLD_TO_PARTY
    SHIP_TO_PARTY
    BILLING_PARTY
    RETURN
    ORDER_HEADER OR sales area  00/00/0000 00/00/0000
    Tables Value
    ORDER_ITEMS_IN 1 Entry
    Result: 1 Entry
    ORDER_PARTNERS 2 Entries
    Result: 2 Entries
    ORDER_SCHEDULE_IN 1 Entry
    Result: 1 Entry
    ORDER_CONDITIONS_IN 0 Entries
    Result: 0 Entries
    ORDER_ITEMS_OUT 0 Entries
    Result: 2 Entries
    ORDER_CFGS_REF 0 Entries
    Result: 0 Entries
    ORDER_CFGS_INST 0 Entries
    Result: 0 Entries
    ORDER_CFGS_PART_OF 0 Entries
    Result: 0 Entries
    ORDER_CFGS_VALUE 0 Entries
    Result: 0 Entries
    ORDER_CFGS_BLOB 0 Entries
    Result: 0 Entries
    ORDER_CCARD 1 Entry
    Result: 1 Entry
    ORDER_CCARD_EX 0 Entries
    Result: 0 Entries
    ORDER_SCHEDULE_EX 0 Entries
    Result: 2 Entries
    ORDER_CONDITION_EX 0 Entries
    Result: 0 Entries
    ORDER_INCOMPLETE 0 Entries
    Result: 0 Entries
    MESSAGETABLE 0 Entries
    Result: 1 Entry
    EXTENSIONIN 0 Entries
    Result: 0 Entries
    PARTNERADDRESSES 1 Entry
    Result: 3 Entries
    WMDVSX 0 Entries
    Result: 0 Entries
    WMDVEX 0 Entries
    Result: 0 Entries
    Z_AVAIL_OUT 0 Entries
    Result: 0 Entries
    ORDER_SCHEDULE_IN2 0 Entries
    Result: 0 Entries
    ORDER_SCHEDULE_EX2 0 Entries
    Result: 0 Entries
    ORDER_ITEMS_IN2 0 Entries
    Result: 1 Entry
    ORDER_PARTNERS2 0 Entries
    Result: 2 Entries

  • BAPI_SALESORDER_SIMULATE-  FREE GOODS - ORDER_CONDITION_EX

    Hi Gurus,
    I am using standard Function module : BAPI_SALESORDER_SIMULATE to simulate pricing conditions.
    I am trying to figure out the reason for the function module:  BAPI_SALESORDER_SIMULATE  not giving values in CONDITIONS EX when I use it to <b>simulate free goods</b> .
    It is only not giving ORDER_CONDITION_EX for <b>free goods</b> materials.
    BAPI   simulates Bill of material, regular orders properly.
    Example : one material has on free good .
    Should give output in ORDER_CONDITION_EX
    It is giving an output in ORDER_ITEMS_OUT  - two  materials line item 10 , 15 .
    However in ORDER_CONDITION_EX it does not return anything , number of entries is zero .
    What could be the reason. What is the correct input for the BAPI for it to give conditions in ORDER_CONDITION_EX  for free goods.
    I know my data  for input are correct as I can make a sale order with the same data.
    Please help me at the earliest to solve this problem.
    <u>BAPI’s  reference : standard  BAPI_SALESORDER_SIMULATE'</u>
    CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'
    EXPORTING
    ORDER_HEADER_IN = order_header_in
    CONVERT_PARVW_AUART = ' '
    DELAY = 0
    IMPORTING
    SALESDOCUMENT =
    ORDER_HEADER_EX =
    SOLD_TO_PARTY =
    SHIP_TO_PARTY =
    BILLING_PARTY =
    RETURN =
    ORDER_HEADER =
    TABLES
    ORDER_ITEMS_IN = order_items_in
    ORDER_PARTNERS = order_partners
    ORDER_SCHEDULE_IN = order_schedule_in
    ORDER_CONDITIONS_IN =
    ORDER_ITEMS_OUT =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CFGS_BLOB =
    ORDER_CCARD =
    ORDER_CCARD_EX =
    ORDER_SCHEDULE_EX =
    ORDER_CONDITION_EX = order_condition_ex
    ORDER_INCOMPLETE =
    MESSAGETABLE = messagetable
    EXTENSIONIN =
    PARTNERADDRESSES =
    WMDVSX =
    WMDVEX =
    AVAIL_OUT =
    ORDER_SCHEDULE_IN2 =
    ORDER_SCHEDULE_EX2 =
    ORDER_ITEMS_IN2 =
    ORDER_PARTNERS2
    <u>Program being developed based on this BAPI</u>
    selection-screen begin of block b1 with frame title text-001.
    parameters : p_kunnr like kna1-kunnr,
    p_matnr like vbap-matnr,
    p_vkorg like vbak-vkorg,
    p_vtweg like vbak-vtweg,
    p_spart like vbak-spart.
    selection-screen end of block b1.
    data: doctype like bapisdhead-doc_type value 'OR',
    itemno like bapiitemin-itm_number value '000010',
    quantity(13) type N value '0000000000001',
    partnertype like knvp-parvw value 'AG'.
    data :count type i.
    data : begin of order_condition_ex occurs 0.
    include structure bapicond.
    data: end of order_condition_ex.
    data: begin of order_header_in.
    include structure bapisdhead.
    data: end of order_header_in.
    data: begin of order_items_in occurs 1.
    include structure bapiitemin.
    data: end of order_items_in.
    data: begin of order_partners occurs 1.
    include structure bapipartnr.
    data:end of order_partners.
    data: begin of order_schedule_in occurs 1.
    include structure bapischdl.
    data:end of order_schedule_in.
    data: begin of messagetable occurs 0 .
    Include structure bapiret2.
    data: end of messagetable.
    order_header_in-doc_type = doctype.
    order_header_in-sales_org = p_vkorg.
    order_header_in-distr_chan = p_vtweg.
    order_header_in-division = p_spart.
    order_header_in-purch_date = sy-datum .
    order_header_in-req_date_h = sy-datum.
    order_items_in-itm_number = itemno.
    order_items_in-material = p_matnr.
    order_items_in-req_qty = quantity.
    append order_items_in.
    order_schedule_in-itm_number = itemno.
    order_schedule_in-req_qty = quantity.
    append order_schedule_in.
    order_schedule_in-req_date = sy-datum.
    order_partners-partn_role = partnertype.
    order_partners-partn_numb = p_kunnr.
    append order_partners.
    order_partners-itm_number = itemno.
    CALL FUNCTION 'Z_BAPI_SALESORDER_SIMULATE'
    EXPORTING
    ORDER_HEADER_IN = order_header_in
    CONVERT_PARVW_AUART = ' '
    DELAY = 0
    IMPORTING
    SALESDOCUMENT =
    ORDER_HEADER_EX =
    SOLD_TO_PARTY =
    SHIP_TO_PARTY =
    BILLING_PARTY =
    RETURN =
    ORDER_HEADER =
    TABLES
    ORDER_ITEMS_IN = order_items_in
    ORDER_PARTNERS = order_partners
    ORDER_SCHEDULE_IN = order_schedule_in
    ORDER_CONDITIONS_IN =
    ORDER_ITEMS_OUT =
    ORDER_CFGS_REF =
    ORDER_CFGS_INST =
    ORDER_CFGS_PART_OF =
    ORDER_CFGS_VALUE =
    ORDER_CFGS_BLOB =
    ORDER_CCARD =
    ORDER_CCARD_EX =
    ORDER_SCHEDULE_EX =
    ORDER_CONDITION_EX = order_condition_ex
    ORDER_INCOMPLETE =
    MESSAGETABLE = messagetable
    EXTENSIONIN =
    PARTNERADDRESSES =
    WMDVSX =
    WMDVEX =
    Z_AVAIL_OUT =
    ORDER_SCHEDULE_IN2 =
    ORDER_SCHEDULE_EX2 =
    ORDER_ITEMS_IN2 =
    ORDER_PARTNERS2

    Hi Eswar  and friends,
    I am using a BAPI :  Z_BAPI_SALESORDER_SIMULATE  , this Bapi is similar to the   BAPI_SALESORDER_SIMULATE . It has customizations that are similar to the customizations done for order  in the SAP system at my organization.
    <b>
    In the Output in the MESSAGETABLE I get the message
    <b>                                                                               
    T      ID                   NUM           MESSAGE                                                                               
    W     V4                   160             Minimum quantity 1 EA of free goods has not been reached                                                                               
    </b>                                                                               
    Please help me with : What is the reason for this message?</b> I am able to make a sale order with the same data      
    <b>I am using exactly the same data in VA01 to create a sale order as I am using to test this BAPI:  Z_BAPI_SALESORDER_SIMULATE </b>
    Please help me at the earliest to solve this problem
    BAPI INPUT :                                                                               
    ORDER_HEADER_IN                              OR          
    CONVERT_PARVW_AUART                                                                               
    Tables                                    Value                                                                               
    ORDER_ITEMS_IN                          1 Entry                                        
    ORDER_PARTNERS                          2 Entries                                      
    ORDER_SCHEDULE_IN                       1 Entry                                        
    ORDER_CONDITIONS_IN                     0 Entries                                      
    ORDER_ITEMS_OUT                         0 Entries                                      
    ORDER_CFGS_REF                          0 Entries                                      
    ORDER_CFGS_INST                         0 Entries                                      
    ORDER_CFGS_PART_OF                 0 Entries                                      
    ORDER_CFGS_VALUE                   0 Entries                                      
    ORDER_CFGS_BLOB                    0 Entries                                      
    ORDER_CCARD                             1 Entry                                        
    ORDER_CCARD_EX                     0 Entries                                      
    ORDER_SCHEDULE_EX                  0 Entries                                      
    ORDER_CONDITION_EX                 0 Entries                                      
    ORDER_INCOMPLETE                   0 Entries                                      
    MESSAGETABLE                       0 Entries                                      
    EXTENSIONIN                        0 Entries                                      
    PARTNERADDRESSES                   1 Entry                                        
    WMDVSX                             0 Entries                                      
    WMDVEX                             0 Entries                                      
    Z_AVAIL_OUT                        0 Entries                                      
    ORDER_SCHEDULE_IN2                 0 Entries                                      
    ORDER_SCHEDULE_EX2                 0 Entries                                      
    ORDER_ITEMS_IN2                    0 Entries                                      
    ORDER_PARTNERS2                    0 Entries                                      
    BAPI Output is :
          Import parameters                   Value                                                                               
    ORDER_HEADER_IN                  OR    I have this filled in                                                                               
    CONVERT_PARVW_AUART                                                                               
    DELAY                               0                                                                               
    Export parameters                   Value                                                                               
    SALESDOCUMENT                                                                               
    ORDER_HEADER_EX                                          OR           
          SOLD_TO_PARTY                            
          SHIP_TO_PARTY                            
          BILLING_PARTY                            
          RETURN                                                                               
    ORDER_HEADER                                                                                OR            SO500750       00/00/0000 00/00/0000                                                        
          Tables                              Value                                                                               
    ORDER_ITEMS_IN                                 1 Entry                                                                               
    Result:                       1 Entry                                                                               
    ORDER_PARTNERS                                 2 Entries                                                                               
    Result:                       2 Entries                                                                               
    ORDER_SCHEDULE_IN                              1 Entry                                                                               
    Result:                       1 Entry                                                                               
    ORDER_CONDITIONS_IN                            0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_ITEMS_OUT                                0 Entries                                                                               
    Result:                       2 Entries                                                                               
    ORDER_CFGS_REF                                 0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_CFGS_INST                                0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_CFGS_PART_OF                             0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_CFGS_VALUE                               0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_CFGS_BLOB                                0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_CCARD                                    1 Entry                                                                               
    Result:                       1 Entry                                                                               
    ORDER_CCARD_EX                                 0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_SCHEDULE_EX                              0 Entries                                                                               
    Result:                       2 Entries                                                                               
    ORDER_CONDITION_EX                             0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_INCOMPLETE                               0 Entries                                                                               
    Result:                       0 Entries                                                                               
    MESSAGETABLE                                   0 Entries                                                                               
    Result:                       1 Entry                                                                               
    EXTENSIONIN                                    0 Entries                                                                               
    Result:                       0 Entries                                                                               
    PARTNERADDRESSES                               1 Entry                                                                               
    Result:                       3 Entries                                                                               
    WMDVSX                                         0 Entries                                                                               
    Result:                       0 Entries                                                                               
    WMDVEX                                         0 Entries                                                                               
    Result:                       0 Entries                                                                               
    Z_AVAIL_OUT                                    0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_SCHEDULE_IN2                             0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_SCHEDULE_EX2                             0 Entries                                                                               
    Result:                       0 Entries                                                                               
    ORDER_ITEMS_IN2                                0 Entries                                                                               
    Result:                       1 Entry                                                                               
    ORDER_PARTNERS2                                0 Entries                                                                               
    Result:                       2 Entries                                                                               
    <b>Additional Note  :</b>
    <b>Checking  CONDITIONS EX , for free goods</b>
    I am using  Function module :Z_BAPI_SALESORDER_SIMULATE to simulate pricing conditions.
    I am trying to figure out the reason for the function module: Z_BAPI_SALESORDER_SIMULATE not giving values in CONDITIONS EX when I use it to simulate free goods .
    It is only not giving ORDER_CONDITION_EX for free goods materials.
    BAPI simulates Bill of material, regular orders properly.
    Example : one material has on free good .
    Should give output in ORDER_CONDITION_EX
    It is giving an output in ORDER_ITEMS_OUT - two materials line item 10 , 15 .
    However in ORDER_CONDITION_EX it does not return anything , number of entries is zero .
    I<b> know my data for input are correct as I can make a sale order with the same data.</b>

  • Rebates Payout as Free Goods

    Hi All,
    I have searched for this topic in the forum but i couldn't get any concrete answers.
    I have a scenario where we need to payout rebates to Customers in the form of free goods.
    So if customer purchases qty of 100 units in multiple orders in a given time frame he is eligible to receive 10 EA free.
    How can we generate a free good order instead of Credit memo while settling rebates?

    Hi Ankit
    There is no such utility in SAP standard. We also had same requirement in my previous company and for meeting this requirement we developed an ABAP application. We maintained main item and free item material in a condition type and at end of the month that program checked the selling quantity of main item and created FOC order for free good material. This is the way we did and many other clients are following this approach.
    Thank$

  • Use FM SD_SALESDOCUMENT_CREATE for creating free goods line items

    Dear Experts,
    I have created a program for uploading Sales Order details using FM "SD_SALESDOCUMENT_CREATE".
    The program successfully creates Sales Orders.
    Now the problem is with the materials which is a free goods item.
    i.e. if I enter a material say 'XYZ' which has a 20% free goods then if I enter quantity as 10 then it has to create 2 line items where in 1st line item will have 8 as qty. with value and 2nd line item will have 2 as qty with no value.
    It successfully happens when I create Sales Order using tcode VA01.
    *&      Form  CREATE_SALES_ORDER
    FORM create_sales_order.
      head_flg = 'T'.
      LOOP AT t_socreate02 INTO w_socreate02.
        CLEAR : vbeln, spart, bstnk, bstdk,
                w_itemin, w_iteminx, w_partnr.
        MOVE : w_socreate02-vbeln TO vbeln,
               w_socreate02-spart TO spart,
               w_socreate02-bstnk TO bstnk,
               w_socreate02-bstdk TO bstdk.
        AT NEW vbeln.
          CLEAR : w_sdhead, w_sdheadx.
    **Transferring Header Details
          MOVE : 'ZODF'   TO w_sdhead-doc_type,   "Default
                 'L001'   TO w_sdhead-sales_org,  "Default
                 '01'     TO w_sdhead-distr_chan, "Default
                 spart    TO w_sdhead-division,
                 bstdk    TO w_sdhead-purch_date,
                 sy-datum TO w_sdhead-req_date_h,
                 bstnk    TO w_sdhead-purch_no_c.
          MOVE : 'I' TO w_sdheadx-updateflag,
                 'X' TO w_sdheadx-doc_type,
                 'X' TO w_sdheadx-sales_org,
                 'X' TO w_sdheadx-distr_chan,
                 'X' TO w_sdheadx-division,
                 'X' TO w_sdheadx-purch_date,
                 'X' TO w_sdheadx-req_date_h,
                 'X' TO w_sdheadx-purch_no_c.
        ENDAT.
    **Transferring Item Details
        MOVE : w_socreate02-posnr TO w_itemin-itm_number,
               w_socreate02-matnr TO w_itemin-material,
               w_socreate02-zmeng TO w_itemin-target_qty.
        APPEND w_itemin TO t_itemin.
        MOVE : w_socreate02-posnr TO w_iteminx-itm_number,
               'I'                TO w_iteminx-updateflag,
               'X'                TO w_iteminx-material,
               'X'                TO w_iteminx-target_qty.
        APPEND w_iteminx TO t_iteminx.
    **Transferring Partner Function Details
        CLEAR : w_partnr.
        MOVE : 'AG'                    TO w_partnr-partn_role, "Sold-to-Party
               w_socreate02-sold_party TO w_partnr-partn_numb.
        APPEND w_partnr TO t_partnr.
        CLEAR : w_partnr.
        MOVE : 'WE'                    TO w_partnr-partn_role, "Ship-to-Party
               w_socreate02-ship_party TO w_partnr-partn_numb.
        APPEND w_partnr TO t_partnr.
    **Transferring Schedule Line Details
    *Schedule Line 1
        CLEAR : w_schedulesin, w_schedulesinx.
        MOVE : w_socreate02-posnr   TO w_schedulesin-itm_number,
               '0001'               TO w_schedulesin-sched_line,
               w_socreate02-edatu01 TO w_schedulesin-req_date,
               w_socreate02-edatu01 TO w_schedulesin-dlv_date,
               w_socreate02-wmeng01 TO w_schedulesin-req_qty.
        APPEND w_schedulesin TO t_schedulesin.
        MOVE : w_socreate02-posnr   TO w_schedulesinx-itm_number,
               '0001'               TO w_schedulesinx-sched_line,
               'I'                  TO w_schedulesinx-updateflag,
               'X'                  TO w_schedulesinx-req_date,
               'X'                  TO w_schedulesinx-dlv_date,
               'X'                  TO w_schedulesinx-req_qty.
        APPEND w_schedulesinx TO t_schedulesinx.
    *Schedule Line 2
        IF NOT w_socreate02-wmeng02 IS INITIAL.
          CLEAR : w_schedulesin, w_schedulesinx.
          MOVE : w_socreate02-posnr   TO w_schedulesin-itm_number,
                 '0002'               TO w_schedulesin-sched_line,
                 w_socreate02-edatu02 TO w_schedulesin-req_date,
                 w_socreate02-edatu02 TO w_schedulesin-dlv_date,
                 w_socreate02-wmeng02 TO w_schedulesin-req_qty.
          APPEND w_schedulesin TO t_schedulesin.
          MOVE : w_socreate02-posnr   TO w_schedulesinx-itm_number,
                 '0002'               TO w_schedulesinx-sched_line,
                 'I'                  TO w_schedulesinx-updateflag,
                 'X'                  TO w_schedulesinx-req_date,
                 'X'                  TO w_schedulesinx-dlv_date,
                 'X'                  TO w_schedulesinx-req_qty.
          APPEND w_schedulesinx TO t_schedulesinx.
        ENDIF.
    *Schedule Line 3
        IF NOT w_socreate02-wmeng03 IS INITIAL.
          CLEAR : w_schedulesin, w_schedulesinx.
          MOVE : w_socreate02-posnr   TO w_schedulesin-itm_number,
                 '0003'               TO w_schedulesin-sched_line,
                 w_socreate02-edatu03 TO w_schedulesin-req_date,
                 w_socreate02-edatu03 TO w_schedulesin-dlv_date,
                 w_socreate02-wmeng03 TO w_schedulesin-req_qty.
          APPEND w_schedulesin TO t_schedulesin.
          MOVE : w_socreate02-posnr   TO w_schedulesinx-itm_number,
                 '0003'               TO w_schedulesinx-sched_line,
                 'I'                  TO w_schedulesinx-updateflag,
                 'X'                  TO w_schedulesinx-req_date,
                 'X'                  TO w_schedulesinx-dlv_date,
                 'X'                  TO w_schedulesinx-req_qty.
          APPEND w_schedulesinx TO t_schedulesinx.
        ENDIF.
    *Schedule Line 4
        IF NOT w_socreate02-wmeng04 IS INITIAL.
          CLEAR : w_schedulesin, w_schedulesinx.
          MOVE : w_socreate02-posnr   TO w_schedulesin-itm_number,
                 '0004'               TO w_schedulesin-sched_line,
                 w_socreate02-edatu04 TO w_schedulesin-req_date,
                 w_socreate02-edatu04 TO w_schedulesin-dlv_date,
                 w_socreate02-wmeng04 TO w_schedulesin-req_qty.
          APPEND w_schedulesin TO t_schedulesin.
          MOVE : w_socreate02-posnr   TO w_schedulesinx-itm_number,
                 '0004'               TO w_schedulesinx-sched_line,
                 'I'                  TO w_schedulesinx-updateflag,
                 'X'                  TO w_schedulesinx-req_date,
                 'X'                  TO w_schedulesinx-dlv_date,
                 'X'                  TO w_schedulesinx-req_qty.
          APPEND w_schedulesinx TO t_schedulesinx.
        ENDIF.
    *Schedule Line 5
        IF NOT w_socreate02-wmeng05 IS INITIAL.
          CLEAR : w_schedulesin, w_schedulesinx.
          MOVE : w_socreate02-posnr   TO w_schedulesin-itm_number,
                 '0005'               TO w_schedulesin-sched_line,
                 w_socreate02-edatu05 TO w_schedulesin-req_date,
                 w_socreate02-edatu05 TO w_schedulesin-dlv_date,
                 w_socreate02-wmeng05 TO w_schedulesin-req_qty.
          APPEND w_schedulesin TO t_schedulesin.
          MOVE : w_socreate02-posnr   TO w_schedulesinx-itm_number,
                 '0005'               TO w_schedulesinx-sched_line,
                 'I'                  TO w_schedulesinx-updateflag,
                 'X'                  TO w_schedulesinx-req_date,
                 'X'                  TO w_schedulesinx-dlv_date,
                 'X'                  TO w_schedulesinx-req_qty.
          APPEND w_schedulesinx TO t_schedulesinx.
        ENDIF.
        AT END OF vbeln.
          PERFORM bapi_salesorder.
          CLEAR : t_itemin[], t_iteminx[], t_partnr[],
                  t_schedulesin[], t_schedulesinx[],
                  sdno, head_flg.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " CREATE_SALES_ORDER
    *&      Form  BAPI_SALESORDER
    FORM bapi_salesorder.
      CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
      CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
        EXPORTING
          sales_header_in       = w_sdhead
          sales_header_inx      = w_sdheadx
          testrun               = p_test
          status_buffer_refresh = 'X'
        IMPORTING
          salesdocument_ex      = sdno
        TABLES
          return                = t_return
          sales_items_in        = t_itemin
          sales_items_inx       = t_iteminx
          sales_partners        = t_partnr
          sales_schedules_in    = t_schedulesin
          sales_schedules_inx   = t_schedulesinx.
      IF p_test <> 'X'.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      ENDIF.
      IF head_flg = 'T' AND p_test = 'X'.
        WRITE :/40 '** E X E C U T E D - I N - T E S T - M O D E **' COLOR 2.
      ELSEIF head_flg = 'T' AND p_test = ' '.
        WRITE :/40 '** E X E C U T E D - I N - U P D A T E - M O D E **' COLOR 2.
      ENDIF.
      IF head_flg = 'T'.
        SKIP 1.
        ULINE /2(139).
        WRITE :/2 sy-vline,
                3 'Dummy SalesOrder No.' COLOR 1,
               23 sy-vline,
               24 'Generated SalesOrder No.' COLOR 1,
               48 sy-vline,
               49  'Return Message' COLOR 1,
              140 sy-vline.
        ULINE /2(139).
      ENDIF.
      IF sdno IS INITIAL.
        DELETE t_return WHERE type <> 'E'.
        IF NOT t_return[] IS INITIAL.
          LOOP AT t_return INTO w_return WHERE type = 'E'.
            WRITE :/2 sy-vline,
                    5 w_socreate02-vbeln,
                   23 sy-vline,
                   28 sdno,
                   48 sy-vline,
                   49 w_return-message COLOR 6 INVERSE,
                  140 sy-vline.
          ENDLOOP.
        ELSE.
          WRITE :/2 sy-vline,
                  5 w_socreate02-vbeln,
                 23 sy-vline,
                 28 sdno,
                 48 sy-vline,
                 49 'Sales Order can be processed SUCCESSFULLY' COLOR 7 INVERSE,
                140 sy-vline.
        ENDIF.
      ELSE.
        WRITE :/2 sy-vline,
                5 w_socreate02-vbeln,
               23 sy-vline,
               28 sdno,
               48 sy-vline,
               49 'Sales Order created SUCCESSFULLY !!' COLOR 5 INVERSE,
              140 sy-vline.
      ENDIF.
      ULINE /2(139).
    ENDFORM.                    " BAPI_SALESORDER

    No reply so closed the thread.

Maybe you are looking for

  • Last two letters do not print

    I have a formula column cf_1 in my report 'purchase order'which actually converts the numeric value of a summary column 'AMOUNT' to the character form.This is to show the amount both in words&numerical figures.Next to cf_1 I have attached a text stri

  • BarCode scaners in Java Application

    Hi, i m interested in learning how to interface BarCode Scanners in Java application can ne one give me code snippest for the same ? i want the scanned value to appear on the selected JtextField.. please help me out.. Thanx in advance Bye

  • Flash Image Gallery

    I purchased the Flash Image Gallery Extension. Installed and created several beautiful working galleries. In my image gallery (link below) there are Category titles 176, 186, etc.. When you click the titles it changes the thumbnail pictures, while th

  • Printable Page behaviour

    Hi all, I have table which has 15+ number of columns and each column has width of more than 90px. When i am using printable page behaviour the printable page is showing all the columns of table but when i am extracting a hard copy out of it, i am not

  • Why won't this show (same) four pages in the Adobe Reader?

    %PDF-1.6 3 0 obj <</Type /Font /BaseFont /Times-Italic /Subtype /Type1 >> endobj 6 0 obj <</Length 158 >> stream 1 0 0 1 50 200 cm /X1 Do 1 0 0 1 0   200 cm /X1 Do 1 0 0 1 0   200 cm /X1 Do 1 0 0 1 200 -400 cm /X1 Do 1 0 0 1 0 200 cm /X1 Do 1 0 0 1 0