Table MBEW and MVEW Difference?
Hi Guys,
Whats the difference btween MBEW and MVEW i can see both for material valuation. If i enter data in material costing (From Material Master Transaction) it is appending entries in MBEW why not in MVEW.
The second thing is whats the use of table MBEW_TMP (File for Incorrect data in direct Input) it also not appending entries from transaction material master as i said before.
Please share your knowledge, looking for your reply.
Thanks in advance.
There is no such table MVEW
The material valuation table MBEW is availabe in SAP...
Regards
sapman
Similar Messages
-
The relation between table mbew and mbewh
MORNING!
I wanna know the relation between table mbew and mbewh.
I finded some materials in table mbewh have total valuated stock , but these materials don't have value .
Thanks a lot !Hi Roy, please check this link.
http://www.sapfans.com/forums/viewtopic.php?p=4330&sid=a1b0e2c950bb90aa410b796d9ce0a13c
REgards,
Rich Heilman -
Table MBEW and Transaction MC.9
Hi,
I developed a report program that reads stocks from table MBEW, but it doesnt reconcile with the stocks you get from MC.9.
Im thinking MC.9 gets the data from other source tables. I need to explain why its not the same and possibly modify the code to reconcile the quantities.
Please help.
Thanks.
Kennycheck with LQUA Table,MLGT Table,MARD-LABST Table
See the below Program and Which is inventory report :
type-pools
type-pools : slis.
Data Declaration
tables : mara,
marc,
lagp,
mvke,
makt.
Constants
constants : c_werks(4) type c value '1000'," Plant
c_lgort(4) type c value '1000'," Storage Location
c_periv like MARC-PERIV value 'XX',
c_perkz like MVER-PERKZ value 'T'.
Internal Tables
Internal Table for MARA and MAKT and MARD
data : begin of I_material occurs 0,
matnr like mara-matnr, " Material
lgpla like mlgt-lgpla," Storage Type
zzdept like marc-zzdept," Pick Dept
ZZPRODDEPT like marc-ZZPRODDEPT," Prod Dept
vmsta like mvke-vmsta, " Material Status
end of i_material.
Structure
data : begin of i_final occurs 0 ,
matnr like mara-matnr," Material #
maktx like makt-maktx," Description
lgpla like mlgt-lgpla, " Storage Bin
days like P0347-SCRDD, " No of Days
menge like mseg-menge, " Avg Daily Sales
kbetr like konp-kbetr, " Avg
labst like mard-labst," Inventory Stock
stprs like mbew-stprs, " Mvg avg Price
dos like mseg-menge, " DOS Units
dosm like konp-kbetr, " DOS $$
end of i_final.
data : int_ges_verb_tab like sverbtaba
occurs 0 with header line.
Internal table for A004
data : i_a004 like a004 occurs 0 with header line.
Data Variables
data : v_stprs like konp-kbetr,
v_repid like sy-repid,
v_labst like mard-labst,
v_maktx like makt-maktx.
ALV Function Module Variables
DATA: g_repid like sy-repid,
gs_layout type slis_layout_alv,
g_exit_caused_by_caller,
gs_exit_caused_by_user type slis_exit_by_user.
DATA: gt_fieldcat type slis_t_fieldcat_alv,
gs_print type slis_print_alv,
gt_events type slis_t_event,
gt_list_top_of_page type slis_t_listheader,
g_status_set type slis_formname value 'PF_STATUS_SET',
g_user_command type slis_formname value 'USER_COMMAND',
g_top_of_page type slis_formname value 'TOP_OF_PAGE',
g_top_of_list type slis_formname value 'TOP_OF_LIST',
g_end_of_list type slis_formname value 'END_OF_LIST',
g_variant LIKE disvariant,
g_save(1) TYPE c,
g_tabname_header TYPE slis_tabname,
g_tabname_item TYPE slis_tabname,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
Selection-screen
selection-screen : begin of block blk with frame title text-001.
parameters : p_werks like marc-werks obligatory default '1000'.
select-options : s_matnr for mara-matnr,
s_MATKL for mara-MATKL,
s_mtart for mara-mtart,
s_LGTYP for LAGP-LGTYP,
p_vmsta for MVKE-VMSTA,
s_dept for marc-zzdept,
s_pdept for MARC-ZZPRODDEPT.
selection-screen: end of block blk.
selection-screen begin of block periods with frame title text-002.
selection-screen begin of line.
selection-screen comment (15) text-c01.
selection-screen position 18.
Period 1
parameters: p_stdat1 like mkpf-budat obligatory.
selection-screen position 35.
selection-screen comment (10) text-c02.
parameters: p_endat1 like mkpf-budat obligatory.
selection-screen end of line.
selection-screen end of block periods.
Fill the default values
initialization.
v_repid = sy-repid.
PERFORM LAYOUT_INIT USING GS_LAYOUT.
PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
Validation for Dates
at selection-screen.
if p_stdat1 > p_endat1.
message e206(zwave) with
' End date should be greater than or equal to Start Date'.
endif.
Make one of the Selection should be mandatory
if s_matnr-low is initial.
if s_matkl-low is initial and s_mtart-low is initial and
s_dept-low is initial and s_pdept-low is initial.
message e208(zwave) with
'Enter atleast one selection Criteria'.
endif.
endif.
Start-of-selection.
start-of-selection.
Get the data from MARA,MARD,MAKT Table
perform get_data_tables.
Read the data into FInal Table.
perform read_data.
END-OF-SELECTION.
end-of-selection.
if not i_final[] is initial.
ALV Function Module
perform print_alv.
endif.
*& Form get_data_tables
Get the data from Tables MARA,MARD,MAKT
FORM get_data_tables.
select a~matnr
b~lgpla
czzdept cZZPRODDEPT d~vmsta into table i_material
from mara as a inner join mlgt as b on amatnr = bmatnr
inner join marc as c on cmatnr = amatnr
inner join mvke as d on dmatnr = amatnr
where a~matnr in s_matnr
and c~werks = p_werks
and a~mtart in s_mtart
and c~ZZPRODDEPT in s_pdept
and a~MATKL in s_MATKL
and c~zzdept in s_dept
and b~lgnum = '100'
and b~LGTYP in s_lgtyp
and b~lgpla ne space
and d~vkorg = '0001'
and d~vtweg = '01'
and d~matnr in s_matnr
and d~vmsta in p_vmsta.
if sy-subrc ne 0.
message e207(zwave) with 'No data found for Given Selection Criteria'.
endif.
sort i_material by matnr .
DELETE ADJACENT DUPLICATES FROM i_material COMPARING matnr.
ENDFORM. " get_data_tables
*& Form read_data
Read the data
FORM read_data.
loop at i_material.
Storage Bin
i_final-lgpla = i_material-lgpla.
Days of Sales ( End date - Start date )
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
DATE1 = p_endat1
DATE2 = p_stdat1
OUTPUT_FORMAT = '02'
IMPORTING
DAYS = i_final-days.
Get the Average Daily Sales (Units) from MVER Table
perform get_average_sales.
Get the Average Daily Sales ($$) from VK13 Transaction
perform get_avgsales_price.
clear : v_labst.
Get the Inventory from MARD Table
select single labst from mard into v_labst
where matnr = i_material-matnr
and werks = p_werks
and lgort = c_lgort.
if sy-subrc eq 0.
Inventory Stock - MARD-LABST
i_final-labst = v_labst.
endif.
Material #
i_final-matnr = i_material-matnr.
Get the Material Description
clear v_maktx.
select single maktx from makt into v_maktx
where matnr = i_material-matnr
and spras = 'EN'.
if sy-subrc eq 0.
Description
i_final-maktx = v_maktx.
endif.
Get the Mvg Average Price
perform get_moving_avgpr.
Days of Supply Units.
if i_final-kbetr ne 0.
i_final-dos = i_final-labst / i_final-menge.
endif.
Days of Supply $$
i_final-dosm = i_final-dos * v_stprs.
append i_final.
clear : i_final,
i_material.
endloop.
refresh i_material.
ENDFORM. " read_data
*& Form get_average_sales
Get the data from MVER Table
FORM get_average_sales.
data : lv_menge like mseg-menge.
refresh int_ges_verb_tab.
clear : int_ges_verb_tab,
lv_menge.
CALL FUNCTION 'CONSUMPTION_READ_FOR_MM'
EXPORTING
KZRFB = ' '
MATNR = i_material-matnr
WERKS = c_werks
PERKZ = c_perkz
PERIV = c_periv
TABLES
GES_VERB_TAB = int_ges_verb_tab
UNG_VERB_TAB =
EXCEPTIONS
WRONG_CALL = 1
NOT_FOUND = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at int_ges_verb_tab.
if int_ges_verb_tab-ertag >= p_stdat1 and
int_ges_verb_tab-ertag <= p_endat1.
add int_ges_verb_tab-vbwrt to lv_menge.
endif.
endloop.
i_final-menge = lv_menge / i_final-days.
ENDFORM. " get_average_sales
*& Form get_avgsales_price
Avg Daily Sales Price
FORM get_avgsales_price.
Get the data from A004 table to get KNUMH
Added new field Sales Unit - Seshu 01/09/2006
refresh : i_a004.
clear : i_a004.
data : lv_kbetr like konp-kbetr," Condition value
lv_KPEIN like konp-kpein , "per
lv_KMEIN like konp-KMEIN. " Sales Unit
select * from a004 into table i_a004
where matnr = i_material-matnr
and vkorg = '0001'
and vtweg = '01'.
if sy-subrc eq 0.
sort i_a004 by DATAB descending.
Get the Latetest Date
read table i_a004 with key matnr = i_material-matnr
vkorg = '0001'
vtweg = '01'
binary search.
Get the Sales Value
select single kbetr KPEIN KMEIN from konp
into (lv_kbetr,lv_KPEIN, lv_KMEIN)
where knumh = i_a004-knumh
and kappl = i_a004-kappl
and kschl = i_a004-kschl.
if sy-subrc eq 0.
i_final-kbetr = lv_kbetr / lv_KPEIN.
i_final-kbetr = i_final-kbetr * i_final-menge.
endif.
endif.
clear : lv_kbetr,
lv_kpein,
lv_KMEIN.
ENDFORM. " get_avgsales_price
*& Form get_moving_avgpr
Get the data from MVEW Table
FORM get_moving_avgpr.
Local Variables
data : lv_stprs like mbew-stprs, " Standard Price
lv_verpr like mbew-verpr, " Moving avg Price
lv_vprsv like mbew-vprsv. " Price Indicator
clear : lv_stprs,
lv_verpr,
lv_vprsv,
v_stprs.
select single stprs verpr vprsv from mbew
into (lv_stprs,lv_verpr,lv_vprsv)
where matnr = i_material-matnr.
if sy-subrc eq 0.
if lv_vprsv = 'S'.
i_final-stprs = lv_stprs * i_final-labst.
v_stprs = lv_stprs.
elseif lv_vprsv = 'V'.
i_final-stprs = lv_verpr * i_final-labst.
v_stprs = lv_verpr.
endif.
endif.
ENDFORM. " get_moving_avgpr
*& Form print_alv
REUSE_ALV_GRID_DISPLAY Function Module
FORM print_alv.
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
Populate field catalog
PERFORM fieldcat_init using gt_fieldcat[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = g_top_of_page
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = gs_layout
IT_FIELDCAT = gt_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " print_alv
*& Form get_fieldcatlog
Fieldcatlog
*& Form fieldcat_init
Fieldcat
FORM fieldcat_init USING e01_lt_fieldcat type slis_t_fieldcat_alv.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
Material #
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-ref_fieldname = 'MATNR'.
LS_FIELDCAT-ref_tabname = 'MARA'.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Material'.
ls_fieldcat-seltext_M = 'Material'.
ls_fieldcat-seltext_S = 'Material'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Material Description
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MAKTX'.
LS_FIELDCAT-OUTPUTLEN = 30.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Description'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Storage Bin
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'LGPLA'.
LS_FIELDCAT-OUTPUTLEN = 10.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Storage Bin'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Start Date
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'SDATE'.
LS_FIELDCAT-OUTPUTLEN = 10.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Start Date'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
End Date.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'EDATE'.
LS_FIELDCAT-OUTPUTLEN = 10.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'End Date'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Days of Sales
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'DAYS'.
LS_FIELDCAT-OUTPUTLEN = 12.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Days of Sales'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Average Daily Sales(Units).
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MENGE'.
LS_FIELDCAT-OUTPUTLEN = 18.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Average Daily Sales(Units)'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Average Daily Sales($$)
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'KBETR'.
LS_FIELDCAT-OUTPUTLEN = 18.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Average Daily Sales($$)'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Inventory(Units)
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'LABST'.
LS_FIELDCAT-OUTPUTLEN = 18.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Inventory(Units)'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
Inventory($$)
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'STPRS'.
LS_FIELDCAT-OUTPUTLEN = 18.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'Inventory($$)'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
DOS($$)
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'DOSM'.
LS_FIELDCAT-OUTPUTLEN = 13.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'DOS($$)'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
DOS(Days)
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'DOS'.
LS_FIELDCAT-OUTPUTLEN = 13.
LS_FIELDCAT-TABNAME = 'I_FINAL'.
ls_fieldcat-seltext_L = 'DOS(Days)'.
APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
ENDFORM. " get_fieldcatlog
FORM COMMENT_BUILD *
--> LT_TOP_OF_PAGE *
FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE
SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
Variables for Date
data : lv_year(4) type c,
lv_mon(2) type c,
lv_day(2) type c,
lv_date1(10) type c,
lv_date2(10) type c.
LIST HEADING LINE: TYPE H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-INFO = sy-title.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
clear : lv_year,
lv_day,
lv_mon,
lv_date1.
lv_year = p_stdat1+0(4).
lv_mon = p_stdat1+4(2).
lv_day = p_stdat1+6(2).
concatenate lv_mon '/' lv_day '/' lv_year into lv_date1.
STATUS LINE: TYPE S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-c01.
LS_LINE-INFO = lv_date1.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
clear : lv_year,
lv_day,
lv_mon,
lv_date2.
lv_year = P_ENDAT1+0(4).
lv_mon = P_ENDAT1+4(2).
lv_day = P_ENDAT1+6(2).
concatenate lv_mon '/' lv_day '/' lv_year into lv_date2.
LS_LINE-KEY = text-c02.
LS_LINE-INFO = lv_date2.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
ENDFORM.
FORM TOP_OF_PAGE *
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'FDLOGO'
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM.
FORM EVENTTAB_BUILD *
--> RT_EVENTS *
FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
*"Registration of events to happen during list display
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = RT_EVENTS.
READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO RT_EVENTS.
ENDIF.
ENDFORM.
FORM LAYOUT_INIT *
--> RS_LAYOUT *
FORM LAYOUT_INIT USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
**"Build layout for list display
RS_LAYOUT-DETAIL_POPUP = 'X'.
lslayout-f2code = p_f2code.
rs_layout-zebra = 'X'.
rs_layout-colwidth_optimize = 'X'.
ENDFORM.
Reward Points if it is helpful
Thanks
Seshu -
Stock report using mbew and mbewh
Hi to all.
i want to prepare o report for month end stock.
i am preparing this report using tables mbew and mbewh..
as per my knowledge goes the current stock is in the table mbew and history stock is in the table mbewh.
i am picking up the current data from the mbew and history data from mbewh..
the report is working fine till for january to august..
but i dont know what wrong happen when i run it for the last month of previous year i.e 01/12/2005.
it is showing some data difference for this period and also due to this some difference for earlier periods..
please suggest me what could be the reason..
because i have worked a lot on it and it is also working fine for this year...
also tell me what could be the problem..
i will surely reward back with points..HI
I guess the problem might be lying with the way you
are handling the date or period.
Can you post your code???
Kind Regards
Eswar -
What is difference between table space and shchema
what is difference between table space and shchema ?
784633 wrote:
so each user has it own space of tables - schema ?yes, but let's clarify a bit ....
The "schema" is the collection of all objects owned by a particular user. So if user SCOTT creates two tables, EMP and DEPT, and a view EMP_RPT, and a procedure GET_MY_EMP, those objects (tables, views, procedures) collectively make up the SCOTT schema.
Those objects will be physically stored in a tablespace.
A tablespace is a named collection of data files. So tablespace USERS will be made up of one or more data files. A specific datafile can belong to one and only one tablespace. If a tablespace has more than one data file, oracle will manage those files as a collection invisible to the application - much like the OS or disk subsystem handles striping across multiple physical disks.
A specific object in the SCOTT schema can exist in only one tablespace, but not all objects of the schema have to be in the same tablespace. Likewise a tablespace can contain objects from multiple schemas.
and can one user to access tables of other users?As others have said - FRED can access tables belonging to SCOTT as long has SCOTT has granted that access to FRED. -
Script to comp 2 tables and the difference to be captured in another table
Hi All,
I had an urgent requirement and i hope you will answer me and thanks a lot.
I had two tables (one is custom table i created and another is base table).I created the custom table based upon the base table.
Now,my requirement is that i need to write a script that compares these two table columns and if there is difference in the tables,we need to capture the difference in another table (third table).
Eg:
Say i had person salary as x in table1 for particular person and the salary for this person in table2 is y.So,i need to capture these two columns information in third table.
Can you please send me your valuable suggestions ASAP.insert into diff_table
select 'A not B', a.* from a minus select 'A not B', b.* from b
union all
select 'B not A', b.* from b minus select 'B not A', a.* from a
/Hemant K Chitale -
Whats the difference betweeen passing the table variable and table valued parameter?
Hi Everbody
Can someone one tell me what's the difference between passing a table variable and table valued parameter to a stored procedure or function? Can both be used to pass a table to a stored procedure/function?
Regards
RegardsThey are essentially the same. What we call a table variable is a local
variable. A table-valued parameter is an incoming parameter to the
procedure. The only difference is that the parameter is readonly.
When you call a stored procedure, you can pass a table variable as the
actual parameter. Or a table-valued parameter that you pass on.
CREATE PROCEDURE nisse_sp @tvp sometype READONLY AS
DECLARE @local someothertabletype
EXEC pelle_sp @tvp, @local
Erland Sommarskog, SQL Server MVP, [email protected] -
Difference between tables statement and by using type statement
Hi all,
I need to know the difference between the two of the below statements
Tables spfli.
and
data spfli type spfli with header line.
As far as i know both seem same to me.
Thanks in advance,
Bala.>
Bala Shanmuga Priyan wrote:
> Hi all,
>
> I need to know the difference between the two of the below statements
>
>
Tables spfli.
this will create a work area (spfli), looks like DB table spfli, but the statement is obsolate
Bala Shanmuga Priyan wrote:
>
data spfli type spfli with header line.
this will result in a syntax error, because this would also create a work area, but they cannot have header lines, so you should leave the WITH HEADER LINE addition.
To create work area use:
DATA : gw_spfli TYPE spfli.
To create internal table:
DATA : gt_spfli TYPE TABLE OF spfli. -
Difference between table CKMLKEPH and transaction figure of CKM3
Hi Gurus,
Having an issue in material ledger transaction and table data.
There is a difference between table CKMLKEPH and transaction figure of CKM3 for couple of periods.
Single level price difference for raw material domestic figure coming in transaction CKM3 is not matching with CKMLKEPH table.
Can you advice the tentative reason of it.
Thanks in advance,
MC.Hi MC,
MLHELP_CCS_CONS_CHECK which check the actual CCS and the program
MLHELP_SPRICE_CCS_INIT for the standard CCS.
These programs are provided by the ML Helpdesk tool via note 364368.
Although these reports are used by SAP Support you can execute them in
test mode to verify your CCS data.
Regards,Declan -
Compares two tables S780 and S720 by material , Print the Difference value
Hi abapers,
Report which compares the two tables S780 and S720 by material
the Statistic currency value of these two tables if show the differences
the report should display only Diffrece value:
The selection should be by
Revenue country, Salesorganisation , month and version
output like this
Material Value S720 / Value S780 / currency difference should be print out.
Regards
RajHi
Use join or for all entries
then move the records into a final table
loop at itab
then get the difference.
modify the itab by transporting the difference.
Regards
Shiva -
Table MBEW Field HKMAT - Impact on variances
Can anyone tell me the impact of having the box called "Material Origin" checked or unchecked when variances are calculated? The check box appears to update the value in Table MBEW Field HKMAT.
We have already set standard costs for the year, but I am seeing large differences between the amounts/quantities for the 261 entries versus what the cost estimates show. We are using backflush.
There is no difference between the costing BOM and the production BOM for the parent item (which is the item that did NOT have the box checked when we created standards). The variances are showing for its component items (which are all ROH's). The user ID in the 261 transactions is the "system ID" user, so I know the entries were created by the backflush operation.
Would this check box cause the variances I am seeing, or would the effects of that check box be something different, like maybe an incorrect cost element?Hello Micheal,
The Material Origin flag simply means that after the variance is run you will be able to see the material related information in the analysis reports. If you do not check this box you will simply see the consumption account and the variance, no reference to the actual material. This flag will not cause variances.
Unfortunately, there are many possibilities why you are seeing variances. Here are some options:
1.) Are your raw materials valued at moving average i.e. Price Control V in the material master? If so this will cause variances in the amounts because the materials are issued to the order at moving average price.
2.) Do your operators have the ability to adjust the quantities during the backflush? In the standard SAP backflush transaction it is possible to change the quantities consumed during the backflush regardless of what is actually on the BOM. If your production department is using this, this could account for your quantities differences.
3.) What about scrap factors? There are many places where scrap factors can be maintained i.e. the MRP 4 view of the material master, the routing, and the BOM. These scrap factors will increase the amount of materials consumed during the backflush. If these were added after your costing was completed this could account for your variance.
4.) Posting of scrap. Is scrap posted directly to the production orders? If so this can cause quantity variance.
It is a painful process but the best way to analyze variances is to take one part and try to follow it all the way back through the production process.
I hope that these options help point you in the right direction.
John. -
Unicode export:Table-splitting and package splitting
Hi SAP experts,
I know there are lot of forums related to this topic, but I have some new questions and hence posting a new thread.
We are in the process of doing unicode conversion in our landscape(CRM 7.0 system based on NW 7.01) and we are running on AIX 6.1 and DB2 9.5. The database size is around 1.5 TB and hence, we want to go in for optimization for export and import in order to reduce the downtime.As a part of the process, we have tried to do table-splitting and parallel export-import to reduce the downtime.
However, we are having some doubts whether this table-splitting has actually worked in our scenario,as the export has exeucted for nearly 28 hours.
The steps followed by us :
1.) Doing the export preparation using SAPINST
2.) Doing table splitting preparation, by creating a table input file having entries in the format <tablename>%<No.of splits>.Also, we have used the latest R3ta file and the dbdb6slib.o(belonging to version 7.20 even though our system is on 7.01) using SAPINST.
3.) Starting with the export using SAPINST.
some observations and questions:
1.) After completion of tablesplitting preparation, there were .WHR files that were generated for each of the tables in DATA directory of export location. However, how many .WHR files should be created and on what basis are they created?
2.) I will take an example of a table PRCD_CLUST(cluster table) in our environment, which we had split. We had 29 *.WHR files that were created for this particular table. The number of splits given for this table was 36 and the table size is around 72 GB.Also, we noticed that the first 28 .WHR files for this table, had lots of records but the last 29th .WHR file, had only 1 record. But we also noticed that, the packages/splits for the 1st 28 splits were created quite fast but the last one,29th one took a long time(serveral hours) to get completed.Also,lots of packages were generated(around 56) of size 1 GB each for this 29th split. Also, there was only one R3load which was running for this 29th split, and was generating packages one by one.
3.) Also,Our question here is that is there any thumb rule for deciding on the number of splits for a table.Also, during the export, are there any things that need to be specified, while giving the inputs when we use table splitting,in the screen?
4.) Also, what exactly is the difference between table-splitting and package-splitting? Are they both effective together?
If you have any questions and or need any clarifications and further inputs, please let me know.
It would be great, if we could get any insights on this whole procedure, as we know a lot of things are taken care by SAPINST itself in the background, but we just want to be certain that we have done the right thing and this is the way it should work.
Regards,
Santosh BhatHi,
First of all please ignore my very first response ... i have accidentally posted a response to some other thread...sorry for that
Now coming you your questions...
> 1.) Can package splitting and table-splitting be used together? If yes or no, what exactly is the procedure to be followed. As I observed that, the packages also have entries of the tables that we decided to split. So, does package splitting or table-splitting override the other, and only one of the two can be effective at a time?
Package splitting and table splitting works together, because both serve a different purpose
My way of doing is ...
When i do package split i choose packageLimit 1000 and also split out the tables (which i selected for table split) into seperate package (one package per table). I do it because that helps me to track those table.
Once the above is done i follow it up with the R3ta and wheresplitter for those tables.
Followed by manual migration monitor to do export/import , as mentioned in the previous reply above you need to ensure you sequenced you package properly ... large tables are exported first , use sections in the package list file , etc
> 2.) If you are well versed with table splitting procedure, could you describe maybe in brief the exact procedure?
Well i would say run R3ta (it will create multiple select queries) followed by wheresplitter (which will just split each of the select into multiple WHR files) ...
Best would go thought some document on table spliting and let me know if you have specific query. Dont miss the role of hints file.
> 3.) Also, I have mentioned about the version of R3ta and library file in my original post. Is this likely to be an issue?Also, is there a thumb rule to decide on the no.of splits for a table.
Rule is use executable of the kernel version supported by your system version. I am not well versed with 7.01 and 7.2 support ... to give you an example i should not use 700 R3ta on 640 system , although it works.
>1.) After completion of tablesplitting preparation, there were .WHR files that were generated for each of the tables in DATA directory of export location. However, how many .WHR files should be created and on what basis are they created?
If you ask for 10 split .... you will get 10 splits or in some case 11 also, the reason might be the field it is using to split the table (the where clause). But not 100% sure about it.
> 2) I will take an example of a table PRCD_CLUST(cluster table) in our environment, which we had split. We had 29 *.WHR files that were created for this particular table. The number of splits given for this table was 36 and the table size is around 72 GB.Also, we noticed that the first 28 .WHR files for this table, had lots of records but the last 29th .WHR file, had only 1 record. But we also noticed that, the packages/splits for the 1st 28 splits were created quite fast but the last one,29th one took a long time(serveral hours) to get completed.Also,lots of packages were generated(around 56) of size 1 GB each for this 29th plit. Also, there was only one R3load which was running for this 29th split, and was generating packages one by one.
Not sure why you got 29 split when you asked for 36, one reason might be the field (key) used for split didn't have more than 28 unique records. I dont know how is PRCD_CLUST split , you need to check the hints file for "key". One example can be suppose my table is split using company code, i have 10 company codes so even if i ask for 20 splits i will get only 10 splits (WHR's).
Yes the 29th file will always have less records, if you open the 29th WHR you will see that it has the "greater than clause". The 1st and the last WHR file has the "less than" and "greater than" clause , kind of a safety which allows you to prepare for the split even before you have downtime has started. This 2 WHR's ensures that no record gets missed, though you might have prepared your WHR files week before the actual migration.
> 3) Also,Our question here is that is there any thumb rule for deciding on the number of splits for a table.Also, during the export, are there any things that need to be specified, while giving the inputs when we use table splitting,in the screen?
Not aware any thumb rule. First iteration you might choose something like 10 for 50 GB , 20 for 100 GB. If any of the tables overshoots the window. They you can give a try by increase or decrease the number of splits for the table. For me couple of times the total export/import time have improved by reducing the splits of some tables (i suppose i was oversplitting those tables).
Regards,
Neel
Edited by: Neelabha Banerjee on Nov 30, 2011 11:12 PM -
Field symbols as Table name and in where condition in a select statement
Hello All,
I have a scenario where I need to get user input on table name and old field value and new field value. Then based on user input, I need to select the record from the database. The column name for all the tables in question is different in the database, however there data type is the same and have same values.
I am not able to use a field symbol for comparing the old field value to fetch the relevant record in my where clause.
I cannnot loop through the entire table as it has 10 millilon records, please advice on how to add the where clause as field symbol as the table name is also dynamically assigned.
Here is my code:
DATA: TAB LIKE SY-TNAME,
TAB_COMP1 LIKE X031L-FIELDNAME,
TAB_COMP2 LIKE X031L-FIELDNAME,
NO_OF_FLD TYPE N.
DATA: BEGIN OF BUFFER,
ALIGNMENT TYPE F,
C(8000) TYPE C,
END OF BUFFER.
FIELD-SYMBOLS: <WA> TYPE ANY,
<COMP1> TYPE ANY,
<COMP2> TYPE ANY.
GET TABLE NAME GIVEN BY USER IN LOCAL VARIABLE
TAB = TAB_NAME.
CREATE FIELD NAME BASED ON THE TABLE NAME ENTERED.
CASE TAB_NAME.
WHEN 'OIUH_RV_GL'.
KEY FIELD
TAB_COMP1 = 'GL_GL_SYS_NO'.
NO_OF_FLD = 1.
WHEN 'OIUH_RV_OPSL'.
KEY FIELD
TAB_COMP1 = 'OPSL_GL_SYS_NO'.
NO_OF_FLD = 1.
WHEN 'OIUH_RV_OTAX'.
NOT THE ONLY KEY FIELD
TAB_COMP1 = 'OTAX_GL_SYS_NO'.
TAB_COMP2 = 'OTAX_TAX_POS_NO'.
NO_OF_FLD = 2.
WHEN 'OIUH_RV_GTAX'.
NOT THE ONLY KEY FIELD
TAB_COMP1 = 'GTAX_GL_SYS_NO'.
TAB_COMP2 = 'GTAX_TAX_POS_NO'.
NO_OF_FLD = 2.
WHEN OTHERS.
EXIT.
ENDCASE.
SET FIELD SYMBOL WITH APPROPRIATE TYPE TO BUFFER AREA.
ASSIGN BUFFER TO <WA> CASTING TYPE (TAB).
How to add where clause and remove the if condition in the select -- endselect
SELECT * FROM (TAB) INTO <WA>.
ASSIGN COMPONENT TAB_COMP1 OF STRUCTURE <WA> TO <COMP1>.
IF NO_OF_FLD = 2.
ASSIGN COMPONENT TAB_COMP2 OF STRUCTURE <WA> TO <COMP2>.
ENDIF.
IF <COMP1> = OLD_SYS_NO.
code for updating table would come here
WRITE: 'MATCH FOUND'.
EXIT.
ENDIF.
ENDSELECT.
Please advice. Thanks much.
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:33 PM
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:34 PM
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:35 PM1. Create single column table for holding field name depending on the table entered.
2. Take input from user: for e.g. table_name
3. Using case load single column table with required fields
for e.g.
CASE TAB_NAME.
WHEN 'OIUH_RV_GL'.
Append 'GL_GL_SYS_NO' to KEY_FIELD --> KEY_FIELD is the single line internal table as mentioned in step 1.
WHEN 'OIUH_RV_OPSL'.
Append 'OPSL_GL_SYS_NO'.
WHEN 'OIUH_RV_OTAX'.
Append 'OTAX_GL_SYS_NO' to KEY_FIELD.
APPEND 'OTAX_TAX_POS_NO' to KEY_FIELD.
WHEN 'OIUH_RV_GTAX'.
Append 'GTAX_GL_SYS_NO' to KEY_FIELD.
APPEND 'OTAX_TAX_POS_NO' to KEY_FIELD.
WHEN OTHERS.
EXIT.
ENDCASE.
Now depending on the table name you have required column ready
4. Create dynamic internal table using following sudo code
Fill the fieldcatlog using the single column field table and DD03L table, See what all columns from DD03L you want to fill in field catlog table
loop at internal table with all the fields.
move it to field catalog.
append field catalog.
endloop.
5. Pass this field catalog table to static method create_dynamic_table method
DATA table TYPE REF TO DATA. --> data object for holding handle to dynamic internal table.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = fieldcatalog_tab
importing
ep_table = table.
6. Now assign table reference to field symbol of type table.
ASSIGN table->* to <field-tab>.
7. Also create work area <field-wa> using refrence of table.
create data object wa LIKE LINE OF <field-tab>.
ASSIGN wa->* to <field-wa>.
8. Also define field symbol for field name.
for e.g. <field_name>
4. Dynamic internal table is ready
5. Now execute the select statement as follows:
SELECT (KEY_FIELD)
INTO <ITAB> --> created dynamically above
FROM (TABLE_NAME)
WHERE (WHERE). --> WHERE is single line internal table having line type of CHAR72. So for every old value there will be one line
Where condition is same as like we give in static way only difference in this case it will stored in internal table line wise.
In this case you need to append all your where condition line by line in to WHERE.
5. To fill this dynamic internal table using ASSIGN COMPONENT <Comp_number> OF STRUCTURE <field-wa> TO <field-name>
So in this case if first field of structure STRUCT1 is user_id then sudo-code will be
loop at internal table containing list of fields into field_wa --> single column field table
ASSIGN COMPONENT field_wa OF STRUCTURE <field-wa> TO <field>. "Here field_wa is wa area for single column internal table holding all the fieldnames.
Now <field-name> points to user_id field. Move some value into it as nornally we do with variables.
Move <your_new_value> to <field-name>. --> Assign new value
or
<field-name> = <your_new_value>.
Endloop.
6. After completing all the fields one row will be ready in <field_wa>.
APPEND <field_wa> to <field_tab>.
Hope this helps you.
Thanks,
Augustin. -
How to compare table data and table field
Hi buddy,
I have some question about how to compare table data and table field.
1. I know there is one method: CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS , it use in unit test to compare the table data(A and B) , you can loop table A into structure A1, then use this mehtod it can compare whether table B contain structure A1. but when I try to use this in main program it will dump.
CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS(
LINE = A1
TABLE = B ).
Is there any method or FM can be used to compare the table data ?
2. I also want to compare two table field , try to find out the different. How to realize this.
Thank you for your sincerely answer.Hi Zongjie,
What`s the difference, if you using loop A into wa_A, read table B into wa_B with all field, then compare with wa_A and wa_B.
The question 2, seems no standard FM available here.
Loop A into wa_A.
Loop B into wa_B.
if wa_A-field1 eq wa_B-field1.
endif.
if wa_A-field2 eq wa_B-field2.
endif.
endloop.
endloop.
regards,
Archer -
Hi
Can someone advise what is the difference between table USR01 and USR02 and is it possible for the 2 tables to have different number of records.
Thank you.Dear friends,
Recently i came across a strange issue with respect to table USR01.
The SU01 entries were not reflected in db table USR01(The runtime version)
Like decimal format,time etc.
Could any body let me know what is the way to make them sync with db level and sap level.
Regards
Omkar
Maybe you are looking for
-
Copy AR invoice to Credit Memo
In B1 2005A SP01 PL 36, you cannot create a Credit memo from a closed invoice. This is extremely restrictive as the majority of product returns occur after the invoice has been paid. Is there an update to 2005A that provides this capability or does 2
-
Error while updating CE 7.11 to 7.2 with ceupdatemanager
Hi, I am trying to update my CE 7.11 to CE 7.2 using the ceupdatemanager. In the dialog phase the error occurs at CE_getNewJDBCDriverADA checkClientSoftware ERROR 2011-02-24 10:38:44.903 MaxDB Client Software for system: ECE must exist! ERROR 2011-0
-
I've Just migrated my mac to a new iMac and CS5 is dead
I've Just migrated my mac to a new iMac and CS5 is dead, I can't uninstall it or do anything with it. When I try to load an application it just crashes (I'm guessing because it needs registering on my new machine) and I can't uninstall it. I've been
-
FRM-92101 in wu_test (the webutil demo form)
Error: FRM-92101 in wu_test (the webutil demo form) Problem: I am attempting to run the wu_test form, downloaded with demos for webutil 1.02. Running wu_test or another form containing webutil functions results in FRM-92101 in the form's window and t
-
How do I programmatically change progress bar limit?
Hello all. I have a custom control and one of the indicators is a progress bar. The bar is used to show the position of a life test fixture as the fixture moves up and down. I would like to have the max limit of the bar to be set by the user. The