Skip to Content
0
Former Member
Jul 16, 2007 at 11:02 AM

Error in CRMXIF_ORDER_SAVE - Urgent

35 Views

I'm Creating a sales order in CRM using CRMXIF_ORDER_SAVE, my program is giving synthetically correct, but when i'm going to activate, it gves Inconsistency between Ditonary type CRMXIF_BUSTRANS_ITEM_T and CRMXIF_BUSTRANS_ITEM.

Please can anyone help me on this.

Thanxs

&----


*& Report Z_SALESORDER_CREATE *

*& *

&----


*& *

*& *

&----


  • Description : program to create Sales Order using BAPI.

REPORT Z_SALESORDER_CREATE .

TABLES : CRMD_ORDERADM_H , CRMD_ORDERADM_I .

*DATA DECLARATION

CONSTANTS : C_X VALUE 'X'.

*Structures to hold PO header data

*DATA : HEADER TYPE STANDARD TABLE OF CRMXIF_BUSTRANS WITH HEADER LINE ,

  • RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

*

data : header type CRMXIF_BUSTRANS_T with header line,

return like bapiret2 occurs 0 with header line.

data : it_item type STANDARD TABLE OF CRMXIF_BUSTRANS_ITEM,

wa_item like line of it_item.

*data : wa_item type CRMXIF_BUSTRANS_ITEM

*DATA : IT_ITEM TYPE STANDARD TABLE OF CRMXIF_BUSTRANS_ITEM ,

  • WA_ITEM TYPE CRMXIF_BUSTRANS_ITEM.

data : ws_langu like sy-langu.

  • Parameters

selection-screen begin of block b1 with frame title text-001.

parameters : proc_tp like header-PROCESS_TYPE default 'YOR1',

doc_date like header-POSTING_DATE default sy-datum,

logsysfi like header-LOGICAL_SYSTEM default 'CRDCLNT220'.

  • co_code like header-co_code default '0103',

  • p_sold TYPE kunnr default '2000000060',

  • p_ship TYPE kunnr default '2000000060'.

selection-screen end of block b1.

selection-screen begin of block b2 with frame title text-002.

*parameters : item_num like IT_ITEM-ITEM_NUMBER default '00001',

  • material like IT_ITEM-product_id default '300000020' .

  • quantity like it_ITEM-TOTAL_QUANTITY default 10.

parameters : item_num TYPE CRMT_ITEM_NO default '00001',

material TYPE COMT_PRODUCT_ID default '300000020' .

  • quantity like it_ITEM-TOTAL_QUANTITY default 10.

selection-screen end of block b2.

&----


START-OF-SELECTION.

&----


*DATA POPULATION

&----


ws_langu = sy-langu. "Language variable

*POPULATE HEADER DATA FOR PO

HEADER-PROCESS_TYPE = PROC_TP.

HEADER-POSTING_DATE = sy-datum.

HEADER-LOGICAL_SYSTEM = LOGSYSFI.

&----


*POPULATE HEADER FLAG.

&----


*HEADERX-PARENT_GUID = c_x.

*HEADERX-doc_date = c_x.

&----


*POPULATE ITEM DATA.

&----


wa_ITEM-ITEM_number = item_num.

wa_ITEM-product_id = material.

*wa_ITEM-TOTAL_QUANTITY = 10.

append wa_item to it_item.

HEADER-ITEM = IT_ITEM.

*wa_ITEM-ITEM_number = '10'.

*wa_ITEM-product_id = '000000000300000020'.

*wa_ITEM-QUANTITY = quantity.

*

*append wa_item to it_item.

&----


*BAPI CALL

&----


*

CALL FUNCTION 'CRMXIF_ORDER_SAVE'

EXPORTING

data = header

  • IMPORTING

  • RETURN =

.

&----


*Confirm the document creation by calling database COMMIT

&----


*CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

**end-of-selection.

**&----


***Output the messages returned from BAPI call

**&----


LOOP AT RETURN.

WRITE / RETURN-MESSAGE.

ENDLOOP.