‎2008 Jan 25 10:01 AM
Hi,
Do you guys know of an available function or bapi that updates values of a WBS element?
‎2008 Jan 25 10:04 AM
Hello,
Make use of this BAPI
BAPI_PROJECT_MAINTAIN
Check this sample.
REPORT ZV_TEST_BAPI .
DATA: WA_PROJECT_DEFINITION LIKE BAPI_PROJECT_DEFINITION.
DATA: WA_PROJECT_DEFINITION_UPD LIKE BAPI_PROJECT_DEFINITION_UP.
DATA: T_METHOD_PROJECT LIKE BAPI_METHOD_PROJECT
OCCURS 0 WITH HEADER LINE.
DATA: T_WBS_ELEMENT LIKE BAPI_WBS_ELEMENT
OCCURS 0 WITH HEADER LINE.
DATA: T_WBS_ELEMENT_UPDATE LIKE BAPI_WBS_ELEMENT_UPDATE
OCCURS 0 WITH HEADER LINE.
DATA: E_MESSAGE_TABLE LIKE BAPI_METH_MESSAGE
OCCURS 0 WITH HEADER LINE.
DATA: RETURN LIKE BAPIRETURN1.
PARAMETERS: PSPID LIKE PROJ-PSPID MEMORY ID PSP.
DATA: LV_REFNUM LIKE BAPI_METHOD_PROJECT-REFNUMBER.
DATA: ITAB LIKE PRPS OCCURS 0 WITH HEADER LINE.
DATA: LV_PSPID(6).
CONCATENATE PSPID '%' INTO LV_PSPID.
SELECT * FROM PRPS INTO TABLE ITAB WHERE POSID LIKE LV_PSPID
AND STUFE BETWEEN '1' AND '3' .
CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
EXPORTING
INPUT = PSPID
IMPORTING
OUTPUT = PSPID.
WA_PROJECT_DEFINITION-PROJECT_DEFINITION = PSPID.
LOOP AT ITAB.
CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
EXPORTING
INPUT = ITAB-POSID
IMPORTING
OUTPUT = ITAB-POSID.
ADD 1 TO LV_REFNUM.
T_METHOD_PROJECT-REFNUMBER = LV_REFNUM.
T_METHOD_PROJECT-OBJECTTYPE = 'WBS-ELEMENT'.
T_METHOD_PROJECT-METHOD = 'UPDATE'.
T_METHOD_PROJECT-OBJECTKEY = ITAB-POSID.
APPEND T_METHOD_PROJECT.
T_WBS_ELEMENT_UPDATE-USER_FIELD_CHAR10_2 = 'X'.
APPEND T_WBS_ELEMENT_UPDATE.
T_WBS_ELEMENT-WBS_ELEMENT = ITAB-POSID.
T_WBS_ELEMENT-PROJECT_DEFINITION = PSPID.
IF ITAB-POSID = PSPID.
T_WBS_ELEMENT-USER_FIELD_CHAR10_2 = SPACE.
ELSE.
T_WBS_ELEMENT-USER_FIELD_CHAR10_2 = PSPID.
ENDIF.
APPEND T_WBS_ELEMENT.
ENDLOOP.
clear:T_METHOD_PROJECT.
T_METHOD_PROJECT-REFNUMBER = '000000'.
T_METHOD_PROJECT-METHOD = 'SaveAndWait'.
APPEND T_METHOD_PROJECT.
sort: T_METHOD_PROJECT,T_WBS_ELEMENT.
CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
EXPORTING
I_PROJECT_DEFINITION = WA_PROJECT_DEFINITION
I_PROJECT_DEFINITION_UPD = WA_PROJECT_DEFINITION_UPD
IMPORTING
RETURN = RETURN
TABLES
I_METHOD_PROJECT = T_METHOD_PROJECT
I_WBS_ELEMENT_TABLE_UPDATE = T_WBS_ELEMENT_UPDATE
I_WBS_ELEMENT_TABLE = T_WBS_ELEMENT
E_MESSAGE_TABLE = E_MESSAGE_TABLE.
IF RETURN-TYPE <> 'E'.
CALL 'BAPI_TRANSACTION_COMMIT'.
commit work.
ENDIF.
Cheers,
Vasanth
‎2008 Jan 25 10:04 AM
Hello,
Make use of this BAPI
BAPI_PROJECT_MAINTAIN
Check this sample.
REPORT ZV_TEST_BAPI .
DATA: WA_PROJECT_DEFINITION LIKE BAPI_PROJECT_DEFINITION.
DATA: WA_PROJECT_DEFINITION_UPD LIKE BAPI_PROJECT_DEFINITION_UP.
DATA: T_METHOD_PROJECT LIKE BAPI_METHOD_PROJECT
OCCURS 0 WITH HEADER LINE.
DATA: T_WBS_ELEMENT LIKE BAPI_WBS_ELEMENT
OCCURS 0 WITH HEADER LINE.
DATA: T_WBS_ELEMENT_UPDATE LIKE BAPI_WBS_ELEMENT_UPDATE
OCCURS 0 WITH HEADER LINE.
DATA: E_MESSAGE_TABLE LIKE BAPI_METH_MESSAGE
OCCURS 0 WITH HEADER LINE.
DATA: RETURN LIKE BAPIRETURN1.
PARAMETERS: PSPID LIKE PROJ-PSPID MEMORY ID PSP.
DATA: LV_REFNUM LIKE BAPI_METHOD_PROJECT-REFNUMBER.
DATA: ITAB LIKE PRPS OCCURS 0 WITH HEADER LINE.
DATA: LV_PSPID(6).
CONCATENATE PSPID '%' INTO LV_PSPID.
SELECT * FROM PRPS INTO TABLE ITAB WHERE POSID LIKE LV_PSPID
AND STUFE BETWEEN '1' AND '3' .
CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
EXPORTING
INPUT = PSPID
IMPORTING
OUTPUT = PSPID.
WA_PROJECT_DEFINITION-PROJECT_DEFINITION = PSPID.
LOOP AT ITAB.
CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
EXPORTING
INPUT = ITAB-POSID
IMPORTING
OUTPUT = ITAB-POSID.
ADD 1 TO LV_REFNUM.
T_METHOD_PROJECT-REFNUMBER = LV_REFNUM.
T_METHOD_PROJECT-OBJECTTYPE = 'WBS-ELEMENT'.
T_METHOD_PROJECT-METHOD = 'UPDATE'.
T_METHOD_PROJECT-OBJECTKEY = ITAB-POSID.
APPEND T_METHOD_PROJECT.
T_WBS_ELEMENT_UPDATE-USER_FIELD_CHAR10_2 = 'X'.
APPEND T_WBS_ELEMENT_UPDATE.
T_WBS_ELEMENT-WBS_ELEMENT = ITAB-POSID.
T_WBS_ELEMENT-PROJECT_DEFINITION = PSPID.
IF ITAB-POSID = PSPID.
T_WBS_ELEMENT-USER_FIELD_CHAR10_2 = SPACE.
ELSE.
T_WBS_ELEMENT-USER_FIELD_CHAR10_2 = PSPID.
ENDIF.
APPEND T_WBS_ELEMENT.
ENDLOOP.
clear:T_METHOD_PROJECT.
T_METHOD_PROJECT-REFNUMBER = '000000'.
T_METHOD_PROJECT-METHOD = 'SaveAndWait'.
APPEND T_METHOD_PROJECT.
sort: T_METHOD_PROJECT,T_WBS_ELEMENT.
CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
EXPORTING
I_PROJECT_DEFINITION = WA_PROJECT_DEFINITION
I_PROJECT_DEFINITION_UPD = WA_PROJECT_DEFINITION_UPD
IMPORTING
RETURN = RETURN
TABLES
I_METHOD_PROJECT = T_METHOD_PROJECT
I_WBS_ELEMENT_TABLE_UPDATE = T_WBS_ELEMENT_UPDATE
I_WBS_ELEMENT_TABLE = T_WBS_ELEMENT
E_MESSAGE_TABLE = E_MESSAGE_TABLE.
IF RETURN-TYPE <> 'E'.
CALL 'BAPI_TRANSACTION_COMMIT'.
commit work.
ENDIF.
Cheers,
Vasanth
‎2008 Jan 29 8:53 AM
Hi Vasanth,
This is very helpful. I'll give you points for this. The highest one ofcourse!!!
Anyway, may I add a question. What if I want to add and delete an object like a project, WBS, network, activity and material/component. How will I do that? What method will I use? is it 'CREATE' and 'DELETE'?
Again, thank you very much.
‎2008 Jan 29 9:24 AM
Hello Jackie,
Could you please have a look at the BAPI Document.
FU BAPI_PROJECT_MAINTAIN
____________________________________________________
Short text
Edit project including networks
Functionality
With the Maintain BAPI of the WorkBreakdownStruct business object you
can edit the objects of a project definition. You can also use all the
functions of the Maintain BAPI of the Network business object.
For more information, see Network.Maintain. With
WorkBreakdownStruct.Maintain it is possible to edit the project
definition, its WBS elements and their hierarchical relationships. The
BAPI encapsulates a complete transaction in itself. As a result, several
operations on project elements can be processed by only one call.
The R/3 Project System determines in which order the operations are to
be executed on the objects. The caller can choose the operations in any
order.
As a result, processing is very speedy and effective. However, this
transaction concept does not include the use and combination of other
SAP BAPIs in the same LUW.
Procedure
The WorkBreakdownStruct business object is a facade of the project
definition for WBS elements and their hierarchy.
To edit a project object, enter a command for an object type. In addition, enter the object key and a reference to its attributes.
In the table of the IMethodProject parameter enter the object type, the
command and the object key. As a reference enter the index of the object
data table of the relevant object type. In the object data table enter
the information about the object. If necessary, use an update structure
for the object.
When entering the object type and method in the IMethodProject table
remember that the entries are case-sensitive.
To finish the transaction and store the data in the R/3 database, enter
the Save command. If you only want to test whether the changes can be
carried out, do not use the save command.
In general, you cannot change the keys of objects.
The return parameter Return indicates whether errors occurred during
processing. After the call you find the error messages created during
processing in the EmessageTable table.
ommands of the Object Types
For the description of the object types Network, NetworkActivity,
NetworkActivityElement, ActivityMilestone, and NetworkRelation, see
Network.Maintain.
bject type: Project definition
The Maintain BAPI must always refer to one project definition.
Therefore, always enter the structure of a project definition in the
IProjectDefinition parameter. Use the project definition as a key. The
reference to the data part is always 1. Always enter the project
definition in uppercase.
Command: Create Enter the project definition and the project profile.
The project profile must exist in the R/3 Project System.
Example - Create a Project Definition in the R/3 Project System
o IMethodProject
- OBJECTTYPE = ProjectDefinition
- METHOD = Create
- OBJECTKEY = PD-TRAINING
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
- DESCRIPTION = Training project
- PROJECT_PROFILE = PPRO001
Command: Update
Use this command to change a project definition that already exists in
the R/3 Project System. If you enter an update structure you can change
individual fields without having to specify the other fields.
Example - Changing the description of a project definition (Only the
description is changed.)
o IMethodProject
- OBJECTTYPE = ProjectDefinition
- METHOD = Update
- OBJECTKEY = PD-TRAINING
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
- DESCRIPTION = Training project
- IProjectDefinitionUp
- PROJECT_DEFINITION =
- DESCRIPTION = X
Command: Lock (from R/3 Release 4.6A)
Use this command to lock a project definition. The "Master data locked"
system status is set for the project definition.
LS>Example - Locking the project definition PD-TRAINING
o IMethodProject
- OBJECTTYPE = ProjectDefinition
- METHOD = Lock
- OBJECTKEY = PD-TRAINING
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
IProjectDefinition
PROJECT_DEFINITION = PD-TRAINING
Command: Unlock (from R/3 Release 4.6A)
Use this command to unlock the project definition. The "Master data
locked" system status is removed from the project definition.
Example - Unlocking the project defintion PD-TRAINING<
o IMethodProject
- OBJECTTYPE = ProjectDefinition
- METHOD = Unlock
- OBJECTKEY = PD-TRAINING
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
Command: Release (from R/3 Release 4.5A)
Releasing a project. The system status "released" is set for the
project definition and all WBS elements.
Example - Releasing the project definition PD-TRAINING
o IMethodProject
- OBJECTTYPE = ProjectDefinition
- METHOD = Release
- OBJECTKEY = PD-TRAINING
- REFNUMBER =
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
t type: WBS element
can edit all WBS elements of a project definition. The name and key
the WBS element are identical.
er the WBS element in uppercase.
mand: Create
mple - Creating a WBS element for the project definition. Creating
ee WBS elements TRAINING, TRAINING.1 and TRAINING.2 for project
inition PD-TRAINING
IMethodProject
- OBJECTTYPE = WBS-Element
- METHOD = Create
- OBJECTKEY = TRAINING
- REFNUMBER = 000001
- OBJECTTYPE = WBS-Element
- METHOD = Create
- OBJECTKEY = TRAINING.1
- REFNUMBER = 000002
- OBJECTTYPE = WBS element
- METHOD = Create
- OBJECTKEY = TRAINING.2
- REFNUMBER = 000003
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
- IWbsElementTable
- Index = 1
- WBS_ELEMENT = TRAINING
- PROJECT_DEFINITION = PD-TRAINING
- DESCRIPTION = Whole project
- Index = 2
- WBS_ELEMENT = TRAINING.1
- PROJECT_DEFINITION = PD-TRAINING
- DESCRIPTION = Preparation
- Index = 3
- WBS_ELEMENT = TRAINING.2
- PROJECT_DEFINITION = PD-TRAINING
- DESCRIPTION = Execution
Kommando: Update
Use this command to change a WBS element that already exists in the R/3
Project System. If you enter an update structure, you can change
individual fields without having to specify the other fields.
Example - Changing the description of the WBS element TRAINING.1 for the
project definition PD TRAINING
o IMethodProject
- OBJECTTYPE = WBS element
- METHOD = Update
- OBJECTKEY = TRAINING.1
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
o IWbsElementTable
- Index = 1
- WBS_ELEMENT = TRAINING.1
- PROJECT_DEFINITION = PD-TRAINING
- DESCRIPTION = Preparation and documentation
o IWbsElementTableUpdate
- Index = 1
- WBS_ELEMENT =
- PROJECT_DEFINITION =
- DESCRIPTION = X
Command: Delete
Use this command to delete a WBS element that already exists in the R/3
Project System. The WBS element receives the Deletion flag system status
and is nor deleted physically. You cannot create a new WBS element with
the same key.
Example - Deleting the WBS element TRAINING.2 for the project PD
TRAINING
o IMethodProject
- OBJECTTYPE = WBS element
- METHOD = Delete
- OBJECTKEY = TRAINING.2
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
- IWbsElementTable
- Index = 1
- WBS_ELEMENT = TRAINING.2
- PROJECT_DEFINITION = PD-TRAINING
Command: Lock (from R/3 Release 4.6A)
Use this command to lock a WBS element. The "Master data lock" system
status is set for the WBS element.
Example - Locking the WBS element TRAINING.1
o IMethodProject
- OBJECTTYPE = WBS-Element
- METHOD = Lock
- OBJECTKEY = TRAINING.1
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
o IWbsElementTable
- Index = 1
- WBS_ELEMENT = TRAINING.1
Command: Unlock (from R/3 Release 4.6A)
Use this command to unlock a WBS element. The "Master data lock" system
status is removed from a WBS element.
Example - Unlocking the WBS element TRAINING.1
o IMethodProjectIMethodProject
- OBJECTTYPE = WBS-Element
- METHOD = Unlock
- OBJECTKEY = TRAINING.1
- REFNUMBER = 000001
ECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
IWbsElementTable
- Index = 1
- WBS_ELEMENT = TRAINING.1
Command: Release (ab R/3 Release 4.5A)
Releasing a WBS element. The system status "released" is set for the
WBS element and all lower-level WBS elements.
Example - Releasing the WBS element TRAINING.1
o IMethodProject
- OBJECTTYPE = WBS-Element
- METHOD = Release
- OBJECTKEY = TRAINING.1
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
o IWbsElementTable
- Index = 1
- WBS_ELEMENT = TRAINING.1
Object type: WBS milestone (from R/3 Release 4.6A)
The key for the object WBS milestone is the milestone number.
Command: Create
Use this command to create a new WBS milestone for a network. It is not
necessary to enter a number for the milestone. The system gives the
milestone a number when it is created. The system returns the milestone
in the message table as an information message.
If however, an external number is entered in the method table, both the
external and the new milestone number are returned in an information a
message in the message table. A WBS element always has to be entered.
Example - Creating a new WBS milestone for a WBS element TRAINING.2
o IMethodProject
- OBJECTTYPE = WBS milestone
- METHOD = Create
- OBJECTKEY =
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IWbsMilestoneTable
- Index = 1
- MILESTONE_NUMBER =
- WBS_ELEMENT = TRAINING.2
Command: Update
Use this command to change a WBS element that already exists in the
Project System. It is always necessary to enter the project definition,
if you do not explicitly change the project definition. Use the update
structure as for WBS elements.
Example - Changing an existing WBS milestone with the number
000000002098 assigned to WBS element TRAINING.2.
o IMethodProject
- METHOD = Create
- OBJECTKEY =
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IWbsMilestoneTable
- Index = 1
- MILESTONE_NUMBER =
- WBS_ELEMENT = TRAINING.2
Command: Update
Use this command to change a WBS element that already exists in the
Project System. It is always necessary to enter the project definition,
if you do not explicitly change the project definition. Use the update
structure as for WBS elements.
Example - Changing an existing WBS milestone with the number
000000002098 assigned to WBS element TRAINING.2.
o IMethodProject
Kommando: Delete
Use this command to delete a WBS milestone that already exists in the
R/3 Project System. The milestone is deleted physically. It is always
necessary to enter the project definition, if you do not explicitly
change the project definition.
Example - Deleting a WBS element with the number 000000002098 assigned
to WBS element TRAINING.2.
o IMethodProject
- OBJECTTYPE = WBS milestone
- METHOD = Delete
- OBJECTKEY = 000000002098
- REFNUMBER = 000001
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER =
o IWbsMilestoneTable
- MILESTONE_NUMBER = 000000002098
- WBS_ELEMENT = TRAINING.2
Object type: WBS hierarchy
The WBS hierarchy object type defines the hierarchy of the WBS elements.
A project definition always has exactly one hierarchy. If the position
of a WBS element changes, the whole hierarchy has to be rebuilt.
Therefore, the WBS hierarchy object type has only one command: Create.
Every WBS element receives exactly one entry in the table parameter
IWbsHierarchieTable with which it defines its position.
Command: Create
Use this command to create or change a WBS element hierarchy for a
project definition. Enter the WBS hierarchy object type and the Create
command in the table of the IMethodProject parameter. The command refers
to all entries in the table of the IWbsHierarchieTable parameter that
contains the data for the data for the hierarchy. Each entry in the
IWbsHierarchieTable refers to a WBS element that describes its position
relative to the other WBS elements.
Example - Positioning WBS elements TRAINING , TRAINING.1 and TRAINING.2
. (WBS elements TRAINING.1 and TRAINING.2 are subordinate to WBS element
TRAINING. WBS element TRAINING1 is positioned on the left of
TRAINING.2.)
o IMethodProject
- OBJECTTYPE = WBS-Hierarchy
- METHOD = Create
- OBJECTKEY =
- REFNUMBER =
- OBJECTTYPE =
- METHOD = Save
- OBJECTKEY =
- REFNUMBER = I
o ProjectDefinition
- PROJECT_DEFINITION = PD-TRAINING
o IWbsHierarchieTable
- WBS_ELEMENT = TRAINING
- PROJECT_DEFINITION = PD-TRAINING
- UP =
- DOWN = TRAINING.1
- LEFT =
- RIGHT =
- WBS_ELEMENT = TRAINING.1
- PROJECT_DEFINITION = PD-TRAINING
- UP = TRAINING
- DOWN =
- LEFT =
- RIGHT = TRAINING.2
- WBS_ELEMENT = TRAINING.2
- PROJECT_DEFINITION = PD-TRAINING
- UP = TRAINING
- DOWN =
- LEFT = TRAINING.1
- RIGHT =
Further Information
For more information, see the R/3 Library under PS Project System ->
Structures -> EPS Interface
Parameter
I_PROJECT_DEFINITION
I_PROJECT_DEFINITION_UPD
RETURN
I_METHOD_PROJECT
I_WBS_ELEMENT_TABLE_UPDATE
I_WBS_ELEMENT_TABLE
I_WBS_MILESTONE_TABLE
I_WBS_MILESTONE_TABLE_UPDATE
I_WBS_HIERARCHIE_TABLE
I_NETWORK
I_NETWORK_UPDATE
I_ACTIVITY
I_ACTIVITY_UPDATE
I_RELATION
I_RELATION_UPDATE
E_MESSAGE_TABLE
I_ACTIVITY_ELEMENT
I_ACTIVITY_ELEMENT_UPDATE
I_ACTIVITY_MILESTONE
I_ACTIVITY_MILESTONE_UPDATE
Exceptions
Function group
2054
Cheers,
Vasanth
‎2008 Jan 25 10:05 AM
HI,,
Hi,
Use BAPI BAPI_INTERNALORDER_CREATE. To add custom field, you have to user the table EXTENSIONIN of this BAPI. But before that you will have to extend AUFK using append structure CI_AUFK ( enhancement COOPA003 )
This what SAP says about this table.
You can use this parameter to transfer user-defined fields from order master records. However, no fields are supported that are updated in user-defined tables. Only the user-defined fields created within the framework of the SAP enhancement COOPA003 that are updated automatically in table AUFK are supported. This means you must use the table extension BAPI_TE_AUFK
The enhancement COOPA_01 includes the function module EXIT_SAPLRKIO_001, in which checks of the user-defined fields can be implemented.
The documentation to the structure BAPIPAREX that this parameter is based on contains more information about the use of this parameter.
This is how you populate this table. Check this code
code----
-
DATA: gt_ci_aufk LIKE bapi_te_aufk
OCCURS 0 WITH HEADER LINE.
DATA: gt_extensionin LIKE bapiparex
OCCURS 0 WITH HEADER LINE.
DATA: lst_ci_aufk LIKE ci_aufk.
Five variables used to handle the structure length changes
DATA: lv_length TYPE i,
lv_length1 TYPE i,
lv_length2 TYPE i,
lv_length3 TYPE i,
lv_length4 TYPE i.
FIELD-SYMBOLS <f> LIKE bapi_te_aufk.
DESCRIBE FIELD <f> LENGTH lv_length.
IF lv_length > 720.
lv_length4 = lv_length - 720.
lv_length3 = 240.
lv_length2 = 240.
lv_length1 = 240.
ELSEIF lv_length > 480 AND lv_length <= 720.
lv_length3 = lv_length - 480.
lv_length2 = 240.
lv_length1 = 240.
ELSEIF lv_length > 240 AND lv_length <= 480.
lv_length2 = lv_length - 240.
lv_length1 = 240.
ELSEIF lv_length <= 240.
lv_length1 = lv_length.
ENDIF.
move custom field
lst_ci_aufk-field1 = 'field1 data'.
lst_ci_aufk-field2 = 'field2 data'.
lst_ci_aufk-field3 = 'field3 data'.
lst_ci_aufk-field4 = 'field4 data'.
move order number
gt_ci_aufk-orderid = 'iternal order no'. "In create node keep this blank
move custom fields
MOVE-CORRESPONDING lst_ci_aufk TO gt_ci_aufk.
This is for the EXTENSIONIN (Custom fields structiure - CI_AUFK)
LOOP AT gt_ci_aufk.
gt_extensionin-structure = 'BAPI_TE_AUFK'.
IF lv_length1 > 0.
MOVE gt_ci_aufk+0(lv_length1) TO gt_extensionin-valuepart1.
ENDIF.
IF lv_length2 > 0.
MOVE gt_ci_aufk+240(lv_length2) TO gt_extensionin-valuepart2.
ENDIF.
IF lv_length3 > 0.
MOVE gt_ci_aufk+480(lv_length3) TO gt_extensionin-valuepart3.
ENDIF.
IF lv_length4 > 0.
MOVE gt_ci_aufk+720(lv_length4) TO gt_extensionin-valuepart4.
ENDIF.
APPEND gt_extensionin.
ENDLOOP.
-
plzz reward if it is usefull dont forget to reward plzz