11-15-2007 10:03 PM
Hi Guyz
Can any one help me in finding a Function module to get characteristics of a material. which we can see in clasification view.
I have Material number
Batch number
Plant
I thought of using VC_I_GET_CONFIGURATION but I cant get a CUOBJ for material.
Thanks.
11-15-2007 10:08 PM
Hi,
Please check table VBAP for field CUOBJ, CHARG, WERKS and MATNR.
Regards,
Ferry Lianto
11-15-2007 10:08 PM
Hi,
Please check table VBAP for field CUOBJ, CHARG, WERKS and MATNR.
Regards,
Ferry Lianto
11-15-2007 10:36 PM
I have done same kind of development and you can check the below code :
I used VBAP-CUOBJ
tables: vbak,
vbap,
cabn,
zwafpo,
marc.
************************************************************************
Data Declarations
************************************************************************
data: t_zfdwstatus like zfdwstatus occurs 0 with header line.
data: begin of t_vbap occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
cuobj like vbap-cuobj,
matnr like vbap-matnr,
zzdept like marc-zzdept,
end of t_vbap.
data: t_vbak like vbak occurs 0 with header line.
data: begin of int_config occurs 0.
include structure conf_out.
data: end of int_config.
data: begin of int_tab occurs 0,
zzdept like marc-zzdept,
name like conf_out-atwtb,
qty type i,
value like conf_out-atwrt,
matnr like vbap-matnr,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
end of int_tab.
data: begin of int_summary occurs 0,
name like conf_out-atwtb,
qty type i,
value like conf_out-atwrt,
end of int_summary.
data: d_dept(3) type c,
d_split1(20) type c,
d_split2(20) type c,
d_name like conf_out-atwtb,
d_qty(15) type c,
d_rpt type c.
************************************************************************
Selection Screen
************************************************************************
selection-screen begin of block b1 with frame title text-001.
parameters: s_werks like zwafpo-dwerk obligatory default '1000'.
"Plant
parameters: p_vdatu like sy-datum obligatory .
select-options: s_dept for marc-zzdept. "Department
select-options: s_vbeln for vbak-vbeln."Order
select-options: s_matnr for vbap-matnr."Material
selection-screen end of block b1.
----
initialization
----
initialization.
set date as default in dependence of the time.
If sy-uzeit >= '000000' and sy-uzeit <= '190000'.
p_vdatu = sy-datum.
else.
p_vdatu = sy-datum + 1.
endif.
************************************************************************
Begin of Program Flow
************************************************************************
top-of-page.
perform report_header_132.
perform local_report_header.
************************************************************************
start of selection
************************************************************************
start-of-selection.
perform get_orders.
perform get_configuration.
perform write_data.
perform write_summary.
end-of-selection.
----
FORM report_header_132 *
----
........ *
----
form report_header_132.
format color col_heading intensified on.
*--- Write Company Name.
perform calc_col_and_write using text-h00
sy-linsz.
*--- Write Report Title.
perform calc_col_and_write using sy-title
sy-linsz.
*--- Write User Id, Date / Time, Program Id, Page etc.
perform write_other_hdr_details.
endform.
----
FORM CALC_COL_AND_WRITE *
----
........ *
----
--> P_TEXT *
--> P_LINSZ *
----
form calc_col_and_write using p_text
p_linsz.
data: col1 type i,
col2 type i,
len type i,
str type i.
str = strlen( p_text ).
col1 = ( p_linsz / 2 ) - ( str / 2 ).
len = p_linsz - col1 + 1.
write: at /col1 p_text.
write at sy-colno(len) space.
endform.
----
FORM WRITE_OTHER_HDR_DETAILS *
----
........ *
----
form write_other_hdr_details.
data: col1 type i,
col2 type i,
len type i.
col1 = 2.
write: at /col1 'UserId : ', sy-uname.
len = sy-linsz - 1.
write at sy-colno(len) space.
col2 = sy-linsz - 16.
write: at col2 'Date: ', sy-datum.
write: at /col1 'ReportId: ', sy-repid.
write at sy-colno(len) space.
col2 = sy-linsz - 16.
write: at col2 'Page: ', sy-pagno.
endform. " WRITE_OTHER_HDR_DETAILS
&----
*& Form local_report_header
&----
text
----
form local_report_header.
if d_dept ne space.
uline.
write:/1 '|',
5 'DEPARTMENT :',
25 d_dept,
100 'Delivery Date',
117 p_vdatu mm/dd/yyyy,
150 '|'.
endif.
uline.
if d_rpt = '1'.
write: /1 '|',
2 'Marinade',
32 '|',
33 'Marinade Qty',
60 '|',
61 'Material #',
75 '|',
76 'Sales Order / Line #',
132 '|'.
uline.
else.
write: /1 '|',
2 'Marinade',
32 '|',
33 'Marinade Qty',
132 '|'.
uline.
endif.
endform. " local_report_header
&----
*& Form get_orders
&----
text
----
form get_orders.
select * from vbak into table t_vbak
where vbeln in s_vbeln and
vdatu eq p_vdatu.
check sy-subrc eq 0.
loop at t_vbak.
select a~vbeln
a~posnr
a~cuobj
b~matnr
b~zzdept
from vbap as a
inner join marc as b
on awerks = bwerks and
amatnr = bmatnr
appending table t_vbap where
a~vbeln eq t_vbak-vbeln and
b~werks eq s_werks and
b~zzdept in s_dept and
a~matnr in s_matnr.
endloop.
endform. " get_orders
&----
*& Form get_configuration
&----
text
----
form get_configuration.
loop at t_vbap where cuobj ne space.
refresh: int_config.
call function 'VC_I_GET_CONFIGURATION'
exporting
instance = t_vbap-cuobj
language = 'E'
tables
configuration = int_config
exceptions
instance_not_found = 1
internal_error = 2
no_class_allocation = 3
others = 4.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
loop at int_config.
select * from cabn where
atinn = int_config-atinn and
atvie = ''.
endselect.
if sy-subrc ne 0.
delete int_config.
endif.
endloop.
clear d_name.
loop at int_config where atbez = 'Marinade' and atwtb <> 'None'.
d_name = int_config-atwtb.
endloop.
if sy-subrc eq 0.
read table int_config with key atbez = 'Marinade Qty'.
if sy-subrc eq 0.
do.
split int_config-atwrt at ',' into d_split1 d_split2.
if sy-subrc ne 0 or d_split2 eq space.
int_tab-zzdept = t_vbap-zzdept.
int_tab-name = d_name. "int_result_tab-name.
split d_split1 at 'X' into d_split1 int_tab-value.
int_tab-qty = d_split1.
shift int_tab-value left deleting leading space.
int_tab-matnr = t_vbap-matnr.
int_tab-vbeln = t_vbap-vbeln.
int_tab-posnr = t_vbap-posnr.
collect int_tab.
clear int_tab.
exit.
endif.
int_tab-zzdept = t_vbap-zzdept.
int_tab-name = d_name. "int_result_tab-name.
split d_split1 at 'X' into d_split1 int_tab-value.
int_tab-qty = d_split1.
shift int_tab-value left deleting leading space.
int_tab-matnr = t_vbap-matnr.
int_tab-vbeln = t_vbap-vbeln.
int_tab-posnr = t_vbap-posnr.
collect int_tab.
clear int_tab.
int_config-atwrt = d_split2.
enddo.
endif.
endif.
endif.
endloop.
if sy-subrc ne 0.
message i000 with 'No records for the given selection!'.
endif.
endform. " get_configuration
&----
*& Form write_data
&----
text
----
form write_data.
sort int_tab by zzdept name value.
d_rpt = '1'.
data: d_order(20) type c.
loop at int_tab.
d_dept = int_tab-zzdept.
at new zzdept.
new-page.
endat.
clear d_qty.
d_qty = int_tab-qty.
condense d_qty.
concatenate d_qty
'X'
int_tab-value
into int_tab-value
separated by space.
shift int_tab-matnr left deleting leading '0'.
shift int_tab-vbeln left deleting leading '0'.
shift int_tab-posnr left deleting leading '0'.
if not int_tab-vbeln is initial and
not int_tab-vbeln is initial.
concatenate int_tab-vbeln int_tab-posnr
into d_order separated by ' / '.
endif.
write: /1 '|',
2 int_tab-name,
32 '|',
33 int_tab-value,
60 '|',
61 int_tab-matnr,
75 '|',
76 d_order,
132 '|'.
uline.
endloop.
if sy-subrc ne 0.
message i000 with 'No records for the given Selection!!'.
endif.
endform. " write_data
&----
*& Form write_summary
&----
text
----
form write_summary.
d_rpt = '2'.
loop at int_tab.
move-corresponding int_tab to int_summary.
collect int_summary.
clear int_summary.
endloop.
sort int_summary.
clear d_dept.
loop at int_summary.
at first.
sy-title = 'Summary of Marinade Requirements'.
new-page.
endat.
clear d_qty.
d_qty = int_summary-qty.
condense d_qty.
concatenate d_qty
'X'
int_summary-value
into int_summary-value
separated by space.
write: /1 '|',
2 int_summary-name,
32 '|',
33 int_summary-value,
132 '|'.
uline.
endloop.
endform. " write_summary
Thanks
Seshu
11-16-2007 1:54 AM
Hai
CUOBJ is not maintianed in every field of VBAP... so this solution doesnt work for me ....
I have material and plant and batch number.... so I need to get the batch characteristics of that material
11-16-2007 2:31 AM
11-16-2007 3:12 AM
Hi,
check the FM: BAPI_OBJCL_GETDETAIL and other FMs of FuGr: CLBPA. FM is clearly documented.
Best Regards, Murugesh
11-16-2007 8:40 PM
Hi thank you guyz for your help, my problem was solved with QC01_BATCH_VALUES_READ FM, where in I give Matnr and batch number... I get all the characteristics into a table ...