Purpose of EXTENSIONIN - structure in BAPI_BUSPROCESSND_CREATEMULTI
Hi,
Could anyone please explain the purpose of the structure EXTENSIONIN - ( Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT ) in the BAPI BAPI_BUSPROCESSND_CREATEMULTI.
I was under the impression that this structure could be used to populate any Z fields that might have been created using EEWB. But going through some of the threads in this forum, I understand that to populate the custom fields created using EEWB, we use certain function modules such as CRM_CUSTOMER_H_MAINTAIN_OW .. etc.
I'm still confused as to how we go about populating the custom fields created using EEWB. I'd greatly appreciate if anyone could explain me the process in breif.
Thanks,
Sahil
Hi Kapil,
I totally agree with you that in the normal circumstances the replication is complete. And it is the case if I create a contract where the Home Assistance is the last item...
But when I create a contract with 3 items (10 = Electricity (new customer so a workflow is started and no replication is needed yet); 20 = Home Assistance (should be replicated to SD); 30 = Gas (new customer so a workflow is started and no replication is needed yet)) then the item 20 is not replicated...
I changed the order of the contract (within the program) and if I create the contract with the following order (10 = Electricity (new customer so a workflow is started and no replication is needed yet); 20 = Gas (new customer so a workflow is started and no replication is needed yet); 30 = Home Assistance (should be replicated to SD)), then the Home Assistance is replicated fine...
It is a very strange problem... replication works fine in all cases, just not in this order....
Thanks for the tip anyhow!!
Micha
Similar Messages
-
Purpose of Append Structure in DDIC(SE11)
What is the purpose of Append Structure in DDIC(SE11)-Table?How to use this?
Title by: Alvaro Tejada Galindo on Jan 23, 2008 6:11 PMAppend structures are like user exits provided by SAP to enhance the Standard tables. It behaves like include structure only, but this append structure is taken care in the SAP version upgrage process, automatically. The name of append structure starts with 'Z' namespace..SAP by default proposes the append structure name with the table name prefixed with 'Z'.
It is always recommended to modiy or append the Standard tables using append structure.
It is the standard provided for SAP standard table enhancement.
APPEND STRUCTURE->
Append structures are used for enhancements that are not included in the standard. This includes special developments, country versions and adding customer fields to any tables or structures.
An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure.
The following enhancements can be made to a table or structure TAB with an append structure:
· Insert new fields in TAB,
· Define foreign keys for fields of TAB that already exist,
· Attach search helps to fields of TAB that already exist,
These enhancements are part of the append structure, i.e. they must always be changed and transported with the append structure.
When a table or structure is activated, all the append structures of the table are searched and the fields of these append structures are added to the table or structure. Foreign keys and search help attachments added using the append structure are also added to the table. If an append structure is created or changed, the table or structure assigned to it is also adjusted to these changes when the append structure is activated.
Since the order of the fields in the ABAP Dictionary can differ from the order of the fields on the database, adding append structures or inserting fields in such append structures does not result in a table conversion.
The customer creates append structures in the customer namespace. The append structure is thus protected against overwriting during an upgrade. The fields in the append structure should also reside in the customer namespace, that is the field names should begin with ZZ or YY. This prevents name conflicts with fields inserted in the table by SAP.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm
INCLUDE->
http://www.sapdb.org/7.4/htmhelp/f2/b1219d1b9646b0ae248a7a5a95a33e/content.htm -
hi
can u please tell me what is the purpose of VBDKR structure ?
From where does the data comes into VBDKR structure ?
in program if we write VBDKR-VBLELN, how will the value comes into the VBDKR-VBELN
thanks in advanceHi pavan,
VBDKR sturcture is used to Document Header View for Billing .
Structure will never have any entries or data with in it. It can be used to define types as reference.
If VBDKR-VBLELN is getting any data means, that structure name would have used as internal table name or any other variable name.
Regards,
Kusuma. -
What is the significance of 'APPREND STRUCTURE' button in a table?
Hello friends
When I go to SE11 to create a table, I see a button 'APPEND STRUCTURE'. I played with it and also have noticed people definiing a structure inside the same structure (recursively).
Why do we need 'APPEND Structure'. if it is for recursive purpose, can't be just use the internal table while coding in ABAP.
I would appreciate if some one can clarify my doubt.
Thanks
RamCheck out the below related thread
Purpose of Append Structure in DDIC(SE11)
Append Structure
Regards,
Santosh -
Purchase Order (BAPI_PO_CREATE! -- EXTENSIONIN)
Hi people!!
I want to create purchase order with the BAPI BAPI_PO_CREATE1, but i have to populated some fields of EKKO table that they are´nt in BAPI and i have to used the EXTENSIONIN structure.
Some example?
This Bapi saved this fields with EXTENSIONIN or
do i have to do something more?
Sorry, but my english is very short and very poor,
Thanks and kind regards,...Hi Juan,
To use the extension in structure:
Declare a local structure (say 'mystruct') with the type of the structure that contains the fields you want to add (it may be declared in the dictionary).
Declare another local structure (say 'mystructx') with the same fields name but with types CHAR1 (they are flags).
Fill mystruct with the values you want.
Fill mystructx with 'X' when you want to modify the corresponding fields.
you will have to fill 2 lines in EXTENSIONIN for header, and 2 lines for each item :
<u>First line :</u>
STRUCTURE : the name of the type of mystruct.
VALUEPART1 : the 240 first characters of mystruct
VALUEPART2 : the 240 following characters of mystruct (of blank if mystruct is not long enough)
VALUEPART3 : the 240 following characters of mystruct (of blank if mystruct is not long enough)
VALUEPART4: the 240 following characters of mystruct (of blank if mystruct is not long enough)
<u>Second line :</u>
STRUCTURE : the name of the type of mystructx.
VALUEPART1 : the 240 first characters of mystructx
VALUEPART2 : the 240 following characters of mystructx (of blank if mystruct is not long enough)
VALUEPART3 : the 240 following characters of mystructx (of blank if mystruct is not long enough)
VALUEPART4: the 240 following characters of mystructx (of blank if mystruct is not long enough)
Hope that helps.
Tell if you want examples. -
Hi all,
I want to publish a customer field in EKPO by using the extensionin for BAPI_PO_CREATE or BAPI_PO_CHANGE
My customer field on Purchase Order Position is populated within structure CI_EKPODB, the name is ztest and the field is numeric(6).
How do I have to fill in data within extensionin structure to pass the data directly in the customer field described above?
Best regards
Andreassince you have only one field. only pass that value to valupar1. check sample code below.
Sample code to populate EXTENSIONIN & EXTENSIONINX tables & call BAPI_MATERIAL_SAVEDATA.
*& Report Z_VMA_MARA_EXT
*& written by : Vivek Amrute.Tested on ECC6 : 20/11/2008
*& Updating values of custom fields added to MARA.
REPORT z_vma_mara_ext.
TABLES : mara, marc.
DATA : rex LIKE bapiparex OCCURS 0 WITH HEADER LINE,
rexx LIKE bapiparexx OCCURS 0 WITH HEADER LINE,
header LIKE bapimathead OCCURS 0 WITH HEADER LINE,
makt1 LIKE bapi_makt OCCURS 0 WITH HEADER LINE,
zbapiret2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
PARAMETERS : material LIKE mara-matnr,
val1 TYPE aktvt,
val2 TYPE actname_kk,
val3 TYPE aktvt,
new_desc TYPE maktx.
header-material = material.
rex-structure = 'BAPI_TE_MARA'.
CONCATENATE material val1 val2 val3 INTO rex-valuepart1 RESPECTING BLANKS.
APPEND rex.
rexx-structure = 'BAPI_TE_MARAX'.
CONCATENATE material 'XXX' INTO rexx-valuepart1 RESPECTING BLANKS.
APPEND rexx.
makt1-langu = 'E'.
makt1-langu_iso = 'EN'.
makt1-matl_desc = new_desc.
APPEND makt1.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = header
IMPORTING
return = zbapiret2
TABLES
materialdescription = makt1
extensionin = rex
extensioninx = rexx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. -
BAPI for PO Create/Change with use of EXTENSIONIN table
Hello,
We are using SRM extended classic scenario which copies PO's from SRM to ECC via function module BBP_PO_INBOUND. This function module does mappings and then calls either BAPI_PO_CREATE1 or BAPI_PO_CHANGE. I have added field YYVSBED (char2) to structure CI_EKKODB. When BAPI's are called this field is present in ExtensionIn structure. While debugging the processing, I can see that it being processed, however, it does not get posted in database.
Any suggestions are very welcome.
Thank you.
NatashaInternally the BAPI uses the the MEPO...-Structures . Your data is lost at the move-corresponding from the BAPI-Structure to the related MEPO... structure . If your target-field is an EKPO-Field you have to check if there is a field in the MEPOITEM -structure .
If you use the CI_EKPODB to extend the EKPO with your custom field, the BAPI would work, because this is included in EKPO and MEPOITEM .
Best regards Josef -
How can I pass extensionin for BAPI_BUS2054_CHANGE_MULTI to enhance
Hi,
I need to enhance 4 customer fields in the PRPS table.
Using BAPI_BUS2054_CHANGE_MULTI extensionin i need to update the 4 fields.
My custom fields is included in BAPI_TE_WBS_ELEMENT structure.
But I am unable to figure out wat exactly need to pass to the structure.
Could anyone send me sample code in order to update the custom fields in BAPI_BUS2054_CHANGE_MULTI.
Thanks
VijayasreeHi,
In ExtensionIn-STRUCTURE = 'BAPI_TE_WBS_ELEMENT' and ExtensionIn-VALUEPART1 will be your data according to fields in the structure.Suppose if your structure contains Fields WBS_ELEMENT and DESCRIPTION , then you need to concatenate both and move to ExtensionIn-VALUEPART1 as per field order in structure.
Regards,
Ashok. -
Questions in BAPI_PO_CREATE1
In BAPI_PO_CREATE1 there are various tables like POITEM, POITEMX....
I wanted to know what is the purpose of the second table(POITEMX)...the documentation says its for the fields which have changed.
Can anyone kindly explain.FUNCTION Z_BC1_BAPI_PO_CREATE02.
""Local Interface:
*" IMPORTING
*" VALUE(POHEADER) TYPE BAPIMEPOHEADER
*" VALUE(POHEADERX) TYPE BAPIMEPOHEADERX
*" VALUE(POADDRVENDOR) TYPE BAPIMEPOADDRVENDOR
*" VALUE(TESTRUN) TYPE BAPIFLAG-BAPIFLAG
*" VALUE(MEMORY_UNCOMPLETE) TYPE BAPIFLAG-BAPIFLAG
*" VALUE(MEMORY_COMPLETE) TYPE BAPIFLAG-BAPIFLAG
*" VALUE(POEXPIMPHEADER) TYPE BAPIMEPOHEADER
*" VALUE(POEXPIMPHEADERX) TYPE BAPIMEPOHEADERX
*" VALUE(VERSIONS) TYPE BAPIMEDCM
*" VALUE(NO_MESSAGING) TYPE BAPIFLAG-BAPIFLAG
*" VALUE(NO_MESSAGE_REQ) TYPE BAPIFLAG-BAPIFLAG
*" VALUE(NO_AUTHORITY) TYPE BAPIFLAG-BAPIFLAG
*" VALUE(NO_PRICE_FROM_PO) TYPE BAPIFLAG-BAPIFLAG
*" EXPORTING
*" VALUE(EXPPURCHASEORDER) TYPE BAPIMEPOHEADER-PO_NUMBER
*" VALUE(EXPHEADER) TYPE BAPIMEPOHEADER
*" VALUE(EXPPOEXPIMPHEADER) TYPE BAPIMEPOHEADER
*" TABLES
*" RETURN STRUCTURE BAPIRET2
*" POITEM STRUCTURE BAPIMEPOITEM
*" POITEMX STRUCTURE BAPIMEPOITEMX
*" POADDRDELIVERY STRUCTURE BAPIMEPOADDRDELIVERY
*" POSCHEDULE STRUCTURE BAPIMEPOSCHEDULE
*" POSCHEDULEX STRUCTURE BAPIMEPOSCHEDULX
*" POACCOUNT STRUCTURE BAPIMEPOACCOUNT
*" POACCOUNTPROFITSEGMENT STRUCTURE BAPIMEPOACCOUNTPROFITSEGMENT
*" POACCOUNTX STRUCTURE BAPIMEPOACCOUNTX
*" POCONDHEADER STRUCTURE BAPIMEPOCOND
*" POCONDHEADERX STRUCTURE BAPIMEPOCONDX
*" POCOND STRUCTURE BAPIMEPOCOND
*" POCONDX STRUCTURE BAPIMEPOCONDX
*" POLIMITS STRUCTURE BAPIESUHC
*" POCONTRACTLIMITS STRUCTURE BAPIESUCC
*" POSERVICES STRUCTURE BAPIESLLC
*" POSRVACCESSVALUES STRUCTURE BAPIESKLC
*" POSERVICESTEXT STRUCTURE BAPIESLLTX
*" EXTENSIONIN STRUCTURE BAPIPAREX
*" EXTENSIONOUT STRUCTURE BAPIPAREX
*" POEXPIMPITEM STRUCTURE BAPIEIPO
*" POEXPIMPITEMX STRUCTURE BAPIEIPOX
*" POTEXTHEADER STRUCTURE BAPIMEPOTEXT
*" POTEXTITEM STRUCTURE BAPIMEPOTEXT
*" ALLVERSIONS STRUCTURE BAPIMEDCM_ALLVERSIONS
*" POPARTNER STRUCTURE BAPIEKKOP
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*" TIMEOUT
*" TCPIP_ERROR
*" CONNECT_FAILED
*" INTERNAL_ERROR
*" SYSTEM_FAILURE
*" COMMUNICATION_FAILURE
Program : Z_BC1_BAPI_PO_CREATE01
TITLE Function Module to create PO using BAPI
AUTHOR Aveek Ghose, IBM
DATE WRITTEN 20-May-2006
R/3 RELEASE 4.6C
CTS: RD1K912067
COPIED FROM N/A
This function module is called during PR Creation in Ariba ( at
checkpoint1, checkpoint2 and checkpoint3) and also during posting of
PO in SAP. The call to this function module is from WebMethods.
PROGRAM TYPE Function Module
DEV. CLASS ZP2P
LOGICAL DB N/A
SCREENS N/A
GUl TITLE N/A
GUl STATUS N/A
TRANSACTIONS N/A
USER EXITS N/A
Local variables
CONSTANTS: C_VENDOR TYPE ELIFN VALUE '4259999999',
C_DOC_TYPE TYPE ESART VALUE 'ZAPS',
C_CURRENCY TYPE WAERS VALUE 'EUR',
C_NETPR TYPE NETPR VALUE '1.00',
C_99 TYPE CHAR2 VALUE '99',
C_00 TYPE CHAR2 VALUE '00'.
DATA : L_VEND_ACTGRP(30) TYPE C, "Vendor Account Group
L_VEND_PAYTRM(30) TYPE C, "Vendor Payment Terms
L_VEND_RECON(30) TYPE C, "Vendor Reconciliation Account
L_MSGV1 LIKE SY-MSGV1, "Message variable1
L_LENGTH TYPE I, "Vendor string length.
L_WBS_EXTERNAL LIKE BAPIMEPOACCOUNT-WBS_ELEMENT,
"WBS external format
L_WBS_INTERNAL LIKE BAPIMEPOACCOUNT-WBS_ELEMENT,
L_bukrs type bukrs.
DATA: l_werks1 type werks_d.
"WBS internal format
*BV-08-July-2004 -Begin - Change error handling for zxa_get_constant
DATA : L_CONST_NAME LIKE SY-MSGV1, "Constant name
L_COMP_CODE LIKE SY-MSGV2. "Company code
DATA: L_WA_TIMESTAMP TYPE ZPO_TIMESTAMP.
DATA: L_WA_TIMESTAMP TYPE ZP2P_TIMESTAMP.
DATA: l_serial_no LIKE poaccount-serial_no.
DATA: L_SERIAL TYPE I.
DATA: L_RETURN TYPE C.
DATA: L_EXIT TYPE I.
*BV-08-July-2004 -End - Change error handling for zxa_get_constant
Internal Table
DATA : T_TEMP_POACCOUNT LIKE POACCOUNT OCCURS 0 WITH HEADER LINE,
"To store items with blank GL
*PVU-22-May-2004 - Start Changes for SCR1
G_T_ITEMX_TMP LIKE POITEMX OCCURS 0 WITH HEADER LINE,
G_T_SCHDX_TMP LIKE POSCHEDULEX OCCURS 0 WITH HEADER LINE,
G_T_SCHD_TMP LIKE POSCHEDULE OCCURS 0 WITH HEADER LINE,
G_T_ACCNTX_TMP LIKE POACCOUNTX OCCURS 0 WITH HEADER LINE,
G_T_CONDX_TMP LIKE POCONDX OCCURS 0 WITH HEADER LINE.
Structure
DATA: G_W_HDRX_TMP LIKE POHEADERX.
DATA: p_constname TYPE zconstname, "Constant Name
g_constval TYPE zconstval, "Constant Value
tbx TYPE SY-TABIX.
data: l_waers type waers.
DATA: L_EKORG TYPE EKORG.
*PVU-22-May-2004 - End Changes for SCR1
CLEAR : G_FLG_VENDOR,
start of change for TPR2220 - DDUTTA - 07/08/2004
t_znonpo_document,
t_znonpo_acctg,
End of change for TPR2220 - DDUTTA - 07/08/2004
*PVU-22-May-2004 - Start Changes for SCR1
G_IDOC_NO,
G_W_HDRX_TMP.
*PVU-22-May-2004 - End Changes for SCR1
REFRESH : RETURN, T_ZRETURN,
start of change for TPR2220 - DDUTTA - 07/08/2004
t_znonpo_document,
t_znonpo_acctg,
End of change for TPR2220 - DDUTTA - 07/08/2004
*PVU-22-May-2004 - Start Changes for SCR1
G_T_IDOC_DATA,
G_T_ITEMX_TMP,
G_T_SCHDX_TMP,
G_T_ACCNTX_TMP,
G_T_CONDX_TMP.
*PVU-22-May-2004 - End Changes for SCR1
Srini 17-May-2005 Start of changes
Developer Flexibility to debug issues
p_constname = 'BAPI_PO_CREATE2'.
do.
CALL FUNCTION 'ZXA_GET_CONSTANT'
EXPORTING
const_name = p_constname
comp_code = poheader-comp_code
IMPORTING
const_value = g_constval
EXCEPTIONS
no_value_found = 1
null_value = 2
OTHERS = 3.
if g_constval ne 'X'.
exit.
endif.
enddo.
Add of change: SDR: 12-Aug-2005
IF poheader-po_number IS INITIAL.
poheader-doc_type = 'ZEHS'.
else.
*mod-003
IF poheader-po_number+0(1) = 'C'.
poheader-doc_type = 'ZAC'.
ENDIF.
IF poheader-po_number+0(1) = 'P'.
poheader-doc_type = 'ZAP'.
ENDIF.
IF poheader-po_number IS INITIAL.
poheader-doc_type = 'ZAPS'.
ENDIF.
DELETE FROM ZP2P_ERRORS WHERE BEACON_DOC_NO = POHEADER-PO_NUMBER.
DELETE FROM ZP2P_ERRORS WHERE TYPE NE C_E.
DELETE FROM ZERRORS WHERE BEACON_DOC_NO = POHEADER-PO_NUMBER.
DELETE FROM ZERRORS WHERE TYPE NE C_E.
*MOD-004
l_wa_timestamp-mandt = SY-MANDT.
l_wa_timestamp-EBELN = POHEADER-PO_NUMBER.
l_wa_timestamp-EBELP = '00'.
l_wa_timestamp-CREATE_TIMESTMP = POHEADER-ARIBACRTTIMESTMP.
l_wa_timestamp-CREATE_TIMESTMP = POHEADER-ARIBACHGTIMESTMP.
insert into ZP2P_TIMESTAMP values l_wa_timestamp.
*MOD-004
ENDIF.
*mod-003
*mod-003
if not poheader-comp_code is initial.
if poheader-comp_code is initial.
clear: l_bukrs.
select single companycode
into l_bukrs
from zcompanycodes01
where companycode = poheader-comp_code and
where FSID = poheader-fsid and
le = poheader-le and
frmrc = poheader-frmrc.
select single companycode
into l_bukrs
from ZP2P_COMPANYCODE
where FSID = poheader-fsid and
le = poheader-le and
frmrc = poheader-frmrc.
if sy-subrc ne 0.
CLEAR L_MSGV1.
L_MSGV1 = T_TEMP_POACCOUNT-PO_ITEM.
Please Enter an Account number for line
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = C_MSGTYPE_E
CL = C_MSGID_Z001
NUMBER = C_MSGNR_618
PAR1 = L_MSGV1
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CLEAR RETURN.
else.
poheader-comp_code = l_bukrs.
endif.
endif.
*mod-003
End of Change: SDR: 12-Aug-2005
Srini 10-May-2005 Start of changes
Pass the value of SERIAL_NO from POACCOUNT to POACCOUNTX.
LOOP AT POACCOUNTX.
MOVE SY-TABIX to TBX.
READ TABLE POACCOUNT INDEX TBX.
IF SY-SUBRC EQ 0 AND POACCOUNTX-SERIAL_NO IS INITIAL.
POACCOUNTX-SERIAL_NO = POACCOUNT-SERIAL_NO.
MODIFY POACCOUNTX INDEX TBX.
ENDIF.
ENDLOOP.
Srini 10-May-2005 End of changes
Srini 17-May-2005 End of changes
T_TEMP_POACCOUNT[] = POACCOUNT[].
To retrieve the line items with blank GL Account Number
PERFORM FILTER_ITEMS TABLES T_TEMP_POACCOUNT.
LOOP AT T_TEMP_POACCOUNT.
CLEAR L_MSGV1.
L_MSGV1 = T_TEMP_POACCOUNT-PO_ITEM.
Please Enter an Account number for line
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = C_MSGTYPE_E "E
CL = C_MSGID_Z001 "Z001
NUMBER = C_MSGNR_037 "037
PAR1 = L_MSGV1
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CLEAR RETURN.
loop at return.
l_wa_zerrors-OBJECT = 'PURCHASE_ORDER'.
l_wa_zerrors-serial_no = sy-tabix.
l_wa_zerrors-COMP_CODE = poheader-comp_code.
l_wa_zerrors-type = return-type.
l_wa_zerrors-zid = return-id.
l_wa_zerrors-znumber = return-number.
l_wa_zerrors-BEACON_DOC_NO = poheader-po_number.
l_wa_zerrors-SRC_DOC_NO = poheader-po_number.
l_wa_zerrors-ZDATE = sy-datum.
l_wa_zerrors-ERR_MSG = return-message.
append l_wa_zerrors to t_errors.
insert into zerrors values l_wa_zerrors.
clear: l_wa_zerrors.
endloop.
ENDLOOP.
On Error, exit the function module
READ TABLE RETURN WITH KEY TYPE = C_E. " 'E'
IF SY-SUBRC EQ 0.
EXPHEADER = POHEADER.
EXPHEADER-CODE = '99'.
EXIT.
ENDIF.
*MOD-005
On Error, exit the function module
l_exit = 0.
LOOP AT RETURN WHERE TYPE = C_E.
L_EXIT = 1.
expheader = poheader.
EXPHEADER-CODE = C_99.
RETURN-RETURN_CODE = C_99.
RETURN-SEQ_CODE = C_99.
MODIFY RETURN TRANSPORTING RETURN_CODE SEQ_CODE.
ENDLOOP..
IF L_EXIT = 1.
EXIT.
ENDIF.
**MOD-005
*MOD-005
**MOD-004
L_RETURN = ' '..
LOOP AT RETURN WHERE TYPE = C_E.
RETURN-RETURN_CODE = '99'.
L_RETURN = C_X.
MODIFY RETURN TRANSPORTING RETURN_CODE.
ENDLOOP.
IF L_RETURN = C_X.
EXIT.
ENDIF.
**MOD-004
Begin of Change: Soumya D Roy: 12/27/2005
Forcibly refresh the T_YRETURN table as a part of the conversion
program since this table is not getting refreshed
REFRESH t_yreturn.
CLEAR t_yreturn.
End of Change: Soumya D Roy: 12/27/2005
****BV-27-May-2004 - Begin of Changes for SCR2****
*mod-003
DATA: L_TABIX TYPE SY-TABIX.
LOOP AT POITEM.
TBX = SY-TABIX.
l_wa_timestamp-mandt = SY-MANDT.
l_wa_timestamp-EBELN = POHEADER-PO_NUMBER.
l_wa_timestamp-EBELP = POITEM-PO_ITEM.
l_wa_timestamp-CHANGE_IND = 'A'.
l_wa_timestamp-CREATE_TIMESTMP = POITEM-ARIBACRTTIMESTMP.
l_wa_timestamp-CREATE_TIMESTMP = POITEM-ARIBAUPDTIMESTMP.
l_wa_timestamp-DATE_TIME_STMP = POITEM-ARIBACRTTIMESTMP.
insert into ZP2P_TIMESTAMP values l_wa_timestamp.
insert into ZP2P_TIMESTAMP values l_wa_timestamp.
clear: poheader-ARIBACRTTIMESTMP,
poheader-ARIBACHGTIMESTMP.
IF NOT POITEM-DISTRIB IS INITIAL.
CLEAR : L_CONST_NAME,
L_COMP_CODE.
READ TABLE POACCOUNT INDEX L_TABIX.
IF SY-SUBRC EQ 0.
L_CONST_NAME = POACCOUNT-GL_ACCOUNT.
L_COMP_CODE = L_comp_code.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = c_msgtype_e "E
cl = c_msgid_z001
number = c_msgnr_613
PAR1 = L_CONST_NAME
PAR2 = L_COMP_CODE
IMPORTING
return = t_yreturn.
APPEND t_yreturn.
CLEAR t_yreturn.
loop at t_yreturn.
l_wa_zerrors-OBJECT = 'PURCHASE_ORDER'.
l_wa_zerrors-serial_no = sy-tabix.
l_wa_zerrors-COMP_CODE = poheader-comp_code.
l_wa_zerrors-type = t_yreturn-type.
l_wa_zerrors-zid = t_yreturn-id.
l_wa_zerrors-znumber = t_yreturn-number.
l_wa_zerrors-BEACON_DOC_NO = poheader-po_number.
l_wa_zerrors-SRC_DOC_NO = poheader-po_number.
l_wa_zerrors-ZDATE = sy-datum.
l_wa_zerrors-ERR_MSG = t_yreturn-message.
append l_wa_zerrors to t_errors.
insert into zerrors values l_wa_zerrors.
clear: l_wa_zerrors.
endloop.
ENDIF.
ENDIF.
ENDLOOP.
if not poheader-currency is initial.
if not poheader-vendor is initial.
loop at pocond.
SELECT SINGLE WAERS
INTO L_WAERS
FROM LFM1 WHERE
LIFNR = POHEADER-VENDOR
AND EKORG = POHEADER-PURCH_ORG.
IF SY-SUBRC NE 0.
IF L_WAERS NE poheader-currency.
pocond-cond_type = 'PBXX'.
pocond-currency = l_waers.
modify pocond transporting cond_value currency.
endif.
ENDIF.
endloop.
ENDIF.
ENDIF.
IF NOT TESTRUN IS INITIAL.
POHEADER-VENDOR = '4259999999'.
poheader-doc_type = 'ZAPS'.
ENDIF.
IF NOT POHEADER-PURCH_ORG IS INITIAL.
IF POHEADER-PURCH_ORG IS INITIAL.
SELECT SINGLE PUR_ORG
INTO L_EKORG
FROM ZP2P_PURCHASEORG
FROM ZPUR_ORG
WHERE LE = POHEADER-LE AND
FRMRC = POHEADER-FRMRC AND
FSID = POHEADER-FSID.
IF SY-SUBRC NE 0.
CLEAR : L_CONST_NAME,
L_COMP_CODE.
L_CONST_NAME = C_p2p_pur_ORG.
L_COMP_CODE = POHEADER-COMP_CODE.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = c_msgtype_e
CL = c_msgid_z001
NUMBER = c_msgnr_619
PAR1 = L_CONST_NAME
PAR2 = L_COMP_CODE
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CLEAR RETURN.
loop at t_yreturn.
l_wa_zerrors-OBJECT = 'PURCHASE_ORDER'.
l_wa_zerrors-serial_no = sy-tabix.
l_wa_zerrors-COMP_CODE = poheader-comp_code.
l_wa_zerrors-zid = t_yreturn-id.
l_wa_zerrors-type = return-type.
l_wa_zerrors-znumber = t_yreturn-number.
l_wa_zerrors-BEACON_DOC_NO = poheader-po_number.
l_wa_zerrors-SRC_DOC_NO = poheader-po_number.
l_wa_zerrors-ZDATE = sy-datum.
l_wa_zerrors-ERR_MSG = return-message.
append l_wa_zerrors to t_errors.
insert into zerrors values l_wa_zerrors.
clear: l_wa_zerrors.
endloop.
EXIT.
ELSE.
POHEADER-PURCH_ORG = L_EKORG.
ENDIF.
ENDIF.
IF NOT POHEADER-PUR_GROUP IS INITIAL.
IF POHEADER-PUR_GROUP IS INITIAL.
clear: g_constval.
CALL FUNCTION 'ZXA_GET_CONSTANT'
EXPORTING
const_name = c_p2p_pur_org
comp_code = POHEADER-COMP_CODE
IMPORTING
const_value = g_constval
EXCEPTIONS
no_value_found = 1
null_value = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
CLEAR : L_CONST_NAME,
L_COMP_CODE.
L_CONST_NAME = C_p2p_pur_org.
L_COMP_CODE = POHEADER-COMP_CODE.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = c_msgtype_e
CL = c_msgid_z001
NUMBER = c_msgnr_046
PAR1 = L_CONST_NAME
PAR2 = L_COMP_CODE
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CLEAR RETURN.
loop at t_yreturn.
l_wa_zerrors-OBJECT = 'PURCHASE_ORDER'.
l_wa_zerrors-serial_no = sy-tabix.
l_wa_zerrors-COMP_CODE = poheader-comp_code.
l_wa_zerrors-zid = t_yreturn-id.
l_wa_zerrors-type = return-type.
l_wa_zerrors-znumber = t_yreturn-number.
l_wa_zerrors-BEACON_DOC_NO = poheader-po_number.
l_wa_zerrors-SRC_DOC_NO = poheader-po_number.
l_wa_zerrors-ZDATE = sy-datum.
l_wa_zerrors-ERR_MSG = return-message.
append l_wa_zerrors to t_errors.
insert into zerrors values l_wa_zerrors.
clear: l_wa_zerrors.
endloop.
EXIT.
ELSE.
POHEADER-PUR_GROUP = G_CONSTVAL.
ENDIF.
ENDIF.
LOOP AT poitem.
if poitem-plant is initial.
clear: l_werks1.
select single plant
into l_werks1
from ZP2P_PLANTMAPING
from zpo_plantmapping
where COMPANY_CODE = poheader-comp_code and
PUR_ORG = poheader-purch_org and
PUR_GROUP = poheader-pur_group and
LE = poheader-le and
FSID = poheader-fsid and
MRC = poheader-mrc and
FRMRC = poheader-frmrc.
if sy-subrc ne 0.
PERFORM ERROR_HANDLING_PLANT USING POHEADER
poheader-comp_code
L_WA_ZERRORS.
EXIT.
else.
poitem-plant = l_werks1.
CLEAR: L_WERKS1.
endif.
endif.
IF POITEM-NET_PRICE NE POHEADER-CURRENCY.
POITEM-NET_PRICE = POHEADER-CURRENCY.
ENDIF.
*mod-004
IF POITEM-net_price NE 0.
POITEM-IR_IND = 'X'.
ENDIF.
*mod-004
IF POITEM-net_price eq 0.
POITEM-IR_IND = 'X'.
ENDIF.
*MOD-004
if POITEM-GR_IND = C_Y..
POITEM-GR_IND = C_X.
ELSEIF POITEM-GR_IND = C_X.
POITEM-GR_IND = C_X.
ELSE.
POITEM-GR_IND = ' '.
endif.
*MOD-004
if POITEM-GR_IND = 'Y'..
POITEM-GR_IND = 'X'.
endif.
if POITEM-INCOTERMS1 is initial.
POITEM-INCOTERMS1 = 'CIF'.
endif.
if POITEM-INCOTERMS2 is initial.
POITEM-INCOTERMS2 = 'CIF'.
endif.
LOOP AT POACCOUNT WHERE PO_ITEM = POITEM-PO_ITEM.
IF POITEM-DISTRIB IS INITIAL.
POACCOUNT-DISTR_PERC = '0.00'.
MODIFY POACCOUNT TRANSPORTING DISTR_PERC.
ENDIF.
ENDLOOP.
POITEM-UNLIMITED_DLV = 'X'.
POITEM-UNDER_DLV_TOL = 0.
clear: poitem-ARIBACRTTIMESTMP,
poitem-ARIBAUPDTIMESTMP.
MODIFY POITEM TRANSPORTING UNLIMITED_DLV
UNDER_DLV_TOL
PLANT
IR_IND
GR_IND
INCOTERMS1
INCOTERMS2
ARIBACRTTIMESTMP
ARIBAUPDTIMESTMP.
ENDLOOP.
*-- Retrieve Account Assignment
PERFORM get_account_assignment TABLES poitem
poitemx
poaccount
poaccountx
t_yreturn
USING poheader-comp_code
poheader.
*mod-003
IF NOT t_yreturn[] IS INITIAL.
APPEND LINES OF t_yreturn TO RETURN.
*& Begin of Change: 26-Sep-2005 SDUTTARO RD1K910316 *&
READ TABLE t_yreturn WITH KEY type = 'W'.
IF sy-subrc <> 0.
expheader = poheader.
EXPHEADER-CODE = '99'.
ENDIF.
**MOD-005
On Error, exit the function module
l_exit = 0.
LOOP AT RETURN WHERE TYPE = C_E.
L_EXIT = 1.
expheader = poheader.
EXPHEADER-CODE = '99'.
RETURN-RETURN_CODE = C_99.
RETURN-SEQ_CODE = C_99.
MODIFY RETURN TRANSPORTING RETURN_CODE SEQ_CODE.
ENDLOOP..
IF L_EXIT = 1.
EXIT.
ENDIF.
**MOD-005
*& End of Change: 26-Sep-2005 SDUTTARO RD1K910316 *&
ENDIF.
*mod-003
if not poheader-currency is initial.
if not poheader-vendor is initial.
loop at pocond.
SELECT SINGLE WAERS
INTO L_WAERS
FROM LFM1 WHERE
LIFNR = POHEADER-VENDOR
AND EKORG = POHEADER-PURCH_ORG.
IF SY-SUBRC NE 0.
IF L_WAERS NE poheader-currency.
pocond-cond_type = 'PBXX'.
pocond-currency = l_waers.
modify pocond transporting cond_value currency.
endif.
ENDIF.
endloop.
ENDIF.
ENDIF.
*currency check MOD-004
DATA: l_header TYPE REF TO cl_po_header_handle_mm,
l_item TYPE REF TO cl_po_item_handle_mm,
l_tkomv TYPE STANDARD TABLE OF komv INITIAL SIZE 10,
l_item_conditions_changed TYPE mmpur_bool.
header level pocond data
CHECK NOT l_item IS INITIAL.
CHECK NOT l_item->po_item_number IS INITIAL.
l_header ?= l_item->my_parent.
CALL METHOD l_header->get_tkomv IMPORTING
ex_tkomv = l_tkomv.
l_item_conditions_changed = mmpur_no.
PERFORM pai_item_conditions IN PROGRAM saplmepo
TABLES l_tkomv
USING poitem-po_item
CHANGING l_item_conditions_changed.
IF NOT l_item_conditions_changed IS INITIAL.
CALL METHOD l_header->set_tkomv EXPORTING
im_tkomv = l_tkomv
im_item_conditions_changed = l_item_conditions_changed.
Item level POCOND data
LOOP AT POITEM.
*. CALL FUNCTION 'MEPO_DOC_PBO_ITEM_CONDITIONS'
EXPORTING
im_ebelp = poitem-po_item
EXCEPTIONS
error_message = 1.
ENDLOOP.
ENDIF.
*currency check mod-004
*MOD-003
IF NOT TESTRUN IS INITIAL.
POHEADER-VENDOR = '4259999999'.
poheader-doc_type = 'ZAPS'.
ENDIF.
*MOD-003
IF NOT POHEADER-PURCH_ORG IS INITIAL.
IF POHEADER-PURCH_ORG IS INITIAL.
SELECT SINGLE PUR_ORG
INTO L_EKORG
FROM ZPUR_ORG
FROM ZP2P_PURCHASEORG
WHERE LE = POHEADER-LE AND
FRMRC = POHEADER-FRMRC AND
FSID = POHEADER-FSID.
IF SY-SUBRC NE 0.
CLEAR : L_CONST_NAME,
L_COMP_CODE.
L_CONST_NAME = C_p2p_pur_ORG.
L_COMP_CODE = POHEADER-COMP_CODE.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = c_msgtype_e
CL = c_msgid_z001
NUMBER = c_msgnr_619
PAR1 = L_CONST_NAME
PAR2 = L_COMP_CODE
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CLEAR RETURN.
loop at t_yreturn.
l_wa_zerrors-OBJECT = 'PURCHASE_ORDER'.
l_wa_zerrors-serial_no = sy-tabix.
l_wa_zerrors-COMP_CODE = poheader-comp_code.
l_wa_zerrors-zid = t_yreturn-id.
l_wa_zerrors-type = return-type.
l_wa_zerrors-znumber = t_yreturn-number.
l_wa_zerrors-BEACON_DOC_NO = poheader-po_number.
l_wa_zerrors-SRC_DOC_NO = poheader-po_number.
l_wa_zerrors-ZDATE = sy-datum.
l_wa_zerrors-ERR_MSG = t_yreturn-message.
append l_wa_zerrors to t_errors.
insert into zerrors values l_wa_zerrors.
clear: l_wa_zerrors.
endloop.
EXIT.
ELSE.
POHEADER-PURCH_ORG = L_EKORG.
ENDIF.
ENDIF.
IF NOT POHEADER-PUR_GROUP IS INITIAL.
IF POHEADER-PUR_GROUP IS INITIAL.
clear: g_constval.
CALL FUNCTION 'ZXA_GET_CONSTANT'
EXPORTING
const_name = c_p2p_pur_org
comp_code = POHEADER-COMP_CODE
IMPORTING
const_value = g_constval
EXCEPTIONS
no_value_found = 1
null_value = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
CLEAR : L_CONST_NAME,
L_COMP_CODE.
L_CONST_NAME = C_p2p_pur_org.
L_COMP_CODE = POHEADER-COMP_CODE.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = c_msgtype_e
CL = c_msgid_z001
NUMBER = c_msgnr_046
PAR1 = L_CONST_NAME
PAR2 = L_COMP_CODE
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CLEAR RETURN.
loop at return.
l_wa_zerrors-OBJECT = 'PURCHASE_ORDER'.
l_wa_zerrors-serial_no = sy-tabix.
l_wa_zerrors-COMP_CODE = poheader-comp_code.
l_wa_zerrors-zid = return-id.
l_wa_zerrors-type = return-type.
l_wa_zerrors-znumber = return-number.
l_wa_zerrors-BEACON_DOC_NO = poheader-po_number.
l_wa_zerrors-SRC_DOC_NO = poheader-po_number.
l_wa_zerrors-ZDATE = sy-datum.
l_wa_zerrors-ERR_MSG = return-message.
append l_wa_zerrors to t_errors.
insert into zerrors values l_wa_zerrors.
clear: l_wa_zerrors.
endloop.
EXIT.
ELSE.
POHEADER-PUR_GROUP = G_CONSTVAL.
ENDIF.
ENDIF.
*MOD-004
LOOP AT POACCOUNT.
if POACCOUNT-COSTCENTER EQ '0000000000' OR
POACCOUNT-COSTCENTER EQ '0'.
POACCOUNT-COSTCENTER = ' '.
MODIFY POACCOUNT.
endif.
ENDLOOP.
*MOD-004
*MOD-003
IF NOT TESTRUN IS INITIAL.
L_SERIAL_NO = 0.
L_TABIX = 0.
POHEADER-VENDOR = C_VENDOR.
poheader-doc_type = C_DOC_TYPE.
poheader-comp_code = l_bukrs.
POHEADER-DOC_DATE = SY-DATUM.
POHEADER-CURRENCY = C_CURRENCY.
POHEADER-NETPR = C_NETPR.
LOOP AT POACCOUNT.
L_TABIX = L_TABIX + 1.
LOOP AT POITEM.
if POACCOUNT-PO_ITEM is initial.
POACCOUNT-PO_ITEM = SY-TABIX.
endif.
if POACCOUNT-SERIAL_NO is initial.
POACCOUNT-SERIAL_NO = L_TABIX.
endif.
MODIFY POACCOUNT.
ENDLOOP.
ENDLOOP.
*MOD-004
IF POCOND[] IS INITIAL and
NOT TESTRUN IS INITIAL.
SELECT SINGLE WAERS
INTO L_WAERS
FROM LFM1 WHERE
LIFNR = POHEADER-VENDOR
AND EKORG = POHEADER-PURCH_ORG.
IF SY-SUBRC NE 0.
IF L_WAERS NE poheader-currency.
LOOP AT POITEM.
pocond-itm_number = poitem-po_item.
POCOND-COND_ST_NO = SY-TABIX.
POCOND-COND_COUNT = SY-TABIX.
pocond-cond_value = poitem-net_price.
pocond-cond_type = 'PBXX'.
POCOND-CHANGE_ID = 'I'.
if not pocond-currency is initial.
pocond-currency = l_waers.
endif.
POCONDHEADER-itm_number = poitem-po_item.
POCONDHEADER-COND_ST_NO = SY-TABIX.
POCONDHEADER-COND_COUNT = SY-TABIX.
pocondHEADER-cond_value = poitem-net_price.
pocondHEADER-cond_type = 'PBXX'.
POCONDHEADER-CHANGE_ID = 'I'.
if not pocond-currency is initial.
pocondHEADER-currency = l_waers.
endif.
APPEND: POCOND,POCONDHEADER.
CLEAR: POCOND, POCONDHEADER.
ENDLOOP.
endif.
ENDIF.
ENDIF.
*MOD-004
IF POITEM[] IS INITIAL.
POITEM-SHORT_TEXT = 'Simulation'(001).
if poitem-plant is initial.
clear: l_werks1.
select single plant
into l_werks1
from zpo_plantmapping
from zp2p_plantmaping
where COMPANY_CODE = poheader-comp_code and
PUR_ORG = poheader-purch_org and
PUR_GROUP = poheader-pur_group and
LE = poheader-le and
MRC = poheader-mrc and
FSID = poheader-fsid and
FRMRC = poheader-frmrc.
IF SY-SUBRC = 0.
poitem-plant = l_werks1.
ENDIF.
endif.
if poitem-po_item is initial.
POITEM-PO_ITEM = L_TABIX.
endif.
if poitem-plant is initial.
poitem-plant = l_werks1.
endif.
if POITEM-MATL_GROUP is initial.
POITEM-MATL_GROUP = '99'.
endif.
if POITEM-QUANTITY is initial.
POITEM-QUANTITY = '1'.
endif.
if POITEM-PO_UNIT is initial.
POITEM-PO_UNIT = 'EA'.
endif.
if POITEM-ORDERPR_UN is initial.
POITEM-ORDERPR_UN = 'EA'.
endif.
if POITEM-NET_PRICE is initial.
POITEM-NET_PRICE = '1.00'.
endif.
if POITEM-PRICE_UNIT is initial.
POITEM-PRICE_UNIT = '1.00'.
endif.
if POITEM-DISTRIB is initial.
POITEM-DISTRIB = ' '.
endif.
if POITEM-PART_INV is initial.
POITEM-PART_INV = ' '.
endif.
*MOD-004
if POITEM-GR_IND = C_Y..
POITEM-GR_IND = C_X.
ELSEIF POITEM-GR_IND = C_X.
POITEM-GR_IND = C_X.
ELSE.
POITEM-GR_IND = ' '.
endif.
*MOD-004
**MOD-004
if POITEM-GR_IND is initial or
POITEM-GR_IND = c_y.
POITEM-GR_IND = c_x.
ELSE.
POITEM-GR_IND = ' '.
ENDIF.
**MOD-004
if POITEM-IR_IND is initial.
POITEM-IR_IND = 'X'.
endif.
if POITEM-INCOTERMS1 is initial.
POITEM-INCOTERMS1 = 'CIF'.
endif.
if POITEM-INCOTERMS2 is initial.
POITEM-INCOTERMS2 = 'CIF'.
endif.
if POITEM-PREQ_ITEM is initial.
POITEM-PREQ_ITEM = '123456'.
endif.
APPEND POITEM.
CLEAR: POITEM.
ENDIF.
if POACCOUNT-PO_ITEM is initial.
POACCOUNT-PO_ITEM = SY-TABIX.
endif.
if POACCOUNT-SERIAL_NO is initial.
POACCOUNT-SERIAL_NO = L_TABIX.
endif.
MODIFY POACCOUNT.
ENDIF.
ENDLOOP.
PERFORM get_account_assignment TABLES poitem
poitemx
poaccount
poaccountx
t_yreturn
USING poheader-comp_code
poheader.
IF NOT t_yreturn[] IS INITIAL.
APPEND LINES OF t_yreturn TO RETURN.
READ TABLE t_yreturn WITH KEY type = 'W'.
IF sy-subrc <> 0.
EXPHEADER = POHEADER.
EXPHEADER-CODE = '99'.
SELECT max( serial_no )
INTO L_SERIAL
FROM ZP2P_ERRORS.
LOOP AT T_ERRORS.
L_SERIAL = L_SERIAL + 1.
T_ERRORS-serial_no = L_SERIAL.
MODIFY T_ERRORS TRANSPORTING serial_no.
ENDLOOP.
INSERT ZERRORS FROM TABLE T_ERRORS.
INSERT ZP2P_ERRORS FROM TABLE T_ERRORS.
**MOD-005
On Error, exit the function module
l_exit = 0.
LOOP AT RETURN WHERE TYPE = C_E.
L_EXIT = 1.
EXPHEADER = POHEADER.
EXPHEADER-CODE = '99'.
RETURN-RETURN_CODE = C_99.
RETURN-SEQ_CODE = C_99.
MODIFY RETURN TRANSPORTING RETURN_CODE SEQ_CODE.
ENDLOOP.
IF L_EXIT = 1.
EXIT.
ENDIF.
**MOD-005
EXIT.
ENDIF.
ENDIF.
PERFORM GET_INCOTERMS_LINE_ITEM tables poitem
using poheader.
perform get_uom_conversion tables poitem
POITEMX
poaccount
poaccountx
poschedule
poschedulex
pocond
pocondx
Pocondheader
pocondheaderx
changing poheader
poheaderx.
ENDIF.
*mod-003
****BV-27-May-2004 - End of Changes for SCR2****
*sraman2 10/14/04
IF POHEADER-PO_NUMBER(3) = C_PCO.
DATA: l_serial_no LIKE poaccount-serial_no.
loop at POACCOUNT.
ADD 1 TO l_serial_no.
POACCOUNT-SERIAL_NO = l_serial_no.
modify POACCOUNT.
endloop.
endif.
*sraman2 10/14/04
SORT POACCOUNT BY PO_ITEM.
LOOP AT POACCOUNT.
check poheader-quotation+0(2) ne 'CR' and
poheader-quotation+0(2) ne 'UT'.
IF NOT POACCOUNT-WBS_ELEMENT IS INITIAL. "line item posting to
"WBS element
CLEAR L_MSGV1.
L_MSGV1 = POACCOUNT-PO_ITEM.
Mod-004
Line Item NOT eligible for PCARD
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = C_MSGTYPE_I "I
CL = C_MSGID_Z001 "Z001
NUMBER = C_MSGNR_038 "038
PAR1 = L_MSGV1
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CLEAR RETURN.
*mod-004
loop at return.
l_wa_zerrors-OBJECT = 'PURCHASE_ORDER'.
l_wa_zerrors-serial_no = sy-tabix.
l_wa_zerrors-COMP_CODE = poheader-comp_code.
l_wa_zerrors-zid = return-id.
l_wa_zerrors-type = return-type.
l_wa_zerrors-znumber = return-number.
l_wa_zerrors-BEACON_DOC_NO = poheader-po_number.
l_wa_zerrors-SRC_DOC_NO = poheader-po_number.
l_wa_zerrors-ZDATE = sy-datum.
l_wa_zerrors-ERR_MSG = return-message.
append l_wa_zerrors to t_errors.
insert into zerrors values l_wa_zerrors.
clear: l_wa_zerrors.
endloop.
clear: l_wa_zerrors.
ELSE.
IF NOT POACCOUNT-COSTCENTER IS INITIAL.
"line item posting to cost center.
READ TABLE POITEM WITH KEY PO_ITEM = POACCOUNT-PO_ITEM.
IF SY-SUBRC = 0.
IF NOT POITEM-DISTRIB IS INITIAL.
CLEAR L_MSGV1.
L_MSGV1 = POACCOUNT-PO_ITEM.
*Mod-004
Line Item NOT eligible for PCAR -
Project Systems - Transaction CJ20N
Hi all,
In the transaction CJ20N(Project builder) for the creation of the WBS element, client has enhanced 2 fields, Investment program name(PRNAM) and investment program indicator(posid),apart from the standard fields available in PRPS table. Is there any BAPI/BADI/FM to create multiple WBS elements and the BAPI table should include these both fields PRNAM and POSID apart from the fields available IN PRPS table.
I used BAPI_BUS2054_CREATE_MULTI. But this BAPI table doesnot include PRNAM and POSID fields.
Kindly post your solutions.
Or is there any other method to solve this problem.Hi ,
u have to make use of Extensions of that BAPI to populate Customer Fields.
FU BAPI_BUS2054_CREATE_MULTI
Text
Create WBS Elements by BAPI
Functionality
WBS elements can be created for a project with BAPI "BAPI_BUS2054_CREATE_MULTI". To do this, parameter "I_PROJECT_DEFINITION" must contain the project definition for which the WBS elements are to be created. The individual WBS elements with all required values must be entered in table "IT_WBS_ELEMENT_TABLE".
The WBS elements are created next to each other, in the same sequence as in table "IT_WBS_ELEMENT_TABLE". A WBS element under which the new WBS elements are to be created can be specified in parameter "I_WBS_UP". A WBS element that is to be located directly to the left of the new WBS elements can be specified with parameter "I_WBS_LEFT". If "I_WBS_LEFT" is not specified, the new WBS elements are added on the left-hand side. If I_WBS_UP is also not specified, the new WBS elements are added on the left and on the first level.
Before anything is created, the following is checked:
Is another project already being processed in the LUW (Logical Unit of Work)?
Can the project be locked?
If one check is not successful, nothing is created. Otherwise, each WBS element is changed individually in "IT_WBS_ELEMENT_TABLE", although the following is checked first:
Is the data consistent?
If all checks are succussful, the individual WBS element is created in the document tables. Afterwards, the hierarchy is updated, that is the new elements are added in the appropriate place as described above. If an error occurs while this is being carried out, the new elements are created on the right-hand side, on the first level, and an error message is generated in the return table. An error can occur if the WBS element in I_WBS_UP and I_WBS_LEFT does not exist in the specified project, or I_WBS_UP is not directly above I_WBS_LEFT if both are specified, or because an inconsistency occurs in the hierarchy for another reason.
As soon as a LUW (Logical Unit of Work) is completed with BAPI BAPI_PS_PRECOMMIT and COMMIT WORK, the WBS elements are finally changed.
Only one project or WBS element from a project can be processed at a time in a LUW.
The return parameter RETURN displays first an error or success message that shows whether the WBS elements could be created. The first message variable contains the object type, the second contains the object ID, and the fourth contains the GUID (if it could be read). All related messages that were generated during processing are listed underneath the error or success messages. The parameters of the individual messages are filled with the object ID.
Notes
1. Definition "Processing Unit"
In the following, the term "processing unit" refers to a series of related processing steps.
The first step in a processing unit is initialization, which is done by calling the BAPI BAPI_PS_INITIALIZATION.
Afterwards, the individual BAPIs listed below can be used several times, if required.
The processing unit ends when the final precommit (call BAPI BAPI_PS_PRECOMMIT) is executed with a subsequent COMMIT WORK (for example, the statement COMMIT WORK, the BAPI "BAPI_TRANSACTION_COMMIT" or the BapiService.TransactionCommit method).
After the final COMMIT WORK, the next initialization opens a new processing unit via the BAPI "BAPI_PS_INITIALIZATION".
In principal, the following applies to each individual processing unit.
2. Creation of a Processing Unit
Each processing unit must be initialized by calling the BAPI "BAPI_PS_INITIALIZATION" once.
Afterwards, the following individual BAPIs can be used within a processing unit - they can also be used more than once, taking into account the "One-Project-Principle" explained below. This also means that an object created in the current processing unit by a CREATE-BAPI can be changed by a CHANGE-BAPI or STATUS-BAPI.
Except for the BAPIs explicitly named below, you can only call up BAPIs that execute GET methods or READ methods only. In particular, the BAPIs for confirming a network may not be used with the individual BAPIs named below!
Business Object ProjectDefinitionPI
BAPI Method
BAPI_BUS2001_CREATE ProjectDefinitionPI.CreateSingle
BAPI_BUS2001_CHANGE ProjectDefinitionPI.Change
BAPI_BUS2001_DELETE ProjectDefinitionPI.Delete
BAPI_BUS2001_SET_STATUS ProjectDefinitionPI.SetStatus
BAPI_BUS2001_PARTNER_CREATE_M ProjectDefinitionPI.PartnerCreateMultiple
BAPI_BUS2001_PARTNER_CHANGE_M ProjectDefinitionPI.PartnerChangeMultiple
BAPI_BUS2001_PARTNER_REMOVE_M ProjectDefinitionPI.PartnerRemoveMultiple
Business Object WBSPI
BAPI Method
BAPI_BUS2054_CREATE_MULTI WBSPI.CreateMultiple
BAPI_BUS2054_CHANGE_MULTI WBSPI.ChangeMultiple
BAPI_BUS2054_DELETE_MULTI WBSPI.DeleteMultiple
BAPI_BUS2001_SET_STATUS WBSPI.SetStatus
Business Object NetworkPI
BAPI Method
BAPI_BUS2002_CREATE NetworkPI.CreateFromData
BAPI_BUS2002_CHANGE NetworkPI.Change
BAPI_BUS2002_DELETE NetworkPI.Delete
BAPI_BUS2002_ACT_CREATE_MULTI NetworkPI.ActCreateMultiple
BAPI_BUS2002_ACT_CHANGE_MULTI NetworkPI.ActChangeMultiple
BAPI_BUS2002_ACT_DELETE_MULTI NetworkPI.ActDeleteMultiple
BAPI_BUS2002_ACTELEM_CREATE_M NetworkPI.ActElemCreateMultiple
BAPI_BUS2002_ACTELEM_CHANGE_M NetworkPI.ActElemChangeMultiple
BAPI_BUS2002_ACTELEM_DELETE_M NetworkPI.ActElemDeleteMultiple
BAPI_BUS2002_SET_STATUS NetworkPI.SetStatus
The processing unit must be finished by calling the BAPIs BAPI_PS_PRECOMMIT and BAPI_TRANSACTION_COMMIT (in that order).
3. One-Project Principle
For technical reasons, only the project definition and the WBS elements of one project can be processed in a processing unit.
More than one project is used, for example, if
You create or change more than one project
You have changed a project and want to change a network to which WBS elements from a different project are assigned
You want to change various networks to which WBS elements from different projects are assigned
You create or change a WBS assignment in a network so that a WBS element from a second project is used
WBS elements from different projects are already assigned to a network (note: this type of network cannot be processed with the network BAPIs named above).
If you define a report for calling BAPIs, this means that:
The report may use a maximum of one project per processing unit. The individual BAPI calls must be distributed between more than one processing unit, which use a maximum of one project per processing unit.
4. All-Or-Nothing Principle
If an error occurs in a processing unit in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT" (that is, the return table ET_RETURN contains at least one message of the type "E" (error), "A" (abnormal end) or "X" (exit), posting is not possible.
If an error occurs in an individual BAPI and despite this you call the BAPI "BAPI_PS_PRECOMMIT", message CNIF_PI 056 is issued with message type I (information).
If an error occurs in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT", but despite this you execute a COMMIT WORK, the program that is currently in process is terminated and message CNIF_PI 056 is issued with message type X.
This is to ensure data consistency for all objects created, changed, and/or deleted in the processing unit.
Note that the processing unit to which this happens can no longer be successfully closed and therefore, no new processing unit can be started.
However, you can set the current processing unit back to an initialized status by using a rollback work (for example, statement ROLLBACK WORK, the BAPI "BAPI_TRANSACTION_ROLLBACK" or the method BapiService.TransactionRollback). Technically speaking, this means that the previous LUW is terminated and a new LUW is started in the current processing unit.
Note that in this case, the current processing unit does not have to be re-initialized.
Also note that the rollback also takes place according to the "all-or-nothing" principle, that therefore all individual BAPIs carried out up to the rollback are discarded. After a rollback, you can, therefore, no longer refer to an object that was previously created in the current processing unit using a CREATE-BAPI.
However, you can close the processing unit again after a rollback, using a PRECOMMIT and COMMIT WORK, as long as all individual BAPIs, and the precommit carried out after the rollback, finish without errors.
You can carry out several rollbacks in a processing unit (technically: start a new LUW several times).
5. Procedure in the Case of Errors
As soon as an error occurs in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT", you have the following options:
Exit the report or the program that calls the BAPIs, the PRECOMMIT and the COMMIT WORK.
Execute a rollback in the current processing unit.
6. Rules for Posting
After you have successfully called the individual BAPIs of a processing unit, you must call the PRECOMMIT "BAPI_PS_PRECOMMIT".
If the PRECOMMIT is also successful, the COMMIT WORK must take place directly afterwards.
In particular, note that after the PRECOMMIT, you cannot call other individual BAPIs again in the current processing unit.
It is also not permitted to call the PRECOMMIT more than once in a processing unit.
7. Recommendation "COMMIT WORK AND WAIT"
If an object created in a processing unit is to be used in a subsequent processing unit (for example, as an account assignment object in a G/L account posting) it is recommended to call the commit work with the supplement "AND WAIT" or to set the parameters for the BAPI "BAPI_TRANSACTION_COMMIT" accordingly.
8. Field Selection
The field selection is a tool for influencing the user interface (that is, for the dialog). In the BAPIs, the settings from the field selection (for example, fields that are not ready for input or required-entry) are not taken into account.
9. Using a date in the BAPI interface
The BAPI must be provided with the date in the internal format YYYYMMDD (year month day). No special characters may be used.
As a BAPI must work independent of user, the date cannot and should not be converted to the date format specified in the user-specific settings.
10. Customer Enhancements of the BAPIs
For the BAPIs used to create and change project definitions, WBS elements, networks, activities, and activity elements, you can automatically fill the fields of the tables PROJ, PRPS, AUFK, and AFVU that have been defined for customer enhancements in the standard system.
For this purpose, help structures that contain the respective key fields, as well as the CI include of the table are supplied. The BAPIs contain the parameter ExtensionIN in which the enhancement fields can be entered and also provide BAdIs in which the entered values can be checked and, if required, processed further.
CI Include Help Structure Key
CI_PROJ BAPI_TE_PROJECT_DEFINITION PROJECT_DEFINITION
CI_PRPS BAPI_TE_WBS_ELEMENT WBS_ELEMENT
CI_AUFK BAPI_TE_NETWORK NETWORK
CI_AFVU BAPI_TE_NETWORK_ACTIVITY NETWORK ACTIVITY
CI_AFVU BAPI_TE_NETWORK_ACT_ELEMENT NETWORK ACTIVITY ELEMENT
Procedure for Filling Standard Enhancements
Before you call the BAPI for each object that is to be created or changed, for which you want to enter customer-specific table enhancement fields, add a data record to the container ExtensionIn:
STRUCTURE: Name of the corresponding help structure
VALUEPART1: Key of the object + start of the data part
VALUEPART2-4: If required, the continuation of the data part
VALUPART1 to VALUPART4 are therefore filled consecutively, first with the keys that identify the table rows and then with the values of the customer-specific fields. By structuring the container in this way, it is possible to transfer its content with one MOVE command to the structure of the BAPI table extension.
Note that when objects are changed, all fields of the enhancements are overwritten (as opposed to the standard fields, where only those fields for which the respective update indicator is set are changed). Therefore, even if you only want to change one field, all the fields that you transfer in ExtensionIn must be filled.
Checks and Further Processing
Using the methods ...CREATE_EXIT1 or. ...CHANGE_EXIT1 of the BAdI BAPIEXT_BUS2001, BAPIEXT_BUS2002, and BAPIEXT_BUS2054, you can check the entered values (and/or carry out other checks).
In the BAdI's second method, you can program that the data transferred to the BAPI is processed further (if you only want to transfer the fields of the CI includes, no more action is required here).
For more information, refer to the SAP Library under Cross-Application Components -> Business Framework Architecture -> Enhancements, Modifications ... -> Customer Enhancement and Modification of BAPIs -> Customer Enhancement of BAPIs (CA-BFA).
Further Information
For more information, refer to the SAP Library under Project System -> Structures -> Project System Interfaces -> PS-EPS Interface to External Project Management Systems.
Parameters
I_PROJECT_DEFINITION
IT_WBS_ELEMENT
ET_RETURN
EXTENSIONIN
EXTENSIONOUT
Exceptions
Function Group
CJ2054
Regards
Prabhu -
Hi All,
This is related to a function module in ISU.
Please tell me how the function module works -
" BAPI_BUS2002_SET_STATUS "
What shall me the input parameters to get the output( the output will me changed status of the service order)
Thx...
PaulHI
GOOD
BAPI_BUS2002_SET_STATUS NetworkPI.SetStatus
FU BAPI_BUS2002_SET_STATUS
Text
Set/Reset Status for BUS2002 (Network)
Functionality
You can use the BAPI BAPI_BUS2002_SET_STATUS to revoke one system status (UNDO_SYSTEM_STATUS) and one user status (UNDO_USER_STATUS) respectively, or to set one system status (SET_SYSTEM_STATUS) and one user status (SET_USER_STATUS) respectively, in the network header (NUMBER).
At the same time, you can revoke one system status and one user status, or set one system status and one user status in a list of activities for the network.
The following system statuses are supported for the network header:
'REL' Released (I0002) set
'LKD' Locked (I0043) set/revoke
'TECO' Technically completed (I0045) set/revoke
'CLSD' Closed (I0046) set/revoke
'AALK' Account Assignment locked (I0064) set/revoke
'DLFL' Deletion flag (I0076) set/revoke
The following system statuses are supported for the network operations:
'REL' Released (I0002) set
'TECO' Technically completed (I0045) set/revoke
'CLSD' Closed (I0046) set/revoke
'AALK' Account Assignment locked (I0064) set/revoke
'DLFL' Deletion flag (I0076) set/revoke
'DSEX' Dates set by external system (I0029) set/revoke
User statuses can be set or revoked in accordance with the status profile assigned to the network header or network activities. They must be transferred via the key in the relevant log-on language.
The processing sequence is as follows:
1. Network header:
a) Revoke system status
b) Revoke user status
c) Set system status
d) Set user status
2. Network operations:
a) Revoke system status
b) Revoke user status
c) Set system status
d) Set user status
If you cannot set/revoke a system/user status, all of the other activities will still be executed.
The inheritance of statuses is not integrated between the project and the network. A status change only affects the current network and not any other assigned projects/WBS elements.
Milestone functions are not supported.
The call of the BAPI can be repeated until a LUW (Logical Unit of Work) is completed with the BAPIs BAPI_PS_PRECOMMIT and BAPI COMMIT WORK.
Notes
1. Definition "Processing Unit"
In the following, the term "processing unit" refers to a series of related processing steps.
The first step in a processing unit is initialization, which is done by calling the BAPI BAPI_PS_INITIALIZATION.
Afterwards, the individual BAPIs listed below can be used several times, if required.
The processing unit ends when the final precommit (call BAPI BAPI_PS_PRECOMMIT) is executed with a subsequent COMMIT WORK (for example, the statement COMMIT WORK, the BAPI "BAPI_TRANSACTION_COMMIT" or the BapiService.TransactionCommit method).
After the final COMMIT WORK, the next initialization opens a new processing unit via the BAPI "BAPI_PS_INITIALIZATION".
In principal, the following applies to each individual processing unit.
2. Creation of a Processing Unit
Each processing unit must be initialized by calling the BAPI "BAPI_PS_INITIALIZATION" once.
Afterwards, the following individual BAPIs can be used within a processing unit - they can also be used more than once, taking into account the "One-Project-Principle" explained below. This also means that an object created in the current processing unit by a CREATE-BAPI can be changed by a CHANGE-BAPI or STATUS-BAPI.
Except for the BAPIs explicitly named below, you can only call up BAPIs that execute GET methods or READ methods only. In particular, the BAPIs for confirming a network may not be used with the individual BAPIs named below!
Business Object ProjectDefinitionPI
BAPI Method
BAPI_BUS2001_CREATE ProjectDefinitionPI.CreateSingle
BAPI_BUS2001_CHANGE ProjectDefinitionPI.Change
BAPI_BUS2001_DELETE ProjectDefinitionPI.Delete
BAPI_BUS2001_SET_STATUS ProjectDefinitionPI.SetStatus
BAPI_BUS2001_PARTNER_CREATE_M ProjectDefinitionPI.PartnerCreateMultiple
BAPI_BUS2001_PARTNER_CHANGE_M ProjectDefinitionPI.PartnerChangeMultiple
BAPI_BUS2001_PARTNER_REMOVE_M ProjectDefinitionPI.PartnerRemoveMultiple
Business Object WBSPI
BAPI Method
BAPI_BUS2054_CREATE_MULTI WBSPI.CreateMultiple
BAPI_BUS2054_CHANGE_MULTI WBSPI.ChangeMultiple
BAPI_BUS2054_DELETE_MULTI WBSPI.DeleteMultiple
BAPI_BUS2001_SET_STATUS WBSPI.SetStatus
Business Object NetworkPI
BAPI Method
BAPI_BUS2002_CREATE NetworkPI.CreateFromData
BAPI_BUS2002_CHANGE NetworkPI.Change
BAPI_BUS2002_DELETE NetworkPI.Delete
BAPI_BUS2002_ACT_CREATE_MULTI NetworkPI.ActCreateMultiple
BAPI_BUS2002_ACT_CHANGE_MULTI NetworkPI.ActChangeMultiple
BAPI_BUS2002_ACT_DELETE_MULTI NetworkPI.ActDeleteMultiple
BAPI_BUS2002_ACTELEM_CREATE_M NetworkPI.ActElemCreateMultiple
BAPI_BUS2002_ACTELEM_CHANGE_M NetworkPI.ActElemChangeMultiple
BAPI_BUS2002_ACTELEM_DELETE_M NetworkPI.ActElemDeleteMultiple
BAPI_BUS2002_SET_STATUS NetworkPI.SetStatus
The processing unit must be finished by calling the BAPIs BAPI_PS_PRECOMMIT and BAPI_TRANSACTION_COMMIT (in that order).
3. One-Project Principle
For technical reasons, only the project definition and the WBS elements of one project can be processed in a processing unit.
More than one project is used, for example, if
You create or change more than one project
You have changed a project and want to change a network to which WBS elements from a different project are assigned
You want to change various networks to which WBS elements from different projects are assigned
You create or change a WBS assignment in a network so that a WBS element from a second project is used
WBS elements from different projects are already assigned to a network (note: this type of network cannot be processed with the network BAPIs named above).
If you define a report for calling BAPIs, this means that:
The report may use a maximum of one project per processing unit. The individual BAPI calls must be distributed between more than one processing unit, which use a maximum of one project per processing unit.
4. All-Or-Nothing Principle
If an error occurs in a processing unit in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT" (that is, the return table ET_RETURN contains at least one message of the type "E" (error), "A" (abnormal end) or "X" (exit), posting is not possible.
If an error occurs in an individual BAPI and despite this you call the BAPI "BAPI_PS_PRECOMMIT", message CNIF_PI 056 is issued with message type I (information).
If an error occurs in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT", but despite this you execute a COMMIT WORK, the program that is currently in process is terminated and message CNIF_PI 056 is issued with message type X.
This is to ensure data consistency for all objects created, changed, and/or deleted in the processing unit.
Note that the processing unit to which this happens can no longer be successfully closed and therefore, no new processing unit can be started.
However, you can set the current processing unit back to an initialized status by using a rollback work (for example, statement ROLLBACK WORK, the BAPI "BAPI_TRANSACTION_ROLLBACK" or the method BapiService.TransactionRollback). Technically speaking, this means that the previous LUW is terminated and a new LUW is started in the current processing unit.
Note that in this case, the current processing unit does not have to be re-initialized.
Also note that the rollback also takes place according to the "all-or-nothing" principle, that therefore all individual BAPIs carried out up to the rollback are discarded. After a rollback, you can, therefore, no longer refer to an object that was previously created in the current processing unit using a CREATE-BAPI.
However, you can close the processing unit again after a rollback, using a PRECOMMIT and COMMIT WORK, as long as all individual BAPIs, and the precommit carried out after the rollback, finish without errors.
You can carry out several rollbacks in a processing unit (technically: start a new LUW several times).
5. Procedure in the Case of Errors
As soon as an error occurs in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT", you have the following options:
Exit the report or the program that calls the BAPIs, the PRECOMMIT and the COMMIT WORK.
Execute a rollback in the current processing unit.
6. Rules for Posting
After you have successfully called the individual BAPIs of a processing unit, you must call the PRECOMMIT "BAPI_PS_PRECOMMIT".
If the PRECOMMIT is also successful, the COMMIT WORK must take place directly afterwards.
In particular, note that after the PRECOMMIT, you cannot call other individual BAPIs again in the current processing unit.
It is also not permitted to call the PRECOMMIT more than once in a processing unit.
7. Recommendation "COMMIT WORK AND WAIT"
If an object created in a processing unit is to be used in a subsequent processing unit (for example, as an account assignment object in a G/L account posting) it is recommended to call the commit work with the supplement "AND WAIT" or to set the parameters for the BAPI "BAPI_TRANSACTION_COMMIT" accordingly.
8. Field Selection
The field selection is a tool for influencing the user interface (that is, for the dialog). In the BAPIs, the settings from the field selection (for example, fields that are not ready for input or required-entry) are not taken into account.
9. Using a date in the BAPI interface
The BAPI must be provided with the date in the internal format YYYYMMDD (year month day). No special characters may be used.
As a BAPI must work independent of user, the date cannot and should not be converted to the date format specified in the user-specific settings.
10. Customer Enhancements of the BAPIs
For the BAPIs used to create and change project definitions, WBS elements, networks, activities, and activity elements, you can automatically fill the fields of the tables PROJ, PRPS, AUFK, and AFVU that have been defined for customer enhancements in the standard system.
For this purpose, help structures that contain the respective key fields, as well as the CI include of the table are supplied. The BAPIs contain the parameter ExtensionIN in which the enhancement fields can be entered and also provide BAdIs in which the entered values can be checked and, if required, processed further.
CI Include Help Structure Key
CI_PROJ BAPI_TE_PROJECT_DEFINITION PROJECT_DEFINITION
CI_PRPS BAPI_TE_WBS_ELEMENT WBS_ELEMENT
CI_AUFK BAPI_TE_NETWORK NETWORK
CI_AFVU BAPI_TE_NETWORK_ACTIVITY NETWORK ACTIVITY
CI_AFVU BAPI_TE_NETWORK_ACT_ELEMENT NETWORK ACTIVITY ELEMENT
Procedure for Filling Standard Enhancements
Before you call the BAPI for each object that is to be created or changed, for which you want to enter customer-specific table enhancement fields, add a data record to the container ExtensionIn:
STRUCTURE: Name of the corresponding help structure
VALUEPART1: Key of the object + start of the data part
VALUEPART2-4: If required, the continuation of the data part
VALUPART1 to VALUPART4 are therefore filled consecutively, first with the keys that identify the table rows and then with the values of the customer-specific fields. By structuring the container in this way, it is possible to transfer its content with one MOVE command to the structure of the BAPI table extension.
Note that when objects are changed, all fields of the enhancements are overwritten (as opposed to the standard fields, where only those fields for which the respective update indicator is set are changed). Therefore, even if you only want to change one field, all the fields that you transfer in ExtensionIn must be filled.
Checks and Further Processing
Using the methods ...CREATE_EXIT1 or. ...CHANGE_EXIT1 of the BAdI BAPIEXT_BUS2001, BAPIEXT_BUS2002, and BAPIEXT_BUS2054, you can check the entered values (and/or carry out other checks).
In the BAdI's second method, you can program that the data transferred to the BAPI is processed further (if you only want to transfer the fields of the CI includes, no more action is required here).
For more information, refer to the SAP Library under Cross-Application Components -> Business Framework Architecture -> Enhancements, Modifications ... -> Customer Enhancement and Modification of BAPIs -> Customer Enhancement of BAPIs (CA-BFA).
The return parameter RETURN will contain an error message if an error occurred during processing. After the call, the table E_MESSAGE_TABLE contains all messages that were created during processing.
Further Information
You can find additional information in the SAP Library under Project System -> Structures -> Project System Interfaces -> PS-EPS Interface to External Project Management Systems.
Parameters
NUMBER
UNDO_SYSTEM_STATUS
UNDO_USER_STATUS
SET_SYSTEM_STATUS
SET_USER_STATUS
RETURN
I_ACTIVITY_SYSTEM_STATUS
I_ACTIVITY_USER_STATUS
E_RESULT
Exceptions
Function Group
CNIF_STATUS_2002
thanks
mrutyun -
Appending customer field for BAPI_CONTRACT_CREATE
Hello.
I'm trying to append customer field to the table EKPO using BAPI called "BAPI_CONTRACT_CREATE ".
I have created a structure and included it into append structure of EKPO.
Can anyone tell me what I should do next?
Regards,
Tomoko SakamotoHello Tomoko
The BAPI has a TABLES parameter EXTENSIONIN having the following documentation:
FU BAPI_CONTRACT_CREATE EXTENSIONIN
Short Text
ExtensionIn
Description
With the parameters ExtensionIn and ExtensionOut, it is possible to
enhance the interface of a BAPI without modification to achieve the
automatic processing of customer-specific data.
The data is passed on in a table. The format of the individual data
records of this table is determined via the structure BAPIPAREX. This
structure contains several data record fields (VALUEPART1, VALUEPART2
etc.) and a field for the name of an auxiliary structure (STRUCTURE).
Because per data record the data is written piecewise consecutively to
the data record fields available for the purpose, an auxiliary structure
is needed for the interpretation of the data.
In the event that an SAP database table is to be enhanced by additional
fields, BAPI table extensions are especially suitable as auxiliary
structures. A BAPI table extension can either be already predefined by
SAP or created by the customer. Examples of auxiliary structures and
BAPI table extensions can be found at the following points:
o Description of the various customer enhancement options
o Enhancement of BAPI based on existing SAP database tables
o Enhancement of BAPI through incorporation of additional customers'
own database tables
o Enhancement of BAPI by import data that does not show up the
database level
Note that only fields of the data type CHAR and similar data types may
be used in the BAPI parameter ExtensionIn/ExtensionOut.
If the customer Include contains deviating parameters, the configurable
message ME 887 is invoked. However, the data is not adopted in the
target structure from the container.
Default
The auxiliary structures have been defined as follows:
o Header data:
- BAPI_TE_MEOUTHEADER
- BAPI_TE_MEOUTHEADERX
o Item data:
- BAPI_TE_MEOUTITEM
- BAPI_TE_MEOUTITEMX
o Account assignment data:
- BAPI_TE_MEOUTACCOUNT
- BAPI_TE_MEOUTACCOUNTX
Function Module
BAPI_CONTRACT_CREATE
You need to define and structure the values passed by this EXTENSIONIN parameter in a specific way in order to achieve your goal. For more details please refer to:
[Customer Enhancement and Modification of BAPIs (CA-BFA)|http://help.sap.com/saphelp_nw70/helpdata/EN/6b/3f6d016d0711d396a50004ac96334b/content.htm]
Regards
Uwe -
Clarification on 'BAPI_BUS2054_CREATE_MULTI'
Hi Frnds,
I need some clarification in Bapi 'BAPI_BUS2054_CREATE_MULTI' :
1. Whether BAPI_PROJECT_MAINTAIN can be used to create a WBS Elemnt in CJ02 with Custom fields Value ?If Yes, then How can we do?
2. I know 'BAPI_BUS2054_CREATE_MULTI' can be used to change the WBS Element.My Doubt is whether we can create a Project and WBS Element with this Bapi? .If Yes, then How can we do?.
3. I want to upload the Custom field in Transaction CJ02.? How Can I do. Give me an Example?
4. I heard that, to use the BAPI 'BAPI_BUS2054_CREATE_MULTI' SAP Note 637345 should be apllied. Whether this is true ?
Please clarify my Doubts .
Thanks in Advance.Anand,
FU BAPI_BUS2054_CREATE_MULTI
Short Text
Create WBS Elements Using BAPI
Functionality
WBS elements can be created for a project with BAPI "BAPI_BUS2054_CREATE_MULTI". To do this, parameter "I_PROJECT_DEFINITION" must contain the project definition for which the WBS elements are to be created. The individual WBS elements with all required values must be entered in table "IT_WBS_ELEMENT_TABLE".
The WBS elements are created next to each other, in the same sequence as in table "IT_WBS_ELEMENT_TABLE". A WBS element under which the new WBS elements are to be created can be specified in parameter "I_WBS_UP". A WBS element that is to be located directly to the left of the new WBS elements can be specified with parameter "I_WBS_LEFT". If "I_WBS_LEFT" is not specified, the new WBS elements are added on the left-hand side. If I_WBS_UP is also not specified, the new WBS elements are added on the left and on the first level.
Before anything is created, the following is checked:
Is another project already being processed in the LUW (Logical Unit of Work)?
Can the project be locked?
If one check was not successful, nothing is created. Otherwise, each WBS element is changed individually in "IT_WBS_ELEMENT_TABLE", although the following is checked first:
Is the data consistent?
If all checks were succussful, the individual WBS element is created in the document tables. Afterwards, the hierarchy is updated, that is the new elements are added in the appropriate place as described above. If an error occurs while this is being carried out, the new elements are created on the right-hand side, on the first level, and an error message is generated in the return table. An error can occur if the WBS element in I_WBS_UP and I_WBS_LEFT does not exist in the specified project, or I_WBS_UP is not directly above I_WBS_LEFT if both are specified, or because an inconsistency occurs in the hierarchy for another reason.
As soon as a LUW (Logical Unit of Work) is completed with BAPI BAPI_PS_PRECOMMIT and COMMIT WORK, the WBS elements are finally changed.
Only one project or WBS element from a project can be processed at a time in a LUW.
The return parameter RETURN displays first an error or success message that shows whether the WBS elements could be created. The first message variable contains the object type, the second contains the object ID, and the fourth contains the GUID (if it could be read). All related messages that were generated during processing are listed underneath the error or success messages. The parameters of the individual messages are filled with the object ID.
Notes
1. Definition "Processing Unit"
In the following, the term "processing unit" refers to a series of related processing steps.
The first step in a processing unit is initialization, which is done by calling the BAPI BAPI_PS_INITIALIZATION.
Afterwards, the individual BAPIs listed below can be used several times, if required.
The processing unit ends when the final precommit (call BAPI BAPI_PS_PRECOMMIT) is executed with a subsequent COMMIT WORK (for example, the statement COMMIT WORK, the BAPI "BAPI_TRANSACTION_COMMIT" or the BapiService.TransactionCommit method).
After the final COMMIT WORK, the next initialization opens a new processing unit via the BAPI "BAPI_PS_INITIALIZATION".
In principal, the following applies to each individual processing unit.
2. Creation of a Processing Unit
Each processing unit must be initialized by calling the BAPI "BAPI_PS_INITIALIZATION" once.
Afterwards, the following individual BAPIs can be used within a processing unit - they can also be used more than once, taking into account the "One-Project-Principle" explained below. This also means that an object created in the current processing unit by a CREATE-BAPI can be changed by a CHANGE-BAPI or STATUS-BAPI.
Except for the BAPIs explicitly named below, you can only call up BAPIs that execute GET methods or READ methods only. In particular, the BAPIs for confirming a network may not be used with the individual BAPIs named below!
Business Object ProjectDefinitionPI
BAPI Method
BAPI_BUS2001_CREATE ProjectDefinitionPI.CreateSingle
BAPI_BUS2001_CHANGE ProjectDefinitionPI.Change
BAPI_BUS2001_DELETE ProjectDefinitionPI.Delete
BAPI_BUS2001_SET_STATUS ProjectDefinitionPI.SetStatus
BAPI_BUS2001_PARTNER_CREATE_M ProjectDefinitionPI.PartnerCreateMultiple
BAPI_BUS2001_PARTNER_CHANGE_M ProjectDefinitionPI.PartnerChangeMultiple
BAPI_BUS2001_PARTNER_REMOVE_M ProjectDefinitionPI.PartnerRemoveMultiple
Business Object WBSPI
BAPI Method
BAPI_BUS2054_CREATE_MULTI WBSPI.CreateMultiple
BAPI_BUS2054_CHANGE_MULTI WBSPI.ChangeMultiple
BAPI_BUS2054_DELETE_MULTI WBSPI.DeleteMultiple
BAPI_BUS2001_SET_STATUS WBSPI.SetStatus
Business Object NetworkPI
BAPI Method
BAPI_BUS2002_CREATE NetworkPI.CreateFromData
BAPI_BUS2002_CHANGE NetworkPI.Change
BAPI_BUS2002_DELETE NetworkPI.Delete
BAPI_BUS2002_ACT_CREATE_MULTI NetworkPI.ActCreateMultiple
BAPI_BUS2002_ACT_CHANGE_MULTI NetworkPI.ActChangeMultiple
BAPI_BUS2002_ACT_DELETE_MULTI NetworkPI.ActDeleteMultiple
BAPI_BUS2002_ACTELEM_CREATE_M NetworkPI.ActElemCreateMultiple
BAPI_BUS2002_ACTELEM_CHANGE_M NetworkPI.ActElemChangeMultiple
BAPI_BUS2002_ACTELEM_DELETE_M NetworkPI.ActElemDeleteMultiple
BAPI_BUS2002_SET_STATUS NetworkPI.SetStatus
The processing unit must be finished by calling the BAPIs BAPI_PS_PRECOMMIT and BAPI_TRANSACTION_COMMIT (in that order).
3. One-Project Principle
For technical reasons, only the project definition and the WBS elements of one project can be processed in a processing unit.
More than one project is used, for example, if
You create or change more than one project
You have changed a project and want to change a network to which WBS elements from a different project are assigned
You want to change various networks to which WBS elements from different projects are assigned
You create or change a WBS assignment in a network so that a WBS element from a second project is used
WBS elements from different projects are already assigned to a network (note: this type of network cannot be processed with the network BAPIs named above).
If you define a report for calling BAPIs, this means that:
The report may use a maximum of one project per processing unit. The individual BAPI calls must be distributed between more than one processing unit, which use a maximum of one project per processing unit.
4. All-Or-Nothing Principle
If an error occurs in a processing unit in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT" (that is, the return table ET_RETURN contains at least one message of the type "E" (error), "A" (abnormal end) or "X" (exit), posting is not possible.
If an error occurs in an individual BAPI and despite this you call the BAPI "BAPI_PS_PRECOMMIT", message CNIF_PI 056 is issued with message type I (information).
If an error occurs in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT", but despite this you execute a COMMIT WORK, the program that is currently in process is terminated and message CNIF_PI 056 is issued with message type X.
This is to ensure data consistency for all objects created, changed, and/or deleted in the processing unit.
Note that the processing unit to which this happens can no longer be successfully closed and therefore, no new processing unit can be started.
However, you can set the current processing unit back to an initialized status by using a rollback work (for example, statement ROLLBACK WORK, the BAPI "BAPI_TRANSACTION_ROLLBACK" or the method BapiService.TransactionRollback). Technically speaking, this means that the previous LUW is terminated and a new LUW is started in the current processing unit.
Note that in this case, the current processing unit does not have to be re-initialized.
Also note that the rollback also takes place according to the "all-or-nothing" principle, that therefore all individual BAPIs carried out up to the rollback are discarded. After a rollback, you can, therefore, no longer refer to an object that was previously created in the current processing unit using a CREATE-BAPI.
However, you can close the processing unit again after a rollback, using a PRECOMMIT and COMMIT WORK, as long as all individual BAPIs, and the precommit carried out after the rollback, finish without errors.
You can carry out several rollbacks in a processing unit (technically: start a new LUW several times).
5. Procedure in the Case of Errors
As soon as an error occurs in an individual BAPI or in the BAPI "BAPI_PS_PRECOMMIT", you have the following options:
Exit the report or the program that calls the BAPIs, the PRECOMMIT and the COMMIT WORK.
Execute a rollback in the current processing unit.
6. Rules for Posting
After you have successfully called the individual BAPIs of a processing unit, you must call the PRECOMMIT "BAPI_PS_PRECOMMIT".
If the PRECOMMIT is also successful, the COMMIT WORK must take place directly afterwards.
In particular, note that after the PRECOMMIT, you cannot call other individual BAPIs again in the current processing unit.
It is also not permitted to call the PRECOMMIT more than once in a processing unit.
7. Recommendation "COMMIT WORK AND WAIT"
If an object created in a processing unit is to be used in a subsequent processing unit (for example, as an account assignment object in a G/L account posting) it is recommended to call the commit work with the supplement "AND WAIT" or to set the parameters for the BAPI "BAPI_TRANSACTION_COMMIT" accordingly.
8. Field Selection
The field selection is a tool for influencing the user interface (that is, for the dialog). In the BAPIs, the settings from the field selection (for example, fields that are not ready for input or required-entry) are not taken into account.
9. Using a date in the BAPI interface
The BAPI must be provided with the date in the internal format YYYYMMDD (year month day). No special characters may be used.
As a BAPI must work independent of user, the date cannot and should not be converted to the date format specified in the user-specific settings.
10. Customer Enhancements of the BAPIs
For the BAPIs used to create and change project definitions, WBS elements, networks, activities, and activity elements, you can automatically fill the fields of the tables PROJ, PRPS, AUFK, and AFVU that have been defined for customer enhancements in the standard system.
For this purpose, help structures that contain the respective key fields, as well as the CI include of the table are supplied. The BAPIs contain the parameter ExtensionIN in which the enhancement fields can be entered and also provide BAdIs in which the entered values can be checked and, if required, processed further.
CI Include Help Structure Key
CI_PROJ BAPI_TE_PROJECT_DEFINITION PROJECT_DEFINITION
CI_PRPS BAPI_TE_WBS_ELEMENT WBS_ELEMENT
CI_AUFK BAPI_TE_NETWORK NETWORK
CI_AFVU BAPI_TE_NETWORK_ACTIVITY NETWORK ACTIVITY
CI_AFVU BAPI_TE_NETWORK_ACT_ELEMENT NETWORK ACTIVITY ELEMENT
Procedure for Filling Standard Enhancements
Before you call the BAPI for each object that is to be created or changed, for which you want to enter customer-specific table enhancement fields, add a data record to the container ExtensionIn:
STRUCTURE: Name of the corresponding help structure
VALUEPART1: Key of the object + start of the data part
VALUEPART2-4: If required, the continuation of the data part
VALUPART1 to VALUPART4 are therefore filled consecutively, first with the keys that identify the table rows and then with the values of the customer-specific fields. By structuring the container in this way, it is possible to transfer its content with one MOVE command to the structure of the BAPI table extension.
Note that when objects are changed, all fields of the enhancements are overwritten (as opposed to the standard fields, where only those fields for which the respective update indicator is set are changed). Therefore, even if you only want to change one field, all the fields that you transfer in ExtensionIn must be filled.
Checks and Further Processing
Using the methods ...CREATE_EXIT1 or. ...CHANGE_EXIT1 of the BAdI BAPIEXT_BUS2001, BAPIEXT_BUS2002, and BAPIEXT_BUS2054, you can check the entered values (and/or carry out other checks).
In the BAdI's second method, you can program that the data transferred to the BAPI is processed further (if you only want to transfer the fields of the CI includes, no more action is required here).
For more information, refer to the SAP Library under Cross-Application Components -> Business Framework Architecture -> Enhancements, Modifications ... -> Customer Enhancement and Modification of BAPIs -> Customer Enhancement of BAPIs (CA-BFA).
Further information
For more information, refer to the SAP Library under Project System -> Structures -> Project System Interfaces -> PS-EPS Interface to External Project Management Systems.
Parameters
I_PROJECT_DEFINITION
IT_WBS_ELEMENT
ET_RETURN
EXTENSIONIN
EXTENSIONOUT
Exceptions
Function Group
CJ2054 -
BAPI_PO_CREATE to BAPI_PO_CREATE1; how to?
Hello gurus,
I'm working on an old custom interface FM (on a backend system) which substancially acts as a "wrapper" for the BAPI_PO_CREATE.
In details, the code processes an input, does some check on some conditions, then launch the BAPI_PO_CREATE fm in order to create a Purchase order. This is used to interface a third party system with SAP backends.
Now, the aim is to substitute the call to the BAPI_PO_CREATE (obsolete) with BAPI_PO_CREATE1. As far as I've seen, the latter allows to manage more data and also structures and types used are different from the older one.
So I wonder and ask if there's a sort of howto or standard FM to manage data conversion in order to successfully swap the call from BAPI_PO_CREATE with a newer call of BAPI_PO_CREATE1.
I searched a bit on the forum and web but didn't find anything related to this task
Thanks in advance for your help.Hello there
sorry for the late, I had a previous task to work to so that I had the chance to test your purposed solution only on friday..
I have to say, Martin's suggestion goes quite fine; I used the standard EHSWA_112_PO_BAPI_CONVERT (curiosity: what are the EHSWA* FM for?) to convert some input structures from BAPI_PO_CREATE to BAPI_PO_CREATE1.
Some other structures use the same data type on both BAPI so they don't need - apparently - specific conversion.
And here comes the trouble: while older BAPI_PO_CREATE worked before, the newly interfaced BAPI_PO_CREATE1 doesn't work, as expected, because some little adjustments need to be done.
The one I'm facing now is how to adapt the EXTENSIONIN structure, which contains custom field values. I noticed in debug the routine that moves extensionin to the data structure of the bapi looks for the structure name BAPI_TE_MEPOHEADER, which is different from the structure used in the older bapi (BAPI_TE_PO_HEADER).
So, a preliminary task is to substitute in the EXTENSIONIN table the structure names, in order to adapt them to the new BAPI.
Tried in debug, but seems there are other problems and... since I don't know specifically how this extensionin structure works and what's the correct way of converting them for the new BAPI, is there any guide/document that could help me understanding how mapping is done ? Or the only way is to debug the stuff?
Thanks in advance for yout help -
How to populate a custom field of a Std. SAP Tx with BAPI usage 2 Load data
Hi Experts,
For instance, I created a custom field (say, custom_field_1) on a screen of standard SAP tx(say, ME21N) by using screen exit. And in order to populate the data into it (custom_field_1), will use the Function user exits of this Tx(ME23N).
1) In next step, Where Where I have to add this field, apart from appending the same custom field in EKKO/EKPO table or any other related table; Extending the corresponding IDOC or creating a new Custom ÍDOC type? like What about BAPI?
2) If I got a text file with the data (including the data for this custom_field_1 too) and I have been asked to load it into SAP, then, I decided to use BAPI (say, BAPI_PO_CREATE or CREATE1) to create the data, So, How to handle this custom field, I mean, In which BAPI structure I have to pass this custom_field_1 data? ( Iguess, for some BAPIs EXTENSIONIN structures are provided, sorry if am wrong!)
Thank you.
Edited by: SAP ABAPer on Feb 21, 2009 7:40 PMfor example if you added field in the VBAP table then you can pass the custome field values like below
move 'BAPE_VBAP' to lwa_extension-structure.
lwa_bape_vbap-vbeln = lwa_final-vbeln.
lwa_bape_vbap-posnr = lv_posnr.
move lwa_final-yyslotid to lwa_bape_vbap-new custome field.
move lwa_bape_vbap to lwa_extension-valuepart1.
append lwa_extension to lt_extension.
clear lwa_extension.
move 'BAPE_VBAPX' to lwa_extension-structure.
lwa_bape_vbapx-vbeln = lwa_final-vbeln.
lwa_bape_vbapx-posnr = lv_posnr.
move 'X' to lwa_bape_vbapx--new custome field.
move lwa_bape_vbapx to lwa_extension-valuepart1.
append lwa_extension to lt_extension.
clear lwa_extension.
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = strcture
order_header_inx = strcture
tables
order_item_in =strcture
order_item_inx = strcture
schedule_lines = strcture
schedule_linesx = strcture
extensionin = lt_extension.
Maybe you are looking for
-
Can we copy the entire standard fact sheet and make it custom for extension BO
Dear all, I have created an extension for account. Now i want to create the Factsheet including the data from xbo and want to remove some standard fields as well. but is it possible to copy or make the standard factsheet as template and we can make o
-
In PI 7.1, condition editor does not show the outbound interface structure
Hello, I am using PI 7.1, I need to use condition whild determing receivers. So I opened the condition editor, then open the expression editor, select XPath instead of Context object. I would expect that the outbound interface structure appears in th
-
[How - to] Install in a click from AUR webpages
Here I little hack I coded to install packages directly from the AUR frontend. Needed: - yaourt - Firefox with greasemonkey (https://addons.mozilla.org/addon/748) or any greasemonkey-scripts accepting browser. Steps: 1. Create a small bash script cal
-
Scrolling back and forward no longer works with any web browser (I've tried it on Opera, Chromium, and Safari) - with either a Magic Mouse or Magic Trackpad. Anyone figure out how to get this back?
-
FF67 not clearing documents with similar amounts
Hi Guys, When we are running FF67 for manual bank statement as a batch input session, the system is not clearing the payments with similar amounts based on the check number. The batch input session is getting stopped in between if we are running it i