BDC for CU51 / CU50

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.

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

 

0

 

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

Item Category (Bill of Material)

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

<span

Comments (0)
Add Comment