Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Read Varinat Configuration Charachteristics of a materail from Sales Order

Former Member
0 Kudos

Hi ,

My requirement is to read the Varinat Configuration Characteristics of a configurable material for a sales order.

I have the sales order number and from there i have to trace back the characteristic values of the material used which would change for each sales order.

We are using text as a chracteristic for the varinat config material and i need to read the text. so please help me with how to trace the Characteristic values of a material for a given sales order number

VC_I_GET_CONFIGURATION_IBASE how to use this function module?

Can some one suggest me the sample code?

Regards,

Jessica.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Ok Jus pass

instance = lx_vbap-cuobj

LANGUAGE = SY-LANGU

in the FM.

You can get the cuobj from VBAP table. Pass Vbeln in VBAP and check for CUOBJ value, Pass the Cuobj in this FM.

Edited by: senthil kumar on Oct 29, 2008 10:36 PM

13 REPLIES 13

Former Member
0 Kudos

Hi,

Ok Jus pass

instance = lx_vbap-cuobj

LANGUAGE = SY-LANGU

in the FM.

You can get the cuobj from VBAP table. Pass Vbeln in VBAP and check for CUOBJ value, Pass the Cuobj in this FM.

Edited by: senthil kumar on Oct 29, 2008 10:36 PM

0 Kudos

Hey Senthil and Suresh i am getting the same error that i got before saying

"ITAB cannot be converted to a charcter type field."

I guess i am making some mistake in declaring itab. this is the code that i followed. As u suggested i got the cuobj and tried passing it to function module but i amstill getting this syntax error ""ITAB cannot be converted to a charcter type field."

"

data: itab type table of CONF_OUT with header line.

data: xcuobj type VBAP-cuobj.

parameters: p_vbeln type VBAP-VBELN.

select cuobj into xcuobj from VBAP where vbeln = p_vbeln.

endselect.

write xcuobj.

CALL FUNCTION 'VC_I_GET_CONFIGURATION_IBASE'

EXPORTING

INSTANCE = xcuobj

LANGUAGE = SY-LANGU

TABLES

CONFIGURATION = itab.

loop at itab.

write itab.

ebdloop.

0 Kudos

define your table as

data: itab type table of CONF_OUT with header line.

to

data: itab like CONF_OUT occurs 0 with header line.

0 Kudos

Hi,

Your code seems to have no problem, I copied the code and pasted in my editor, i got the output without problem.

May be problem with the system or unicode compatibility.

Jus try this, Instead of writing the entire itab, write some of the fields only.

Instead of

loop at itab.

write itab.

ebdloop.

Try

loop at itab.

write:/ itab-ATINN, itab-ATNAM, itab-ATINN, itab-ATBEZ, itab-ATNAM.

endloop.

0 Kudos

Thanks Senthil, Perfect, i am now getting the output.

Also thanks to MxG, Sunil, Suresh too for timely inputs.

0 Kudos

h

Edited by: jessica sam on Oct 29, 2008 7:05 PM

0 Kudos

Hi,

If you want to read only one characterstic name, do like this.

Ex:

READ TABLE it_conftab INTO wa_conftab

WITH KEY atnam = 'CH_MSG_IMAGE_OPTION'.

IF sy-subrc = 0.

" Move your Atwrt value

ENDIF.

If you want to read multiple use loop and case.

Ex:

LOOP AT lt_conf_out INTO lx_conf_out.

CASE lx_conf_out-atnam.

WHEN c_sdrolls_cal.

lx_item_chartrcs-sdrolls_calculated = lx_conf_out-atwrt.

WHEN c_sdorder_qty.

lx_item_chartrcs-sdorder_qty_in_msf = lx_conf_out-atwrt.

WHEN c_sdmsf_roll.

lx_item_chartrcs-sdmsf_per_roll = lx_conf_out-atwrt.

WHEN c_sdrolls_rnd.

lx_item_chartrcs-sdrolls_rounded = lx_conf_out-atwrt.

ENDCASE.

ENDLOOP.

Note : Clear it_conf_out befor the FM 'VC_I_GET_CONFIGURATION_IBASE'

Edited by: senthil kumar on Oct 30, 2008 12:39 AM

0 Kudos

hey senthil, i was able to read, i made a small mistake, that is why i saw duplicate entries.

now it is working fine.

thanks for ur inputs

Edited by: jessica sam on Oct 29, 2008 9:14 PM

0 Kudos

Hi,

I said if you want to take only one description use READ table, else use LOOP and CASE.

Your way of doing this is not suggestable.

Check this example.

declare a new internal table for the structure you want and move the required values to the new itab and write it down.

Data : itab1 type itab occurs 0 with header line.

Loop at itab.

Case itab-atnam.

When u2018'CH_MSG1_LINE1u2019.

Move itab-atnam to itab1-atnam.

