Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member


Hi Folks,

Long back I was given the requirement to develop a Function Module for operations in Order BoM Configuration Results (CU51) i.e. Insert, Copy, Delete and Change. After a good amount of search output was nothing due to which I tried my last option of BDC for that which was giving random results.

It was a challenging task for me to get out of CU51 successfully with a solution, after healthy discussions with my team we came to conclusion and a good logic to fulfill the requirements to a certain extent.

About


This document is meant to provide the solution of operations like Insert, Copy, Delete etc. on Order BoM in CU50 or CU51 in Configuration Result screen

Version 1.00















SAP Release



SAP ERP 6.0 EHP6



Transaction Code



CU51 / CU50



1 Scope


This document gives a raw solution with code snippet to Order BoM Configuration Results toolbar operations (CU51) via BDC/FM.


These operations include only Change, Delete, Copy, Insert.



2 Prerequisites


Following are the major prerequisites to be taken care before implementing the solution to your system.

  • SAP Component Version compatibility

  • SAP implementations for SD, PP


3 What are CU51 operations


CU51 is one of the transaction codes used for Order Bill of Materials in SAP. Through this functionality we can also view or change Configuration Results of the material in Order BoM.

After getting on to configuration results screen we have multiple operations to do like we can insert a new item, change the existing item, copy and delete the existing ones.

That item can be a Compatible unit, Document, Non stock, Stock, Text or Variable size item.

Following are the operations we are going to discuss in this document.

  • Insert

  • Change

  • Copy

  • Delete


4 How we do it manually


Let us discuss the current process for the above mentioned operations with the help of appropriate screen shots.

All the operations are similar to each other in their approach so we will discuss only one in detail so that it can be taken as reference for others.


4.1 Delete


We will follow a generic process for the operation.

  • Go to command bar on top left and enter ‘CU51’

  • Now you will see Order BoM: Initial Screen, enter the order number and order item as shown in the screen shot below and press enter




  • Click on ‘Results’ button (Ctrl+F9), now you will see all the configuration results on next screen as shown below




  • Go to ‘Edit’ on menu bar and select ‘Select All’ as shown




  • Now click on compress button, after which you will see  all the nodes getting collapsed or compressed

  • Now select the node under which you want to perform given operation as shown




  • Now click on explode button after which you will see that node gets collapsed into it’s sub items,  now select the sub node you want to delete




  • Now click on delete button and then click on save button to save the changes made


4.2 Change/Copy/Insert


Now similarly we can perform all other operations as well.

5 How SAP standard is updating


SAP is updating the database via Update mode Function Module BOM_POST inside another FM CS_BT_BOM_POST in include program LCSSFU01.

 

As per my understanding there is no standard class or function module or bapi is available for these operations.

6 Why we want this solution


As I said there is no such FM or class available for all these operations so the final option is nothing but Batch Input which is a bit complex in itself.

When I was given this requirement I thought it will be like any other process in which we will use standard FM or program to update but I didn’t find any such program which was a bit strange, then I moved on towards Batch Input which itself was a challenge to implement and after a bit of struggle I was able to get a raw solution for the same and it’s working fine as per the requirements given to me.

Sometimes we face such instances that we need to update the data via back end FM or class for customized applications on GUI or Web interface as per the customer requirements, at that point of time we can implement the given solution

7 Assumptions


Well it’s not a perfect solution but we can still make it useful for many such requirements, it’s being implemented with certain assumptions mentioned below.

  • When compressing all nodes, visible nodes are header nodes(black color) and after expansion we get item nodes(blue color)




  • Internal table for BDC needs to be in same sequence as in standard with proper indexing keeping in mind the header and item nodes, like other columns need to be added which will contain the header node and item node calculated programmatically (Will demonstrate in example)

  • Onupdating the long text taken as input, first two lines need to be empty spaced and the text should start from 3rd line as shown in the screen shots below






  • Operations will be performed in fixed sequence i.e. Change, Delete, Copy and Insert

  • At once only 4 header nodes can be seen on screen and item nodes will vary based on the selected header node, it may vary from minimum 1 item node to maximum 4 item nodes


8 Solution



  • We will record individual BDC recording for every operation

  • We will calculate the formula for selecting the header node based on the last assumption and input index in the internal table, similarly we will calculate the no of page downs to be done to select the required header node

  • Based on the last assumption, selected header node and item nodes displaying on screen after expanding the selected header node, we will calculate the page downs for item node and index of item node to be selected

  • Now we will perform the operation

  • If the operation is delete or copy we will have to pro-grammatically reorder the index of next nodes for other operations

  • Once all the operations with correct reordering is done we will save the changes


8.1    Raw Code Snippet and Screen shots


 

Following are the parameters of the FM and code is attached in the text files.

Please ignore the unwanted code if it's not required.


 

Importing Parameters



 

Table Parameters



 

Structure ZCU51_INP

<tdnowrap="nowrap" style="border:0px solid black;padding: 0 5.4pt 0 5.4pt;border-right: solid windowtext 1.0pt;border-bottom: solid windowtext 1.0pt;border-left: none;border-top: none;" valign="bottom" width="64"> 0

Item Category (Bill of Material)





































































































































































































































































































Field name



Types



Data element



Data type



Length



Decimal



Description



H_ITM



1 Types



EBELP



NUMC



5



0



Header Node Index



S_ITEM



1 Types



EBELP



NUMC



5



0



Item Node Index



C_H_ITM



1 Types



EBELP



NUMC



5



0



Sub header index (Header node index to be selected, only for Copy operation)



C_S_ITEM



1 Types



EBELP



NUMC



5



0



Sub Item index (Item node index index
to be copied, only for copy operation)



ICD_IND



1 Types



ZCU51_ICD_IND



CHAR



1



0



Change/Delete/Copy/Insert Indicator



MATNR



1 Types



MATNR



CHAR



18



0



Material Number



POSNR



1 Types



SPOSN



CHAR



4



0



BOM Item Number



POSTP



1 Types



POSTP



CHAR



1



STLKN



1 Types



STLKN



NUMC



8



0



BOM item node number



IDNRK



1 Types



IDNRK



CHAR



18



0



BOM component



MENGE



1 Types



KMPMG



QUAN



13



3



Component quantity



MEINS



1 Types



KMPME



UNIT



3



0



Component unit of measure



FMENG



1 Types



FMNGE



CHAR



1



0



Fixed qty



AVOAU



1 Types



AVOAU



DEC



5



2



Operation scrap



AUSCH



1 Types



KAUSF



DEC



5



2



Component scrap in percent



NETAU



1 Types



NETAU



CHAR



1



0



Indicator: Net scrap



POTX1



1 Types



POTX1



CHAR



40



0



BOM Item Text (Line 1)



DOKNR



1 Types



DOKNR



CHAR



25



0



Document number



DOKAR



1 Types



DOKAR



CHAR



3



0



Document Type



DOKTL



1 Types



DOKTL_D



CHAR



3



0



Document Part



DOKVR



1 Types



DOKVR



CHAR



2



0



Document Version



PREIS



1 Types



CPREI



CURR



11



2



Price



WAERS



1 Types



WAERS



CUKY



5



0



Currency Key



PENIH



1 Types



PEINH



DEC



5



0



Price Unit



EKORG



1 Types



EKORG



CHAR



4



0



Purchasing Organization



EKGRP



1 Types



EKGRP



CHAR



3



0



Purchasing Group



MATKL



1 Types



MATKL



CHAR



9



0



Material Group



ROMS1



1 Types



ROMS1



QUAN



13



3



Size 1



ROMEI



1 Types



ROMEI



UNIT



3



0



Unit of measure for sizes 1 to 3



ROANZ



1 Types



CS_ROANZ_V



QUAN



13



3



Number of Variable-Size Items



ROAME



1 Types



ROAME



UNIT



3



0



Unit of measure for variable-size items



9 Error Handling


Following are the possible points to be checked if any error strikes.

  • No enhancements are being done on the screens used

  • Sequence of operations is correct

  • Formula used in the BDC is correct as given in the code snippet

  • Index in the input table are correct


10 Example Data




I = Insert, C = Change,  D = Delete,  R = Copy

Note: In case of copy C_H_Item = Index of header node to be selected and C_S_Item = Index of item node to be copied. Numbers displayed are index of Header and Item nodes.

Also remaining fields are optional based on the requirements.

Suggestions and doubts invited.

Thanks and Regards.

1 Comment