FM to Convert UOM
Hi Experts,
I have one query. Can anybody will suggest me the FM which will convert the quantity into desired unit of measure?
For example I have material X having qunatity 10 CV & I would like to convert it in PAL.
Regards,
Neha
you can use either of the following
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = VALUE_OLD_IMP
ROUND_SIGN = 'X'
UNIT_IN = UNIT_OLD_IMP
UNIT_OUT = UNIT_NEW_IMP
IMPORTING
OUTPUT = VALUE_NEW_EXP
EXCEPTIONS
CONVERSION_NOT_FOUND = 01
DIVISION_BY_ZERO = 02
INPUT_INVALID = 03
OUTPUT_INVALID = 04
OVERFLOW = 05
TYPE_INVALID = 06
UNITS_MISSING = 07
UNIT_IN_NOT_FOUND = 08
UNIT_OUT_NOT_FOUND = 09.
CALL FUNCTION 'MATERIAL_UNIT_CONVERSION'
EXPORTING
MATNR = MATNR_IMP
INPUT = VALUE_OLD_IMP
MEINH = UNIT_OLD_IMP
KZMEINH = 'X'
MEINS = MEINS_IMP
IMPORTING
OUTPUT = VALUE_MEINS_TMP
EXCEPTIONS
CONVERSION_NOT_FOUND = 01
INPUT_INVALID = 02
MATERIAL_NOT_FOUND = 03
MEINH_NOT_FOUND = 04
MEINS_MISSING = 05
NO_MEINH = 06
OUTPUT_INVALID = 07
OVERFLOW = 08.
CALL FUNCTION 'MATERIAL_UNIT_CONVERSION'
EXPORTING
MATNR = MATNR_IMP
INPUT = VALUE_MEINS_TMP
MEINH = UNIT_NEW_IMP
KZMEINH = SPACE
MEINS = MEINS_IMP
IMPORTING
OUTPUT = VALUE_NEW_EXP
EXCEPTIONS
CONVERSION_NOT_FOUND = 01
INPUT_INVALID = 02
MATERIAL_NOT_FOUND = 03
MEINH_NOT_FOUND = 04
MEINS_MISSING = 05
NO_MEINH = 06
OUTPUT_INVALID = 07
OVERFLOW = 08.
Similar Messages
-
Hi Experts
IN QP03 Inspection Plan Charcterstics there is filed called UOM (MASSEINHSW) actually in Screen it is KG\cm2 but in table it is stored as +KGC+.
In Program it is displying as KGC but i need to display kg\cm2 any FM to Convert this.
Rgards
JagadishHi,
Check these below FM's
CIF_GEN_CONVERT_BASE_UOM
ISA_CONVERT_UOM
CONVERSION_EXIT_SUOM_OUTPUT HU number output conversion exit
OIG_F_CONVERT_UOM_FOR_SCD TD-F convert UOM for scd-calculation to different UOM
OIU_QCI_CONVERT_UOM Convert units of measurement
Regards,
Jyothi CH. -
Hi ABAP Experts,
Please let me know the Function Module name where in we can convert UOM (Unit of Measure) to Cases.
u2022 Outbound Delivery will have unique Shipping Point and the u201CPIECESu201D value will be a summation of the ordered quantities per line item. Unit of Measure for all the line items needs to be converted to Cases individually. This value of ordered quantities needs to be transmitted to TMS in cases but the Unit of Measure will not be transmitted.
How can this be achieved? Please provide your inputs. Thanks!
-SowmyaFM's MD_CONVERT_MATERIAL_UNIT and MATERIAL_UNIT_CONVERSION are not working properly.
The value was 20.00 before. After calling the FM, it is changing to 0.0
I'm using like this:
CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
EXPORTING
I_MATNR = TAB_LIPS-MATNR
I_IN_ME = TAB_LIPS-MEINS "Base Unit of Measure
I_OUT_ME = LC_C01 "Cases
I_MENGE = TAB_LIPS-LFIMG "Actual quantity delivered (in sales units)
IMPORTING
E_MENGE = LTAB_LIPS-LFIMG
EXCEPTIONS
ERROR_IN_APPLICATION = 1
ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
ENDIF.
Please do help. How to convert UOM to Cases?
Thanks,
Sowmya -
Hi,
We have difference in UOM in for materials between R/3 and Planning area. We use CT in planning area where as we have M in material master. We don't want to change the Planning area UOM settings as there are many more materials that we are having in CT. BUt the transfer to R/3 is failing even though we maintain the conversion in material master and CIF over to APO.
How can we convert the CT to M when we transfer data to R/3?
Thanks.Actually the orders moving back from APO to R/3 should be moving in base unit of measure of the material. Base UoM gets CIFed from R/3 to APO. As long as you maintain UoM conversions from base UoM to planning area UoM in the material master, this should work. So using the APO inbound enhancement I mentioned, you can ensure that the product master captures the conversion parameters from base to planning area UoM.
I would advise maintaining the design discussed above, instead of forcing product master to have base UoM same as planning area UoM, which i think is the solution you have. In this case you would need to manage many R/3 inbound enhancements (you can check in SMOD transaction by search term CIF*) -
Any FM / BAPI to Convert UOM (PLPO-MEINH) from ST to PC
Dear Friends,
I am searching for a FM or Bapi to convert the Unit of Measure PLPO-MEINH, from ST to PC(Piece). Your Feed Back would be highly appreciated.
Best Regards,
Azam.Hi
Use the FM CONVERSION_EXIT_CUNIT_OUTPUT.
Edited by: Subhankar Garani on Nov 10, 2009 1:54 PM -
can any one tell me how to convert UOM TO KG'S.
Is there any FM to do it.use the FM:
UNIT_CONVERSION_SIMPLE
Usage:
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = <value in Base unit>
UNIT_IN = <Unit of measure>
UNIT_OUT = 'KG'
IMPORTING
OUTPUT = V_Value
EXCEPTIONS
CONVERSION_NOT_FOUND = 2
INPUT_INVALID = 4
OUTPUT_INVALID = 4
TYPE_INVALID = 4
DIVISION_BY_ZERO = 6
OVERFLOW = 8
UNITS_MISSING = 10
UNIT_IN_NOT_FOUND = 12
UNIT_OUT_NOT_FOUND = 12.
Regards,
Ravi
Message was edited by:
Ravi Kanth Talagana -
Function module to convert unit of meause
Hi. I am using a function module 'CF_UT_UNIT_CONVERSION' to convert UoM for material. But it's output field 'VALUE_NEW_EXP' is smaller (length 9 including 3 decimals). So I am getting a overflow error when the value crosses the limit. Is there any substitute function module available for this? Please let me know ASAP. Thanks in advance for your kind help.
Hi.
Now my error has gone. i.e. not getting the overflow shortdump but quantity is not getting converted into required units of measure... Can you please guess what should be the problem...
Appreciate your help.
Thanks. -
Error in UOMs when using Bookmarks
Hi,
I have a Forecast Consumption report which has 4 tabs: Data Analysis (which gives UOMs in KGs) , U.S. UOM View (which converts UOMs to LBs), Chart Display and Report Information.
An interesting problem faced by an User. When the User runs the Forecast Consumption report from the web, he is able to see UOMs in KGs in Data Analysis tab and in LBs under U.S. UOM View, which is expected.
But when he tries to execute the report using bookmarks, he is able to view only KGs in both the tabs in Data Analysis tab and under U.S. UOM View.
Have checked all the settings and everything seems fine but cannot figure out why U.S. UOM is showing in KGs when the report is run via bookmark. Has anybody encountered this issue. Any help would be appreciated.Do you know how to use the 'result' parameter of the query
tag to get
the actual, complete SQL statement sent to the database.
Looking at
this may tell you what your issue is. -
Derive method of characteristic relationship with exit class BI IP
Hi All,
We have below four fileds in real time planning cube.
Quantity
Unit of measure
Converted Quantity
Converted UOM
We have implemented characteristic relationship of type exit between UOM and converted UOM. We need to populate values of converted UOM using characteristic relationship.
do we need to implement derive method to fulfil this requirement ?
if yes, when derive method of exit class is getting called ?
Awaiting for your reply.
Regards,
Mitesh.Hi Andrey,
Thanks for your reply.
I have tried approach suggested by you however break-point did not stop yet to derive method.
I will give little more details on what i have implemented, probably it may help you.
I implemented CREATE method and generated below combinations. No other method has been implemented yet.
UOM Converted UOM
G KG
KG G
clear ls_unit.
ls_unit-unit = 'G'.
ls_unit-unit1 = 'KG'.
APPEND ls_unit to lt_unit.
clear ls_unit.
ls_unit-unit = 'KG'.
ls_unit-unit1 = 'G'.
APPEND ls_unit to lt_unit.
E_TH_CHAS = lt_unit[] .
Kindly suggest,
1. any specific configuration at query level is required to call derive method
2. what code should i need to write if i want to derive above combination using derive method
Thanks,
Mitesh. -
Currency problem in BAPI_MATERIAL_SAVEDATA while uploading valuation class
Hello Experts,
I am uploading valuation class using BAPI_MATERIAL_SAVEDATA.
While uploading it is showing runtime error "Unable to interpret KG as a number".
I have used the FM CONVERSION_EXIT_CUNIT_INPUT to convert the UOM from the file to Field symbol.
still the same. please guide me.
I have pasted my code below.
Kindly go through and help would be highly appreciated.
*& Report ZPRI_MAT_PRICE_UPLOAD
REPORT ZPRI_MAT_PRICE_UPLOAD no standard page heading line-size 150.
tables : mbew, " Material valuation
makt, " Material description
mara. " General material master
data : begin of t_matvclass occurs 0,
material type matnr, " Material
ind_sec type mbrsh, " Industry sector
mat_typ type mtart, " Material type
val_class type BKLAS, " Valuation class
MOV_PR TYPE VERPR, " MOVING PRISE
STD_PR TYPE STPRS, " STANDARD PRISE
base_uom like mara-meins, " Material unit
mat_desc type maktx, " Material description - MAKTX
plant type werks, " Plant
langu(2),
end of t_matvclass.
data : wa like line of t_matvclass.
data: begin of it_makt occurs 0.
include structure bapi_makt.
data end of it_makt.
data :bapi_head like bapimathead, " Header Segment with Control Info
bapi_clientdata like bapi_mara, " Material Data at Client Level
bapi_clientdatax like bapi_marax, "Checkbox Structure
bapi_valclass like BAPI_MBEW, " Valuation class
bapi_valclassx like BAPI_MBEWX, " Checkbox Structure
* BAPI_MOVING_PR LIKE BAPI_MBEW, "MOVING PRISE
* BAPI_MOVING_PRX LIKE BAPI_MBEWX, "MOVING PRISE
* BAPI_STD_PRISE LIKE BAPI_MBEW, "STANDARD PRISE
* BAPI_STD_PRISEX LIKE BAPI_MBEWX, "STANDARD PRISE
bapi_return like bapiret2, " Bapi return structrue
returnm type table of bapi_matreturn2 with header line.
data : it_excel type alsmex_tabline occurs 0 with header line.
data: begin of it_ret occurs 0.
include structure bapiret2.
data end of it_ret.
* Data objects for exception handling.
data : lv_converr type ref to CX_SY_CONVERSION_ERROR,
lv_dynerr type ref to CX_SY_DYN_CALL_ERROR.
data : txt_converr type string,
txt_converr_l type string,
txt_dynerr type string,
txt_dynerr_l type string.
data : char_uom(4) type c. " Global UOM after conversion
* Declaring selection screen for selecting a data file
* for uploading valuation class
selection-screen begin of block b1 with frame title text-001.
parameter : file_nam type rlgrap-filename obligatory default
'C:\master data UPDATED_test.xls'.
parameter : p_begcol type i default 1, " no-display,
p_begrow type i default 2, " no-display,
p_endcol type i default 9, " no-display,
p_endrow type i default 267. " no-display.
*parameters: p_valare type mbew-bwkey obligatory. " Valuation area
selection-screen end of block b1.
at selection-screen on value-request for file_nam.
perform F_get_file using file_nam.
start-of-selection.
perform F_xls_itab using file_nam changing it_excel.
perform F_move_data.
*perform F_get_data.
perform F_Display_data.
*& Form F_xls_itab
* text
* -->P_FILE_NAM text
* <--P_IT_EXCEL text
form F_xls_itab using p_file_nam changing p_it_excel.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file_nam
i_begin_col = p_begcol
i_begin_row = p_begrow
i_end_col = p_endcol
i_end_row = p_endrow
tables
intern = it_excel
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
endform. " F_xls_itab
*& Form F_get_file
* Subroutine to get the file on F4
* -->P_FILE_NAM text
form F_get_file using p_file_nam.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
* STATIC = ' '
* MASK = ' '
CHANGING
file_name = file_nam
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
endform. " F_get_file
*& Form F_Display_data
* text
* --> p1 text
* <-- p2 text
form F_Display_data .
skip 2.
*write:/2 'Valuation area :', p_valare.
*write:/2 'Standard price :', p_stdprc.
skip 2.
write:/29 sy-uline(120).
write:/29 sy-vline,
30 'Material' color 1, " Material - MATNR
50 sy-vline, 'Ind_sector' color 1, " Industry sector - MBRSH
62 sy-vline, 'Mat_typ' color 1, " Material type - MTART
75 sy-vline, 'Valuation class' color 1, " Valuation class
85 sy-vline, 'Base UOM' color 1, " Base UOM
95 sy-vline, 'Material Decp' color 1, " Material descp
120 sy-vline, 'Mov Price', " Moving price
130 sy-vline, 'Std Price', " Standard price
140 sy-vline, 'Plant', " Plant
150 sy-vline.
write:/29 sy-uline(120).
loop at t_matvclass into wa.
write:/29 sy-vline,
30 wa-material color 2, " Material - MATNR
50 sy-vline,
55 wa-ind_sec color 2 right-justified, " Industry sector
62 sy-vline,
66 wa-mat_typ color 2, " Material type - MTART
75 sy-vline,
78 wa-val_class color 2 right-justified, " Valuation class
85 sy-vline,
88 wa-base_uom color 2 right-justified, " Base UOM
95 sy-vline,
98 wa-mat_desc color 2 left-justified, " Material Desc
120 sy-vline, wa-MOV_PR, " Standard price
130 sy-vline, wa-STD_PR, " Moving price
140 sy-vline, wa-plant, " Plant
150 sy-vline.
endloop.
write:/29 sy-uline(64).
endform. " F_Display_data
*& Form F_move_data
* Subroutine to move data from excel to internal table
* --> p1 text
* <-- p2 text
form F_move_data .
data : lv_index type i.
field-symbols <fs>.
* Sorting the internal table
sort it_excel by row col.
clear it_excel.
loop at it_excel.
move it_excel-col to lv_index.
* Assigning each record to the internal table row.
assign component lv_index of structure wa to <fs>.
* Assigning the field value to a field symbol
if lv_index eq 5.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
INPUT = it_excel-value
LANGUAGE = SY-LANGU
IMPORTING
OUTPUT = char_uom.
** Moving the converted UOM to field symbol
move char_uom to <fs>.
else.
move it_excel-value to <fs>.
endif.
at end of row.
append wa to t_matvclass.
clear wa.
endat.
endloop.
endform. " F_move_data
*& Form F_get_data
* text
* --> p1 text
* <-- p2 text
form F_get_data .
loop at t_matvclass into wa.
try.
* BAPIHEAD --- > Header Segment with Control Information
bapi_head-material = wa-material.
bapi_head-ind_sector = wa-ind_sec.
bapi_head-matl_type = wa-mat_typ.
bapi_head-account_view = 'X'.
* For Clien Data
bapi_clientdata-BASE_UOM = wa-base_uom.
bapi_clientdatax-base_uom = 'X'.
bapi_clientdatax-base_uom_iso = 'X'.
* For Valuation Class.
bapi_valclass-val_area = wa-plant.
bapi_valclass-val_class = wa-val_class.
bapi_valclass-std_price = wa-STD_PR.
bapi_valclass-MOVING_PR = wa-MOV_PR.
* For Valuation Class control checkbox.
bapi_valclassx-val_area = wa-plant.
bapi_valclassx-val_class = 'X'.
bapi_valclassx-std_price = 'X'.
bapi_valclass-MOVING_PR = 'X'.
refresh it_makt.
wa-langu = SY-LANGU.
it_makt-langu = wa-langu.
it_makt-matl_desc = wa-mat_desc.
append it_makt.
clear it_ret.
refresh it_ret.
if t_matvclass[] is initial.
write:/ 'Cannot be updated'.
else.
perform F_call_bapi.
endif.
catch CX_SY_CONVERSION_ERROR into lv_converr.
txt_converr = lv_converr->get_text( ).
txt_converr_l = lv_converr->get_longtext( ).
write:/ 'Error:', txt_converr color 5.
write:/ 'Error:', txt_converr_l color 3.
endtry.
endloop.
endform. " F_get_data
*& Form F_bapi_commit
* text
* --> p1 text
* <-- p2 text
form F_bapi_commit.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
if sy-subrc eq 0.
write:/2 ' Transaction commited' color 4.
else.
write:/2 'Unable to commit the transaction' color 4.
endif.
endform. " F_bapi_commit
*& Form F_call_bapi
* text
* --> p1 text
* <-- p2 text
form F_call_bapi .
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = bapi_head
CLIENTDATA = bapi_clientdata
CLIENTDATAX = bapi_clientdatax
VALUATIONDATA = bapi_valclass
VALUATIONDATAX = bapi_valclassx
IMPORTING
RETURN = it_ret
TABLES
MATERIALDESCRIPTION = it_makt
RETURNMESSAGES = returnm.
IF it_ret-type eq 'E' or it_ret-TYPE eq 'S'.
Write:/1 it_ret-type,
8 it_ret-id,
30 it_ret-number,
38 it_ret-message,
190 it_ret-parameter,
210 it_ret-row,
220 it_ret-field.
endif.
endform. " F_call_bapi
Regards,
Ranjith Nresloved.
issue with the internal table structrue. -
BAPI for Inbound Delivery(IBD - VL31N)
Hi all,
I need to create an inbound delivery with reference to PO using bapi which is retreived by an IDoc. I cannot use standard Process code to Create it because i need to do validations and convert UOM etc). In that i need to use Container No E1EDL37-EXIDV2(Idoc field).
May i know which bapi which suits for this requirement.
Thanks & regards
sreehari pHi Rajiv,
Please check this FM --> BAPI_DELIVERYPROCESSING_EXEC
Please check these threads
Bapi to create inbound delivery
BAPI to create inbound delivery
Hope this would help you.
Good luck
Narin -
Help with CSAP_MAT_BOM_CREATE
I'm desperately trying to create a simple BOM using 'CSAP_MAT_BOM_CREATE' but I'm just getting nowhere! The only thing this FM is creating is a headache. I'm hoping someone can help me!!!
At the moment, I am using:
call function 'CSAP_MAT_BOM_CREATE'
exporting
material = MATNR of BOM I want to create
plant = Destination plant
bom_usage = '5'
valid_from = DATUV
* change_no = aennr
i_stko = ls_stko
* fl_commit_and_wait = 'X'
* importing
* fl_warning = lv_warning
* bom_no = lv_bom_no
tables
t_stpo = lt_stpo
* t_stpu = lt_stpu
exceptions
error = 1.
...But it's always returning 1 :-(
When I'm debugging I'm always getting upto: "PERFORM mc29s_fuellen_01 USING mtl_matnr mtl_werks ini_bwkey." (LCSDIFAS - Line 88). Here's where it seems to fail. Inside this it's always trying to do a "call function 'MATERIAL_READ'" on the MATNR I want to create, but obviously it doesn't exist yet, so it always fails. It therefore sets FLG_API_ERROR = 'X' and fails everytime.
I've looked through all 157 search results on this forum, seemingly all of Google, and the documentation hasn't helped at all either :-(
Can someone please provide me with either some suggestions, or some example code (Using the actual values you're populating parameters with instead of other variable names so I can see what's going on)?
Many thanks.Hi,
As Jarek mentined , pls check the material existency and then convert the material in to internal format , moreover pls check the mandatory parameters .
CALL FUNCTION 'CSAP_MAT_BOM_CREATE'
EXPORTING
material = material "2000000001
plant = plant "1001
bom_usage = '05'
valid_from = valid_from 'Date
i_stko = ls_stko "Structure of header
* FL_NO_CHANGE_DOC = ' '
* FL_COMMIT_AND_WAIT = ' '
* FL_CAD = ' '
fl_default_values = ' '
IMPORTING
fl_warning = fl_warning
bom_no = bom_no
TABLES
t_stpo = lt_stpo[]
* T_DEP_DATA =
* T_DEP_DESCR =
* T_DEP_ORDER =
* T_DEP_SOURCE =
* T_DEP_DOC =
* T_LTX_LINE =
* T_STPU =
EXCEPTIONS
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.
why can't you use the below function module :
* call function to create bill fo materail by using
* the previously declared local internal tables
DATA : lit_bomgroup TYPE STANDARD TABLE OF bapi1080_bgr_c,
wa_bomgroup TYPE bapi1080_bgr_c,
lv_bom_text TYPE string,
lv_plant TYPE ztbom_header-werks,
lit_variants TYPE STANDARD TABLE OF bapi1080_bom_c,
wa_variants TYPE bapi1080_bom_c,
lit_items TYPE STANDARD TABLE OF bapi1080_itm_c,
wa_items TYPE bapi1080_itm_c,
lit_matrel TYPE STANDARD TABLE OF bapi1080_mbm_c,
wa_matrel TYPE bapi1080_mbm_c,
lit_itemas TYPE STANDARD TABLE OF bapi1080_rel_itm_bom_c,
wa_itemas TYPE bapi1080_rel_itm_bom_c.
wa_bomgroup-bom_group_identification = 'BAPI_SMP_COL1'.
wa_bomgroup-object_type = 'BGR'.
wa_bomgroup-object_id = 'SIMPLE1'.
wa_bomgroup-bom_usage = wa_bom_h-stlan.
wa_bomgroup-created_in_plant = wa_bom_h-werks.
wa_bomgroup-ltxt_lang = sy-langu.
wa_bomgroup-technical_type = ' '.
wa_bomgroup-bom_text = lv_bom_text.
APPEND wa_bomgroup TO lit_bomgroup.
*-->Check BOM Existency
*-->Convert Material
wa_bom_h-datuv = sy-datum.
wa_bom_h-stlst = '01'.
*-->Convert UOM
*--Get Alt BOM based on Material and Plantand pass the next Alt BOM which we have to create
*-->Variants
wa_variants-bom_group_identification = 'BAPI_SMP_COL1'.
wa_variants-object_type = 'BOM'.
wa_variants-object_id = 'SIMPLE1'.
wa_variants-alternative_bom = wa_bom_h-stlal.
wa_variants-bom_status = wa_bom_h-stlst.
wa_variants-base_qty = wa_bom_h-bmeng.
wa_variants-base_unit = wa_bom_h-bmein. " base unit
wa_variants-alt_text = wa_bom_h-alternate_text. " alternative text
wa_variants-valid_from_date = wa_bom_h-datuv.
wa_variants-function = 'NEW'.
APPEND wa_variants TO lit_variants.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = wa_bom_h-bmein
IMPORTING
output = wa_bom_h-bmein
EXCEPTIONS
unit_not_found = 1
OTHERS = 2.
*--> Pass Items
SORT lit_items BY object_id valid_from_date.
CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
EXPORTING
all_error = 'X'
TABLES
bomgroup = lit_bomgroup
variants = lit_variants
items = lit_items
materialrelations = lit_matrel
itemassignments = lit_itemas
return = e_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. -
Please send sample code for va01 bdc
Thanks,
AshaREPORT zsdcidoc NO STANDARD PAGE HEADING LINE-SIZE 160.
OBJECT NAME: ZSDCIDOC
OBJECT TYPE: Executable Program
DESCRIPTION: Create Sales Documents on variances in
Consignment/InPlant physical inventory.
PROGRAM CHANGE LOG:
NAME DATE DESCRIPTION OF CHANGE
VOOTKURA 11/19/99 Initial release
VOOTKURA 11/28/99 Don't create BDC session on errors
VOOTKURA 01/10/2000 On Sales Ord, ReqDelDate=CountDate
VOOTKURA 01/14/2000 Make ReqDelDate=PlannedCountDate
DB TABLES
Mod. By Date Description Transport *
NEMANIR 23/08/2006 Modified for Unicode Compliance DEVK914940 *
in lines 492, 527-529, 646
VIGNESWARAN S 01/03/2007 Corrected BDC Recording To
Create Sale Order *
TABLES: mkpf, "Material Document Header
t9ip, "In-plants - user table
iseg, "Physical Inventory Document Items
ikpf. "Header: Physical Inventory Document
Internal tables
DATA: BEGIN OF tiseg OCCURS 0,
iblnr LIKE iseg-iblnr,
gjahr LIKE iseg-gjahr,
zeili LIKE iseg-zeili,
matnr LIKE iseg-matnr,
werks LIKE iseg-werks,
charg LIKE iseg-charg,
sobkz LIKE iseg-sobkz,
kunnr LIKE iseg-kunnr,
zldat LIKE iseg-zldat,
budat LIKE iseg-budat,
xzael LIKE iseg-xzael,
xdiff LIKE iseg-xdiff,
xnzae LIKE iseg-xnzae,
xloek LIKE iseg-xloek,
xamei LIKE iseg-xamei,
buchm LIKE iseg-buchm,
xnull LIKE iseg-xnull,
menge LIKE iseg-menge,
meins LIKE iseg-meins,
erfmg LIKE iseg-erfmg,
erfme LIKE iseg-erfme,
crdr_ind(1),
ord_type(4),
ord_rsn(3),
qty_p TYPE p DECIMALS 3, "03/02/00
qty(13),
qty_c(13),
uom_conv(3),
END OF tiseg.
DATA: tiseg2 LIKE tiseg OCCURS 0 WITH HEADER LINE.
DATA: tiseg3 LIKE tiseg OCCURS 0 WITH HEADER LINE.
Internal table BDC_TAB has BDCDATA
DATA: bdc_tab LIKE bdcdata OCCURS 5 WITH HEADER LINE.
Internal table MESSTAB - Message table for use in Call transaction
DATA: BEGIN OF messtab OCCURS 5.
INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF messtab.
TXMSG has info on call trans output
DATA: BEGIN OF txmsg OCCURS 0,
tx(4),
success,
type LIKE vbak-auart,
reason(4),
zldat(10),
matnr LIKE iseg-matnr,
comments(100),
END OF txmsg.
DATA DEFINITIONS - Structures
DATA: outrec LIKE tiseg.
DATA DEFINITIONS - Constants
DATA: ord_reason_zke(3) VALUE 'O05',
ord_reason_zkr(3) VALUE 'O05',
ord_reason_zmor(3) VALUE 'O08',
ord_reason_zmre(3) VALUE 'O08'.
DATA DEFINITIONS - Counters
DATA: tx_va01_ok(3) TYPE n VALUE 0,
tx_va01_err(3) TYPE n VALUE 0,
tx_va01_sub(3) TYPE n VALUE 0,
tx_mi02_ok(3) TYPE n VALUE 0,
tx_mi02_err(3) TYPE n VALUE 0,
tx_mi02_sub(3) TYPE n VALUE 0,
n(5) TYPE n VALUE 0.
DATA DEFINITIONS - Miscellaneous
DATA: stock_ind LIKE iseg-sobkz,
inplant_customer LIKE t9ip-kunnr,
qty_p TYPE p DECIMALS 3,
qty_c(13),
qty_c(13) type p decimals 3,
qty_c type p decimals 3,
vmsgno(3) TYPE n,
count_date(10), "Date of the document
bdc_open_flag,
call_mode,
msg LIKE message,
prt_cnt TYPE i,
session_name(12),
tx_rc,
loop_cnt TYPE i,
ikpf_gidat(10).
Parameter Definitions
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK pgm.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_doc# LIKE zpinv-iblnr OBLIGATORY,
p_year LIKE iseg-gjahr OBLIGATORY.
SELECTION-SCREEN SKIP.
PARAMETERS: p_org LIKE vbak-vkorg DEFAULT '1000',
p_chnl LIKE vbak-vtweg DEFAULT '01',
p_div LIKE vbak-spart DEFAULT '00'.
SELECTION-SCREEN END OF BLOCK pgm.
SELECTION-SCREEN SKIP 2.
*parameters: testmode as checkbox default space.
INITIALIZATION
INITIALIZATION.
p_year = sy-datum(4).
START-OF-SELECTION
START-OF-SELECTION.
Initialize
PERFORM init.
Get data from the Phy Inv Document (PID)
The PID entered should be for Consignment or In-plant
PERFORM get_data_frm_phy_inv_doc.
Build transactions for order processing
PERFORM build_order_trans.
Submit orders
PERFORM submit_order_transactions.
If orders went through, set delete indicator on the PID's
IF tx_va01_err IS INITIAL.
PERFORM set_pid_delete.
ENDIF.
Wrapup
PERFORM wrapup.
END-OF-SELECTION
END-OF-SELECTION.
FORM INIT *
FORM init.
CLEAR: stock_ind,
inplant_customer.
call_mode = 'N'. "No display
if testmode = 'X'.
call_mode = 'A'. "Display mode
endif.
ENDFORM. "INIT
FORM GET_DATA_FRM_PHY_INV_DOC *
FORM get_data_frm_phy_inv_doc.
VALIDATE PID AT THE HEADER LEVEL
PERFORM validate_pid.
GET DATA AT ITEM LEVEL
SELECT * FROM iseg
INTO CORRESPONDING FIELDS OF TABLE tiseg
WHERE iblnr = p_doc# AND gjahr = p_year AND
xnzae <> 'X' AND "NOT RECOUNT
xloek <> 'X' AND "NOT DELETED
xzael = 'X' AND "COUNTED
zldat <> '00000000'. "COUNT POSTED "redundant?
IF sy-subrc <> 0.
FORMAT INTENSIFIED OFF.
WRITE: / 'NO QUALIFIED ENTRIES WERE FOUND FOR THE PHY INV DOCUMENT',
p_doc#.
STOP.
Is it Consignment?
ELSE.
LOOP AT tiseg FROM 1 TO 1.
ENDLOOP.
IF tiseg-sobkz <> 'W'.
In-Plant?
SELECT SINGLE * FROM t9ip
WHERE werks = tiseg-werks.
IF sy-subrc = 0.
MOVE t9ip-kunnr TO inplant_customer.
Neither
ELSE.
CLEAR inplant_customer.
MESSAGE ID 'ZS' TYPE 'I' NUMBER '909' WITH p_doc#.
STOP.
ENDIF.
ENDIF.
ENDIF.
FORMAT COLOR 6 OFF.
ENDFORM. "GET_DATA_FRM_PHY_INV_DOC
FORM VALIDATE_PID *
FORM validate_pid.
CLEAR inplant_customer.
VALIDATE
FORMAT COLOR 6 ON.
FORMAT INTENSIFIED OFF.
CLEAR ikpf_gidat.
SELECT SINGLE * FROM ikpf
WHERE iblnr = p_doc# AND gjahr = p_year.
IF sy-subrc <> 0.
WRITE: / 'NO ENTRY FOUND FOR THE PHY INV DOCUMENT', p_doc#.
STOP.
ELSE.
IF ikpf-zstat <> 'X'.
WRITE: / 'THE PHY INV DOCUMENT', p_doc#,
'INDICATES THAT ALL ITEMS HAVE NOT BEEN COUNTED'.
STOP.
ENDIF.
IF ikpf-lstat = 'X'.
WRITE: / 'THE PHY INV DOCUMENT', p_doc#,
'INDICATES THAT ALL ITEMS HAVE ALREADY BEEN DELETED'.
STOP.
ENDIF.
Save Planned Count date "01/14/2000
CONCATENATE ikpf-gidat4(2) '/' ikpf-gidat6(2) '/'
ikpf-gidat(4) INTO ikpf_gidat.
ENDIF.
ENDFORM. "VALIDATE_PID
FORM BUILD_ORDER_TRANS *
FORM build_order_trans.
Get Sales details in to internal table TISEG
SORT tiseg BY iblnr zeili.
LOOP AT tiseg.
IF tiseg-buchm <> tiseg-menge.
BOOKED QTY - COUNTED
tiseg-qty = tiseg-buchm - tiseg-menge.
tiseg-qty_p = tiseg-qty. "03/02/00
MODIFY tiseg.
ENDIF.
ENDLOOP.
Now, prepare data for BDC
LOOP AT tiseg.
If inplant_customer is filled in, take that for customer number
IF NOT inplant_customer IS INITIAL.
tiseg-kunnr = inplant_customer.
ENDIF.
Convert UOM from internal to external presentation
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
EXPORTING
input = tiseg-meins
language = sy-langu
IMPORTING
output = tiseg-uom_conv
EXCEPTIONS
unit_not_found = 1
OTHERS = 2.
Identify Order Type (Booked-counted<0,CR-ZKE-ZMRE else DR-ZKR-ZMOR)
IF tiseg-qty_p < 0.
tiseg-crdr_ind = 'C'.
tiseg-qty = ABS( tiseg-qty ).
Consignment
IF inplant_customer IS INITIAL.
tiseg-ord_type = 'ZKR '.
tiseg-ord_rsn = ord_reason_zkr.
InPlant
ELSE.
tiseg-ord_type = 'ZMRE'.
tiseg-ord_rsn = ord_reason_zmre.
ENDIF.
ELSEIF tiseg-qty_p > 0.
tiseg-crdr_ind = 'D'.
Consignment
IF inplant_customer IS INITIAL.
tiseg-ord_type = 'ZKE '.
tiseg-ord_rsn = ord_reason_zke.
InPlant
ELSE.
tiseg-ord_type = 'ZMOR'.
tiseg-ord_rsn = ord_reason_zmor.
ENDIF.
ELSE.
tiseg-crdr_ind = 'X'. "No orders on these
CLEAR: tiseg-ord_rsn, tiseg-ord_type.
ENDIF.
Get qty in char format
qty_p = tiseg-qty.
MOVE qty_p TO: qty_c, tiseg-qty_c.
Update tiseg with the new fields.
MODIFY tiseg.
ENDLOOP.
tiseg2[] = tiseg[].
LOOP AT tiseg WHERE crdr_ind = 'X'.
DELETE tiseg.
ENDLOOP.
tiseg3[] = tiseg[].
ENDFORM. "BUILD_ORDER_TRANS
FORM SUBMIT_ORDER_TRANSACTIONS *
FORM submit_order_transactions.
SORT tiseg BY crdr_ind matnr.
n = 1.
LOOP AT tiseg.
Change in CR/DR order type, save and call Trans
ON CHANGE OF tiseg-crdr_ind.
IF n > 1.
PERFORM fill_bdc_save.
PERFORM call_trans USING 'VA01'.
n = 1.
ENDIF.
ENDON.
outrec = tiseg.
IF n = 1.
PERFORM fill_bdc1. "Screen 1 & hdr of screen 2
ENDIF.
PERFORM fill_bdc2. "Materials on screen 2
n = n + 1.
Last record, save and call Trans
AT LAST.
PERFORM fill_bdc_save.
PERFORM call_trans USING 'VA01'.
ENDAT.
ENDLOOP.
ENDFORM. "SUBMIT_ORDER_TRANSACTIONS
FORM FILL_BDC1 *
FORM fill_bdc1.
Create Sales Order - Initial Screen
PERFORM dynpro USING: 'X' 'SAPMV45A' '0101' ,
' ' 'VBAK-AUART' outrec-ord_type,
' ' 'VBAK-VKORG' p_org , "Sales org
' ' 'VBAK-VTWEG' p_chnl , "Distr Channel
' ' 'VBAK-SPART' p_div , "Div
' ' 'BDC_OKCODE' '/00' . "Enter
CONCATENATE outrec-zldat4(2) '/' outrec-zldat6(2) '/'
outrec-zldat(4) INTO count_date.
Create Phy Inv Credit/Debit: Overview
PERFORM dynpro USING:
'X' 'SAPMV45A' '0400' , ""Changed on 22.01.07
'X' 'SAPMV45A' '4001' ,
' ' 'KUAGV-KUNNR' outrec-kunnr ,
' ' 'VBAK-BSTDK' count_date . " Changed on 22.01.07
' ' 'VBKD-BSTDK' count_date .
IF outrec-ord_type <> 'ZKR '.
PERFORM dynpro USING:
' ' 'RV45A-KETDAT' ikpf_gidat . "Planned deliv date 01/14/00
ENDIF.
*****Start Added on 26/02/2007
***Pick Sales TAB in VA01 for updating Ordering Reason
PERFORM dynpro USING : ' ' 'BDC_OKCODE' '=T\01',
'X' 'SAPMV45A' '4001',
' ' 'VBAK-AUGRU' outrec-ord_rsn. " 'C25'.
***Come back to Item Overview Tab in VA01 for inserting Plant
PERFORM dynpro USING : 'X' 'SAPMV45A' '4001',
' ' 'BDC_OKCODE' '=T\02'.
End of Add on 26/02/2007
PERFORM dynpro USING : 'X' 'SAPMV45A' '4001',
' ' 'RV45A-DWERK' outrec-werks , "Deliv Plant
' ' 'BDC_OKCODE' '/00' , "Hdr-Bus Data
'X' 'SAPMV45A' '4001' .
ENDFORM. "FILL_BDC1
FORM FILL_BDC2 *
FORM fill_bdc2.
IF n = 4. "4 double entries per page
n = 2. "On the next page start from 2nd line
PERFORM ldynpro USING:
' ' 'BDC_OKCODE' '/20' 0, "Create item
'X' 'SAPMV45A' '0400' 0. "Changed on 22.01.07
'X' 'SAPMV45A' '4001' 0.
ENDIF.
PERFORM ldynpro USING:
' ' 'VBAP-MATNR' outrec-matnr n, "Material
' ' 'RV45A-KWMENG' outrec-qty_c n, "Quantity
' ' 'VBAP-VRKME' outrec-uom_conv n, "UoM
' ' 'RV45A-ETDAT' ikpf_gidat n, "Del Date 1
' ' 'VBAP-CHARG' outrec-charg n. "Batch#
PERFORM ldynpro USING:
' ' 'BDC_OKCODE' '/00' 0, "Enter
'X' 'SAPMV45A' '0400' 0. ""Changed on 22.01.07
'X' 'SAPMV45A' '4001' 0.
ENDFORM. "FILL_BDC2
FORM FILL_BDC3 *
FORM fill_bdc_save.
PERFORM dynpro USING:
' ' 'BDC_OKCODE' '/11' . "Save
ENDFORM. "FILL_BDC_SAVE
FORM DYNPRO
--> DYNBEGIN *
--> NAME *
--> VALUE *
*------Begin of SAP Unicode changes - <23/08/2006>
FORM dynpro USING dynbegin TYPE c " Unicode change
name TYPE bdc_prog
value TYPE clike.
*------End of SAP Unicode chnages - <23/08/2006>
CLEAR bdc_tab.
IF dynbegin = 'X'.
MOVE: name TO bdc_tab-program,
value TO bdc_tab-dynpro,
'X' TO bdc_tab-dynbegin.
ELSE.
MOVE: name TO bdc_tab-fnam,
value TO bdc_tab-fval.
ENDIF.
IF NOT value IS INITIAL.
APPEND bdc_tab.
ENDIF.
ENDFORM. "DYNPRO
FORM LDYNPRO *
--> DYNBEGIN *
--> NAME *
--> VALUE *
--> N *
*------Begin of SAP unicode changes - <23/08/2006>
FORM ldynpro USING dynbegin TYPE c "Unicode change
name TYPE bdc_prog
value TYPE clike
n TYPE n.
*------End of SAp Unicode changes - <23/08/2006>
CLEAR bdc_tab.
IF dynbegin = 'X'.
MOVE: name TO bdc_tab-program,
value TO bdc_tab-dynpro,
'X' TO bdc_tab-dynbegin.
ELSE.
IF n <> 0.
CONCATENATE name '(' n ')' INTO bdc_tab-fnam.
ELSE.
MOVE name TO bdc_tab-fnam.
ENDIF.
MOVE value TO bdc_tab-fval.
ENDIF.
IF NOT value IS INITIAL.
APPEND bdc_tab.
ENDIF.
ENDFORM. "LDYNPRO
FORM BDC_INSERT *
--> TCODE *
FORM bdc_insert USING tcode.
DATA: l_tcode TYPE sy-tcode. "Added on 26/02/2007
IF bdc_open_flag = ' '.
CONCATENATE 'ZS' p_doc# INTO session_name.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = session_name
user = sy-uname
keep = 'X'.
ENDIF.
l_tcode = tcode. "Added on 26/02/2007
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = l_tcode
TABLES
dynprotab = bdc_tab.
bdc_open_flag = 'X'.
ENDFORM. "bdc_insert using tcode
FORM SET_PID_DELETE *
FORM set_pid_delete.
Set Delete Ind on the items covered by the prev trans
REFRESH tiseg. CLEAR tiseg.
tiseg[] = tiseg2[].
SORT tiseg BY iblnr zeili.
loop_cnt = 1.
LOOP AT tiseg.
IF loop_cnt = 1.
PERFORM dynpro USING:
'X' 'SAPMM07I' '0701' ,
' ' 'RM07I-IBLNR' p_doc# ,
' ' 'RM07I-GJAHR' p_year , "Sales org
' ' 'BDC_OKCODE' '/00' . "Enter
ENDIF.
IF tiseg-zeili <> 001.
PERFORM dynpro USING:
'X' 'SAPMM07I' '0721' ,
' ' 'BDC_CURSOR' 'ISEG-BSTAR(01)',
' ' 'BDC_OKCODE' '/20' ,
'X' 'SAPMM07I' '1701' ,
' ' 'BDC_CURSOR' 'RM07I-ZEILE',
' ' 'RM07I-ZEILE' tiseg-zeili ,
' ' 'BDC_OKCODE' '/00' .
ENDIF.
PERFORM dynpro USING:
'X' 'SAPMM07I' '0721' ,
' ' 'BDC_CURSOR' 'ISEG-BSTAR(01)' ,
' ' 'BDC_OKCODE' '=DP'. "'/14' "Set Del ind
IF loop_cnt = sy-tfill.
PERFORM dynpro USING:
'X' 'SAPMM07I' '0721' ,
' ' 'BDC_OKCODE' '/11' . "Save
ENDIF.
ADD 1 TO loop_cnt.
ENDLOOP.
PERFORM call_trans USING 'MI02'.
ENDFORM. "SET_PID_DELETE
FORM CALL_TRANS *
--> TX *
*-------Begin of SAP Unicode changes - <23/08/2006>
FORM call_trans USING tx TYPE char4. " Unicode change
*-------End of SAP Unicode changes - <23/08/2006>
CASE tx.
WHEN 'VA01'.
ADD 1 TO tx_va01_sub.
WHEN 'MI02'.
ADD 1 TO tx_mi02_sub.
ENDCASE.
CALL TRANSACTION tx USING bdc_tab
MODE call_mode
UPDATE 'S'
MESSAGES INTO messtab .
tx_rc = sy-subrc. "Save RC
Errors, write to BDC session only on MI02 "12/28/99
IF sy-subrc <> 0.
perform bdc_insert using tx. "12/28/99
IF tx = 'VA01'.
ADD 1 TO tx_va01_err.
ELSEIF tx = 'MI02'.
ADD 1 TO tx_mi02_err.
PERFORM bdc_insert USING tx. "12/28/99
ENDIF.
ELSE.
CLEAR tx_rc.
IF tx = 'VA01'.
ADD 1 TO tx_va01_ok.
ELSEIF tx = 'MI02'.
ADD 1 TO tx_mi02_ok.
ENDIF.
ENDIF.
Get messages for OK/Err tx's both
LOOP AT messtab.
CLEAR txmsg.
txmsg-tx = tx.
IF NOT tx_rc IS INITIAL.
txmsg-success = 'X'.
ENDIF.
PERFORM get_message.
IF sy-tabix = sy-tfill.
CONCATENATE '==>' msg INTO txmsg-comments. "Last rec.
ELSE.
txmsg-comments = msg.
ENDIF.
CASE tx.
WHEN 'VA01'.
txmsg-type = outrec-ord_type.
txmsg-reason = outrec-ord_rsn.
txmsg-matnr = outrec-matnr.
txmsg-zldat = count_date.
ENDCASE.
APPEND txmsg.
ENDLOOP.
CLEAR txmsg.
Clear BDC table and Message table for next transaction
REFRESH: bdc_tab, messtab.
CLEAR: bdc_tab, messtab.
ENDFORM. "CALL_TRANS
FORM GET_MESSAGE *
FORM get_message.
vmsgno = messtab-msgnr.
CALL FUNCTION 'WRITE_MESSAGE'
EXPORTING
msgid = messtab-msgid
msgno = vmsgno
msgty = messtab-msgtyp
msgv1 = messtab-msgv1
msgv2 = messtab-msgv2
msgv3 = messtab-msgv3
msgv4 = messtab-msgv4
msgv5 = messtab-fldname
IMPORTING
messg = msg
EXCEPTIONS
OTHERS = 1.
ENDFORM. "get_message
FORM WRAPUP *
FORM wrapup.
IF bdc_open_flag = 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDIF.
PERFORM write_stats.
ENDFORM. "WRAPUP
FORM CLOSE_BDC *
*FORM close_bdc.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
*ENDFORM. "CLOSE_BDC
FORM WRITE_STATS *
FORM write_stats.
REFRESH tiseg. CLEAR tiseg.
tiseg[] = tiseg3[].
FORMAT COLOR 7 ON.
WRITE: /3 'PHYSICAL INV DOCUMENT:', p_doc#,
45 'YEAR: ', p_year, ' '.
WRITE: /3 'ORDER TXs SUBd:', tx_va01_sub,
30 'Errored:', tx_va01_err.
WRITE: /3 'PID TXs SUBd: ', tx_mi02_sub,
30 'Errored:', tx_mi02_err.
FORMAT COLOR 7 OFF.
SKIP.
FORMAT COLOR 4 ON .
FORMAT INTENSIFIED ON.
WRITE: /4 'MATERIAL NUMBER', 23 ' QUANTITY', 37 'UOM',
42 'PLANT', 71 ' '.
WRITE: /4 '***************', 23 ' *******', 37 '**',
42 '*****', 71 ' '.
FORMAT INTENSIFIED OFF.
SORT tiseg BY ord_type matnr.
LOOP AT tiseg.
ON CHANGE OF tiseg-ord_type.
FORMAT INTENSIFIED OFF.
WRITE: /6 'ORDER TYPE:', tiseg-ord_type,
26 'COUNT DATE:', count_date,
52 'CUSTOMER:', tiseg-kunnr.
FORMAT INTENSIFIED ON.
ENDON.
WRITE: /4 tiseg-matnr, 23 tiseg-qty_c, 37 tiseg-uom_conv,
42 tiseg-werks, 71 ' '.
ENDLOOP.
SKIP 2.
FORMAT COLOR 4 OFF.
FORMAT INTENSIFIED ON.
IF tx_va01_err > 0.
FORMAT COLOR 6 ON.
WRITE: /2 'Correct ERR in Sales Orders (VA01 Tx) and',
'reexecute the program'.
ENDIF.
IF tx_mi02_err > 0.
FORMAT COLOR 6 ON.
WRITE: /2 'ERR found in executing PID change (MI02 Tx)'.
IF bdc_open_flag = 'X'.
WRITE: /2 'Correct ERR and submit the BDC session created'.
ENDIF.
ENDIF.
IF tx_va01_err = 0 AND tx_mi02_err = 0.
FORMAT COLOR 5 ON INTENSIFIED OFF.
WRITE: /3 'ALL TRANSACTIONS WERE SUCCESSFUL '.
ENDIF.
FORMAT COLOR 3 ON INTENSIFIED ON.
ULINE.
WRITE: /20 'MESSAGES RECEIVED DURING TRANSACTION PROCESSING', 170 ' '.
WRITE: /2 'TX ', 8 'ERR?', 15 'ORDER TYPE', 27 'REASON',
36 'COUNT DATE', 49 'MATERIAL NUMBER',
69 'MESSAGES RECEIVED FROM TRANSACTION ', 170 ' '.
WRITE: /2 '***', 8 '**', 15 '********', 27 '*****',
36 '*********', 49 '**************',
69 '********************************** ', 170 ' '.
FORMAT INTENSIFIED OFF.
LOOP AT txmsg.
IF txmsg-success = ' '.
FORMAT COLOR 3 ON.
ELSE.
FORMAT COLOR 6 ON.
ENDIF.
ON CHANGE OF txmsg-type.
ULINE.
ENDON.
IF txmsg-tx = 'VA01'.
WRITE: /2 txmsg-tx, 8 txmsg-success, 15 txmsg-type,
27 txmsg-reason, 36 txmsg-zldat.
ENDIF.
IF txmsg-tx = 'MI02'.
uline.
format color 7 on intensified on.
WRITE: /2 txmsg-tx, 8 'CHANGE PID:', p_doc#, 'YEAR:', p_year.
ENDIF.
IF txmsg-tx = 'VA01'.
WRITE: 49 txmsg-matnr.
ENDIF.
IF txmsg-comments(3) = '==>'.
FORMAT INTENSIFIED ON.
WRITE 69 txmsg-comments.
FORMAT INTENSIFIED OFF.
ELSE.
WRITE 69 txmsg-comments.
ENDIF.
ENDLOOP.
ULINE.
ENDFORM. "WRITE_STATS
Ashok... -
Function to convert PO quantity and cancelled quantity into Primary UOM
Hello,
I am looking for a function to convert PO quantity and cancelled quantity into its Primary UOM from the unit of measure the line order was placed.
Thank youhi
In case if you are already working in production remember that decimal places should not change. It will affect all previous data.
For your problem best solution is make order unit as 1000. So that your problem will solve
e.g. instead of 2.009 inr for 1 Unit use 2009 inr for 1000 unit. -
Rounding profile: convert ordered qty to another UoM
Hi all,
I would like to convert the ordered qty on the sales order into a different unit of measure. This can be done with rounding profile. However, I don't want it to round if it is not exact.
For example: 1 case = 100 EA. If a customer orders 100 EA, it will automatically convert it to 1 case. This should work.
However, if customer orders 75 EA, I don't want it to auto round to 100EA (and convert to 1 case). Instead I want an error to occur, or atleast give the user the option to round or not round.
How can this be done?
ThanksRounding profile is used to adjust the order proposal quantity to deliverable units.
Sales unit will default the order item to cases (As entered in material master).
Now, if you want to give an options to the user
1st thing to check at order item level is
1. Is the Sales order UOM = Sales UOM of material (VBAP-VRKME = MVKE-VRKME)
If not then
Check if the sales order unit satisfies the conversion factor (if VBAP - VRKME can be converted to MVKE-VRKME)
If yes then change the sales order unit and make it equal to material sales unit
If not then
switch off round up, have a pop up asking user for pop-up
You will have to utilize
1. Rounding,
2. Sales unit of Material
3. Exit to change VBAP.
4. Screen changes for pop up.
<< Moderator message - Point begging removed >>
Edited by: Rob Burbank on Dec 13, 2011 8:57 AM
Maybe you are looking for
-
Can it be done? Can I post a Keynote that I created onto iWeb and have it be viewable? How would I do it? Would I have to transform it to another format?
-
How much does a slide weigh?
Hi, weight means Kb size for this post....not sure what else to call it. I am wondering, is there is a source to find out what makes a slide/project "heavy" in terms of its published kb size. Meaning, if I create a single slide project, just for argu
-
Query generated program in sq01
Hi Experts, Im changing a query (adding new fields) in the infoset and regenerating the program. The program name is getting changed. Im not sure if the name gets changed for every change we make in the query. Is it possible to use the old query name
-
Cannot access Adobe website with Safari under Lion
Hi guys, I have 5 macs at home and upgraded two of them with Lion. Since then, these two computers (MBP 17" + imac 27") can no longer access Adobe website (the other three macs + my ipad 2 can still access Adobe website without any problem). Message
-
After updates shutdown takes forever
Recently, I had to use the recovery on my computer. I reinstalled all of my software and updated windows 8.1 thru microsoft and now it takes forever to shutdown. Monitors (2) turn off pretty quick but computer takes 4 to 5 minutes to completely shu