Move itab-atwrt to itab1-atwrt.

When u2018'CH_MSG1_LINE2u2019.

Move itab-atnam to itab1-atnam.

Move itab-atwrt to itab1-atwrt.

When u2018'CH_MSG2_LINE1u2019.

Move itab-atnam to itab1-atnam.

Move itab-atwrt to itab1-atwrt.

When u2018'CH_MSG2_LINE2u2019.

Move itab-atnam to itab1-atnam.

Move itab-atwrt to itab1-atwrt.

When u2018'CH_MSG3_LINE1u2019.

Move itab-atnam to itab1-atnam.

Move itab-atwrt to itab1-atwrt.

When u2018'CH_MSG3_LINE2u2019.

Move itab-atnam to itab1-atnam.

Move itab-atwrt to itab1-atwrt.

.

.

.

Endcase.

Append itab1.

Clear itab1.

Endloop.

Loop at itab1.

Write 😕 itab1-atnam, itab1-atwrt.

Endloop.

I dont know how do you get duplicate entries??

I said in my earlier post to clear the body of the internal table.

You have used clear itab, which only clears the work area as you have not explicitly declared the workarea. Please use Refresh itab next line of the clear itab.

Former Member
0 Kudos

Hi,

get the object no of the material from VBAP table field name is CUOBJ and pass that object no and language to the function module . You will get all configuration details to the internal table

TABLES

configuration = it_configuration

and based on the characteristic name get the values.

i hope this clarifies u.

Regards,

Suresh.

Former Member
0 Kudos

Check this.

Select single cuobj into v_cuobj where vbeln = p_vbeln.

CALL FUNCTION 'VC_I_GET_CONFIGURATION_IBASE'

EXPORTING

INSTANCE = v_cuobj

LANGUAGE = SY-LANGU

TABLES

CONFIGURATION = t_conf

EXCEPTIONS

INSTANCE_NOT_FOUND = 1

OTHERS = 2

Former Member
0 Kudos

Hey Senthil,

My requirement is to read the varinat characteristcs from Sales order, but i dont want to read all values.

I want to read only Characteristic value, that is ATWRT value of CONF_OUT table only when ATNAM is CH_MSG_IMAGE_OPTION.

CH_MSG_IMAGE_OPTION this is a custom one that they configured while doing Varinat Configuration.

Now i put a logic such that if the ATNAM = CH_MSG_IMAGE_OPTION then read ATWRT, but it is not working. i am able to read all values but my req is to only read values when ATNAM = CH_MSG_IMAGE_OPTION

This my code, but i am not getting any output. can you help me with this.

If i know in which table the information is, then may be i can trace back and out a logic to pick only the values that i want.

      • Define the data elements

DATA: xaufnr TYPE afko-aufnr.

DATA: xltxa1 TYPE afvc-ltxa1.

DATA: xaplzl TYPE afvc-aplzl.

data: xaufk type aufk.

DATA: XKDAUF type afpo-kdauf.

data: it_conf_out like CONF_OUT occurs 0 with header line.

data: xcuobj type VBAP-cuobj.

DATA: CH_MSG_IMAGE_OPTION type CONF_OUT-ATNAM.

Parameters

PARAMETERS: p_rueck type afvc-rueck.

To obtain the Production Order Number for a given production order confirmation number***

***Select Query for retrieving the production order number from production confirmation number

***Tables Used: afko (for production order num) , afvc (for production confirmation num)

SELECT r1~aufnr

INTO xaufnr

FROM afko AS r1

INNER JOIN

afvc AS r2

ON r1aufpl = r2aufpl WHERE r2~rueck = p_rueck AND ltxa1 = 'candy jet' .

ENDSELECT.

to obtain the sales order number from production order number

SELECT kdauf INTO xkdauf FROM AFPO where aufnr = xaufnr.

ENDSELECT.

to obtain the cuobj for the sales order number

select cuobj into xcuobj from VBAP where vbeln = xkdauf.

endselect.

call function to get the characteristic values from sales order

CALL FUNCTION 'VC_I_GET_CONFIGURATION_IBASE'

EXPORTING

INSTANCE = xcuobj

LANGUAGE = SY-LANGU

TABLES

CONFIGURATION = it_conf_out.

*loop at it_conf_out.

*write:/ it_conf_out-ATwrt.

*endloop.

IF it_conf_out-atnam = CH_MSG_IMAGE_OPTION.

write: it_conf_out-ATwrt.

endif.

if i am writing

loop at it_conf_out.

write:/ it_conf_out-ATwrt.

endloop.

i am reading all values, i need to read only few values and i put logic such that

IF it_conf_out-atnam = CH_MSG_IMAGE_OPTION.

write: it_conf_out-ATwrt.

endif.

but not getting any o/p

can u tell me where i am missing

Former Member
0 Kudos

Thanks to all people who helped me with timely inputs