Inventory reports without value/price
Hi there,
I am looking for an inventory report like MC.9, MCBA, MCBE without value. Is there any standard inventory report without value or is it possible to restrict these reports without value through authorization?
Regards,
R.S
HI,
,try this not sure
MB53 - Display Plant Stock Availability
MB52 - List of Warehouse Stocks on Hand
MB5T - Stock in transit CC
MMBE-stock overview
MB51-material document list
MC50-dead stock
MC.1 INVCO: Plant Anal. Selection: Stock
MC.2 INVCO: Plant Anal.Selection, Rec/Iss
MC.5 INVCO: SLoc Anal. Selection, Stock
MC.9 INVCO: Material Anal.Selection,Stock
MC.A INVCO: Mat.Anal.Selection, Rec/Iss
MC.L INVCO: Mat.Group Analysis Sel. Stock
MC50 INVCO: Analysis of Dead Stock
MCBA INVCO: Plant Analysis Selection
MCBC INVCO: Stor. Loc. Analysis Selection
MCBE INVCO: Material Analysis Selection
MCBK INVCO: MatGrp Analysis Selection
MCBR INVCO: Batch Analysis Selection
Regards
Kailas Ugale
Similar Messages
-
Inventory report without reversals
Is there report that would show me the beginning balance, movements, ending balance of inventory but without the reversals?
Try this one:
SELECT T0.[ItemCode], max(T0.[Dscription]) Descr,
(select top 1 T.[Quantity] from DLN1 T
where T.ItemCode=T0.Itemcode order by T.DocEntry desc) LastQuant,
max(T1.[DocDueDate]) LastShip
FROM DLN1 T0
INNER JOIN ODLN T1 ON T0.DocEntry = T1.DocEntry
WHERE T1.[DocType] ='I'
and not exists
(select * from DLN1 t inner join ODLN o on o.docentry=t.docentry
where t.ItemCode=T0.ItemCode
and datediff(D,o.DocDueDate,getdate())<45 )
GROUP BY T0.[ItemCode]
ORDER BY T0.[ItemCode] -
Stock adjustment without value update
Dear Experts,
How to make inventory adjustments without value update. Like my client asks me to increase qty of a certain material whose value shoudnot get updated. My requirement is some movement type for stock increasing without generating FI docs.
Thanks,
NagarajHi
check this link [Physical inventory without accounting doc;
Regards
Kailas Ugale -
-ve values in inventory report
Hi Experts,
I have inventory report, this report shows total stock, in this report some materials are showing '-ve' values,but in cube total issue stock and total received stock both are same, that means this inventory report should show '0' value.
for example: in cube total issues stock: 13.60, total received stock: 13.60. That means total stock is = 0 (13.60-13.60), but in report it is showing -13.60.
I am not understanding what is the problem,
Pl help to do this,
good answer will be appriciated.
thanks in advance,
VenkatHi Venkat,
The calculation's of Inventory total stock is not as simple as we understand them. To calculate total stock it consider different Movement type's, reversal entries, blocked stock etc. as well into consideration.
There is no -ve stock and there can be no as well, but still u r getting that (i also got that ) then this is how u can analyze at various points where exactly the problem is.
1. Try to run some standard report for total stock (based on inventory Cube 0IC_C03 i guess this is u usign probably). Check the stock value for 1 or two particular Material and cross check the stock of same material in your R/3 system through some tr MMBE.
2. If standard report gives u rite result then probably some logic problem in ur report.
3. Apart from that the main problem of this situation is data loading issue.
Please follow proper inventory data loading steps. If not done step by step u will end up with wrong data.
Hope these steps will help you out in tracking the situation.
Thanks
Dipika Tyagi -
Cube for Inventory values, prices and quantity
Hi,
Does anybody knows some standard InfoCube that delivers Inventory values, prices and quantity?
I need something like R/3 transaction CKM3 (Material Prices Analysis CO-ML). This transaction agregates inventory quantity, value ( material price) per material/plant, you could drill-down to material moviments level.
I found a InfoCube named 0IC_C03 (Material Movements - see help link), but i can't figure out how this cube works.
http://help.sap.com/saphelp_nw04/helpdata/en/fb/64073c52619459e10000000a114084/frameset.htm
Regards,
EduardoHi Eduardo,
Now, I am developing a new query, exactly in CKM3 format, but where you can see more than one material at once.
I am using the infocube 0COPC_C07 (Actual Costing/Material Ledger), where I can see the same information as in CKM3 transaction.
I hope this helps,
Regards,
Fernando. -
Inventory Month End Value Report
Hi all,
I've been informed that I can confirm the value of my ERP inventory month end value report by the following formula:
last month end value + current month delivery value – current month MO (Move Order) = Current Month End Value
but the oputput of this formula does not reconcile with the report generated from ERP .. I think this happend because the ERP uses the average costing method .. but again why for only this month the numbers are not the same?!
Thanks,Options:
1. Check with MC.1 (for plant perspective) or MC.9 (for mtl perspective), by specifying the period in the Period to Analyze
2. Check with MB5B, by specifying the month start & end dates in the Selection date field.
3. Check with MB51 report by specifying the posting date.
Hope the above helps.
Regards,
Vivek -
How to open a report without refreshing and sending some param value
we have a summary report which has links to the detail report.For example the summary report has data like
Countries EmployeeCount
UK 5
US 6
China 7
Total 18
When we click on China it must show the Employees whose country is China (detail report) When we click on Total it shows Employee of all countries UK,US,China...
Now when we run the summary report online say at 5:10 it shows the staus of countries at 5:10.Say the report is open while an employee of china is moved from China to Uk.But when we open the detail report it shows China count as 6 which should actually be 7 according to the summary report run time.
A similar problem exist when we schedule the report .When we schedule the summary report and detail report at same time..And then try to open the scheduled instance of detail report from summary scheduled instance ,It only works fine if no parameter is passed to openDocument url.
Say suppose I click China on summary report the Value China should be passed to detail report as Country.But whenever we try to open a scheduled instance of Detail Report along with a parameter using openDocument Url.It refreshes the whole data even though refresh is set to 'N'.So the scheduled data is lost..Even if we try for Drillfilters in detail Report we cannot set it at runtime using open document Url.Mihail - I detailed a couple of approaches here: Re: Application Link
Scott -
Roll Forward Inventory Reporting
Hi,
We currently use Roll Forward reporting. However, due to an error a wrong yield was posted. This caused the Sales at average price to calculate inacurately. Hence the inventory dollars was also inaccurate. Since the Cost of Sales and Inventory dollars from the roll forward are tied to the Trial Balance accounts through IS OIL, my TB values were also wrong. How can I fix my inventory on the Roll Forward report to match the inventory on the Balance sheet?Sandesh,
Thanks for your help. Will the MR21 change the volumes?. Currently the inventory volumes on the Roll Forward is correct, however, because of the error, the moving average cost of sales dollars is wrong. This caused the inventory dollars to be inaccurate on the Roll Forward and the Trial Balance. I can increase the dollars on the RF and TB using MB1C and 961 using 1 gallon and any dollar value. But our inventory dollars is overstated on both the RF and TB and I cannot input a -ve dollars using MB1C.
Will the MR 21 allow me to manually decrease the inventory cost without affecting volume? -
OO ALV displaying without Values despite Internal table contains
My below OO ALV displaying without Values despite Internal table contains the values ...
Help please ...
REPORT zsd_concession1 NO STANDARD PAGE HEADING
LINE-SIZE 285
LINE-COUNT 64
MESSAGE-ID zz.
Program Description ******************************
This report is to Calculate consession against Quotations
complying standards for enhanced Performance, Readability &
Maintenance.
Change Log *********************************
Remedy # / Who When Why / What
Transport #
CLASS lcl_event_handler DEFINITION DEFERRED.
*& Data Definitions .
DATA: BEGIN OF vbap_wa,
vbeln TYPE vbak-vbeln, "Quotation#
erdat TYPE vbak-erdat, "Quot date
knumv TYPE vbak-knumv, "Cond Rec#
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF vbap_wa,
BEGIN OF konv_wa,
knumv TYPE konv-knumv, "Cond#
kposn TYPE konv-kposn, "Cond Item#
kappl TYPE konv-kappl, "Applic
kschl TYPE konv-kschl, "Cond Typ
kbetr TYPE konv-kbetr, "Price ZBP1,ZNAA,ZNAX
END OF konv_wa,
BEGIN OF vbpa_wa,
vbeln TYPE vbpa-vbeln, "Quot#
posnr TYPE vbpa-posnr, "Item#
parvw TYPE vbpa-parvw, "Prt Fn
kunnr TYPE vbpa-kunnr, "Cust#
END OF vbpa_wa,
BEGIN OF result_wa,
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF result_wa.
DATA: ikonv LIKE STANDARD TABLE OF konv_wa,
ivbap LIKE STANDARD TABLE OF vbap_wa,
ivbpa LIKE STANDARD TABLE OF vbpa_wa,
iresult LIKE STANDARD TABLE OF result_wa.
*Work storage
DATA: BEGIN OF ws,
vbeln TYPE vbak-vbeln,
ok_code TYPE sy-ucomm,
alv_save TYPE c, "ALV save
alv_variant TYPE disvariant, "ALV Variant
alv_sort TYPE lvc_t_sort, "Sort table
END OF ws.
*Data declarations for ALV Main list
DATA : ty_lay1 TYPE lvc_s_layo,
it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat ,
l_smenu TYPE REF TO cl_ctmenu,
c_alv1 TYPE REF TO cl_gui_alv_grid,
c_cont1 TYPE REF TO cl_gui_custom_container,
e_dclick TYPE REF TO lcl_event_handler.
*Data declarations for ALV Interactive list
DATA : ty_lay2 TYPE lvc_s_layo,
it_fcat TYPE lvc_t_fcat ,
ty_fcat TYPE lvc_s_fcat ,
c_alv2 TYPE REF TO cl_gui_alv_grid,
c_cont2 TYPE REF TO cl_gui_custom_container.
*Field-Symbols
FIELD-SYMBOLS:
<konv> LIKE konv_wa,
<vbap> LIKE vbap_wa.
*Constants
CONSTANTS:
c_end_row TYPE i VALUE 65000.
*CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
ENDCLASS. "lcl_event_handler DEFINITION
*CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
DATA: sec_wa LIKE LINE OF iresult.
*Reading the selected data into a variable
READ TABLE iresult INDEX e_row-index INTO sec_wa.
*Select the field details of the selected table
SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
WHERE tabname EQ ls_dd02l-tabname.
*Calling the ALV containing the field values
CALL SCREEN 101.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_vbeln FOR ws-vbeln DEFAULT '2002354788' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a.
INITIALIZATION.
PERFORM setup_screen_defaults.
START-OF-SELECTION.
PERFORM gather_report_data.
END-OF-SELECTION.
PERFORM create_output.
*& Form initialization
FORM setup_screen_defaults.
CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
REFRESH: ivbpa, ikonv, ivbap, iresult.
ENDFORM. " setup_screen_defaults
*& Form gather_report_data
FORM gather_report_data.
SELECT vbeln posnr parvw kunnr
INTO TABLE ivbpa
FROM vbpa
WHERE vbeln IN s_vbeln
AND ( parvw = 'SP' OR "SoldTO
parvw = 'WE' OR "ShipTo
parvw = 'ZT' ). "Top Parent
SELECT vkvbeln vkerdat vkknumv vpposnr vp~matnr
z1zansicat z1zansigrd z2~zcurrvaltnarea
z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
m1mstav vpkwmeng vp~netpr
INTO CORRESPONDING FIELDS OF TABLE ivbap
FROM vbak AS vk
INNER JOIN vbap AS vp
ON vpvbeln = vkvbeln
INNER JOIN zmarall AS z1
ON z1matnr = vpmatnr
INNER JOIN zco002 AS z2
ON z2matnr = vpmatnr
INNER JOIN zglbprc AS zg
ON zgmatnr = vpmatnr
INNER JOIN mara AS m1
ON m1matnr = vpmatnr
WHERE vk~vbeln IN s_vbeln
AND vk~auart = 'AG'."AG = Quot
SORT ivbap BY posnr matnr.
SELECT kvknumv kvkposn kvkappl kvkschl kv~kbetr
INTO TABLE ikonv
FROM konv AS kv
FOR ALL ENTRIES IN ivbap
WHERE kv~knumv = ivbap-knumv
AND kv~kposn = ivbap-posnr
AND kv~kappl EQ 'V'
AND ( kv~kschl EQ 'ZBP1'
OR kv~kschl EQ 'ZNAX'
OR kv~kschl EQ 'ZNAA' ).
SORT ikonv BY knumv kposn.
LOOP AT ivbap ASSIGNING <vbap>.
CLEAR konv_wa.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZBP1'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-lprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAX'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAA'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
ENDLOOP.
SORT ivbap BY posnr matnr.
LOOP AT ivbap INTO vbap_wa.
MOVE-CORRESPONDING vbap_wa TO result_wa.
APPEND result_wa TO iresult.
CLEAR: vbap_wa, result_wa.
ENDLOOP.
ENDFORM. " gather_report_data
*& Form create_output
FORM create_output.
CALL SCREEN 100.
FREE: iresult.
ENDFORM. " create_output
*& Module PBO_0100 OUTPUT
text
MODULE pbo_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
IF c_cont1 IS INITIAL.
*Creating object of container
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CCONT1'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Alv layout
PERFORM alv_100_layout.
PERFORM save_alv_layout.
*Alv field catalogue
PERFORM alv_100_fieldcat.
*Displaying the ALV grid
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = ty_lay1
i_save = ws-alv_save
is_variant = ws-alv_variant
CHANGING
it_outtab = iresult[]
it_sort = ws-alv_sort
it_fieldcatalog = it_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Create object of the event class
*and setting handler for double click
CREATE OBJECT e_dclick.
SET HANDLER e_dclick->handle_double_click FOR c_alv1.
ENDIF.
ENDMODULE. " PBO_0100 OUTPUT
*& Module PAI_0100 INPUT
text
MODULE pai_0100 INPUT.
ws-ok_code = sy-ucomm.
CASE ws-ok_code.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
CLEAR ws-ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*& Form alv_100_layout
text
--> p1 text
<-- p2 text
FORM alv_100_layout.
ty_lay1-numc_total = 'X'. " Numc total line
ty_lay1-cwidth_opt = 'X'. " Optimal column width
ty_lay1-detailinit = 'X'. " Show values that are initial in
ty_lay1-sel_mode = 'A'. " Column selection mode
ty_lay1-no_merging = 'X'. " No merging while sorting columns
ty_lay1-keyhot = 'X'.
ty_lay1-grid_title = 'SD Concessions'.
ty_lay1-zebra = 'X'.
ty_lay1-no_toolbar = ' '.
ENDFORM. " alv_100_layout
*& Form alv_100_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_100_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 6.
ty_fieldcat-fieldname = 'zcurrcstusd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Cost $'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 7.
ty_fieldcat-fieldname = 'zzbrndnm'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Brand'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 8.
ty_fieldcat-fieldname = 'zqedscgrp'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'QE'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'mstav'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Status'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'kwmeng'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Qty'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 10.
ty_fieldcat-fieldname = 'lprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'List Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 11.
ty_fieldcat-fieldname = 'sprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Discount'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 12.
ty_fieldcat-fieldname = 'netpr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Quot Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 13.
ty_fieldcat-fieldname = 'mrgn'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Margin%'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_100_fieldcat
*& Module PBO_0101 OUTPUT
text
MODULE pbo_0101 OUTPUT.
*Check if the Custom container exists.
IF c_cont2 IS INITIAL.
*Creating container object
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CCONT2'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*creating ALV grid for interactive list
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ALV layout
PERFORM alv_101_layout.
*ALV fieldcatalogue
PERFORM alv_101_fieldcat.
*Sorting the output by field position
SORT iresult BY posnr.
*ALV for display field details
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
is_layout = ty_lay2
CHANGING
it_outtab = iresult[]
it_fieldcatalog = it_fieldcat.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDMODULE. " PBO_0101 OUTPUT
*& Module PAI_0101 INPUT
text
MODULE pai_0101 INPUT.
ENDMODULE. " PAI_0101 INPUT
*& Form alv_101_layout
text
--> p1 text
<-- p2 text
FORM alv_101_layout.
ty_lay2-grid_title = 'Line Details'.
ty_lay2-zebra = 'X'.
ty_lay2-no_toolbar = 'X'.
ENDFORM. " alv_101_layout
*& Form alv_101_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_101_fieldcat.
REFRESH it_fieldcat.
REFRESH it_fcat.
CLEAR ty_fcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_101_fieldcat
*& Form save_alv_layout
text
--> p1 text
<-- p2 text
form save_alv_layout.
ws-alv_save = 'A'.
ws-alv_variant-report = sy-repid.
endform. " save_alv_layoutHello
Creating fieldcatalogs manually is one of the major error sources in ALV programming.
There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
Regards
Uwe -
Urgent:Inventory Modelling with Moving price
I have to create an Inventory report storage locationwise material stock along with standard price and moving average price.
We have a z cube zic_c03.
Moving price and standard price is stored an Z ODS on fiscal/period wise.
I need to have the following fields in the report
charactersitics
Plant
Material
Storage location
Price control(from Z ods)
keyfigures:
Valuated stock qty(from zic_c03)
Valuated stock value(from zic_c03)
Standard price(from ods)-Using routine
Moving Price(from ods)-Using Routine
I have created another cube(included all the fields from zic_c03 and added the three fields from ODS).
For the fields included from ODS, I have written an lookup routine in the new cube (zic_c04) update rule.
For ex.Stand price routine as follows:
PROGRAM UPDATE_ROUTINE.
TABLES: ...
DATA : tstd like /BIC/AZMM_O0200-pRICE_std.
DATA : tavg like /BIC/AZMM_O0200-pRICE_avg.
DATA : tpc like /BIC/AZMM_O0200-PRICE_CTRL.
fill the internal table "MONITOR", to make monitor entries
select single PRICE_STD
into tstd
from /BIC/AZMOV_O0100
where material = COMM_STRUCTURE-material
and plant = COMM_STRUCTURE-plant
and FISCPER = COMM_STRUCTURE-FISCPER.
RESULT = tstd.
RETURNCODE = 0.
ABORT = 0.
I have the following issues:.
1)After adding the price control Indicator(assigned to all keyfigures in update rule) Valuated stock qty and value showing in negative.
2)Intially I didn't compress the new cube(zic_c04).After seeing negative values I compressed(no marker update enabled) it and checked.But still showing negative.
2)If I assign price control Indicator to only standard price and moving price Iam not getting any results for valuated qty and stock(price control Indicator = 'not assigned')
Pls help me to do the right modelling for the above requirement.
Thanks in advance.
Regards
SoujanyaHi,
I have different Modeling scenario to get MAP in BIW.
Take a Look on this thread:
Re: 2lis_03_um and MBEW- STPRS
Re: How to get Moving Average Prince and Standard Price in BW (inventory cube).
With rgds,
Anil Kumar Sharma .P -
How to generate Inventory Report to display all details at end of mon/yr?
Hi Guys..
I would like to know how we can generate a
Inventory report to display all inventory details at the end of every
month or year?
Also, another question.How can we create a PO past delivery date report?
Any help is appreciated.
Thanks,
Sri Harsha;Hi,
Pls the code here-
TYPES :
BEGIN OF ty_mard,
matnr TYPE matnr,
werks TYPE werks_d,
lgort TYPE lgort_d,
labst TYPE labst,
retme TYPE retme,
umlme TYPE umlme,
END OF ty_mard.
TYPES :
BEGIN OF ty_mska,
matnr TYPE matnr,
kalab TYPE labst,
vbeln TYPE vbeln,
posnr TYPE posnr,
END OF ty_mska.
TYPES :
BEGIN OF ty_vbap,
matnr TYPE matnr,
kwmeng TYPE kwmeng,
pstyv TYPE pstyv,
END OF ty_vbap.
TYPES :
BEGIN OF ty_mbew,
matnr TYPE matnr,
salk3 TYPE salk3,
stprs TYPE stprs,
END OF ty_mbew.
TYPES :
BEGIN OF ty_mchb,
matnr TYPE matnr,
charg TYPE charg_d,
END OF ty_mchb.
TYPES :
BEGIN OF ty_mara,
matnr TYPE matnr,
mfrpn TYPE mfrpn,
END OF ty_mara.
TYPES :
BEGIN OF ty_makt,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
TYPES :
BEGIN OF ty_ekpo,
matnr TYPE matnr,
netpr TYPE bprei,
meins TYPE bstme,
END OF ty_ekpo.
DATA :
BEGIN OF final OCCURS 0,
matnr LIKE mard-matnr,
maktx LIKE makt-maktx,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
mfrpn LIKE mara-mfrpn,
usp LIKE mbew-stprs,
labst LIKE mard-labst,
salk3 LIKE mbew-salk3,
kalab LIKE mska-kalab,
vbeln LIKE mska-vbeln,
sov LIKE ekpo-netpr,
uom LIKE ekpo-meins,
posnr LIKE mska-posnr,
pstyv LIKE vbap-pstyv,
kwmeng LIKE vbap-kwmeng,
retme LIKE mard-retme,
umlme LIKE mard-umlme,
END OF final.
DATA :
BEGIN OF itab OCCURS 0,
matnr LIKE mard-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
labst LIKE mard-labst,
retme LIKE mard-retme,
umlme LIKE mard-umlme,
charg LIKE mchb-charg,
END OF itab.
DATA :
i_mard TYPE STANDARD TABLE OF ty_mard,
i_mbew TYPE STANDARD TABLE OF ty_mbew,
i_mchb TYPE STANDARD TABLE OF ty_mchb,
i_mara TYPE STANDARD TABLE OF ty_mara,
i_vbap TYPE STANDARD TABLE OF ty_vbap,
i_mska TYPE STANDARD TABLE OF ty_mska,
i_makt TYPE STANDARD TABLE OF ty_makt,
i_ekpo TYPE STANDARD TABLE OF ty_ekpo.
DATA :
wa_mard TYPE ty_mard,
wa_mbew TYPE ty_mbew,
wa_mchb TYPE ty_mchb,
wa_mara TYPE ty_mara,
wa_vbap TYPE ty_vbap,
wa_mska TYPE ty_mska,
wa_makt TYPE ty_makt,
wa_ekpo TYPE ty_ekpo.
DATA :
sov_total TYPE currency,
urestrict_total type currency.
*Select options:
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR gf_matnr, " Material No.
s_werks FOR gf_werks, " Plant
s_lgort FOR gf_lgort, " Storage Location
s_charg FOR gf_charg. " Batch No.
SELECTION-SCREEN END OF BLOCK a.
*Validation of Selection Fields
AT SELECTION-SCREEN.
IF s_matnr IS INITIAL
AND s_werks IS INITIAL
AND s_lgort IS INITIAL
AND s_charg IS INITIAL.
MESSAGE e001(zcir).
ENDIF.
*Function Module for Checking the inputs
CALL FUNCTION 'MMIM_ENTRYCHECK_MAIN'
TABLES
it_matnr = s_matnr
it_werks = s_werks
it_lgort = s_lgort.
*Checking of input values for S_CHARG
IF NOT s_charg-low IS INITIAL OR NOT s_charg-high IS INITIAL.
SELECT charg FROM mchb into table LT_charg WHERE charg IN s_charg.
IF sy-subrc NE 0.
MESSAGE e002(zcir).
ENDIF.
clear wa_mchb.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR COL_HEADING.
WRITE sy-uline(105).
WRITE :/ '|',2 text-101, "MATERIAL NO:
16 text-102, "MATERIAL DESCRIPTION
52 text-103, "PLANT
60 text-104, "STORAGE LOCATION.
74 text-105, "MANUFACTURE PARTNER NO.
88 text-106, "VALUATED STOCK.
95 text-107. "STANDARD PRICE.
105 '|'.
FORMAT COLOR COL_GROUP.
WRITE :/ '|',2 text-108, " UNRESTRCTED STOCK
16 text-109, " SALES DOCUMENT NO:
20 text-110, " ITEM NO:
27 text-111, " UNIT
32 text-112, " NET VALUE
39 text-113, " ITEM CATEGRY
50 text-114, " QUANTITY
60 text-115, " BLOCKED STOCK
79 text-116, " TOTAL STOCK
95 text-117. " STOCK TRANSFER
87 '|'.
FORMAT COLOR OFF.
WRITE sy-uline(105).
*START OF SELECTION
START-OF-SELECTION.
IF NOT s_matnr IS INITIAL
OR NOT s_werks IS INITIAL
OR NOT s_lgort IS INITIAL.
PERFORM select1.
ELSEIF NOT s_charg IS INITIAL.
PERFORM select2.
ELSEIF NOT s_matnr IS INITIAL
OR NOT s_werks IS INITIAL
OR NOT s_lgort IS INITIAL
AND NOT s_charg IS INITIAL.
PERFORM select3.
ENDIF.
PERFORM final1.
PERFORM collect.
*END OF SELECTION
END-OF-SELECTION.
LOOP AT LT_FINAL.
FORMAT COLOR COL_KEY.
WRITE :/2 LT_FINAL-matnr,
14 LT_FINAL-maktx,
52 LT_FINAL-werks,
58 LT_FINAL-lgort,
69 LT_FINAL-mfrpn,
73 LT_FINAL-labst,
87 LT_FINAL-usp.
FORMAT COLOR OFF.
FORMAT COLOR COL_NORMAL.
WRITE :/2 LT_FINAL-kalab,
14 LT_FINAL-vbeln,
17 LT_FINAL-posnr,
24 LT_FINAL-uom,
28 LT_FINAL-sov,
36 LT_FINAL-pstyv,
46 LT_FINAL-kwmeng,
57 LT_FINAL-retme,
65 LT_FINAL-salk3,
75 LT_FINAL-umlme.
ENDLOOP.
FORMAT COLOR COL_TOTAL.
WRITE :/2 text-119, " TOTAL VALUE
28 V_sov_total,
87 V_urestrict_total.
FORMAT COLOR OFF.
Form Name: select1
text: Population of internal table LT_MARD and using LT_MARD populating
the internal table LT_MCHB
FORM select1.
SELECT matnr
werks
lgort
labst
retme
umlme
FROM mard
INTO TABLE LT_mard
WHERE matnr IN s_matnr
AND werks IN s_werks
AND lgort IN s_lgort.
SELECT matnr
charg
FROM mchb
INTO TABLE LT_mchb
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
ENDFORM. "select1
Form Name: select2
text:Population of internal table LT_MCHB and using LT_MCHB populating
LT_MARD
FORM select2.
SELECT matnr
charg
FROM mchb
INTO TABLE LT_mchb
WHERE charg IN s_charg.
SELECT matnr
werks
lgort
labst
retme
umlme
FROM mard
INTO TABLE LT_mard
FOR ALL ENTRIES IN LT_mchb
WHERE matnr EQ LT_mchb-matnr.
ENDFORM. "select2
Form Name: select3
text: Population of internal table LT_TAB using inner join and then
populating internal tables LT_MARD and LT_MCHB
FORM select3.
SELECT a~matnr
a~werks
a~lgort
a~labst
a~retme
a~umlme
b~charg
INTO CORRESPONDING FIELDS OF TABLE LT_TAB
FROM mard AS a
INNER JOIN mchb AS b ON bmatnr = amatnr
WHERE a~matnr IN s_matnr
OR a~werks IN s_werks
OR a~lgort IN s_lgort
AND b~charg IN s_charg.
LOOP AT LT_TAB.
MOVE: LT_TAB-matnr TO wa_mard-matnr,
LT_TAB-werks TO wa_mard-werks,
LT_TAB-lgort TO wa_mard-lgort,
LT_TAB-labst TO wa_mard-labst,
LT_TAB-retme TO wa_mard-retme,
LT_TAB-umlme TO wa_mard-umlme,
LT_TAB-matnr TO wa_mchb-matnr,
LT_TAB-charg TO wa_mchb-charg.
APPEND wa_mard TO LT_mard.
APPEND wa_mchb TO LT_mchb.
ENDLOOP.
ENDFORM. "select3
Form Name:collect
text:population of LT_FINAL internal table-LT_FINAL using other internal
tables
FORM collect.
LOOP AT LT_mard INTO wa_mard.
MOVE : wa_mard-matnr TO LT_FINAL-matnr,
wa_mard-werks TO LT_FINAL-werks,
wa_mard-lgort TO LT_FINAL-lgort,
wa_mard-labst TO LT_FINAL-labst,
wa_mard-retme TO LT_FINAL-retme,
wa_mard-umlme TO LT_FINAL-umlme.
READ TABLE LT_makt INTO wa_makt WITH KEY matnr = wa_mard-matnr.
MOVE wa_makt-maktx TO LT_FINAL-maktx.
READ TABLE LT_mska INTO wa_mska WITH KEY matnr = wa_mard-matnr.
MOVE: wa_mska-kalab TO LT_FINAL-kalab,
wa_mska-vbeln TO LT_FINAL-vbeln,
wa_mska-posnr TO LT_FINAL-posnr.
READ TABLE LT_vbap INTO wa_vbap WITH KEY matnr = wa_mard-matnr.
MOVE: wa_vbap-kwmeng TO LT_FINAL-kwmeng.
READ TABLE LT_mara INTO wa_mara WITH KEY matnr = wa_mard-matnr.
MOVE : wa_mara-mfrpn TO LT_FINAL-mfrpn.
READ TABLE LT_mbew INTO wa_mbew WITH KEY matnr = wa_mard-matnr.
Calculation of Unrestricted value
LT_FINAL-usp = wa_mard-labst * wa_mbew-stprs.
V_urestrict_total = V_urestrict_total + ( wa_mard-labst * wa_mbew-stprs ).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = V_urestrict_total
IMPORTING
OUTPUT = V_urestrict_total
MOVE wa_mbew-salk3 TO LT_FINAL-salk3.
READ TABLE LT_ekpo INTO wa_ekpo WITH KEY matnr = wa_mard-matnr.
MOVE wa_ekpo-meins TO LT_FINAL-uom.
Calculation of Sales Order Value
LT_FINAL-sov = wa_mska-kalab * wa_ekpo-netpr.
V_sov_total = V_sov_total + ( wa_mska-kalab * wa_ekpo-netpr ).
APPEND LT_FINAL.
ENDLOOP.
ENDFORM. "collect
*Form Name:FINAL1
*Population of all the internal tables
FORM FINAL1.
SELECT matnr
kalab
vbeln
posnr
FROM mska
INTO TABLE LT_mska
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
kwmeng
pstyv
FROM vbap
INTO TABLE LT_vbap
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
salk3
stprs
FROM mbew
INTO TABLE LT_mbew
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
mfrpn
FROM mara
INTO TABLE LT_mara
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
maktx
FROM makt
INTO TABLE LT_makt
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
netpr
FROM ekpo
INTO TABLE LT_ekpo
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
ENDFORM. "final1
Reward if helpful.
Chandralekha -
One Consolidated MM Inventory report for all inventories
Hello Experts,
I have a requirement to develop an MM inventory report which should include all the below inventories for a given period. basically I have to display the Quantity, Unit price and Value for all these.
1. Stock Beginning value (Similar to MB5B)
2. Stock period end value (Similar to MB5B)
3. Stock in (MSEG-BWART = 101 and 102 )
4. Total available goods
5. Stock out to project ( MSEG-BWART = 261, 921, 961 )
6. Stock out to Cost center ( MSEG-BWART = 201)
7. Stock difference (MSEG-BWART = 701 and 702)
8. Scraping (MSEG-BWART = 501)
I heard that there are separate transactions for each points above. But Is there any consolidated (Standard or Z)report which includes all the above said information.
Thanks in advance,
BalajiHi,
Pl. explore this report S_P00_07000139, hope it will help you, else you need to develop a Z Report
Regards,
Vikas
Edited by: Vikas Mayekar on Jul 27, 2009 10:57 AM -
Bulk update of inventory for last evaluated price
In SAP, there are about 10,000 items . Last evaluated price is not assigned for many items. So it is very tedious task of assigning the price. For each item Inventory Audit Report is executed. Is there any way of assigning the last evaluated price in bulk ? I want to update the entire inventory in single instance.
Hi,
Last Evaluated Price is volatile and unreliable. It is updated whenever you run the Inventory Valuation Simulation Report (Inventory > Inventory Reports > Inventory Valuation Simulation Report).
This report should only be run to see what the value of your stock would be if you were to use another valuation method than has been set in your settings (Administration > System Initialization > Company Details > Basic Initialization > Item Groups Valuation Method).
So you really should not need to update the Last Evaluated Price, because you should not be using this price for any business purposes like for example calculating your sales margins.
If you want to do so anyway, use the Inventory Valuation Simulation Report.
Regards,
Johan -
Pls some one send me mm inventory report
hi all,'
pls some one send me mm inventory report.
i m facing problem in mm report.
regards
vikas saini.Hai.
check the examople codes.
MM Process flow
The typical procurement cycle for a service or material consists of the following phases:
1. Determination of Requirements
Materials requirements are identified either in the user departments or via materials planning and control. (This can cover both MRP proper and the demand-based approach to inventory control. The regular checking of stock levels of materials defined by master records, use of the order-point method, and forecasting on the basis of past usage are important aspects of the latter.) You can enter purchase requisitions yourself, or they can be generated automatically by the materials planning and control system.
2. Source Determination
The Purchasing component helps you identify potential sources of supply based on past orders and existing longer-term purchase agreements. This speeds the process of creating requests for quotation (RFQs), which can be sent to vendors electronically via SAP EDI, if desired.
3.Vendor Selection and Comparison of Quotations
The system is capable of simulating pricing scenarios, allowing you to compare a number of different quotations. Rejection letters can be sent automatically.
4. Purchase Order Processing
The Purchasing system adopts information from the requisition and the quotation to help you create a purchase order. As with purchase requisitions, you can generate Pos yourself or have the system generate them automatically. Vendor scheduling agreements and contracts (in the SAP System, types of longer-term purchase agreement) are also supported.
5. Purchase Order Follow-Up
The system checks the reminder periods you have specified and - if necessary - automatically prints reminders or expediters at the predefined intervals. It also provides you with an up-to-date status of all purchase requisitions, quotations, and purchase orders.
6. Goods Receiving and Inventory Management
Goods Receiving personnel can confirm the receipt of goods simply by entering the Po number. By specifying permissible tolerances, buyers can limit over- and underdeliveries of ordered goods.
7. Invoice Verification
The system supports the checking and matching of invoices. The accounts payable clerk is notified of quantity and price variances because the system has access to PO and goods receipt data. This speeds the process of auditing and clearing invoices for payment.
example code.
REPORT ZMMBDC1_1 NO STANDARD PAGE HEADING MESSAGE-ID ZT.
Declaration of internal tables
internal table for selecting data from flat file
DATA : BEGIN OF IT_DATA OCCURS 0,
MBRSH, " Industry sector
MTART(4), " Material type
KZSEL, " Checkbox
MAKTX(40), " Material description
MEINS(3), " Base unit of measure
MATKL(9), " Material group
BISMT(18), " Old material number
END OF IT_DATA.
internal table for bdcdata
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
internal table to handle messages
DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
Variables & Flag declaration
variables declaration
DATA : V_MESG(50).
flag declaration
DATA : FG_BDC,
FG_FLAG1 TYPE I.
selection screen
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
parameter
PARAMETERS : P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK1.
initialization
INITIALIZATION.
peform to initialize parameter
PERFORM INIT_PARM.
start of selection
start-of-selection.
perform to upload it_data
PERFORM UP_LOAD_IT_DATA.
perform transfer data
PERFORM TRANSFER_DATA.
end of selection
END-OF-SELECTION.
*& Form INIT_PARM
Initializing parameter
FORM INIT_PARM.
P_FILE = 'C:\'.
ENDFORM. " INIT_PARM
*& Form UP_LOAD_IT_DATA
Transfering data from file to internal table
FORM UP_LOAD_IT_DATA.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FILE
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
IF SY-SUBRC = 2 .
FG_FLAG1 = 1.
MESSAGE I001.
ENDIF.
ENDFORM. " UP_LOAD_IT_DATA
*& Form TRANSFER_DATA
Processing the data
FORM TRANSFER_DATA.
FG_BDC = 'N'.
LOOP AT IT_DATA.
perform to fill it_bdcdata.
PERFORM FILL_IT_BDCDATA.
CALL TRANSACTION 'MM01' USING IT_BDCDATA MODE 'N' UPDATE 'S'
MESSAGES INTO IT_MESSAGES.
IF SY-SUBRC <> 0.
FG_FLAG1 = 1.
if error occurs in transaction mode run bdc session for that data
PERFORM BDC_PROCESS.
ENDIF.
Handles error messages
PERFORM ERROR_MESSAGES.
CLEAR : IT_BDCDATA,IT_DATA,IT_MESSAGES.
REFRESH : IT_BDCDATA,IT_MESSAGES.
ENDLOOP.
IF FG_FLAG1 = 0.
MESSAGE I003.
ENDIF.
IF FG_BDC = 'O'.
close bdc if it is open
PERFORM CLOSE_BDC.
ENDIF.
ENDFORM. " TRANSFER_DATA
*& Form FILL_IT_BDCDATA
Filling Bdcdata structure with it_data
Some fields have been commented for future updations
FORM FILL_IT_BDCDATA.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '/00',
: 'BDC_CURSOR' 'RMMG1_REF-MATNR',
: 'RMMG1-MBRSH' IT_DATA-MBRSH,
: 'RMMG1-MTART' IT_DATA-MTART.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '=RESA'.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '=ENTR',
: 'MSICHTAUSW-KZSEL(01)' IT_DATA-KZSEL.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '=BU',
: 'BDC_SUBSCR' 'SAPLMGMM' & ' 2000TABFRA1',
: 'BDC_SUBSCR' 'SAPLMGD1' & ' 1002SUB1',
: 'BDC_CURSOR' 'MAKT-MAKTX',
: 'MAKT-MAKTX' IT_DATA-MAKTX,
: 'BDC_SUBSCR' 'SAPLMGD1' & ' 2001SUB2',
: 'MARA-MEINS' IT_DATA-MEINS,
: 'MARA-MATKL' IT_DATA-MATKL,
: 'MARA-BISMT' IT_DATA-BISMT,
: 'BDC_OKCODE' '=BU'.
*perform bdc_field using 'MARA-EXTWG' ''.
*perform bdc_field using 'MARA-LABOR' ''.
*perform bdc_field using 'MARA-KOSCH' ''.
*perform bdc_field using 'MARA-MSTAE' ''.
*perform bdc_field using 'MARA-MSTDE' ''.
*perform bdc_field using 'BDC_SUBSCR' 'SAPLMGD1' & ' 2561SUB3'.
*perform bdc_field using 'MARA-BEGRU' ''.
*perform bdc_field using 'BDC_SUBSCR' 'SAPLMGD1' & ' 2007SUB4'.
*perform bdc_field using 'MARA-NTGEW' ''.
*perform bdc_field using 'MARA-BRGEW' ''.
*perform bdc_field using 'MARA-GEWEI' ''.
*perform bdc_field using 'MARA-VOLUM' ''.
*perform bdc_field using 'MARA-VOLEH' ''.
*PERFORM BDC_FIELD USING 'MARA-GROES' ''.
*perform bdc_field using 'MARA-EAN11' ''.
*perform bdc_field using 'MARA-NUMTP' ''.
*PERFORM BDC_FIELD USING 'BDC_SUBSCR' 'SAPLMGD1' & ' 2005SUB5'.
*perform bdc_field using 'BDC_SUBSCR' 'SAPLMGD1' & ' 2011SUB6'.
*perform bdc_field using 'MARA-MAGRV' ''.
ENDFORM. " FILL_IT_BDCDATA
*& Form BDC_DYNPRO
Filling the it_bdcdata table with program name & screen number
FORM BDC_DYNPRO USING PROGRAM LIKE BDCDATA-PROGRAM
DYNPRO LIKE BDCDATA-DYNPRO.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
Filling it_bdcdata with field name and field value
FORM BDC_FIELD USING FNAM LIKE BDCDATA-FNAM
FVAL.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
ENDFORM. " BDC_FIELD
*& Form ERROR_MESSAGES
Displaying error messages
FORM ERROR_MESSAGES.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = '-D'
IMPORTING
MSG = V_MESG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
LOOP AT IT_MESSAGES WHERE MSGTYP = 'E'.
WRITE : / 'Message :'(I06) ,V_MESG.
CLEAR IT_MESSAGES.
ENDLOOP.
ENDFORM. " ERROR_MESSAGES
*& Form BDC_PROCESS
Open bdc session if call transaction fails
FORM BDC_PROCESS.
IF FG_BDC = 'N'.
open bdc session
PERFORM OPEN_BDC.
FG_BDC = 'O'.
ENDIF.
IF FG_BDC = 'O'.
insert data into bdc session
PERFORM INSERT_BDC.
ENDIF.
ENDFORM. " BDC_PROCESS
*& Form OPEN_BDC
Calling function module to open bdc session
FORM OPEN_BDC.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SMM1'
KEEP = 'X'
USER = SY-UNAME
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11.
ENDFORM. " OPEN_BDC
*& Form INSERT_BDC
Insert it_bdcdata into bdc by calling function module bdc_insert
FORM INSERT_BDC.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'MM01'
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7.
ENDFORM. " INSERT_BDC
*& Form CLOSE_BDC
Closing bdc session
FORM CLOSE_BDC.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
ENDFORM. " CLOSE_BDC
example code.
report ZMMBDCP_MATERIAL_PRICE
no standard page heading
line-size 255.
Includes
include zbdcrecx1.
Tables
TABLES : MARA.
Internal Tables
*--Internal Table To hold Material Price data from flat file.
Data: begin of it_mat_price occurs 0,
key(4),
f1(10), " date
f2(4), " Company Code
f3(4), " Plant
f4(18), " material
f5(15), " Price
end of it_mat_price.
*--Internal Table To hold Material Price header Data .
data : begin of it_header occurs 0,
key(4),
f1(10),
f2(4),
f3(4),
end of it_header.
*--Internal Table To hold Material Price details data .
data : begin of it_details occurs 0,
key(4),
f4(18),
f5(15),
end of it_details.
Variables
data : v_sno(2), " Serial Number
v_rows type i, " Number of Rows
v_fname(40). " To store Field Name
Start of Selection
start-of-selection.
clear it_mat_price.
refresh it_mat_price.
clear it_header.
refresh it_header.
clear it_details.
refresh it_details.
WRITE : / 'Upload Material Price Change from ',
P_FNAME, ' on ', SY-DATUM.
*--To Upload Material Price Data from Flat file.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME =
'C:\WINDOWS\Desktop\mat_price_change.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = it_mat_price
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
OPEN DATASET P_FNAME FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
WRITE : / 'File could not be opened. Please check file name.'.
STOP.
ENDIF.
CLEAR : it_mat_price[], it_mat_price.
DO.
READ DATASET P_FNAME INTO V_STR.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
write v_str.
translate v_str using '#/'.
SPLIT V_STR AT ',' INTO it_mat_price-key
it_mat_price-F1 it_mat_price-F2
it_mat_price-F3 it_mat_price-F4
it_mat_price-F5.
APPEND it_mat_price.
CLEAR it_mat_price.
ENDDO.
IF it_mat_price[] IS INITIAL.
WRITE : / 'No data found to upload'.
STOP.
ENDIF.
*--Separating Header & Details Records
loop at it_mat_price.
At new key.
read table it_mat_price index sy-tabix.
move-corresponding it_mat_price to it_header. " Header
append it_header.
clear it_header.
endat.
move-corresponding it_mat_price to it_details. " Details
append it_details.
clear it_details.
endloop.
*--Perform to open Session
perform open_group.
*--To get Number of rows for Table Control
v_rows = sy-srows - 13.
*--Looping on Header record
loop at it_header.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_CURSOR'
'MR21HEAD-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MR21HEAD-BUDAT'
it_header-f1.
perform bdc_field using 'MR21HEAD-BUKRS'
it_header-f2.
perform bdc_field using 'MR21HEAD-WERKS'
it_header-f3.
perform bdc_field using 'MR21HEAD-SCREEN_VARIANT'
'MR21_LAGERMATERIAL_0250'.
v_sno = 0.
*--Looping On detials record.
loop at it_details where key eq it_header-key.
SELECT SINGLE MATNR INTO IT_DETAILS-F4
FROM MARA
WHERE BISMT EQ IT_DETAILS-F4.
if v_sno le v_rows.
v_sno = v_sno + 1.
endif.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
clear v_fname.
CONCATENATE 'CKI_MR21_0250-MATNR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f4.
clear v_fname.
CONCATENATE 'CKI_MR21_0250-NEWVALPR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f5.
endloop.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'BDC_CURSOR'
'MR21HEAD-SCREEN_VARIANT'.
perform bdc_field using 'MR21HEAD-SCREEN_VARIANT'
'MR21_LAGERMATERIAL_BWKEY_0250'.
*--Call Transaction to upadate New price
perform bdc_transaction using 'MR21'.
endloop.
perform close_group.
regards.
sowjanya.b -
How to create a report without any data
HI All, <BR> Can anyone help me in writing a report without any data. I want to create a report with list of memebers from a dimension where UDA is "My UDA". I wrote a report "<UDA(CHANNEL,'My UDA')" but this fetches me data too in the report. How to eliminate the data in the report. <BR><BR>Thanks<BR>Murali
Hi<BR><BR>Assuming you are using the essbase report writer the following script will work: <BR><BR>{ SUPPAGEHEADING }<BR>{ SUPCOLHEADING }<BR>{ SUPFORMATS }<BR>{ SUPFEED }<BR>{ NOINDENTGEN }<BR>{ FIXCOLUMNS 1 }<BR> <ROW("Dimension") <BR> <UDA(Dimension,MyUDA)<BR>!<BR><BR>the fixcolumns 1 will ensure that you only get the UDA without it you will get the variable followed by the corrosponding value.<BR>
Maybe you are looking for
-
How to schedule a report with dynamic parameters
We need to schedule a Webi report with dynamic parameters then email the different result to different email groups. Is it possible to do this in scheduler? Please advise. Thanks.
-
I don't know how to get started with Time Machine. Also, I want to change to a SSD hard drive and I was told that I could save evrything in Time Machine and then load all my software files from Time Machine onto the new SSD. Is this possible? If so,
-
Selecting Single Rows that match to a column within group function output
Trying to write a Query that will look through a data set that will return the Barcodes of CompoundNames that have a summed Quantity > 500. So if it was ran against the sample table below the output would be 0005 0006 0007 0008 0009 0010 Barcode, Com
-
Jelly Bean 4.1.2 Punctuation bar not working correctly
Just updated my S3 to 4.1.2 and noticed that when texting or emailing the punctuation bar doesn't show up after you hit the space bar. I have to hit backspace then hit the space bar again for the punctuation bar to show up. I went into the keyboard
-
The software update will not load
Sofware update window opens. There is a bar which says underneath connecting to server. Apart from green bar going across nathing else happens.