
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.
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’
This will give all the list of object id associated with class and class type in output table SELECTEDOBJECTS.
Get the All the object id and pass each object ids in loop to BAPI ‘BAPI_OBJCL_GETDETAIL’
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
In table allocvalueschar
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |