Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Kudos

Dear All,

I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating Sales order.

It creates the sales order But when I go for display Sales order there it shows " BLOCKED FOR DELIVERY".

I am unable to keep this filed  empty.

What & to which parameter value should I pass in this BAPI to get the Deliver Block filed in VA03 as empty..

With Regards,

Akshay

14 REPLIES 14

former_member186055
Active Participant

Hi Akshay,

Please check the FM importing parameter ORDER_HEADER_IN pass value 'X' for field COMPL_DLV.

Regards,

SuryaPraveen.

Former Member
0 Kudos

Hi,

Try creating a sales order manually in the same system and check whether the sales order is going for delivery block. Configuration settings are present in SAP to push the sales order to delivery block based on several condition.

Cheers

~Niranjan

0 Kudos

Dear Surya/Niranjan,

Thanks for you responses..

Surya I tried but still it is not working..

The Delivery Block in Va03 i showing "Blocked for Delivery".

I want to set it as empty .

Niranajan I have tried Va01 manually , it is not having default "Blocked for Delivery" status.

Still my hunt continues .

With Regards,

Akshay


0 Kudos

Akshay,

* Commit the work.

    COMMIT WORK.

Regards,

SuryaPraveen

0 Kudos

Hi Akshay,

Can you copy and paste your code here, I mean the BAPI call and how its parameters are filled?

Thanks,

Mahesh

0 Kudos

Dear Surya,

It is creating Sales order but with BLOCKED for DELIVERY STATUS

I want to make the Delivery Block as Empty in VA03.

With Regards,

Akshay

0 Kudos

*"----------------------------------------------------------------------

*"*"Local interface:

*"  IMPORTING

*"     VALUE(SALES_ORG) TYPE  VKORG

*"     VALUE(DISTRIBUTION_CHANNEL) TYPE  VTWEG

*"     VALUE(DIVISION) TYPE  SPART

*"     VALUE(CUTOMER_NUMBER) TYPE  KUNNR

*"  EXPORTING

*"     VALUE(SALESDOCUMENT) TYPE  BAPIVBELN-VBELN

*"  TABLES

*"      ITEMS STRUCTURE  ZSD_ITEM_EKAUFF

*"      ZRETURN STRUCTURE  BAPIRET2 OPTIONAL

*"----------------------------------------------------------------------

data:  itemnum like vbap-posnr,

        order_header_in like bapisdhd1,

        order_items_in  like bapisditm occurs 0 with header line,

        order_partners  like bapiparnr occurs 0 with header line,

        order_schedules_in like bapischdl occurs 0 with header line,

        order_schedules_inx like bapischdlx occurs 0 with header line.

* Header Data Initilization.................

order_header_in-doc_type   = 'ZKOR'.

order_header_in-sales_org  = sales_org.

order_header_in-distr_chan = distribution_channel.

order_header_in-division   = division.

order_header_in-compl_dlv = 'X'.

* Partner Function Initilization............

order_partners-partn_role = 'SP'.

order_partners-partn_numb = cutomer_number.

append order_partners.

clear order_partners.

order_partners-partn_role = 'WE'.

order_partners-partn_numb = cutomer_number.

append order_partners.

clear order_partners.

* Item Data.............

itemnum = 000000.

loop at items.

   move items-material   to order_items_in-material.

   move items-batch      to order_items_in-batch.

   move items-plant      to order_items_in-plant.

   move items-store_loc  to order_items_in-store_loc.

   move items-target_qty to order_items_in-target_qty.

*  MOVE ITEMS-TARGET_QTY TO ORDER_ITEMS_IN-COMP_QUANT.

   move items-target_qu  to order_items_in-target_qu.

   append order_items_in.

   clear  order_items_in.

   itemnum = itemnum + 10.

   move itemnum to order_schedules_in-itm_number.

   move items-target_qty to order_schedules_in-req_qty.

*  Testing Starts....

