IWO10018: User Fields in Maintenance Order
Introduction
One of the very frequently asked questions in this space, is about the subject matter, i.e., How can I add Custom fields to my Maintenance Order? In the recent months the author had replied 3 times to discussions related to this topic. It is thought that this topic if documented would be helping many.
Objective
This documentation is intended to enable the readers to create the Custom fields in the Maintenance Order, update the Order Master data Table and also display these fields in IW38 Order list output.
Let’s Start
Part1
Create Custom fields in the Order Table
The table of our context is AUFK. We need to append our Z-fields to this through the include structure namely CI_AUFK.
The process of creating any custom field starts with creating a Data Element with desired Type and Length or with desired Domain name and with the Field Labels we want to have for the Customer fields. For our Demo, we have created Two Data Elements, namely :
1. ZCUSTFLD1 (Domain CHAR12 and Field Label ‘Customer Field 1’)
2. ZCUSTFLD2 (Domain CHAR40 and Field Label ‘Customer Field 2’)
Now let us create our Customer fields Run Tcode SE11 –> give value AUFK in the Database Table field –>Click on Display. Scroll-down to find include table CI_AUFK. Double click on this, Go to Change mode and Add 2 new fields of our interest as shown in the picture and Activate.
As seen in the picture, we have created Two Customer-Fields namely ZZCUSTFLD1 and ZZCUSTFLD2. It is essential for all Customer fields used in Enhancement purposes to be prefixed with ZZ. Activate the Structure.
Part2
Enhancement and Screen-Exit
1, Create an Enhancement Project say ZPMORDER using Tcode CMOD.
2. Assign Enhancement IWO0018 to this project.
3. Click on Components in the picture above to reach this screen.
4. Activate by clicking on the Activate Icon (shown in picture above)
As we see here, there is One screen-exit (screen 0900) and Two Function-Exits namely EXIT_SAPLCOIH_018 and EXIT_SAPLCOIH_019 in this enhancement. Double Click on this screen number to create a Sub-Screen for holding our Custom Fields. You’ll get this pop-up. Press Enter and Continue.
You’re in the screen below, where you’ll give a Description, Select the Subscreen Radio button, Save and Activate.
Click on Layout Arrow in the Application Toolbar of (See the picture above) to reach the Screen-Painter pop-up window, where we will be creating :
1. A Box to hold our Z-fields
2. Text Fields to for Z-field labels
3. Input Fields for Z-fields
The input fields should be referred to the Dictionary fields we have just created. (AUFK-ZZCUSTFLD1 and AUFK-ZZCUSTFLD2)
See the picture.
Activate.
Part3
1. Declare table AUFK
Declare table AUFK in the top include LXWOCTOP of Function group XWOC by Clicking on and creating the include ZXWOCTOP .
2. Codes to be given in Function-Exits
Go to the following screen of the User-exit
Double click on the Function-Exit EXIT_SAPLCOIH_018 and put the following code in the include ZXWOCU15.
*———————————————————————————————
MOVE-CORRESPONDING COCI_AUFK_IMP TO AUFK.
*———————————————————————————————
Similarly put the following code in the include ZXWOCU16 of the Function-Exit EXIT_SAPLCOIH_019.
*———————————————————————————————
MOVE-CORRESPONDING AUFK TO COCI_AUFK_EXP.
*———————————————————————————————
Now let’s see the effect of work done so far.
Create a Maintenance Order (IW31). You will see an Additional Tab named Enhancement has been added here by the system, in which our Custom fields appear with their labels and the input fields.
Now let’s add some values in these fields and Save the Order.
Run IW32, open the Order and verify whether the values are updated to table or not. If they are appearing in the Enhancement tab as you have entered and saved, this means the AUFK table has been updated with these values when Order was saved.
Part4
Let’s have these Custom fields in the Order list output namely the ALV of Tcode IW38
So far we have succeeded in creating our Custom fields and updating the values to the Order Master data. Next natural requirement of a user would be to have these fields in IW38 ALV screen. For this purpose we, need to create an Append Structure in the Structure RIHAUFK_LIST, as shown in the picture below. The
Tcode is SE11 again for this task. Here we have created an Append Structure named ZCUSTFLD and in this structure we have added both the Custom fields.
Now let’s create one more Order, fill the custom fields with some values and Save. The second order is to have ALV output in IW38. (Because single Order in the output takes to IW33 screen instead of ALV screen). Now run IW38 with selection parameters to display these 2 orders we created. Click on the icon shown , You’d find the Custom fields in the Column-set list, Bring them to Displayed list on the Right hand side.
Almost Done
Now if you go to IW33, unlike all other greyed-out fields, the Custom fields in Enhancement Tab will be seen Editable. Though there is no provision to Save the edits here, you’d definitely like to have these fields too in Greyed-out mode.
For this we need to write a small code in the PBO (Process Before Output) module of the screen 0900 we have created. Double click on the Screen number 0900 of the enhancement,
Now you are in the Flow Logic Tab ,
Un-comment line MODULE STATUS_900. and D’Click on the STATUS_0900 of the PBO module. Insert the following code between the MODULE, END MODULE lines like this.
————————————————————————————————————————
MODULE STATUS_0900 OUTPUT.
IF SY-TCODE = ‘IW33’.
LOOP AT SCREEN.
SCREEN-INPUT = ‘0’.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE.
————————————————————————————————————————-
Lastly Do not Forget to
Activate the Function Group XWOC from Tcode SE80. Right click on the Function Group and click on the Activate option
…… and thus we reach to the end of this knowledge sharing Documentation.
Note
1. As this is largely a Technical job, it is recommended to be developed through an experienced ABAPer, especially Part1 which involves Activating the Standard table AUFK.
2. The Environment of Author is ECC 6.0 with no EHPs, hence the document applicability.
Expecting this document too would be of use to many of the members,
See also these related posts
How To add Custom Fields as Selection Inputs to IW38/39
Defaulting a value to the Custom Field
Thank you
KJogeswaraRao
Rather than controlling the screen attributes by transaction code as in the example above, I'd recommend using the function module CO_IH_GET_EFFECTIVE_ACT_TYPE to determine the effective activity type of the current maintenance order. This function module also considers the currently active status of the order.
This approach ensures the custom fields are closed for input if the order is being processed in IW32 but the order is completed or locked etc.
Thanks Andrew. for the comments.
Very useful document .It's like reference for addition of Custom fields in other area also.
Thank you for sharing your knowledge .
Thank you Rakhee for the review and Comments
Really good one and useful one. Thanks for sharing. 🙂
Thank you very much Krishna. 🙂
Very nice document.
Here's some supplementary information:
Thank you very much for value adding info Peter. Members will be benefited by this information of more possibilities.
Nice Document Jogeswara.
Thank you Shrithar
very use full...
thanks for sharing
Hello,
Your document is very interesting but I have a problem with AUFK. The AUFK table isn't available either in ZXWOCU15 or ZXWOCU16. So, I can't make the move-corresponding from/to aufk as you make in your document. Could you help me please?
Can't do
MOVE-CORRESPONDING COCI_AUFK_IMP TO AUFK.
MOVE-CORRESPONDING AUFK TO COCI_AUFK_EXP.
Is there any additional step?
Óscar
Hello Óscar,
Just put these lines in the corresponding includes. It will accept. See my screen-captures.
There can not be any syntax error. Also replied in detail to
Thank you. I have solved with your instructions and declaring the table AUFK.
Óscar
Very Good Document!!!
Hello Sir,
Nice document indeed. It opened a lot of possibilities.
I wanted to ask you as to how to activate field AUSWK in PM Notification.
Thanks
Pradeep
Hello BHATTACHARYA,
Though the question does not relate to the subject document, here is my reply.
In SPRO in the following path
Give the following subscreen number (020) in Responsibilities tab (in the Notification Type you want this field AUSWK)
After this you will see the field AUSWK (Effect) in the Responsibilities tab in the screen area named Effect on the system.
(Request you to create a discussion in situations like this).
Best of luck
KJogeswaraRao
Thanks so much. I understand your concern. It is only that trying for the solution on the forum was not bearing fruit and then got to your nice article and ........rest you know.
I still have some query on this but I am afraid I am going to have to open a new discussion 😀 .
Thanks again.
Pradeep
Dear Mr.Jogeswara,
Thanks for sharing the documents.Its really useful and important.
Regards.
Swapnil
Thank you swapnil 🙂
Hi Jogeshwara,
Firstly i want to thank you for sush a good blog.
I a requirement in which i have added a new field Process order in IW21 tcode.
The same field (process order) has been added in IW31 tcode as well.
Now the requirement is that when I was create a notification in IW21 if i gave a process order the same has to be reflected when i click on create order in IW21 tcode the process order field should be auto populated in IW31 as well.
We cannot find the field value in QMEL table as the notification is not yet saved.
Can you please let me know how to acheive?
Thanks in advance.
Hello Balaji,
It is a good question. Normally the Screen-exits are Development conveniences provided by SAP for easily meeting our simple non-standard requirements. Yours being an in-depth ABAP query, the expertise to answer would lie in ABAP space only. So suggest you to crate a question in that space. If you have got an ABAPer, he can spend time in some research, through which it could become possible.
Best of luck
KJogeswaraRao
Thanks a lot. Created in ABAP space.
Hello Sir, thanks for the good information!
I'm looking for a enhancement to include new fields from CI_AFVU under the Operations tab.
Do you know if it is possible?
Thanks in advance!
Hello Leandro,
This page (Enhancement tab of operation) already have several enhancement fields through standard. I have never user IWO10018 to add more such fields to Operations enhancement tab. Presently I am off-system and likely to be so for several days. In case it is possible at sometime I will check about it. . Better you should start a new thread.
Thank you & Regards
Jogeswara Rao
Hi Joseswara,
Thanks a lot!
I think I'll take the Pete's hint and i will include sub-tabs on the Enhancement tab of the header view and so include a grid with information of operations.
However, if you find something about my solicitation, please, share with me.
Once again, thank you!
Thank you very much ..
however, a very important part is missing,
the Declaration of AUFK in the TOP INCLUDE.
Because if you don't declare it you'll face an error message:
"Field "AUFK" is unknown. It is neither in one of the specified tables
nor defined by a "DATA" statement."
So, go to include: LXWOCTOP
double click and create include: ZXWOCTOP
inside that you'll insert the following
tables AUFK.
once you activate .. the error will not appear again 🙂
Thank you Marwan,
I have included this in the document.
Regards
KJogeswaraRao
you're mostly welcome 🙂
by the way ..
it's lxwoCtop not lxwoXtop
the honor is mine that you took my comment in consideration 🙂
Thanks again, it was a typo. Corrected.
🙂
Hi Jogeswara,
I have read this document, which is really very good exploration.
Many-2 thanks to you for sharing such kind of documents..... 🙂
Thank you Akhilesh,
Your appreciation has always been valuable to me.
Regards
KJogeswaraRao
Very usefull document. Thanks for your job!
Thank you Pavel Lazhbanov !
Hi Jogeswara,
The document is pretty comprehensive.I have a question that in IW32 headerdata tab screen,are the tabs Malfnctn data,Damage,Notif.dates as shown below are standard functionality of SAP that are coming through some customizing.Any lights on this will be highly appreciated.
Thanks and Regards
Nazmul
The following setting brings this info into the Order related to Notification.
Plant Maintenance and Customer Service > Maintenance and Service Processing > Maintenance and Service Orders > Functions and Settings for Order Types > Define Notification and Order Integration.
As per this setting Order created through M2 notifications will have the Malfunction data in the Header page of the Order.
Becuase this topic is not connected to the present topic, you are advised to post a query, in case you have further questions.
KJogeswaraRao
Hi Sir,
Thanks a lot for the information..It solves my issue.
Regards
Nazmul
Hi, it is somewhat related to this as we have a requirement to add a custom field in the work order which should contain the ordering address (entry required for specific vendors entered in the work order). This then needs to be transferred to the purchase requisition that gets automatically created once the work order is released. Is this possible?
While describing the requirement, you have entered the PR zone, which needs to be explored through other exits in that function group. Contact your ABAPer.