‎2008 Feb 05 1:25 PM
"E 06 436 In case of account assignment, please enter acc. assignment data for item"
can any one help me to solve the above, which I am getting while creating PO using BAPI : BAPI_PO_CREATE1.
I followed the mapping which is there in the SAP note: 420332.
Still it gives the error :Kindly help me to resolve this.
Thanks in advance!
ben.
‎2008 Feb 05 1:42 PM
hi, chk this.
***********************************************************************
** Program ID :
** Program Desc : PO Creation Using BAPI
** Process Overview :
** Created By : P.KARTHIKEYAN
** Created Date : 25/10/2006
** Company Name : Infoview Technologies Limited
************************************************************************
&----
*& Report ZBAPI_CREATE_PO *
*& *
&----
REPORT ZBAPI_CREATE_PO .
&----
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE BAPIMEPOHEADER ,
HEADERX LIKE BAPIMEPOHEADERX .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM LIKE BAPIMEPOITEM OCCURS 0 WITH HEADER LINE,
ITEMX LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
**Internal table to hold messages from BAPI call
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
data : w_header(40) value 'PO Header'.
data : ws_langu like sy-langu.
data: V_EXPPURCHASEORDER like BAPIMEPOHEADER-PO_NUMBER.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code default '1000' ,
doctyp like HEADER-DOC_TYPE default 'NB' ,
cdate like HEADER-CREAT_DATE default sy-datum ,
vendor like HEADER-VENDOR default 'RAJ',
pur_org like HEADER-PURCH_ORG default '0001' ,
pur_grp like HEADER-PUR_GROUP default '001' .
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like ITEM-PO_ITEM default '00020',
material like ITEM-MATERIAL default 'M-127' ,
plant like ITEM-PLANT default '0001' ,
quantity like ITEM-QUANTITY default 200.
selection-screen end of block b2.
*&----
**START-OF-SELECTION.
*&----
**DATA POPULATION
*&----
ws_langu = sy-langu. "Language variable
*POPULATE HEADER DATA FOR PO
HEADER-COMP_CODE = company .
HEADER-DOC_TYPE = doctyp .
HEADER-CREAT_DATE = cdate .
HEADER-VENDOR = vendor .
HEADER-LANGU = ws_langu .
HEADER-PURCH_ORG = pur_org .
HEADER-PUR_GROUP = pur_grp .
&----
*POPULATE HEADER FLAG.
&----
HEADERX-comp_code = c_x.
HEADERX-doc_type = c_x.
HEADERX-creat_date = c_x.
HEADERX-vendor = c_x.
HEADERX-langu = c_x.
HEADERX-purch_org = c_x.
HEADERX-pur_group = c_x.
*HEADERX-doc_date = c_x.
&----
*POPULATE ITEM DATA.
&----
ITEM-PO_ITEM = item_num.
ITEM-MATERIAL = material.
ITEM-PLANT = plant.
ITEM-QUANTITY = quantity.
APPEND ITEM.
&----
*POPULATE ITEM FLAG TABLE
&----
ITEMX-PO_ITEM = item_num.
ITEMX-MATERIAL = C_X.
ITEMX-PLANT = C_X .
*ITEMX-STGE_LOC = C_X .
ITEMX-QUANTITY = C_X .
*ITEMX-TAX_CODE = C_X .
*ITEMX-ITEM_CAT = C_X .
*ITEMX-ACCTASSCAT = C_X .
APPEND ITEMX.
&----
*BAPI CALL
&----
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = HEADER
POHEADERX = HEADERX
POADDRVENDOR =
TESTRUN =
IMPORTING
EXPPURCHASEORDER = V_EXPPURCHASEORDER
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN
POITEM = ITEM
POITEMX = ITEMX.
&----
*Confirm the document creation by calling database COMMIT
&----
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
.
end-of-selection.
***&----
****Output the messages returned from BAPI call
***&----
*LOOP AT RETURN.
WRITE / v_EXPPURCHASEORDER.
*ENDLOOP.
cheers,
Hema.
‎2008 Feb 05 1:49 PM
Hello Beson.,
This error is due to you are not passing to the table POACCOUNT and POACCOUNTX to the BAPI.
If the EKPO-KNTTP is filled with any of the value A,K etc then u need to fill data to the above tables.
Cheers,
Vasanth
‎2008 Feb 05 2:14 PM
hi
good
You might want to debug the program. This is step by step to do this.
1. Run txn SM30. Enter table T100. Display message class 06 with message number 436.
2. Click on message number 436, then do cross reference.
3. Put a break point at the Abaps that use this message.
4. Execute the Bapi again.
thanks
mrutyun^
‎2008 Feb 06 1:18 PM
Hi Everyone,
Thanks for responding to my query.
I solved the issue by debugging.
Don't get too worried, there is an easy way to solve this if you get issues like this. See I was able to create a service PO from ME21N transaction. As you know service PO needs Service lines to be created it's mandatory. Here were my error is.
SAP from front end is using a hierarchical method of creating service lines. Not sure this is always like this!!!
The way you can figure out is ..go and create a PO from front end. use that PO number in BAPI_PO_GETDETAIL.
See the values it returns in the associated tables. Compare these values with your mapping in data load program. Then make the necessary changes. Of course there are things needs to be changed in Both Service line structure and Account structure. good luck
Many Thanks!
Reagards,
ben.
‎2008 Feb 06 1:20 PM