Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
KALYANI_HEDAOO
Explorer
0 Kudos
2,446

CL30N Data Extraction

Sharing this blog to SAP community as there are very less blogs explaining data extraction for CL30N tcode.

CL30N tcode is used mainly to get the characteristic values assigned to object.

It uses class and class type as input.

Example: Object can be here a vendor code, material code etc.

 

Our requirement was to pass the vendor code or Material code and then get the data associated with that vendor code/Material code from CL30N tcode using ABAP.

Below is the screen shot how CL30N data looks on SAP screen. Object can be Material code or Vendor code.

hedaoo_kalyani_0-1722277207450.png

 

As program ‘SAPLCLSD’ behind tcode CL30N is Function Group, data extraction can’t be possible using normal SUBMIT PROGRAM syntax.

So, this can be done using SAP Standard BAPI’s where we need to read data one by one for each characteristic.

First step is to get the object Id by passing class to BAPI ‘BAPI_CLASS_SELECT_OBJECTS’

hedaoo_kalyani_1-1722277207454.png

 

This will give all the list of object id associated with class and class type in output table SELECTEDOBJECTS.

hedaoo_kalyani_2-1722277207456.png

 

Get the All the object id and pass each object ids in loop to BAPI ‘BAPI_OBJCL_GETDETAIL’

hedaoo_kalyani_3-1722277207460.png

 

After passing object ids to Object key (Make sure complete id is getting passed as it doesn’t do any conversion). Table allocvaluesum will give all number characteristic data and table allocvalueschar will give characteristics data and allocvaluescurr will give currency data.

In our case this table has return a data as, In table allocvaluesum

hedaoo_kalyani_4-1722277207462.png

 

In table allocvalueschar

hedaoo_kalyani_5-1722277207464.png

 

As this table gives individual characteristics data, we need to read individual entries using constant value, as below.

READ TABLE lt_allocvaluesum into lwa_allocvaluesum

      WITH KEY charact = lc_sfg_prod_length. (‘ESI_019’)

As this above table is not giving correct numeric value, we need to convert this data to proper required data format.

Similarly for table lt_allocvalueschar

READ TABLE lt_allocvalueschar into lwa_allocvalueschar

      WITH KEY Charact = lc_grade. (’ESI_004’)

Using each constant for each characteristic data can be retrieved.

This might not be performance efficient as we are calling BAPI in loop multiple times.

If anyone has tried some different logic for CL30N data extraction feel free to share in comments.

 

 

 

 

 

Labels in this area