*  MOVE '06' TO ORDER_SCHEDULES_IN-REQ_DLV_BL.

*       ORDER_SCHEDULES_INX-REQ_DLV_BL = 'X'.

*       APPEND ORDER_SCHEDULES_INX.

*  Testing end....

   append order_schedules_in.

   clear order_schedules_in.

endloop.

call function 'BAPI_SALESORDER_CREATEFROMDAT2'

   exporting

*   SALESDOCUMENTIN               =

     order_header_in               = order_header_in

*   ORDER_HEADER_INX              =

*   SENDER                        =

*   BINARY_RELATIONSHIPTYPE       =

*   INT_NUMBER_ASSIGNMENT         =

*   BEHAVE_WHEN_ERROR             =

*   LOGIC_SWITCH                  =

*   TESTRUN                       =

*   CONVERT                       = ' '

   importing

     salesdocument                 = salesdocument

   tables

     return                        = zreturn

     order_items_in                = order_items_in

*   ORDER_ITEMS_INX               =

     order_partners                = order_partners

     order_schedules_in            = order_schedules_in

*   ORDER_SCHEDULES_INX           = ORDER_SCHEDULES_INX

*   ORDER_CONDITIONS_IN           =

*   ORDER_CONDITIONS_INX          =

*   ORDER_CFGS_REF                =

*   ORDER_CFGS_INST               =

*   ORDER_CFGS_PART_OF            =

*   ORDER_CFGS_VALUE              =

*   ORDER_CFGS_BLOB               =

*   ORDER_CFGS_VK                 =

*   ORDER_CFGS_REFINST            =

*   ORDER_CCARD                   =

*   ORDER_TEXT                    =

*   ORDER_KEYS                    =

*   EXTENSIONIN                   =

*   PARTNERADDRESSES              =

  .

if sy-subrc = 0.

call function 'BAPI_TRANSACTION_COMMIT'

* EXPORTING

*   WAIT          =

* IMPORTING

*   RETURN        =

           .

endif.

0 Kudos

Akshay,

Please check importing parameter, ORDER_HEADER_INX (BAPISDHD1X-DLV_BLOCK) pass this value 'X'. and check all other parameters.

I think you need to pass ORDER_HEADER_INX this importing parameter also, by selecting the check boxes whatever the fields you are updating in ORDER_HEADER_IN parameter.

order_header_inx-doc_type   = 'X'.

order_header_inx-sales_org  = 'X'.

order_header_inx-distr_chan = 'X'.

order_header_inx-division   = 'X'.

order_header_inx-compl_dlv = 'X'.

Regards,

SuryaPraveen.

0 Kudos

Dear Surya,

I have passed that also..

You can go through the piece of code posted below..

With Regards,

Akshay

0 Kudos

Akshay,

I'm saying Importing Parameters not in Table Parameters.

data: order_header_inx like bapisdhd1x.

order_header_inx-doc_type   = 'X'.

order_header_inx-sales_org  = 'X'.

order_header_inx-distr_chan = 'X'.

order_header_inx-division   = 'X'.

order_header_inx-compl_dlv = 'X'.

For your reference, Please check this.

Regards,

SuryaPraveen

0 Kudos

Hi Akshay,

Since it is only happening in the BAPI scenario I would debug and set a watchpoint on VBAK-LIFSK with the condition of <> '  '.  This will trigger the debugger to stop where the value is being set to something other than blank. 

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi :

     The sales order need a approval before do DN PGI. I think there is some approval setting for the sales document. it's not issue of this BAPI. You may check the IMG setting for this.

Regards

Jay

0 Kudos

Hi Akshay,

I think you better check with your functional consultant just as Jay suggested. This is more of an SPRO setting/exit check rather than the way you've used your BAPI.

Cheers,

Mahesh

Former Member
0 Kudos

Dear All,

It got resolved by making changes in SPRO...

With Regards,

Akshay