on 03-21-2006 6:41 PM
Hai friends,
Thanks to the replies for my previous doubts.
I have doubts in the BAPI, BAPI_PO_CREATE1.
the error is "Please enter Reason for ord."
But i give the reason for order(001) in item data and update the field aslo in itemx table also. still i am getting the error. What is the solution for this?
plz, if u know post it to me.
thanks,
Elamaran
Please post the code.
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The coding of my program is:
*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.
*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 'V130' ,
doctyp LIKE header-doc_type DEFAULT 'NB' ,
cdate LIKE header-creat_date DEFAULT sy-datum ,
vendor LIKE header-vendor DEFAULT '0000001390',
pur_org LIKE header-purch_org DEFAULT 'U001' ,
pur_grp LIKE header-pur_group DEFAULT 'VM8' .
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 '00001',
material LIKE item-material DEFAULT '100039' ,
plant LIKE item-plant DEFAULT 'V700' ,
quantity LIKE item-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-comp_code = company .
header-doc_type = doctyp .
header-creat_date = cdate .
header-doc_date = '20060321'.
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.
item-order_reason = '001'.
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 .
ITEM-ORDER_REASON = 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 =
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
return = return
poitem = item
poitemx = itemx.
BREAK-POINT.
*&----
-
-
-
-
-
-
*
*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 / return-message.
ENDLOOP.
Here is your problem
*&---------------------------------------------------------------------*
*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 .
<b>*ITEM-ORDER_REASON = c_x. <---problem</b>
<b>ITEM<u>X</u>-ORDER_REASON = c_x. <---should have been this</b>
itemx-tax_code = c_x .
itemx-item_cat = c_x .
itemx-acctasscat = c_x .
APPEND itemx.
Please see the following.....
*&---------------------------------------------------------------------*
*POPULATE ITEM DATA.
*&---------------------------------------------------------------------*
item-po_item = item_num.
item-material = material.
item-plant = plant.
item-quantity = quantity.
item-order_reason = '001'.
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 .
<b> item-order_reason = c_x.</b>
itemx-tax_code = c_x .
itemx-item_cat = c_x .
itemx-acctasscat = c_x .
append itemx.
Notice in BOLD, that the field that you are filling here is the ITEM structure not the ITEMX structure.
REgards,
Rich Heilman
Is '001' a valid value for order reason?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you want in this custom function module? Can it be called from the regular ME21N user exit? If so, then you can just call it there and the BAPI will do the same call. Using the BAPI to create the PO goes through the same logic, same config, same user exits as creating a PO from ME21N. I hope that clears.
Srinivas
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.