1.sy-tabix 2.sy-batch 3.gd_printparams
Hi Folks,
1.data:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
data:gd_prntparams TYPE slis_print_alv.
In the reuse_alv_grid_display I am giving these.
i_save = 'A'
is_print = gd_prntparams
it_sort = itsort[]
What difference does these two parameters make.
I commented it and seen but I was not able to figureout the difference.
2.To get the serial number in the alv grid,I had delcared a variable sl_no like sy-tabix and then
loop at it_final.
it_final-sl_no = it_final-sl_no + 1.
modify it_final.
endloop.
I am getting the result,but I want to know is this the correct way or do we have any other way to get the same.
3.If a report has to be run in the background why we have to choose only a particular layout.
if sy-batch = space.
call function reuse_alv_grid_display.
elseif sy-batch = 'X'.
call function reuse_alv_list_display.
why?
Can anyone here please let me know about the same.
Thanks,
K.Kiran.
<b>see the details you want </b>
for <b>1. i_save = 'A' </b>
Variants can be saved using Controls the save mode
Prerequisite:
Parameter IS_VARIANT is filled accordingly.
See also the documentation on IMPORTING parameter IS_VARIANT.
Value range
' ' = Display variants cannot be saved
Defined display variants (such as delivered display variants) can be selected for presentation regardless of this indicator. However, changes cannot be saved.
'X' = Standard save mode
Display variants can be saved as standard display variants.
Saving display variants as user-specific is not possible.
'U' = User-specific save mode
Display variants can only be saved as user-specific.
'A' = Standard and user-specific save mode
Display variants can be saved both as user-specific and as standard
variants. Users make their choice on the dialog box for saving the
display variant.
<b>2.is_print</b> Control parameters relevant for printing
PRINT
Value range: SPACE, 'X'
'X' = Print list and do not display it on the screen. Further settings can be made on the print parameter screen.
NO_PRINT_SELINFOS
Value range: SPACE, 'X'
'X' = Do not print existing selection information (see also LAYOUT-GET_SELINFOS)
NO_COVERPAGE
Value range: SPACE, 'X'
'X' = Print selection information and list status, if available, on a separate page.
NO_NEW_PAGE
Value range: SPACE, 'X'
Internal use only
RESERVE_LINES
Value range: 0, n
n = Number of lines output in the footer by the user during printout at END_OF_PAGE in the corresponding callback event.
NO_PRINT_LISTINFOS
Value range: SPACE, 'X'
'X' = Do not print list status (sort information, subtotals information and filter information).
NO_CHANGE_PRINT_PARAMS
Value range: SPACE, 'X'
SPACE = (default) The output format (number of columns) is dynamically adjusted depending on the list width (255 at most).
'X' = The current print parameters are always used. If the list is wider, the output width is not adjusted dynamically.
<b>3.it_sort = itsort[]</b> Using internal table IT_SORT, the caller determines the sort order and/or the subtotalling of the basic list.
The following fields of this internal table must be filled:
spos
Sort order
fieldname
Field name in the internal output table
up
'X' = Sorted in ascending order
down
'X' = Sorted in descending order
subtot
'X' = Subtotals for control level changes
comp (INTERNAL USE ONLY)
expa
Prequisite:
IT_SORT-SUBTOT = 'X', that is, the sort criterion is also the subtotals criterion.
If no complete breakdown but only a breakdown to totals level n that can be further expanded by the user should be displayed when the list is output for the first time, you must set the indicator for the totals level criterion of level n.
to get the serianl no ... you are Correct it was the easiest method just all one field in the internal table and push the serial nos. define the field catalog .... enough
loop at it_final.
it_final-sl_no = it_final-sl_no + 1.
modify it_final.
endloop.
fieldcatalog-fieldname = 'SI_NO'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
rewarde points if it is usefull...
Girish
Similar Messages
-
Batch input of a list of values
Hello,
I have to make a batch input of a list.
The screen of the transaction contains a list with 9 lines, if i enter a value in one, another line is added to the list.
I did record this transaction and have an incremented list in the generated program that looks like this :
it begins whith ADRPCIT-POST_CODE(01) and increments till 09
perform bdc_dynpro using 'SAPLSZRL' '0400'.
perform bdc_field using 'BDC_CURSOR'
'ADRPCDCITY-POST_CODE(08)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ADRPCDCITY-POST_CODE(08)'
record-POST_CODE_08_017.
perform bdc_dynpro using 'SAPLSZRL' '0400'.
perform bdc_field using 'BDC_CURSOR'
'ADRPCDCITY-POST_CODE(09)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ADRPCDCITY-POST_CODE(09)'
record-POST_CODE_09_018.
perform bdc_dynpro using 'SAPLSZRL' '0400'.
perform bdc_field using 'BDC_CURSOR'
'ADRPCDCITY-POST_CODE(09)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLSZRL' '0400'.
perform bdc_field using 'BDC_CURSOR'
'ADRPCDCITY-POST_CODE(07)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ADRPCDCITY-POST_CODE(07)'
record-POST_CODE_07_019.
perform bdc_dynpro using 'SAPLSZRL' '0400'.
perform bdc_field using 'BDC_CURSOR'
'ADRPCDCITY-POST_CODE(08)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ADRPCDCITY-POST_CODE(08)'
record-POST_CODE_08_020.
perform bdc_dynpro using 'SAPLSZRL' '0400'.
perform bdc_field using 'BDC_CURSOR'
'ADRPCDCITY-POST_CODE(09)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ADRPCDCITY-POST_CODE(09)'
record-POST_CODE_09_021.
perform bdc_dynpro using 'SAPLSZRL' '0400'.
perform bdc_field using 'BDC_CURSOR'
'ADRPCDCITY-POST_CODE(09)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
What i did is setting the value of the incremented number to 09 if it's greater than 09 but i'm not sure it's the right way to do it cause i get only 9 records
My code :
LOOP AT gt_record ASSIGNING <fs_record>.
IF sy-tabix > 9.
ligne = 9.
ELSE.
ligne = sy-tabix.
ENDIF.
IF ligne > 1.
IF city_mem EQ <fs_record>-city_code_001.
flag_end = 'X'.
ELSE.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_transaction USING 'SR10'.
CLEAR flag_end.
ENDIF.
ENDIF.
city_mem = <fs_record>-city_code_001.
IF flag_end NE 'X'. "premier passage
PERFORM bdc_dynpro USING 'SAPLSZRC' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ADRCITYD-CITY_CODE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'ADRCITYD-CITY_CODE'
<fs_record>-city_code_001.
PERFORM bdc_field USING 'ADRCITYD-COUNTRY'
'FR'.
PERFORM bdc_field USING 'ADRCITYD-LANGU'
'F'.
PERFORM bdc_dynpro USING 'SAPLSZRC' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ADRCITYD-COMMU_CODE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'ADRCITYD-FLAG_STRTS'
'X'.
PERFORM bdc_field USING 'ADRCITYD-CITY_NAME'
<fs_record>-city_name_005.
PERFORM bdc_field USING 'ADRCITYD-REGION'
<fs_record>-region_006.
PERFORM bdc_field USING 'ADRCITYD-TIME_ZONE'
'CET'.
PERFORM bdc_field USING 'ADRCITYD-COMMU_CODE'
<fs_record>-commu_code_008.
PERFORM bdc_field USING 'ADRCITYD-DEF_LANGU'
'F'.
PERFORM bdc_dynpro USING 'SAPLSZRC' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ADRCITYD-CITY_NAME'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=PSTC'.
PERFORM bdc_field USING 'ADRCITYD-FLAG_STRTS'
'X'.
PERFORM bdc_field USING 'ADRCITYD-CITY_NAME'
<fs_record>-city_name_005.
PERFORM bdc_field USING 'ADRCITYD-REGION'
<fs_record>-region_006.
PERFORM bdc_field USING 'ADRCITYD-TIME_ZONE'
'CET'.
PERFORM bdc_field USING 'ADRCITYD-COMMU_CODE'
<fs_record>-commu_code_008.
PERFORM bdc_field USING 'ADRCITYD-DEF_LANGU'
'F'.
* PERFORM bdc_dynpro USING 'SAPLSZRL' '0400'.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLSZRL' '0400'. "ajout2
lignec = ligne.
CONCATENATE 'ADRPCDCITY-POST_CODE(' lignec ')' INTO cp.
PERFORM bdc_field USING 'BDC_CURSOR'
cp.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING cp
<fs_record>-post_code_01_016.
ENDLOOP.
* deniere sauvegarde
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_transaction USING 'SR10'.
CLEAR flag_end.
PERFORM close_group.
PERFORM close_dataset USING dataset.
Can somebody help me on this one ?
Thank you,
Tom.If it is table control you may have to pass PageDown after 9 rec & again start with (01)
record number remains 1 to 9 but Top_line parameter will change to 9or10 after 1 pagedown.
Cxould be P++
you can record Pagedown & check recording. -
Values in "vendor batch" in the Goods-in-order and Goods-in-plan lists are
Vendor batch No. : Transaction ZJPMPU322
(Background)
There are "vendor batch" and "batch" fields in Goods-in-order and Goods-in-plan lists (transaction ZJPMPU322). Values for these fields are retrieved from inbound delivery document (transaction VL33N). After core 7.0 upgrade, "vendor batch" is not copied from "batch" in inbound delivery document any more so that nothing appears in the vendor batch field in the lists.
(Change request)
Values in "vendor batch" in the Goods-in-order and Goods-in-plan lists are retrieved from "batch" in inbound delivery document ONLY IF "vendor batch" is blank in the inbound delivery document.
(Current design)
Batch is retrieved from LIPS-CHARG
Vendor batch is retrieved from LIPS-LICHN
(If there is no record in LIPS, blank will be printed out for both fields)
(After change)
Batch is retrieved from LIPS-CHARG
Vendor batch is retrieved from LIPS-LICHN only if LIPS-LICHN is not blank.
If LIPS-LICHN is blank, vendor batch is retrieved from LIPS-CHARG.
(If there is no record in LIPS, blank will be printed out for both fields. If both LIPS-CHARG and LIPS-LICHN are blank, blank will be printed out for both fields),
Following is the program:
REPORT zjpmrpu322 MESSAGE-ID zjpm001
NO STANDARD PAGE HEADING
LINE-COUNT 50
LINE-SIZE 255.
*& Development ID: PU_DD_322_LJP *
*& Report : ZJPMRPU322 *
*& The Purpose of this program is to print the Goods-in-order list *
*& and the Goods in plan list for raw materials, materials purchase *
*& etc at the Sasayama plant, Japan. *
*& Change Log: *
*& Init Who Date Text *
*& PV P V R S Varma 07-May-2003 Initial Version *
*& DU D.Usui 2004/02/26 CR No. 1432 *
*& DU D.Usui 2004/03/08 CR No. 1447 *
*& DU D.Usui 2004/05/06 CR No. 1591 *
Constants
CONSTANTS:
c_werks LIKE ekpo-werks VALUE 'JP01', "Plant code - Sasayama plant
c_id LIKE thead-tdid VALUE 'F02', "Text ID for Info record
c_object LIKE thead-tdobject VALUE 'EKPO',"Object of text for info rec
*c_zzjp_r1 LIKE marc-zzjp_re1 VALUE 'GMP', "Goods in plan- Domestic
*c_zzjp_r2 LIKE marc-zzjp_re1 VALUE 'GMPI', "Import sales order document
c_plus TYPE c VALUE '', "Holding '' sign
c_spras LIKE makt-spras VALUE 'J', "Language key Japan
*c_device(7) type c value 'PRINTER', "Device type
c_form(16) TYPE c VALUE 'ZJPMPU305', "Form name
c_ele_gmp(4) TYPE c VALUE 'GMP', "GMP Text element
c_ele_gmpi(4) TYPE c VALUE 'GMPI', "GMPI Text element
add begin CR1432
c_ele_bgmp(4) TYPE c VALUE 'BGMP', "BGMP
c_ele_bgmpi(5) TYPE c VALUE 'BGMPI', "BGMPI
add end CR1432
c_function(3) TYPE c VALUE 'SET', "Function
c_type(4) TYPE c VALUE 'BODY', "Window area in main window
c_win_head(7) TYPE c VALUE 'HEADING', "Heading window
c_win_shead(7) TYPE c VALUE 'SUBHEAD', "sub heading window
c_win_fot1(7) TYPE c VALUE 'FOOTER1', "Footer 1 window
c_win_main(4) TYPE c VALUE 'MAIN', "Main window
c_comd(8) TYPE c VALUE 'NEW-PAGE', "New-page command
c_zar TYPE ekko-bsart VALUE 'ZAR',
c_x TYPE c VALUE 'X', "Indicator for print options
c_f TYPE c VALUE 'F', "Indicator for Purchase Order
add begin CR1591
Deletion indicator in purchasing document
c_loekz(1) TYPE c VALUE 'L',
For ranges tables
c_sign_i(1) TYPE c VALUE 'I', "Sign(include)
c_op_eq(2) TYPE c VALUE 'EQ', "Option(=)
Confirmation category
c_ebtyp_ab(2) TYPE c VALUE 'AB', "Order acknowledgment
add end CR1591
c_la(2) TYPE c VALUE 'LA'. "Indicator for Inbound deliver
Database Tables
Vaiables / Internal tables *
Internal table to store PO information
Not used after CR1591
DATA: BEGIN OF t_purc OCCURS 0,
ebeln LIKE eket-ebeln, "Purchasing Document Number
ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled quantity
charg LIKE eket-charg, "Batch number
matnr LIKE ekpo-matnr, "Material code
werks LIKE ekpo-werks, "Plant
meins LIKE ekpo-meins, "Unit of measure
lifnr LIKE ekko-lifnr, "Vendor number
END OF t_purc.
Internal table to store material description.
DATA: BEGIN OF t_makt OCCURS 0,
matnr LIKE makt-matnr, "Material code
maktx LIKE makt-maktx, "Material description
END OF t_makt.
Internal table for storage of final EKET data
DATA: BEGIN OF t_eket OCCURS 0,
ebeln LIKE eket-ebeln, "Purchasing Document Number
ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
ebelp_ex(6) TYPE n, "Extended ebelp with length 6
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled quantity
dabmg LIKE ekes-dabmg, " Delivered Quantity
charg LIKE eket-charg, "Batch number
matnr LIKE ekpo-matnr, "Material code
werks LIKE ekpo-werks, "Plant
maktx LIKE makt-maktx, "Material Description-- jp check
etens LIKE ekes-etens, "Sequence Number
meins LIKE ekpo-meins, "Unit of measure
lifnr LIKE ekko-lifnr, "Vendor number
vbeln LIKE ekes-vbeln,
vbelp LIKE ekes-vbelp,
vpnam(40) TYPE c, "Vendor product name
END OF t_eket.
Internal table for extraction of data from EKES
Not used after CR1591
DATA: BEGIN OF t_ekes OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE ekes-eindt, "Item delivery date
menge LIKE ekes-menge, "Scheduled Quantity
dabmg LIKE ekes-dabmg, " delivered quantity
vbeln LIKE ekes-vbeln,
vbelp LIKE ekes-vbelp,
mark TYPE c,
END OF t_ekes.
Internal table for extraction of data from EKES
Not used after CR1591
DATA: BEGIN OF t_ekes_temp OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE ekes-eindt, "Item delivery date
menge LIKE ekes-menge, "Scheduled Quantity
END OF t_ekes_temp.
Internal table for storing data from MLGN table.
DATA: BEGIN OF t_mlgn OCCURS 0,
matnr LIKE mlgn-matnr, "material code
lhmg1 LIKE mlgn-lhmg1, "Standard pallet size
lhme1 LIKE mlgn-lhme1, "Unit of measure
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
END OF t_mlgn.
Internal table for storing data from MARM table.
DATA: BEGIN OF t_marm OCCURS 0,
matnr LIKE marm-matnr, "material code
umrez LIKE marc-zzjp_cas_size, "Std package unit
meins LIKE ekpo-meins, "alternate unit
END OF t_marm.
Internal table for storing data from MARC table.
DATA: BEGIN OF t_marc OCCURS 0,
matnr LIKE marc-matnr, "Material code
zzjp_nyu_sop LIKE marc-zzjp_nyu_sop, "Product Std number
zzjp_dos_frm LIKE marc-zzjp_dos_frm, "Dosage form
zzjp_aprn LIKE marc-zzjp_aprn, "Apperance
zzjp_re1 LIKE marc-zzjp_re1, "Heading
END OF t_marc.
Internal table for storing data from lfa1 table.
DATA: BEGIN OF t_lfa1 OCCURS 0,
lifnr LIKE lfa1-lifnr, "Vendor code
name1 LIKE lfa1-name1, "Vendor name
END OF t_lfa1.
Internal table for Storing data from LIPS table.
DATA: BEGIN OF t_lips OCCURS 0,
vbeln LIKE lips-vbeln, "Delivery document no
posnr LIKE lips-posnr, "Item number for Delivery document
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
END OF t_lips.
Internal table for storing the final display data.
DATA: BEGIN OF t_display OCCURS 0,
g_checkbox type c, "check box for selection of records
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled Quantity
vpnam(40) TYPE c, "Vendor product name
lifnr LIKE ekko-lifnr, "Vendor code
name1 LIKE lfa1-name1, "Vendor name
meins LIKE ekpo-meins, "Unit of measure
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description-- jp check
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
lhmg1 LIKE mlgn-lhmg1, "standard pallet size
lhme1 LIKE mlgn-lhme1, "Unit of standard pallet
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
umrez LIKE marc-zzjp_cas_size, "Std package unit
meinh LIKE ekpo-meins, "alternate unit
zzjp_nyu_sop LIKE marc-zzjp_nyu_sop, "Product Std number
zzjp_dos_frm LIKE marc-zzjp_dos_frm, "Dosage form
zzjp_aprn LIKE marc-zzjp_aprn, "Apperance
zzjp_re1 LIKE marc-zzjp_re1, "Heading
std_pac_no(13) TYPE n, "Std receipt package no
tot_std_pt(13) TYPE n, "Total no of std pallets
add begin CR1447
Add new field 'Goods-in-order','Item' for goods in plan list
vbeln like ekes-vbeln, "Goods-in-order
vbelp like ekes-vbelp, "Item
add end CR1447
END OF t_display.
Internal table for storing the final display data -Goods in order list
DATA: BEGIN OF t_display1 OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled Quantity
vpnam(40) TYPE c, "Vendor product name
lifnr LIKE ekko-lifnr, "Vendor code
name1 LIKE lfa1-name1, "Vendor name
meins LIKE ekpo-meins, "Unit of measure
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description-- jp check
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
lhmg1 LIKE mlgn-lhmg1, "standard pallet size
lhme1 LIKE mlgn-lhme1, "Unit of standard pallet
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
umrez LIKE marc-zzjp_cas_size, "Std package unit
meinh LIKE ekpo-meins, "alternate unit
zzjp_nyu_sop LIKE marc-zzjp_nyu_sop, "Product Std number
zzjp_dos_frm LIKE marc-zzjp_dos_frm, "Dosage form
zzjp_aprn LIKE marc-zzjp_aprn, "Apperance
zzjp_re1 LIKE marc-zzjp_re1, "Heading
std_pac_no(13) TYPE n, "Std receipt package no
tot_std_pt(13) TYPE n, "Total no of std pallets
END OF t_display1.
Internal table for storing the final display data - Goods in plan list
DATA: BEGIN OF t_display2 OCCURS 0,
ebeln LIKE ekes-ebeln, "Purchasing Document Number
ebelp LIKE ekes-ebelp, "Item Number of Purchasing Document
etens LIKE ekes-etens, "Sequence No
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled Quantity
name1 LIKE lfa1-name1, "Vendor name
meins LIKE ekpo-meins, "Unit of measure
matnr LIKE ekpo-matnr, "Material Number
maktx LIKE makt-maktx, "Material Description-- jp check
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
lhmg1 LIKE mlgn-lhmg1, "standard pallet size
lety1 LIKE mlgn-lety1, "tower
ltkze LIKE mlgn-ltkze, "Storage location
tot_std_pt(13) TYPE n, "Total no of std pallets
add begin CR1447
Add new field 'Goods-in-order','Item' for goods in plan list
vbeln like ekes-vbeln, "Goods-in-order
vbelp like ekes-vbelp, "Item
add end CR1447
END OF t_display2.
add begin CR1591
RANGES: r_matnr FOR mara-matnr, "for p_matnr
r_ebeln FOR ekpo-ebeln. "for p_ebeln
add end CR1591
DATA: line TYPE i. " line number
DATA: g_checkbox TYPE c. "check box for selection of records
DATA: g_tab LIKE sy-index. "variable to hold index
DATA g_tabix LIKE sy-tabix. "holder for table index
Printing Options.
DATA: lw_pr_options LIKE itcpo.
*lw_pr_options-tddest = 'SA03'. " Print Device Name
lw_pr_options-tdpreview = 'X'. " Print Preview
lw_pr_options-tdnewid = 'X'. " New Request
lw_pr_options-tdlifetime = 2. " Retention in Spool
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
SELECT-OPTIONS:
s_date FOR sy-datum DEFAULT sy-datum. " Search period.
PARAMETERS:
p_matnr LIKE mara-matnr, " Material code
p_ebeln LIKE ekpo-ebeln. " Purchase Document No
SELECTION-SCREEN END OF BLOCK blk1.
Selection Screen Checks *
AT SELECTION-SCREEN.
IF ( s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
MESSAGE e000 WITH 'Entry Must in atleast one of the Fields'(t00).
ENDIF.
IF ( NOT p_matnr IS INITIAL ) AND
( s_date IS INITIAL ) AND
( p_ebeln IS INITIAL ).
MESSAGE e000 WITH 'Date should also be Entered'(t01).
ENDIF.
del begin CR1591
This check is not found in original FS
IF ( NOT p_matnr IS INITIAL ) AND
( s_date IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
MESSAGE e000 WITH 'Date should also be Entered'(t01).
ENDIF.
del end CR1591
Validations for Data selection *
del begin CR1591
Waste check
IF ( NOT s_date IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
PERFORM f_check_date_in_eket.
ENDIF.
IF ( NOT s_date IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
PERFORM f_check_matnr_in_plant.
PERFORM f_check_matnr_in_ekpo.
PERFORM f_check_date_in_eket.
PERFORM f_check_matnr_in_plant.
PERFORM f_check_matnr_in_ekpo.
ENDIF.
IF ( NOT s_date IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
PERFORM f_check_matnr_in_plant.
PERFORM f_check_matnr_in_ekpo.
PERFORM f_check_date_in_eket.
PERFORM f_check_ebeln_in_ekpo.
PERFORM f_check_werks_in_ekpo.
ENDIF.
IF ( NOT p_ebeln IS INITIAL ) AND
( NOT s_date IS INITIAL ) AND
( p_matnr IS INITIAL ).
PERFORM f_check_date_in_eket.
PERFORM f_check_ebeln_in_ekpo.
PERFORM f_check_werks_in_ekpo.
ENDIF.
IF ( NOT p_ebeln IS INITIAL ) AND
( s_date IS INITIAL ) AND
( p_matnr IS INITIAL ).
PERFORM f_check_ebeln_in_ekpo.
PERFORM f_check_werks_in_ekpo.
ENDIF.
del end CR1591
Data selection from Tables *
START-OF-SELECTION.
SET PF-STATUS 'SELECT'.
add begin CR1591
Set ranges tables
PERFORM set_ranges.
add end CR1591
mod begin CR1591
**Selection of PO data from EKET into internal table t_purc.
PERFORM f_select_eket.
**Selection of corresponding PO data for EKET from EKES into t_ekes.
PERFORM f_select_ekes.
**Selection of material desc from MAKT table into T_makt.
PERFORM f_select_makt.
**Copy the contents of t_purc and t_makt into t_eket table.
PERFORM f_move_eket.
**Replace the corresponding entries of t_eket with t_ekes.
PERFORM f_update_eket.
Selection of PO data from EKET into internal table T_EKET.
PERFORM f_select_eket2.
Selection of corresponding PO data from EKES appending to T_EKET.
PERFORM f_select_ekes2.
Selection of material desc from MAKT table into T_MAKT.
PERFORM f_select_makt2.
mod end CR1591
*Selection of vendor product name.
PERFORM f_select_vpnam.
del begin CR1591
No need
**copy t_eket-ebelp into temporary variable.
PERFORM f_copy_ebelp.
del end CR1591
*selection of data from MLGN table into t_mlgn internal table
PERFORM f_select_mlgn.
*selection of data from marm table into t_marm internal table
PERFORM f_select_marm.
*selection of data from marc table into t_marc internal table
PERFORM f_select_marc.
*selection of data from lfa1 table into t_lfa1 internal table
PERFORM f_select_lfa1.
*Selection of data from LIPS table into t_lips internal table
PERFORM f_select_lips.
del begin CR1591
Don't display list screen when no data exists
*END-OF-SELECTION.
del end CR1591
*lines = sy-linno - 1.
*Collection of data into the final display internal table t_Display
PERFORM f_collect_final.
*Display the contents of t_display as a simple List
PERFORM f_list_display.
AT USER-COMMAND.
PERFORM f_select_layout.
INCLUDE zjpmipu315.
INCLUDE zjpmipu316.
*& Form f_check_MATNR_in_plant
This Routine is to check if the the selected material code is
available in the plant 'JP01'.
FORM f_check_matnr_in_plant.
DATA: l_matnr LIKE mara-matnr.
SELECT matnr UP TO 1 ROWS FROM marc
INTO l_matnr
WHERE
matnr = p_matnr AND
werks = c_werks.
ENDSELECT.
IF l_matnr IS INITIAL.
MESSAGE e000 WITH
'The material is not available in '(t02) c_werks 'plant'(t20).
ENDIF.
ENDFORM. " f_check_MATNR_in_plant
*& Form f_check_EBELN_in_EKPO
This Routine is to check if the Purchase order number selected
is existing or not and if it exists, check if it is related to
the plant 'JP01'.
FORM f_check_ebeln_in_ekpo.
DATA: l_ebeln LIKE ekpo-ebeln.
SELECT ebeln UP TO 1 ROWS FROM ekpo
INTO l_ebeln
WHERE
ebeln = p_ebeln AND
werks = c_werks.
ENDSELECT.
IF l_ebeln IS INITIAL.
MESSAGE e000 WITH
'PO not available or not related to '(t03) c_werks 'plant'(t21).
ENDIF.
ENDFORM. " f_check_EBELN_in_EKPO
*& Form f_check_matnr_in_ekko
This routine is to check if any PO exist for the selected
Material code.
FORM f_check_matnr_in_ekpo.
DATA: l_matnr LIKE ekpo-matnr.
SELECT matnr UP TO 1 ROWS FROM ekpo
INTO l_matnr
WHERE
matnr = p_matnr.
ENDSELECT.
IF l_matnr IS INITIAL.
MESSAGE e000 WITH
'PO does not exist for the material no'(t04) p_matnr.
ENDIF.
ENDFORM. " f_check_matnr_in_ekpo
*& Form f_check_date_in_eket
This routine is to check if any purchase order exists
with the selected
FORM f_check_date_in_eket.
DATA: l_eindt LIKE eket-eindt.
SELECT eindt UP TO 1 ROWS FROM eket
INTO l_eindt
WHERE
eindt IN s_date.
ENDSELECT.
IF l_eindt IS INITIAL.
MESSAGE e000 WITH
'No PO exist with the selected delivery date '(t05).
ENDIF.
ENDFORM. " f_check_date_in_eket
*& Form f_check_werks_in_ekpo
This Routine is to check if the selected purchase order
is associated with the plant JP01
FORM f_check_werks_in_ekpo.
DATA: l_ebeln LIKE ekpo-ebeln.
SELECT ebeln UP TO 1 ROWS FROM ekpo
INTO l_ebeln
WHERE
werks = c_werks.
ENDSELECT.
IF l_ebeln IS INITIAL.
MESSAGE e000 WITH
'The selected P0 is not relevant to '(t06) c_werks 'plant'(t22).
ENDIF.
ENDFORM. " f_check_werks_in_ekpo
*& Form f_select_eket
Routine to collect data from EKET, EKPO, MAKT, EKKO tables
using inner join and store the data into internal table
t_PURC. The data selection is based on the selection screen's
input.
FORM f_select_eket.
IF ( NOT s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( NOT s_date-low IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~matnr = p_matnr AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( NOT s_date-low IS INITIAL ) AND
( NOT p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~matnr = p_matnr AND
ekpo~ebeln = p_ebeln AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
ekpo~ebeln = p_ebeln AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ELSEIF ( NOT s_date-low IS INITIAL ) AND
( p_matnr IS INITIAL ) AND
( NOT p_ebeln IS INITIAL ).
SELECT
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO TABLE t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~eindt IN s_date AND
ekpo~ebeln = p_ebeln AND
ekpo~werks = c_werks AND
ekpo~elikz NE c_x AND
ekko~bstyp EQ c_f AND
ekko~bsart NE c_zar.
ENDIF.
IF sy-subrc <> 0.
MESSAGE s000 WITH 'Data not found'(t07).
LEAVE LIST-PROCESSING.
ELSE.
SORT t_purc.
ENDIF.
ENDFORM. " f_select_eket
*& Form f_select_makt
Routine to select the material description for all the
materials present in T_purc table
FORM f_select_makt.
DATA: l_t_makt(4) TYPE c VALUE 'MAKT'.
SELECT
matnr
maktx
FROM
makt
INTO TABLE t_makt
FOR ALL ENTRIES IN t_purc
WHERE
matnr = t_purc-matnr AND
spras = c_spras.
IF sy-subrc <> 0.
MESSAGE s000 WITH
'Relevant data not found in'(t09) l_t_makt 'table'(t23).
ELSE.
SORT t_makt.
ENDIF.
ENDFORM. " f_select_makt
*& Form f_move_eket
Routine to join data in T_PURC and T_MAKT tables into
internal table T_MAKT.
FORM f_move_eket.
LOOP AT t_purc.
t_eket-ebeln = t_purc-ebeln.
t_eket-ebelp = t_purc-ebelp.
t_eket-eindt = t_purc-eindt.
t_eket-menge = t_purc-menge.
t_eket-charg = t_purc-charg.
t_eket-matnr = t_purc-matnr.
t_eket-werks = t_purc-werks.
t_eket-meins = t_purc-meins.
t_eket-lifnr = t_purc-lifnr.
READ TABLE t_makt WITH KEY matnr = t_purc-matnr
BINARY SEARCH.
IF sy-subrc = 0.
t_eket-maktx = t_makt-maktx.
ENDIF.
APPEND t_eket.
CLEAR t_eket.
ENDLOOP.
ENDFORM. " f_move_eket
*& Form f_select_ekes
Routine to select EKES data for all corresponding entries
of T_EKET.
FORM f_select_ekes.
DATA: l_tabix TYPE i.
IF NOT s_date IS INITIAL.
SELECT
ebeln
ebelp
etens
eindt
menge
INTO TABLE t_ekes
FROM
ekes
WHERE
eindt IN s_date.
ELSE.
DESCRIBE TABLE t_purc LINES l_tabix.
IF l_tabix GT 0.
SELECT
ebeln
ebelp
etens
eindt
menge
dabmg
vbeln
vbelp
FROM
ekes
INTO TABLE t_ekes
FOR ALL ENTRIES IN t_eket
FOR ALL ENTRIES IN t_purc
WHERE
ebeln = t_purc-ebeln AND
ebelp = t_purc-ebelp AND
eindt IN s_date.
AND ebeln eq p_ebeln.
and matnr in p_matnr.
ENDIF.
CLEAR l_tabix.
IF NOT s_date IS INITIAL AND NOT p_ebeln IS INITIAL.
SELECT
ekes~ebeln
ekes~ebelp
ekes~etens
ekes~eindt
ekes~menge
ekes~dabmg
APPENDING TABLE t_ekes
FROM ekes
WHERE
eindt IN s_date AND
ebeln EQ p_ebeln AND
ebtyp EQ c_la.
ELSEIF NOT s_date IS INITIAL AND p_ebeln IS INITIAL.
SELECT
ekes~ebeln
ekes~ebelp
ekes~etens
ekes~eindt
ekes~menge
ekes~dabmg
APPENDING TABLE t_ekes
FROM ekes
WHERE
eindt IN s_date AND
ebeln EQ p_ebeln AND
ebtyp EQ c_la.
ELSEIF s_date IS INITIAL AND NOT p_ebeln IS INITIAL.
SELECT
ekes~ebeln
ekes~ebelp
ekes~etens
ekes~eindt
ekes~menge
ekes~dabmg
APPENDING TABLE t_ekes
FROM ekes
WHERE
eindt IN s_date AND
ebeln EQ p_ebeln AND
ebtyp EQ c_la.
ENDIF.
IF sy-subrc = 0.
SORT t_ekes.
ENDIF.
IF NOT t_ekes[] IS INITIAL.
t_ekes_temp[] = t_ekes[].
SORT t_ekes_temp BY ebeln ebelp.
DELETE ADJACENT DUPLICATES FROM t_ekes_temp COMPARING ebeln ebelp.
LOOP AT t_ekes_temp.
READ TABLE t_purc WITH KEY ebeln = t_ekes_temp-ebeln
ebelp = t_ekes_temp-ebelp.
IF sy-subrc NE 0.
CLEAR t_purc.
SELECT SINGLE
eket~ebeln
eket~ebelp
eket~eindt
eket~menge
eket~charg
ekpo~matnr
ekpo~werks
ekpo~meins
ekko~lifnr
INTO CORRESPONDING FIELDS OF t_purc
FROM
( ( eket INNER JOIN ekko ON
eketebeln = ekkoebeln ) INNER JOIN ekpo ON
eketebelp = ekpoebelp AND
ekpoebeln = ekkoebeln )
WHERE
eket~ebeln = t_ekes_temp-ebeln
AND eket~ebelp = t_ekes_temp-ebelp
AND ekpo~elikz NE c_x
AND ekko~bstyp EQ c_f
AND ekko~bsart NE c_zar.
IF sy-subrc EQ 0.
APPEND t_purc.
CLEAR t_purc.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH: t_ekes_temp, t_ekes.
CLEAR: t_ekes_temp, t_ekes.
Once the header is filled up get the details from EKES
SELECT ebeln ebelp etens eindt menge dabmg vbeln vbelp
INTO TABLE t_ekes
FROM ekes
FOR ALL ENTRIES IN t_purc
WHERE ebeln EQ t_purc-ebeln.
Mark the entries as 'X' which falls in the date range
LOOP AT t_ekes.
IF t_ekes-eindt IN s_date.
t_ekes-mark = 'X'.
MODIFY t_ekes INDEX sy-tabix TRANSPORTING mark.
ENDIF.
ENDLOOP.
SORT t_ekes BY ebeln ebelp ASCENDING mark DESCENDING.
Delete the entries from eket if no entries in EKES falls in the period
LOOP AT t_purc.
l_tabix = sy-tabix.
READ TABLE t_ekes WITH KEY ebeln = t_purc-ebeln
ebelp = t_purc-ebelp.
IF sy-subrc EQ 0.
IF t_ekes-mark NE 'X'.
DELETE t_purc INDEX l_tabix.
ENDIF.
ENDIF.
ENDLOOP.
delete the entries from EKES which do not fall in the specified period
DELETE t_ekes WHERE mark NE 'X'.
ENDFORM. " f_select_ekes
*& Form f_update_eket
Routine to substitute relevant t_eket entries with that of
t_ekes entries.It does not modify the remaining entries for
for which the corresponding values in t_ekes doesnot exist.
FORM f_update_eket.
DATA: BEGIN OF lt_temp_eket OCCURS 0,
ebeln LIKE eket-ebeln, "Purchasing Document Number
ebelp LIKE eket-ebelp, "Item Number of Purchasing Document
eindt LIKE eket-eindt, "Item delivery date
menge LIKE eket-menge, "Scheduled quantity
dabmg LIKE ekes-dabmg, " Delivered quantity
matnr LIKE ekpo-matnr, "Material code
maktx LIKE makt-maktx, "Material Description-- jp check
etens LIKE ekes-etens, "Sequence Number
meins LIKE ekpo-meins, "Unit of measure
lifnr LIKE ekko-lifnr, "Vendor number
charg LIKE eket-charg, " Batch number Added by PD 08/08/03
vbeln LIKE ekes-vbeln,
vbelp LIKE ekes-vbelp,
END OF lt_temp_eket,
l_menge LIKE ekes-menge.
LOOP AT t_eket.
LOOP AT t_ekes WHERE ebeln = t_eket-ebeln
AND ebelp = t_eket-ebelp.
Added by PD 08/08/03
MOVE t_eket-charg TO lt_temp_eket-charg.
addition ends
MOVE t_eket-ebeln TO lt_temp_eket-ebeln.
MOVE t_eket-ebelp TO lt_temp_eket-ebelp.
MOVE t_eket-meins TO lt_temp_eket-meins.
CLEAR l_menge.
l_menge = t_ekes-menge - t_ekes-dabmg.
IF l_menge LE 0.
CONTINUE.
ELSE.
MOVE l_menge TO lt_temp_eket-menge.
ENDIF.
MOVE t_ekes-eindt TO lt_temp_eket-eindt.
MOVE t_ekes-etens TO lt_temp_eket-etens.
MOVE t_eket-lifnr TO lt_temp_eket-lifnr.
MOVE t_eket-maktx TO lt_temp_eket-maktx.
MOVE t_eket-matnr TO lt_temp_eket-matnr.
MOVE t_ekes-vbeln TO lt_temp_eket-vbeln.
MOVE t_ekes-vbelp TO lt_temp_eket-vbelp.
APPEND lt_temp_eket.
CLEAR lt_temp_eket.
CLEAR t_ekes.
ENDLOOP.
IF sy-subrc NE 0.
Added by PD 08/08/03
MOVE t_eket-charg TO lt_temp_eket-charg.
addition ends
MOVE t_eket-ebelnDear
Problem No 1 : we are working in a process industries with three plants each of them have three order type. we have define MRP group in "OPPR" then assign each MRP group to Orde types in "OPPE". Now the problem is whn i convert plan order in process order for any material systme automaticaly pick the order type PIi01.
Answer :
1.Please check the OPPR -Plant and MRP group -Select Order Type Button -Check what Order Type you have assinged here ( PI01( May be the default Process Order Type )
2.If you are maintaing MRP group ( 0001 or 0002) , did you asisng the same in MRP1 view ?? because
3.Did you maintain the similar Order type in OPKP -Define Production Scheduling Profile ? -This has highest priority .
4.Did you maintain correct order type in OPJH-Maintain Order Type ??
Refer the expert comments on the same issue : Strategy group to define production order type
Problem No 2: 2nd Problem is system system is not creating plan order for prrevios dates. say i enter PIR for month of november from first november to 30th november and run MRP on 29th the sytem create plan order on 30th of november with exception message 30.
Answer : You can plan the order in back dated , if you maitain Satrt date in the Past optiuon in OPU3/OPU5-Define Scheduling parameters .Goto OPU3 -Select the Order Type -Double click -Maintain 90-60 days in the Start Date in the past in Scheduling Control and Details scheduling tab .
Hope it helps
regards
JH -
Batch Classification Values not getting changed
Hi Gurus,
I am using the following bapi ( BAPI_OBJCL_CHANGE ) to change Batch classification values Eg: Cut clarity etc.
when i pass these values thru the function module in the program it is not getting changed while when i change it through msc2n it gets changed successfully...
I have passed the following values in the parameters of the bapi :
OBJECTKEY = v_objectkey
OBJECTTABLE = 'MCH1'
CLASSNUM = V_CLASSNUM
CLASSTYPE = '023'
KEYDATE = 30.04.2010
ALLOCVALUESCHARNEW
CHARACT = CLARITY
VALUE_CHAR = P040
VALUE_NEW = P040.
Can some one help me solve this....
Needed urgently..
Edited by: NAVIN FERNANDES on Apr 30, 2010 12:31 PM
Edited by: NAVIN FERNANDES on Apr 30, 2010 12:32 PMHi Jacky,
I am posting the code here.. Do let me know if u have ne queries:
REPORT ZNAVBATCH.
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS: P_MATNR TYPE MATNR,
P_CHARG TYPE CHARG_D,
P_WERKS TYPE WERKS_D,
P_LGORT TYPE LGORT_D.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
DATA: WA_BATCH TYPE BAPI1003_OBJECT_KEYS,
WA_ALLOCCHAR TYPE BAPI1003_ALLOC_VALUES_CHAR,
WA_ALLOCVAL TYPE BAPI1003_ALLOC_VALUES_NUM,
INT_BATCH TYPE STANDARD TABLE OF BAPI1003_OBJECT_KEYS,
INT_RET1 TYPE STANDARD TABLE OF BAPIRET2,
INT_RET2 TYPE STANDARD TABLE OF BAPIRET2,
INT_RET3 TYPE STANDARD TABLE OF BAPIRET2,
LV_KEY TYPE BAPI1003_KEY-OBJECT,
INT_ALLOCVAL TYPE STANDARD TABLE OF BAPI1003_ALLOC_VALUES_NUM,
INT_ALLOCCHAR TYPE STANDARD TABLE OF BAPI1003_ALLOC_VALUES_CHAR,
INT_ALLOCCURR TYPE STANDARD TABLE OF BAPI1003_ALLOC_VALUES_CURR.
WA_BATCH-KEY_FIELD = 'MATNR'.
WA_BATCH-VALUE_INT = P_MATNR.
APPEND WA_BATCH TO INT_BATCH.
WA_BATCH-KEY_FIELD = 'CHARG'.
WA_BATCH-VALUE_INT = P_CHARG.
APPEND WA_BATCH TO INT_BATCH.
CALL FUNCTION 'BAPI_OBJCL_CONCATENATEKEY'
EXPORTING
OBJECTTABLE = 'MCH1'
IMPORTING
OBJECTKEY_CONC = LV_KEY
TABLES
OBJECTKEYTABLE = INT_BATCH
RETURN = INT_RET1.
IF SY-SUBRC = 0.
WRITE: 'SUCCESSFUL'.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
OBJECTKEY = LV_KEY
OBJECTTABLE = 'MCH1'
CLASSNUM = 'ZTBATCHCHR'
CLASSTYPE = '023'
KEYDATE = SY-DATUM
UNVALUATED_CHARS = ' '
LANGUAGE = SY-LANGU
IMPORTING
STATUS =
STANDARDCLASS =
TABLES
ALLOCVALUESNUM = INT_ALLOCVAL
ALLOCVALUESCHAR = INT_ALLOCCHAR
ALLOCVALUESCURR = INT_ALLOCCURR
RETURN = INT_RET2
IF SY-SUBRC = 0.
WRITE : 'SUCCESSFUL'.
READ TABLE INT_ALLOCCHAR INTO WA_ALLOCCHAR WITH KEY CHARACT = 'CLARITY'.
IF SY-SUBRC = 0.
WA_ALLOCCHAR-VALUE_CHAR = 'C02'.
WA_ALLOCCHAR-VALUE_NEUTRAL = 'C02'.
MODIFY INT_ALLOCCHAR FROM WA_ALLOCCHAR INDEX SY-TABIX TRANSPORTING VALUE_CHAR VALUE_NEUTRAL.
ENDIF.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
OBJECTKEY = LV_KEY
OBJECTTABLE = 'MCH1'
CLASSNUM = 'ZTBATCHCHR'
CLASSTYPE = '023'
STATUS = '1'
STANDARDCLASS =
CHANGENUMBER =
KEYDATE = SY-DATUM
NO_DEFAULT_VALUES = ' '
IMPORTING
CLASSIF_STATUS =
TABLES
ALLOCVALUESNUMNEW = INT_ALLOCVAL
ALLOCVALUESCHARNEW = INT_ALLOCCHAR
ALLOCVALUESCURRNEW = INT_ALLOCCURR
RETURN = INT_RET3
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
IF SY-SUBRC = 0.
WRITE: 'SUCCESSFUL'.
ENDIF.
ENDIF.
ENDIF.
ENDIF. -
Batch-input FB05 Cost Center -A mode - N mode
Hello,
When i execute a FB05 batch-input in mode A (visible) , the program post every document right , but when i try to execute in mode N a error message return in the messanges internal table.
"No batch input data for screen & & "
So i´ve checked many times the screen where i inform the Cost Center , and everything seems right. I suspect that it is a pop-up , and the program could not read properly this screen in N mode .
Anybody has passed for this situation ? What i need to do to make this work in N mode .
Ps: i´ve tried play with many option on the call transaction options ,
like :
T_CTU_PARAMS-UPDMODE
T_CTU_PARAMS-RACOMMIT
T_CTU_PARAMS-DEFSIZE
T_CTU_PARAMS-NOBINPT
T_CTU_PARAMS-NOBIEND
thank a lot
best regardsfollow
SELECT BUKRS KUNNR BELNR BUZEI
INTO TABLE T_BSID
FROM BSID
FOR ALL ENTRIES IN T_BATCH_AUX
WHERE BUKRS EQ T_BATCH_AUX-BUKRS
AND KUNNR EQ T_BATCH_AUX-KUNNR.
IF SY-SUBRC = 0.
LOOP AT T_BATCH INTO WA_BATCH.
T_BSID_AUX = T_BSID.
DELETE T_BSID_AUX WHERE KUNNR NE WA_BATCH-KUNNR.
READ TABLE T_BSID_AUX INTO WA_BSID
WITH KEY BUKRS = WA_BATCH-BUKRS
KUNNR = WA_BATCH-KUNNR
BELNR = WA_BATCH-BELNR
BUZEI = WA_BATCH-BUZEI.
MOVE SY-TABIX TO W_TABIX.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPMF05A' '0122' ,
' ' 'BDC_CURSOR' 'RF05A-XPOS1(02)',
' ' 'BDC_OKCODE' '=SL',
' ' 'BKPF-BLDAT' WA_BATCH-DTA_DOCTO,
' ' 'BKPF-BLART' WA_BATCH-TP_DOCTO,
' ' 'BKPF-BUKRS' WA_BATCH-BUKRS,
' ' 'BKPF-BUDAT' WA_BATCH-DTA_LCTO,
' ' 'BKPF-MONAT' WA_BATCH-PERIODO,
' ' 'BKPF-WAERS' WA_BATCH-MOEDA,
' ' 'BKPF-XBLNR' WA_BATCH-REFERENCIA,
' ' 'BKPF-XBLNR' WA_BATCH-TXTCAB,
' ' 'BKPF-BKTXT' WA_BATCH-TXTCAB,
' ' 'RF05A-AUGTX' WA_BATCH-TXTDESC.
' ' 'FS006-DOCID' '*'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPMF05A' '0710' ,
' ' 'BDC_CURSOR' 'RF05A-XPOS1(03)',
' ' 'BDC_OKCODE' '=PA',
' ' 'RF05A-AGBUK' WA_BATCH-BUKRS,
' ' 'RF05A-AGKON' WA_BATCH-KUNNR,
' ' 'RF05A-AGKOA' 'D',
' ' 'RF05A-AGUMS' WA_BATCH-CDRZE,
' ' 'RF05A-XNOPS' 'X',
' ' 'RF05A-XPOS1(03)' 'X'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPMF05A' '0731' ,
' ' 'BDC_CURSOR' 'RF05A-SEL01(01)',
' ' 'BDC_OKCODE' '=PA',
' ' 'RF05A-SEL01(01)' WA_BSID-BELNR.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '3100' ,
' ' 'BDC_OKCODE' '=OMX',
' ' 'BDC_SUBSCR' 'SAPDF05X',
' ' 'BDC_CURSOR' 'DF05B-PSSKT(01)',
' ' 'RF05A-ABPOS' '1'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '3100' ,
' ' 'BDC_OKCODE' '=Z-',
' ' 'BDC_SUBSCR' 'SAPDF05X',
' ' 'BDC_CURSOR' 'DF05B-PSSKT(01)',
' ' 'RF05A-ABPOS' '1'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '3100' ,
' ' 'BDC_OKCODE' '=OSU',
' ' 'BDC_SUBSCR' 'SAPDF05X',
' ' 'BDC_CURSOR' 'DF05B-PSSKT(01)',
' ' 'RF05A-ABPOS' '1'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '2000' ,
' ' 'BDC_CURSOR' 'RF05A-XPOS1(01)',
' ' 'BDC_OKCODE' '=GO',
' ' 'RF05A-XPOS1(01)' 'X'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '0731' ,
' ' 'BDC_CURSOR' 'RF05A-SEL01',
' ' 'BDC_OKCODE' '=GO',
' ' 'RF05A-SEL01(01)' WA_BSID-BUZEI.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '3100' ,
' ' 'BDC_OKCODE' '=OMX',
' ' 'BDC_SUBSCR' 'SAPDF05X',
' ' 'BDC_CURSOR' 'DF05B-PSSKT(01)',
' ' 'RF05A-ABPOS' '1'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '3100' ,
' ' 'BDC_OKCODE' '=Z+',
' ' 'BDC_SUBSCR' 'SAPDF05X ',
' ' 'BDC_CURSOR' 'DF05B-PSSKT(01)',
' ' 'RF05A-ABPOS' '1'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPDF05X' '3100' ,
' ' 'BDC_OKCODE' '=KMD',
' ' 'BDC_SUBSCR' 'SAPDF05X ',
' ' 'BDC_CURSOR' 'DF05B-PSSKT(01)',
' ' 'RF05A-ABPOS' '1'.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPMF05A' '0700' ,
' ' 'BDC_CURSOR' 'RF05A-NEWKO',
' ' 'BDC_OKCODE' '/00',
' ' 'BKPF-XBLNR' WA_BATCH-REFERENCIA,
' ' 'BKPF-BKTXT' WA_BATCH-TXTCAB,
' ' 'RF05A-NEWBS' WA_BATCH-CH1,
' ' 'RF05A-NEWKO' WA_BATCH-CTA.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPMF05A' '0300' ,
' ' 'BDC_CURSOR' 'BSEG-WRBTR',
' ' 'BDC_OKCODE' '/00',
' ' 'BSEG-WRBTR' WA_BATCH-VALOR,
' ' 'BSEG-VALUT' WA_BATCH-DTA_LCTO.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPLKACB' '0002' ,
' ' 'BDC_CURSOR' 'COBL-KOSTL',
' ' 'BDC_OKCODE' '=ENTE',
' ' 'COBL-KOSTl' WA_BATCH-CENTR.
PERFORM ZE_MOVER_BDC USING:
'X' 'SAPMF05A' '0300' ,
' ' 'BSEG-WRBTR' WA_BATCH-VALOR,
' ' 'BDC_OKCODE' '=BU'.
PERFORM F_EXECUTA_TRANSACAO.
PERFORM F_MENSAGEM.
CLEAR: INT_BDC, T_BDCMSG, W_TABIX, W_POSICAO.
REFRESH: INT_BDC, T_BDCMSG.
ENDLOOP.
Form f_executa_transação
Call-Transaction parameters
CLEAR T_CTU_PARAMS.
A: show all dynpros E: show dynpro on error only
N: do not display dynpro
T_CTU_PARAMS-DISMODE = P_MODE.
S: synchronously A: asynchronously L: local
T_CTU_PARAMS-UPDMODE = 'S'.
T_CTU_PARAMS-RACOMMIT = 'X'.
T_CTU_PARAMS-DEFSIZE = 'X'.
T_CTU_PARAMS-NOBINPT = 'X'.
T_CTU_PARAMS-NOBIEND = 'X'.
*Executa a transação
CALL TRANSACTION W_TRANS USING INT_BDC
OPTIONS FROM T_CTU_PARAMS
MESSAGES INTO T_BDCMSG.
ENDFORM. " f_executa_transacao -
About material master data batch input
hello
i wrote a batch input for material master data. but it can't work ,i can't use it to create material.hope someone help me!thanks.code is below.
report z_mat_batchinput no standard page heading
line-size 255 message-id YB.
mat batch input
include bdcrecx1.
include .
tables: mara,marm,MARC,MARD,T134,NRIV,T006A,T023,T001W,T001L,
TVKO,TVTW,T025,TTGR,TLGR,TVKWZ,T006.
data: DIMID like t006-DIMID.
data: flag, K, tmp.
DATA: X TYPE I.
************ÉÏÔØÎļþÄÚ±í************************
data: begin of record occurs 0,
MATNR(018), " ÎïÁϺÅ
MTART(004), " ÎïÁÏÀàÐÍ
**generaldata1**
MAKTX(040), " ÎïÁÏÃèÊö
EAKTX(040), " Ó¢ÎÄÃèÊö
MEINS(003), " »ù±¾¼ÆÁ¿µ¥Î»
MATKL(009), " ÎïÁÏ×é
BISMT(018), " ¾ÉÎïÁϺÅ
EXTWG(018), " ÍⲿÎïÁÏ×é
SPART(002), " ²¿ÃÅ
MTPOS_MARA(004), " ÆÕͨÏîÄ¿Àà±ð×é
BRGEW(017), " ëÖØ
GEWEI(003), " ÖØÁ¿µ¥Î»
NTGEW(017), " ¾»ÖØ
VOLUM(017), " Ìå»ý
VOLEH(003), " Ìå»ýµ¥Î»
GROES(032), " Á¿¸Ù
MAGRV(004), " ÎïÁÏ×éµÄ°ü×°Îï
**generaldata2**
NORMT(018), " ¹¤Òµ±ê×¼ÃèÊö
FERTH(018), " ÀàÐÍ
WRKST(048), " ¹æ¸ñ
**generaldata1**
EAN11(018), " ²úÆ·±íʶÂë
**generaldata2**
ZEIAR(003), " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ
WERKS(004), " ¹¤³§
VKORG(004), " ÏúÊÛ×éÖ¯
VTWEG(002), " ·ÖÏúÇþµÀ
**salesorg 1**
VRKME(003), " ÏúÊÛµ¥Î»
VMREN(006), " ÏúÊÛµ¥Î»×ª»»Òò×Ó
VMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SPART(002), " ²úÆ·×é
DWERK(004), " ½»»õ¹¤³§
TAXKM(001), " ÎïÁÏË°·ÖÀà
**salesorg 2**
KONDM(002), " ÎïÁ϶¨¼Û×é
KTGRM(002), " ¿ÆÄ¿ÉèÖÃ×é
MVGR1(003), " ÎïÁÏ×é 1
MVGR2(003), " ÎïÁÏ×é 2
MTPOS(004), " ÏîÄ¿Àà±ð×é
VERSG(001), " ÎïÁÏͳ¼Æ×é
**ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**
MTVFP(002), " ¿ÉÓÃÐÔ¼ì²é
XCHPF(001), " Åú´Î¹ÜÀí
YCHPF(001), " ÅúÁ¿¹ÜÀí
TRAGR(004), " ÔËÊä×é
ladgr(004), " ×°ÔØ×é
**pur**
BSTME(003), " ¶©µ¥µ¥Î»
UMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREN(006), " ¶©µ¥µ¥Î»×ª»»Òò×Ó
WEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
EKGRP(003), " ²É¹º×é
LGORT(004), " ¿â´æµØ
**Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**
AUSME(003), " ·¢»õµ¥Î»
UMREJ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREF(006), " ·¢»õµ¥Î»×ª»»Òò×Ó
XCHPF(001), " ÅúÁ¿¹ÜÀí
**MRP 1**
DISGR(004), " MRP×é
DISMM(002), " MRPÀàÐÍ
FXHOR(003), " ¼Æ»®µÄʱ½ì
DISPO(003), " MRP¿ØÖÆÕß
DISLS(002), " ÅúÁ¿
MAABC(001), " ABC±êʶ
BSTFE(018), " ¹Ì¶¨ÅúÁ¿´óС
**MRP 2**
RESKZ(001), " »ñÈ¡ÀàÐÍ
BESKZ(001), " ²É¹ºÀàÐÍ
SOBSL(002), " ÌØÊâ²É¹ºÀà
LGPRO(004), " ·¢»õ²Ö´¢µØµã
RGEKZ(001), " ·´³å
PLIFZ(003), " ¼Æ»®½»»õʱ¼ä
VEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
DZEIT(008), "×ÔÖÆÉú²ú
FHORI(003), " ¼Æ»®±ß¼ÊÂë
EISBE(018), " °²È«¿â´æ
**MRP 3**
PERKZ(001), " ÆÚ¼ä±êʶ
STRGR(002), " ²ßÂÔ×é
VRMOD(001), " ÏûºÄģʽ
VINT1(003), " ÄæÏòÏûºÄÆÚ¼ä
VINT2(003), " ÏòÇ°ÏûºÄÆÚ¼ä
NTVFP(002), " ¿ÉÓÃÐÔ¼ì²é
**MRP 4**
SAUFT(001), " Öظ´ÖÆÔì±êÖ¾
SFEPR(004), " Öظ´Éú²ú²ÎÊýÎļþ
**¹¤×÷¼Æ»®**
FEVOR(003), " Éú²úµ÷¶ÈÔ±
FRTME(003), " Éú²úµ¥Î»
SMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SMREN(006), " Éú²úµ¥Î»×ª»»Òò×Ó
UEETK(001), " ÎÞÏÞÖƹýÁ¿½»»õ
**»á¼Æ 1**
BKLAS(004), " ÆÀ¹ÀÀà
BWTTY(001), " ¹À¼Û·ÖÀà
VPRSV(001), " ¼Û¸ñ¿ØÖÆ
PEINH(006), " ¼Û¸ñµ¥Î»
VERPR(015), " Òƶ¯Æ½¾ù¼Û
STPRS(015), " ±ê×¼¼Û
**»á¼Æ 2**
BWPRH(014), " ÉÌÒµ¼Û¸ñ 1
**³É±¾ 1**
LOSGR(018), " ÅúÁ¿³É±¾ºËËã
**³É±¾ 2**
ZPLP1(014), " ¼Æ»®¼Û¸ñ 1
ZPLD1(010), " ¼Æ»®ÈÕÆÚ 1
**qm**
ART1(8), "¼ìÑéÀàÐÍ1
AKTIV1(1), "ÒѼ¤»î
QMPUR(1), "¼¤»î²É¹ºÖÐµÄ QM
SSQSS(8), "QM ¿ØÖÆÂë¡¢
QMATV(8), "QM¼ìÑéÉèÖÃ
ART2(8), "¼ìÑéÀàÐÍ2
AKTIV2(6), "ÒѼ¤»î
ART3(8), "¼ìÑéÀàÐÍ3
AKTIV3(6), "ÒѼ¤»î
end of record.
************ÏÂÔظñʽ/´íÎóÎļþÄÚ±í**************
data: begin of record1 occurs 0,
MATNR(018), " ÎïÁϺÅ
MTART(008), " ÎïÁÏÀàÐÍ
**»ù±¾Êý¾Ý1**
MAKTX(040), " ÎïÁÏÃèÊö
EAKTX(040), " Ó¢ÎÄÃèÊö
MEINS(013), " »ù±¾¼ÆÁ¿µ¥Î»
MATKL(009), " ÎïÁÏ×é
BISMT(018), " ¾ÉÎïÁϺÅ
EXTWG(018), " ÍⲿÎïÁÏ×é
SPART(002), " ²¿ÃÅ
MTPOS_MARA(004), " ÆÕͨÏîÄ¿Àà±ð×é
BRGEW(017), " ëÖØ
GEWEI(008), " ÖØÁ¿µ¥Î»
NTGEW(017), " ¾»ÖØ
VOLUM(017), " Ìå»ý
VOLEH(008), " Ìå»ýµ¥Î»
GROES(032), " Á¿¸Ù
MAGRV(014), " ÎïÁÏ×éµÄ°ü×°Îï
**»ù±¾Êý¾Ý2**
NORMT(018), " ¹¤Òµ±ê×¼ÃèÊö
FERTH(018), " ÀàÐÍ
WRKST(048), " ¹æ¸ñ
**»ù±¾Êý¾Ý1**
EAN11(018), " ²úÆ·±íʶÂë
**»ù±¾Êý¾Ý2**
ZEIAR(003), " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ
WERKS(004), " ¹¤³§
VKORG(008), " ÏúÊÛ×éÖ¯
VTWEG(008), " ·ÖÏúÇþµÀ
**ÏúÊÛ×éÖ¯ 1**
VRKME(003), " ÏúÊÛµ¥Î»
VMREN(006), " ÏúÊÛµ¥Î»×ª»»Òò×Ó
VMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SPART(006), " ²úÆ·×é
DWERK(008), " ½»»õ¹¤³§
TAXKM(010), " ÎïÁÏË°·ÖÀà
**ÏúÊÛ×éÖ¯ 2**
KONDM(010), " ÎïÁ϶¨¼Û×é
KTGRM(010), " ¿ÆÄ¿ÉèÖÃ×é
MVGR1(003), " ÎïÁÏ×é 1
MVGR2(003), " ÎïÁÏ×é 2
MTPOS(010), " ÏîÄ¿Àà±ð×é
VERSG(001), " ÎïÁÏͳ¼Æ×é
**ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**
MTVFP(010), " ¿ÉÓÃÐÔ¼ì²é
XCHPF(008), " Åú´Î¹ÜÀí
YCHPF(001), " ÅúÁ¿¹ÜÀí
TRAGR(006), " ÔËÊä×é
ladgr(006), " ×°ÔØ×é
**²É¹º**
BSTME(003), " ¶©µ¥µ¥Î»
UMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREN(006), " ¶©µ¥µ¥Î»×ª»»Òò×Ó
WEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
EKGRP(006), " ²É¹º×é
LGORT(004), " ¿â´æµØ
**Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**
AUSME(003), " ·¢»õµ¥Î»
UMREJ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREF(006), " ·¢»õµ¥Î»×ª»»Òò×Ó
XCHPF(001), " ÅúÁ¿¹ÜÀí
**MRP 1**
DISGR(004), " MRP×é
DISMM(009), " MRPÀàÐÍ
FXHOR(003), " ¼Æ»®µÄʱ½ì
DISPO(011), " MRP¿ØÖÆÕß
DISLS(004), " ÅúÁ¿
MAABC(007), " ABC±êʶ
BSTFE(018), " ¹Ì¶¨ÅúÁ¿´óС
**MRP 2**
RESKZ(001), " »ñÈ¡ÀàÐÍ
BESKZ(008), " ²É¹ºÀàÐÍ
SOBSL(002), " ÌØÊâ²É¹ºÀà
LGPRO(004), " ·¢»õ²Ö´¢µØµã
RGEKZ(001), " ·´³å
PLIFZ(012), " ¼Æ»®½»»õʱ¼ä
VEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
DZEIT(008), "×ÔÖÆÉú²ú
FHORI(010), " ¼Æ»®±ß¼ÊÂë
EISBE(018), " °²È«¿â´æ
**MRP 3**
PERKZ(008), " ÆÚ¼ä±êʶ
STRGR(006), " ²ßÂÔ×é
VRMOD(001), " ÏûºÄģʽ
VINT1(003), " ÄæÏòÏûºÄÆÚ¼ä
VINT2(003), " ÏòÇ°ÏûºÄÆÚ¼ä
NTVFP(010), " ¿ÉÓÃÐÔ¼ì²é
**MRP 4**
SAUFT(001), " Öظ´ÖÆÔì±êÖ¾
SFEPR(004), " Öظ´Éú²ú²ÎÊýÎļþ
**¹¤×÷¼Æ»®**
FEVOR(003), " Éú²úµ÷¶ÈÔ±
FRTME(003), " Éú²úµ¥Î»
SMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SMREN(006), " Éú²úµ¥Î»×ª»»Òò×Ó
UEETK(001), " ÎÞÏÞÖƹýÁ¿½»»õ
**»á¼Æ 1**
BKLAS(006), " ÆÀ¹ÀÀà
BWTTY(001), " ¹À¼Û·ÖÀà
VPRSV(008), " ¼Û¸ñ¿ØÖÆ
PEINH(008), " ¼Û¸ñµ¥Î»
VERPR(015), " Òƶ¯Æ½¾ù¼Û
STPRS(015), " ±ê×¼¼Û
**»á¼Æ 2**
BWPRH(014), " ÉÌÒµ¼Û¸ñ 1
**³É±¾ 1**
LOSGR(018), " ÅúÁ¿³É±¾ºËËã
**³É±¾ 2**
ZPLP1(014), " ¼Æ»®¼Û¸ñ 1
ZPLD1(010), " ¼Æ»®ÈÕÆÚ 1
**ÖÊÁ¿¹ÜÀí**
ART1(8), "¼ìÑéÀàÐÍ1
AKTIV1(6), "ÒѼ¤»î
QMPUR(010), "¼¤»î²É¹ºÖÐµÄ QM
SSQSS(8), "QM ¿ØÖÆÂë¡¢
QMATV(8), "QM¼ìÑéÉèÖÃ
ART2(8), "¼ìÑéÀàÐÍ2
AKTIV2(6), "ÒѼ¤»î
ART3(8), "¼ìÑéÀàÐÍ3
AKTIV3(6), "ÒѼ¤»î
end of record1.
selection-screen begin of block 0 with frame title text-001.
selection-screen begin of line .
selection-screen position 1.
parameters: test like rkec1-test .
selection-screen
comment 3(4) text-004 for field test.
selection-screen position 26.
parameters: oldfile like rlgrap-filename.
selection-screen
comment 9(17) text-003 for field oldfile.
selection-screen: end of line.
selection-screen begin of line.
selection-screen position 1.
parameters: dnldflag like rkec1-test default 'X'.
selection-screen
comment 3(4) text-005 for field dnldflag.
selection-screen position 26.
parameters: outfile like rlgrap-filename .
selection-screen
comment 9(17) text-006 for field outfile.
selection-screen: end of line.
selection-screen end of block 0 .
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-002.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: GEN1 LIKE RKEC1-TEST.
selection-screen
comment 3(9) text-007 for field GEN1.
selection-screen position 26.
PARAMETERS: GEN2 LIKE RKEC1-TEST.
selection-screen
comment 28(9) text-008 for field GEN2.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: SALORG1 LIKE RKEC1-TEST.
selection-screen
comment 3(21) text-009 for field SALORG1.
selection-screen position 26.
PARAMETERS: SALORG2 LIKE RKEC1-TEST.
selection-screen
comment 28(21) text-010 for field SALORG2.
selection-screen position 51.
PARAMETERS: SALPLANT LIKE RKEC1-TEST.
selection-screen
comment 53(19) text-011 for field SALPLANT.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: PURCHASE LIKE RKEC1-TEST.
selection-screen
comment 3(21) text-012 for field PURCHASE.
selection-screen position 26.
PARAMETERS: PLTSTRG1 LIKE RKEC1-TEST.
selection-screen
comment 28(21) text-018 for field PLTSTRG1.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: MRP1 LIKE RKEC1-TEST.
selection-screen
comment 3(4) text-013 for field MRP1.
selection-screen position 13.
PARAMETERS: MRP2 LIKE RKEC1-TEST.
selection-screen
comment 15(4) text-014 for field MRP2.
selection-screen position 26.
PARAMETERS: MRP3 LIKE RKEC1-TEST.
selection-screen
comment 28(4) text-015 for field MRP3.
selection-screen position 37.
PARAMETERS: MRP4 LIKE RKEC1-TEST.
selection-screen
comment 39(4) text-016 for field MRP4.
selection-screen position 51.
PARAMETERS: PLANTSTR LIKE RKEC1-TEST.
selection-screen
comment 53(8) text-017 for field PLANTSTR.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: QAU LIKE RKEC1-TEST.
selection-screen
comment 3(8) text-023 for field QAU.
selection-screen position 13.
PARAMETERS: ACC1 LIKE RKEC1-TEST.
selection-screen
comment 15(5) text-019 for field ACC1.
selection-screen position 26.
PARAMETERS: ACC2 LIKE RKEC1-TEST.
selection-screen
comment 28(5) text-020 for field ACC2.
selection-screen position 37.
PARAMETERS: COR1 LIKE RKEC1-TEST.
selection-screen
comment 39(5) text-021 for field COR1.
selection-screen position 51.
PARAMETERS: COR2 LIKE RKEC1-TEST.
selection-screen
comment 53(5) text-022 for field COR2.
selection-screen end of line.
SELECTION-SCREEN END OF BLOCK 1.
at selection-screen on value-request for oldfile.
call function 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = ',Îı¾Îļþ(ÖƱí·û·Ö¸ô),*.txt'
static = 'X'
CHANGING
file_name = oldfile.
at selection-screen on value-request for outfile.
call function 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = ',Microsoft Excel¹¤×÷²¾,*.xls'
static = 'X'
CHANGING
file_name = outfile.
initialization.
******µÃµ½ÎļþĿ¼*******
call function 'WS_QUERY'
EXPORTING
query = 'CD'
IMPORTING
return = outfile.
if sy-subrc <> 0.
message e005 with outfile.
endif.
oldfile = outfile.
concatenate outfile 'mat_fat' into outfile.
*ÅúÊäÈëĬÈÏÃû³Æ
group = 'MATBATCHIN'.
start-of-selection.
if dnldflag eq 'X' and not ( outfile is initial ).
perform download_data.
stop.
endif.
perform upload_data.
if test = ' '.
*ÊÓͼ²ÎÊý¼ì²é
IF ( GEN1 NE 'X' AND GEN2 NE 'X' AND SALORG1 NE 'X'
AND SALORG2 NE 'X' AND SALPLANT NE 'X'
AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'
AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'
AND MRP4 NE 'X' AND PLANTSTR NE 'X'
AND ACC1 NE 'X' AND ACC2 NE 'X'
AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .
MESSAGE E000 WITH 'ÇëÑ¡ÔñÐèά»¤ÊÓͼ'.
ENDIF.
perform open_group.
SORT RECORD BY WERKS MATNR.
loop at record.
perform bdc_fill.
perform bdc_transaction using 'MM01'.
clear: bdcdata.
refresh: bdcdata.
endloop.
perform close_group.
else.
perform file_check.
endif.
end-of-selection.
*& Form UPLOAD_DATA
ÉÏÔØÅúÊäÈëÊý¾Ý
--> p1 text
<-- p2 text
form upload_data.
call function 'WS_UPLOAD'
EXPORTING
filename = oldfile
filetype = 'DAT'
TABLES
data_tab = record
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
customer_error = 9
others = 10.
if sy-subrc <> 0.
message E000 with 'ÇëÊäÈëÉÏÔØÎļþ'.
endif.
read table record with key MATNR = '**'.
if sy-tabix lt 1.
message E000 with 'ÉÏÔØÎļþÎļþÍ·ÓëÊý¾ÝÖ®¼äÎÞ**'.
endif.
delete record from 1 to sy-tabix.
endform. " UPLOAD_DATA
*& Form BDC_FILL
ÅúÊäÈë
--> p1 text
<-- p2 text
form bdc_fill.
data: N type I,
M type I,
S_MATNR(018),
test(1) type N.
PERFORM BDC_FILL_INITALSCR. "³õʼÆÁÄ»
tmp = '0'.
condense record-matnr no-gaps.
test = record-matnr(1).
if test <> ''.
M = STRLEN( RECORD-MATNR ).
M = 18 - M.
DO M TIMES.
CONCATENATE '0' RECORD-MATNR INTO S_MATNR.
RECORD-MATNR = S_MATNR.
ENDDO.
endif.
**ÅжÏÎïÁÏ»ù±¾ÊÓͼÊÇ·ñÒѾ±»Î¬»¤¹ý**
SELECT SINGLE * FROM MARA WHERE MATNR = RECORD-MATNR.
IF SY-SUBRC NE 0.
K = '0'.
Else.
condense MARA-PSTAT no-gaps.
N = strlen( mara-pstat ).
M = 0.
record-meins = mara-meins.
do N times.
K = MARA-PSTAT+M.
IF K = 'K'.
EXIT.
ENDIF.
M = M + 1.
enddo.
ENDIF.
IF ( ( GEN1 EQ 'X' OR GEN2 EQ 'X' ) AND SALORG1 NE 'X'
AND SALORG2 NE 'X' AND SALPLANT NE 'X'
AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'
AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'
AND MRP4 NE 'X' AND PLANTSTR NE 'X'
AND ACC1 NE 'X' AND ACC2 NE 'X'
AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .
IF K EQ 'K'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(15)'.
perform bdc_field using 'BDC_OKCODE'
'/N'.
ELSE.
PERFORM BDC_FILL_CHOICEVIEW. "Ñ¡ÔñÊÓͼ
ENDIF.
ELSE.
PERFORM BDC_FILL_CHOICEVIEW. "Ñ¡ÔñÊÓͼ
PERFORM BDC_FILL_ORGVIEW. "×éÖ¯¼¶±ð
ENDIF.
TRANSLATE record-MEINS TO UPPER CASE.
TRANSLATE record-BSTME TO UPPER CASE.
TRANSLATE record-VRKME TO UPPER CASE.
TRANSLATE record-FRTME TO UPPER CASE.
TRANSLATE record-AUSME TO UPPER CASE.
if gen1 eq 'X'.
IF K NE 'K'.
PERFORM GENERALDATA1.
ENDIF.
endif.
if gen2 eq 'X'.
IF K NE 'K'.
perform generaldata2.
ENDIF.
endif.
if salorg1 eq 'X'.
perform salorg1.
endif.
if salorg2 eq 'X'.
perform salorg2.
endif.
if salplant eq 'X'.
perform salplant.
endif.
if purchase eq 'X'.
perform purchasedata.
endif.
if mrp1 eq 'X'.
perform MRP1.
endif.
if mrp2 eq 'X'.
perform MRP2.
endif.
if mrp3 eq 'X'.
perform MRP3.
endif.
if mrp4 eq 'X'.
perform MRP4.
endif.
if PLANTSTR eq 'X'.
perform PLANTSTR.
endif.
if PLTSTRG1 eq 'X'.
perform PLTSTRG1.
endif.
if qau eq 'X'.
perform qualitydata.
endif.
if ACC1 eq 'X'.
perform ACC1DATA.
endif.
if ACC2 eq 'X'.
perform ACC2DATA.
endif.
if COR1 eq 'X'.
perform COR1DATA.
endif.
if COR2 eq 'X'.
perform COR2DATA.
endif.
perform BDC_SAVE.
endform. " BDC_FILL
*& Form GENERALDATA1
Ò»°ãÊý¾Ý 1
--> p1 text
<-- p2 text
form generaldata1.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
"'=ZU01'.
'/00'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX. " ÎïÁÏÃèÊö
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»
perform bdc_field using 'MARA-MATKL'
record-MATKL. " ÎïÁÏ×é
perform bdc_field using 'MARA-BISMT'
record-BISMT.
perform bdc_field using 'MARA-EXTWG'
record-EXTWG.
perform bdc_field using 'MARA-SPART'
record-SPART.
perform bdc_field using 'MARA-MTPOS_MARA'
record-MTPOS_MARA.
perform bdc_field using 'BDC_CURSOR'
'MARA-GROES'.
perform bdc_field using 'MARA-BRGEW'
record-BRGEW.
if record-gewei = '' and ( salorg1 = 'X' or salorg2 = 'X'
or salplant = 'X' ).
perform bdc_field using 'MARA-GEWEI'
'KG'. " ÖØÁ¿µ¥Î»
else.
perform bdc_field using 'MARA-GEWEI'
record-GEWEI. " ÖØÁ¿µ¥Î»
endif.
perform bdc_field using 'MARA-NTGEW'
record-NTGEW.
perform bdc_field using 'MARA-VOLUM'
record-VOLUM.
perform bdc_field using 'MARA-VOLEH'
record-VOLEH.
perform bdc_field using 'MARA-GROES'
record-GROES.
condense record-EAN11 no-gaps.
if record-EAN11 <> ''.
perform bdc_field using 'MARA-EAN11'
record-EAN11.
perform bdc_field using 'MARA-NUMTP'
'HT'.
endif.
perform bdc_field using 'MARA-MAGRV'
record-MAGRV.
perform bdc_dynpro using 'SAPLMGMM' '4300'.
perform bdc_field using 'BDC_OKCODE'
'=ZU02'.
condense record-EAKTX no-gaps.
if record-EAKTX <> ''.
perform bdc_field using 'SKTEXT-SPRAS(2)'
'EN'.
perform bdc_field using 'SKTEXT-MAKTX(2)'
record-EAKTX.
endif.
perform bdc_dynpro using 'SAPLMGMM' '4300'.
perform bdc_field using 'BDC_OKCODE'
'=MAIN'.
if record-meins <> 'PAK'.
perform bdc_field using 'SMEINH-UMREN(05)'
'1'.
perform bdc_field using 'SMEINH-MEINH(05)'
'PAK'.
perform bdc_field using 'SMEINH-UMREZ(05)'
'1'.
endif.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endform. " GENERALDATA
*& Form generaldata2
Ò»°ãÊý¾Ý 2
--> p1 text
<-- p2 text
FORM generaldata2.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARA-NORMT'.
condense record-ferth no-gaps.
if record-ferth <> ''.
perform bdc_field using 'MARA-FERTH'
record-FERTH.
endif.
perform bdc_field using 'MARA-NORMT'
record-NORMT.
perform bdc_field using 'MARA-WRKST'
record-WRKST.
perform bdc_field using 'MARA-ZEIAR'
record-ZEIAR.
ENDFORM. " generaldata2
*& Form salorg1
ÏúÊÛ×éÖ¯ 1
--> p1 text
<-- p2 text
FORM salorg1.
condense RECORD-SPART no-gaps.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'MAKT-MAKTX'
RECORD-MAKTX. " ÎïÁÏÃèÊö
IF K NE 'K'.
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»
ENDIF.
perform bdc_field using 'MARA-SPART'
record-SPART. " ²úÆ·×é
perform bdc_field using 'MVKE-DWERK'
record-DWERK. " ½»»õ¹¤³§
PERFORM BDC_FIELD USING 'MG03STEUER-TAXKM(01)'
RECORD-TAXKM. " ÎïÁÏË°·ÖÀà
condense RECORD-VRKME no-gaps.
IF RECORD-MEINS <> RECORD-VRKME and RECORD-VRKME <> ''.
perform bdc_field using 'MVKE-VRKME'
record-VRKME. " ÏúÊÛµ¥Î»
select single * from MARM where matnr = record-matnr
and meinh = record-vrkme.
if SY-SUBRC NE 0.
tmp = 'W'.
select single * from t006 where MSEHI = record-meins.
if t006-DIMID = 'AAAADL'.
DIMID = ''.
else.
DIMID = t006-DIMID.
endif.
select single * from t006 where MSEHI = record-vrkme.
if dimid <> t006-DIMID.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMZU-UMREN'
record-VMREN. "ÏúÊÛµ¥Î»×ª»»Òò×Ó
perform bdc_field using 'RMMZU-UMREZ'
record-VMREZ. "»ù±¾µ¥Î»×ª»»Òò×Ó
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
endif.
endif.
ENDIF.
perform bdc_dynpro using 'SAPLMGMM' '4200'.
perform bdc_field using 'BDC_OKCODE' " µ÷ÓÃË°Àà×ÓÆÁÄ»
'/00'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' " ·µ»ØÏúÊÛ×éÖ¯ 1ÆÁÄ»
'/00'.
ENDFORM. " salorg1
*& Form salorg2
ÏúÊÛ×éÖ¯ 2
--> p1 text
<-- p2 text
FORM salorg2.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MVKE-KTGRM'.
PERFORM BDC_FIELD USING 'MVKE-VERSG'
RECORD-VERSG. " ÎïÁÏͳ¼Æ×é
PERFORM BDC_FIELD USING 'MVKE-KTGRM'
RECORD-KTGRM. " ¿ÆÄ¿ÉèÖÃ×é
PERFORM BDC_FIELD USING 'MVKE-KONDM'
RECORD-KONDM. " ÎïÁ϶¨¼Û×é
perform bdc_field using 'MVKE-MTPOS'
RECORD-MTPOS. " ÏîÄ¿Àà±ð×é
PERFORM BDC_FIELD USING 'MVKE-MVGR1'
RECORD-MVGR1. " ÎïÁÏ×é 1
PERFORM BDC_FIELD USING 'MVKE-MVGR2'
RECORD-MVGR2. " ÎïÁÏ×é 2
ENDFORM. " salorg2
*& Form salplant
ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý
--> p1 text
<-- p2 text
FORM salplant.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
select single * from marc where matnr = record-matnr
and werks = record-werks.
if SY-SUBRC NE 0 OR MARC-MTVFP = ''.
PERFORM BDC_FIELD USING 'MARC-MTVFP'
RECORD-MTVFP. " ¿ÉÓÃÐÔ¼ì²é
endif.
PERFORM BDC_FIELD USING 'MARA-TRAGR'
RECORD-TRAGR. " ÔËÊä×é
PERFORM BDC_FIELD USING 'MARC-LADGR'
RECORD-LADGR. " ×°ÔØ×é
perform bdc_field using 'MARC-XCHPF'
record-XCHPF. " ÅúÁ¿¹ÜÀí
ENDFORM. " salplant
*& Form PURCHASEDATA
²É¹ºÊý¾Ý
--> p1 text
<-- p2 text
form purchasedata.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARC-WEBAZ'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX.
IF K NE 'K'.
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»
perform bdc_field using 'MARA-MATKL'
record-MATKL. " ÎïÁÏ×é
ENDIF.
condense RECORD-BSTME no-gaps.
IF RECORD-MEINS <> RECORD-BSTME and RECORD-BSTME <> ''.
perform bdc_field using 'MARA-BSTME'
record-BSTME. " ¶©µ¥µ¥Î»
select single * from MARM where matnr = record-matnr
and meinh = record-bstme.
if SY-SUBRC NE 0 and
( record-vrkme <> record-bstme or tmp <> 'W' ).
tmp = 'W'.
select single * from t006 where MSEHI = record-meins.
if t006-DIMID = 'AAAADL'.
DIMID = ''.
else.
DIMID = t006-DIMID.
endif.
select single * from t006 where MSEHI = record-bstme.
if dimid <> t006-DIMID.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMZU-UMREN'
record-UMREN. "¶©µ¥µ¥Î»×ª»»Òò×Ó
perform bdc_field using 'RMMZU-UMREZ'
record-UMREZ. "»ù±¾µ¥Î»×ª»»Òò×Ó
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
endif.
endif.
ENDIF.
perform bdc_field using 'MARC-EKGRP'
record-EKGRP. " ²É¹º×é
perform bdc_field using 'MARC-WEBAZ'
record-WEBAZ. " ÊÕ»õ´¦Àíʱ¼ä
endform. " PURCHASEDATA
*& Form MRP1
text
--> p1 text
<-- p2 text
FORM MRP1.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX. " ÎïÁÏÃèÊö
IF K NE 'K'.
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾µ¥Î»
ENDIF.
perform bdc_field using 'MARC-DISGR'
record-DISGR. " MRP×é
perform bdc_field using 'MARC-MAABC'
record-MAABC. " ABC±êʶ
perform bdc_field using 'MARC-DISMM'
record-DISMM. " MRPÀàÐÍ
perform bdc_field using 'MARC-FXHOR'
record-FXHOR. " ¼Æ»®µÄʱ½ì
perform bdc_field using 'MARC-DISPO'
record-DISPO. " MRP¿ØÖÆÕß
perform bdc_field using 'MARC-DISLS'
record-DISLS. " ÅúÁ¿
perform bdc_field using 'MARC-BSTFE'
Here is a sample program which creates a material with the bare minmal fields, this will get you started.
report zrich_0003 .
data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: descdata type table of BAPI_MAKT with header line.
data: return type bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.
parameters: p_matnr type mara-matnr.
headdata-material = p_matnr.
headdata-ind_sector = 'M'.
headdata-matl_type = 'FERT'.
headdata-basic_view = 'X'.
clientdata-BASE_UOM = 'EA'.
clientdatax-BASE_UOM = 'X'.
clientdata-old_mat_no = 'Old Material'.
clientdatax-old_mat_no = 'X'.
clientdata-division = '00'.
clientdatax-division = 'X'.
descdata-LANGU = sy-langu.
descdata-MATL_DESC = 'This is the description'.
append descdata.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
* PLANTDATA =
* PLANTDATAX =
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA =
* VALUATIONDATAX =
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA =
* SALESDATAX =
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
importing
return = return
tables
MATERIALDESCRIPTION = descdata
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
returnmessages = returnm
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
check sy-subrc = 0.
Regards,
Rich Heilman -
Subject in the mail sent through Batch Job
Hi,
We have a batch job which is running daily.
Consumer wants the output of the batch job (spool request) in mail. We generally send the mail from batch job by filling the mail id in "Title field".. there is some third party involved in managing spool requests..
But now consumer wants to send the mail with a subject line filled..
I could not find any field or option in SM36 where i can fill in the subject..
Please help. Now we are getting the subject as user id + spool request + system number.Check the below Code.
DATA: NUMBYTES TYPE TST01-DSIZE,
PDFSPOOLID TYPE TSP01-RQIDENT.
DATA: BEGIN OF PDFDATA OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF PDFDATA.
DATA: G1_LINES_TXT TYPE I.
DATA : L_DOCUMENT_DATA TYPE SODOCCHGI1,
T_PACKING_LIST TYPE STANDARD TABLE OF SOPCKLSTI1,
W_OBJHEAD TYPE SOLI_TAB,
T_OBJBIN TYPE STANDARD TABLE OF SOLISTI1,
T_OBJTXT TYPE STANDARD TABLE OF SOLISTI1,
LW_PACKING_LIST TYPE SOPCKLSTI1,
L_LINES TYPE I,
W_RECEIVER TYPE SOMLRECI1,
T_RECEIVER TYPE STANDARD TABLE OF SOMLRECI1.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
*...Read the Spool request number generated.
SELECT MAX( RQIDENT ) INTO G_SPOOL_NUM
FROM TSP01
WHERE RQCLIENT = SY-MANDT AND
RQOWNER = SY-UNAME.
*....Convert Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = G_SPOOL_NUM
NO_DIALOG = 'X'
DST_DEVICE = G_PDEST
IMPORTING
PDF_BYTECOUNT = NUMBYTES
TABLES
PDF = PDFDATA
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12.
*...Convert 132 char to 255 char
LOOP AT PDFDATA.
TRANSLATE PDFDATA USING ' ~'.
CONCATENATE GD_BUFFER PDFDATA INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
DO.
IT_MESS_ATT = GD_BUFFER.
APPEND IT_MESS_ATT.
SHIFT GD_BUFFER LEFT BY 255 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Creating the document attachment
LOOP AT IT_MESS_ATT.
OBJBIN = IT_MESS_ATT.
APPEND OBJBIN.
CLEAR: OBJBIN,
IT_MESS_ATT.
ENDLOOP.
Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'IG Balance'.
*.....Subject of the email.
CONCATENATE 'Intragroup Confirmation from AoO: ' P_ZAOO INTO DOC_CHNG-OBJ_DESCR.
DOC_CHNG-OBJ_DESCR = 'Intragroup Confirmation from AoO '.
*...Body of the email
OBJTXT = 'Please find attached a summary and details '.
APPEND OBJTXT.
OBJTXT = 'Any queries regarding the attached should be addressed to the contact names on the Report.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creating the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'Balace.PDF'. APPEND OBJHEAD.
Creating the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Balance Report'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK..
Entering names in the distribution list
DATA: L_CNT TYPE I.
LOOP AT T_EMAIL INTO W_EMAIL.
IF W_EMAIL-ZCONTACT1 IS NOT INITIAL.
RECLIST-RECEIVER = W_EMAIL-ZCONTACT1.
RECLIST-REC_TYPE = 'U'.
L_CNT = L_CNT + 1.
ELSEIF W_EMAIL-ZCONTACT2 IS NOT INITIAL.
RECLIST-RECEIVER = W_EMAIL-ZCONTACT2.
RECLIST-REC_TYPE = 'U'.
L_CNT = L_CNT + 1.
ENDIF.
APPEND RECLIST.
CLEAR: RECLIST,
W_EMAIL.
ENDLOOP.
SELECT SINGLE ZAOO
ZCONTACT1
ZCONTACT2 FROM ZFI_MT_RPTRMAP INTO W_EMAIL
WHERE ZAOO EQ P_ZAOO.
IF W_EMAIL-ZCONTACT1 IS NOT INITIAL.
RECLIST-RECEIVER = W_EMAIL-ZCONTACT1.
RECLIST-REC_TYPE = 'U'.
L_CNT = L_CNT + 1.
APPEND RECLIST.
ELSEIF W_EMAIL-ZCONTACT2 IS NOT INITIAL.
RECLIST-RECEIVER = W_EMAIL-ZCONTACT2.
RECLIST-REC_TYPE = 'U'.
L_CNT = L_CNT + 1.
APPEND RECLIST.
ENDIF.
Sending the document
IF L_CNT > 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE 'Email sent successfully'.
WHEN 1.
WRITE: / 'no authorization to send to the specified number of recipients!'.
WHEN 2.
WRITE: / 'document could not be sent to any of the recipients!'.
WHEN 4.
WRITE: / 'no authorization to send !'.
WHEN OTHERS.
WRITE: / 'error occurred during sending !'.
ENDCASE.
ELSE.
MESSAGE S000 WITH TEXT-018.
STOP.
ENDIF.
*...Delete Spool Request.
DATA: SPOOLID TYPE TSP01_SP0R-RQID_CHAR.
SPOOLID = G_SPOOL_NUM.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
SPOOLID = SPOOLID
IMPORTING
RC =
STATUS =
ERROR_MESSAGE = -
Vendor batch is retrieved from LIPS-LICHN only if LIPS-LICHN is not blank,
(Current design)
Batch is retrieved from LIPS-CHARG
Vendor batch is retrieved from LIPS-LICHN
(If there is no record in LIPS, blank will be printed out for both fields)
REQUIREMENT:
Batch is retrieved from LIPS-CHARG
Vendor batch is retrieved from LIPS-LICHN only if LIPS-LICHN is not blank.
If LIPS-LICHN is blank, vendor batch is retrieved from LIPS-CHARG.
(If there is no record in LIPS, blank will be printed out for both fields. If both LIPS-CHARG and LIPS-LICHN are blank, blank will be printed out for both fields)
t-lips is the internal table :
DATA: BEGIN OF t_lips OCCURS 0,
vbeln LIKE lips-vbeln, "Delivery document no
posnr LIKE lips-posnr, "Item number for Delivery document
charg LIKE lips-charg, "Batch number
lichn LIKE lips-lichn, "Vendor Batch number
END OF t_lips.
Following is the piece of code:
*& Form f_collect_final
Routine to collect all the display data into the final internal
table t_display.
FORM f_collect_final.
DATA: l_std_pac_no LIKE eket-menge,
l_std_pac_no_out(13) TYPE p,
l_tot_std_pt(13) TYPE c,
l_rmdr(13) TYPE n,
l_qtnt(13) TYPE n,
l_tabix TYPE i.
LOOP AT t_eket.
t_display-ebeln = t_eket-ebeln.
t_display-ebelp = t_eket-ebelp.
t_display-etens = t_eket-etens.
t_display-eindt = t_eket-eindt.
t_display-menge = t_eket-menge.
t_display-meins = t_eket-meins.
t_display-matnr = t_eket-matnr.
mod begin CR1591
t_display-maktx = t_eket-maktx.
READ TABLE t_makt WITH KEY matnr = t_eket-matnr
BINARY SEARCH.
IF sy-subrc = 0.
t_display-maktx = t_makt-maktx.
ENDIF.
mod end CR1591
t_display-vpnam = t_eket-vpnam.
t_display-lifnr = t_eket-lifnr.
t_display-charg = t_eket-charg.
READ TABLE t_mlgn WITH KEY matnr = t_eket-matnr
BINARY SEARCH.
IF sy-subrc = 0.
t_display-lhmg1 = t_mlgn-lhmg1.
t_display-lhme1 = t_mlgn-lhme1.
t_display-lety1 = t_mlgn-lety1.
t_display-ltkze = t_mlgn-ltkze.
ENDIF.
READ TABLE t_marm WITH KEY matnr = t_eket-matnr
BINARY SEARCH.
IF sy-subrc = 0.
t_display-umrez = t_marm-umrez.
t_display-meinh = t_eket-meins.
ENDIF.
READ TABLE t_marc WITH KEY matnr = t_eket-matnr
BINARY SEARCH.
IF sy-subrc = 0.
t_display-zzjp_nyu_sop = t_marc-zzjp_nyu_sop.
t_display-zzjp_dos_frm = t_marc-zzjp_dos_frm.
t_display-zzjp_aprn = t_marc-zzjp_aprn.
t_display-zzjp_re1 = t_marc-zzjp_re1.
ENDIF.
READ TABLE t_lfa1 WITH KEY lifnr = t_eket-lifnr
BINARY SEARCH.
IF sy-subrc = 0.
t_display-name1 = t_lfa1-name1.
ENDIF.
READ TABLE t_lips WITH KEY vbeln = t_eket-vbeln
posnr = t_eket-vbelp
BINARY SEARCH.
l_tabix = sy-tabix.
IF sy-subrc = 0.
t_display-charg = t_lips-charg.(I think this is the place to change).
t_display-lichn = t_lips-charg.
ENDIF.
I have tried with the following code, but it is not working.
IF sy-subrc = 0.
t_display-charg = t_lips-charg.
IF not t_lips-lichn is initial.
t_display-lichn = t_lips-lichn.
ELSE.
t_display-lichn = t_lips-charg.
ENDIF.
ENDIF.Hi,
Find the modification below, consider the bold text and remove the old one:
READ TABLE t_lips WITH KEY vbeln = t_eket-vbeln
posnr = t_eket-vbelp
BINARY SEARCH.
l_tabix = sy-tabix.
IF sy-subrc = 0.
<b>if t_lips-lichn EQ space AND
t_lips-charg NE space.
t_display-charg = t_lips-charg.
t_display-lichn = t_lips-charg.
endif.</b>
<i>t_display-charg = t_lips-charg.(I think this is the place to change).
t_display-lichn = t_lips-charg.</i>ENDIF. -
Hi,
can anybody plz drop me a piece of code for running BDC for the transactions 'ME21' & 'ME51' transaction, in which BDC trable control will be occuring.
Your help is verymuch required for these two BDC table control code.
Thanks in advance...
Thanks & Regards
SangramHi Sangram,
here is a sample BDC code for ME21
if needed add/delete the fields
REPORT zmm_bdcp_purchaseorderkb02
NO STANDARD PAGE HEADING LINE-SIZE 255.
Declaring internal tables *
*-----Declaring line structure
DATA : BEGIN OF it_dummy OCCURS 0,
dummy(255) TYPE c,
END OF it_dummy.
*-----Internal table for line items
DATA : BEGIN OF it_idata OCCURS 0,
ematn(18), "Material Number.
menge(13), "Qyantity.
netpr(11), "Net Price.
werks(4), "Plant.
ebelp(5), "Item Number.
END OF it_idata.
*-----Deep structure for header data and line items
DATA : BEGIN OF it_me21 OCCURS 0,
lifnr(10), "Vendor A/c No.
bsart(4), "A/c Type.
bedat(8), "Date of creation of PO.
ekorg(4), "Purchasing Organisation.
ekgrp(3), "Purchasing Group.
x_data LIKE TABLE OF it_idata,
END OF it_me21.
DATA : x_idata LIKE LINE OF it_idata.
DATA : v_delimit VALUE ','.
DATA : v_indx(3) TYPE n.
DATA : v_fnam(30) TYPE c.
DATA : v_count TYPE n.
DATA : v_ne TYPE i.
DATA : v_ns TYPE i.
*include bdcrecx1.
INCLUDE zmm_incl_purchaseorderkb01.
Search help for file *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
START-OF-SELECTION.
To upload the data into line structure *
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = it_dummy.
Processing the data from line structure to internal tables *
REFRESH:it_me21.
CLEAR :it_me21.
LOOP AT it_dummy.
IF it_dummy-dummy+0(01) = 'H'.
v_indx = v_indx + 1.
CLEAR it_idata.
REFRESH it_idata.
CLEAR it_me21-x_data.
REFRESH it_me21-x_data.
SHIFT it_dummy.
SPLIT it_dummy AT v_delimit INTO it_me21-lifnr
it_me21-bsart
it_me21-bedat
it_me21-ekorg
it_me21-ekgrp.
APPEND it_me21.
ELSEIF it_dummy-dummy+0(01) = 'L'.
SHIFT it_dummy.
SPLIT it_dummy AT v_delimit INTO it_idata-ematn
it_idata-menge
it_idata-netpr
it_idata-werks
it_idata-ebelp.
APPEND it_idata TO it_me21-x_data.
MODIFY it_me21 INDEX v_indx.
ENDIF.
ENDLOOP.
To open the group *
PERFORM open_group.
To populate the bdcdata table for header data *
LOOP AT it_me21.
v_count = v_count + 1.
REFRESH it_bdcdata.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0100',
' ' 'BDC_CURSOR' 'EKKO-LIFNR',
' ' 'BDC_OKCODE' '/00',
' ' 'EKKO-LIFNR' it_me21-lifnr,
' ' 'RM06E-BSART' it_me21-bsart,
' ' 'RM06E-BEDAT' it_me21-bedat,
' ' 'EKKO-EKORG' it_me21-ekorg,
' ' 'EKKO-EKGRP' it_me21-ekgrp,
' ' 'RM06E-LPEIN' 'T'.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
' ' 'BDC_CURSOR' 'RM06E-EBELP',
' ' 'BDC_OKCODE' '/00'.
MOVE 1 TO v_indx.
*-----To populate the bdcdata table for line item data
LOOP AT it_me21-x_data INTO x_idata.
CONCATENATE 'EKPO-EMATN(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-ematn.
CONCATENATE 'EKPO-MENGE(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-menge.
CONCATENATE 'EKPO-NETPR(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-netpr.
CONCATENATE 'EKPO-WERKS(' v_indx ')' INTO v_fnam.
PERFORM subr_bdc_table USING ' ' v_fnam x_idata-werks.
v_indx = v_indx + 1.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
' ' 'BDC_CURSOR' 'RM06E-EBELP',
' ' 'BDC_OKCODE' '/00'.
ENDLOOP.
PERFORM subr_bdc_table USING: 'X' 'SAPMM06E' '0120',
' ' 'BDC_CURSOR' 'RM06E-EBELP',
' ' 'BDC_OKCODE' '=BU'.
PERFORM bdc_transaction USING 'ME21'.
ENDLOOP.
PERFORM close_group.
End of selection event *
END-OF-SELECTION.
IF session NE 'X'.
*-----To display the successful records
WRITE :/10 text-001. "Sucess records
WRITE :/10 SY-ULINE(20).
SKIP.
IF it_sucess IS INITIAL.
WRITE :/ text-002.
ELSE.
WRITE :/ text-008, "Total number of Succesful records
35 v_ns.
SKIP.
WRITE:/ text-003, "Vendor Number
17 text-004, "Record number
30 text-005. "Message
ENDIF.
LOOP AT it_sucess.
WRITE:/4 it_sucess-lifnr,
17 it_sucess-tabix CENTERED,
30 it_sucess-sucess_rec.
ENDLOOP.
SKIP.
*-----To display the erroneous records
WRITE:/10 text-006. "Error Records
WRITE:/10 SY-ULINE(17).
SKIP.
IF it_error IS INITIAL.
WRITE:/ text-007. "No error records
ELSE.
WRITE:/ text-009, "Total number of erroneous records
35 v_ne.
SKIP.
WRITE:/ text-003, "Vendor Number
17 text-004, "Record number
30 text-005. "Message
ENDIF.
LOOP AT it_error.
WRITE:/4 it_error-lifnr,
17 it_error-tabix CENTERED,
30 it_error-error_rec.
ENDLOOP.
REFRESH it_sucess.
REFRESH it_error.
ENDIF.
CODE IN INCLUDE.
Include ZMM_INCL_PURCHASEORDERKB01
DATA: it_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: it_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA: E_GROUP_OPENED.
*-----Internal table to store sucess records
DATA:BEGIN OF it_sucess OCCURS 0,
msgtyp(1) TYPE c,
lifnr LIKE ekko-lifnr,
tabix LIKE sy-tabix,
sucess_rec(125),
END OF it_sucess.
DATA: g_mess(125) type c.
*-----Internal table to store error records
DATA:BEGIN OF it_error OCCURS 0,
msgtyp(1) TYPE c,
lifnr LIKE ekko-lifnr,
tabix LIKE sy-tabix,
error_rec(125),
END OF it_error.
Selection screen
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS session RADIOBUTTON GROUP ctu. "create session
SELECTION-SCREEN COMMENT 3(20) text-s07 FOR FIELD session.
SELECTION-SCREEN POSITION 45.
PARAMETERS ctu RADIOBUTTON GROUP ctu. "call transaction
SELECTION-SCREEN COMMENT 48(20) text-s08 FOR FIELD ctu.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) text-s01 FOR FIELD group.
SELECTION-SCREEN POSITION 25.
PARAMETERS group(12). "group name of session
SELECTION-SCREEN COMMENT 48(20) text-s05 FOR FIELD ctumode.
SELECTION-SCREEN POSITION 70.
PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.
"A: show all dynpros
"E: show dynpro on error only
"N: do not display dynpro
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 48(20) text-s06 FOR FIELD cupdate.
SELECTION-SCREEN POSITION 70.
PARAMETERS cupdate LIKE ctu_params-updmode DEFAULT 'L'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(20) text-s03 FOR FIELD keep.
SELECTION-SCREEN POSITION 25.
PARAMETERS: keep AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN COMMENT 48(20) text-s09 FOR FIELD e_group.
SELECTION-SCREEN POSITION 70.
PARAMETERS e_group(12). "group name of error-session
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 51(17) text-s03 FOR FIELD e_keep.
SELECTION-SCREEN POSITION 70.
PARAMETERS: e_keep AS CHECKBOX. "' ' = delete session if finished
"'X' = keep session if finished
SELECTION-SCREEN END OF LINE.
PARAMETERS:p_file LIKE rlgrap-filename.
at selection screen *
AT SELECTION-SCREEN.
group and user must be filled for create session
IF SESSION = 'X' AND
GROUP = SPACE. "OR USER = SPACE.
MESSAGE E613(MS).
ENDIF.
create batchinput session *
FORM OPEN_GROUP.
IF SESSION = 'X'.
SKIP.
WRITE: /(20) 'Create group'(I01), GROUP.
SKIP.
*----open batchinput group
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = GROUP
USER = sy-uname.
WRITE:/(30) 'BDC_OPEN_GROUP'(I02),
(12) 'returncode:'(I05),
SY-SUBRC.
ENDIF.
ENDFORM. "OPEN_GROUP
end batchinput session *
FORM CLOSE_GROUP.
IF SESSION = 'X'.
*------close batchinput group
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
(12) 'returncode:'(I05),
SY-SUBRC.
ELSE.
IF E_GROUP_OPENED = 'X'.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /.
WRITE: /(30) 'Fehlermappe wurde erzeugt'(I06).
ENDIF.
ENDIF.
ENDFORM. "CLOSE_GROUP
Start new transaction according to parameters *
FORM BDC_TRANSACTION USING TCODE TYPE ANY.
DATA: L_SUBRC LIKE SY-SUBRC.
*------batch input session
IF SESSION = 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = TCODE
TABLES
DYNPROTAB = it_BDCDATA.
WRITE: / 'BDC_INSERT'(I03),
TCODE,
'returncode:'(I05),
SY-SUBRC,
'RECORD:',
SY-INDEX.
ELSE.
REFRESH it_MESSTAB.
CALL TRANSACTION TCODE USING it_BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO it_MESSTAB.
L_SUBRC = SY-SUBRC.
WRITE: / 'CALL_TRANSACTION',
TCODE,
'returncode:'(I05),
L_SUBRC,
'RECORD:',
SY-INDEX.
ENDIF.
Message handling for Call Transaction *
perform subr_mess_hand using g_mess.
*-----Erzeugen fehlermappe
IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
IF E_GROUP_OPENED = ' '.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = E_GROUP
USER = sy-uname
KEEP = E_KEEP.
E_GROUP_OPENED = 'X'.
ENDIF.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = TCODE
TABLES
DYNPROTAB = it_BDCDATA.
ENDIF.
REFRESH it_BDCDATA.
ENDFORM. "BDC_TRANSACTION
Form subr_bdc_table *
text
-->P_0220 text *
-->P_0221 text *
-->P_0222 text *
FORM subr_bdc_table USING VALUE(P_0220) TYPE ANY
VALUE(P_0221) TYPE ANY
VALUE(P_0222) TYPE ANY.
CLEAR it_bdcdata.
IF P_0220 = ' '.
CLEAR it_bdcdata.
it_bdcdata-fnam = P_0221.
it_bdcdata-fval = P_0222.
APPEND it_bdcdata.
ELSE.
it_bdcdata-dynbegin = P_0220.
it_bdcdata-program = P_0221.
it_bdcdata-dynpro = P_0222.
APPEND it_bdcdata.
ENDIF.
ENDFORM. " subr_bdc_table
Form subr_mess_hand *
text *
-->P_G_MESS text *
FORM subr_mess_hand USING P_G_MESS TYPE ANY.
LOOP AT IT_MESSTAB.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = it_messtab-msgid
LANG = it_messtab-msgspra
NO = it_messtab-msgnr
v1 = it_messtab-msgv1
v2 = it_messtab-msgv2
IMPORTING
MSG = P_G_MESS
EXCEPTIONS
OTHERS = 0.
CASE it_messtab-msgtyp.
when 'E'.
it_error-error_rec = P_G_MESS.
it_error-lifnr = it_me21-lifnr.
it_error-tabix = v_count.
APPEND IT_ERROR.
when 'S'.
it_sucess-sucess_rec = P_G_MESS.
it_sucess-lifnr = it_me21-lifnr.
it_sucess-tabix = v_count.
APPEND IT_SUCESS.
endcase.
ENDLOOP.
Describe table it_sucess lines v_ns.
Describe table it_error lines v_ne.
ENDFORM. " subr_mess_hand
if it helpful reward points are appreciated -
Delete batches with zero stock from dropdown list
Hi All,
I have a requirement on batch stock materials.The exist program displaying multiple batches for material plant with stock and without stock in the drop down list for MCH1 table in the pop up window.
Now i would need to delete the batches with zero stock from drop down list.I could find the data for stock and non stock from MCHB table .
Any idea how to delete the entry of non stock batches from drop down list
Regards,
ReddyHi All,
The logic has already been implemented to for drop down list for all batches(with or without stock) for material plant.the follwing code has been written for the same.
Any idea how to delete the entry for non stck baches from the drop down list.
this is the code
SET PARAMETER ID 'MAT' FIELD help_lips-matnr.
SET PARAMETER ID 'WRK' FIELD help_lips-werks.
Export parameters to memory to enable search help via classes
CLEAR dseltab.
REFRESH dseltab.
dseltab-fldname = 'MANDT'.
MOVE sy-mandt TO dseltab-fldinh.
APPEND dseltab.
dseltab-fldname = 'MATNR'.
MOVE help_lips-matnr TO dseltab-fldinh.
APPEND dseltab.
dseltab-fldname = 'WERKS'.
MOVE help_lips-werks TO dseltab-fldinh.
APPEND dseltab.
dseltab-fldname = 'CHARG'.
MOVE help_lips-charg TO dseltab-fldinh.
APPEND dseltab.
EXPORT dseltab TO MEMORY ID 'DSELTAB'.
Get description for search help
mc_object = 'MCH1'.
lf_shlpname = mc_object.
CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
EXPORTING
shlpname = lf_shlpname
shlptype = 'SH'
IMPORTING
shlp = lx_shlp
EXCEPTIONS
OTHERS = 1.
Enable value copy from search help to dynpro field
READ TABLE lx_shlp-interface INTO ls_interface
WITH KEY shlpfield = 'CHARG'.
ls_interface-valfield = 'X'.
MODIFY lx_shlp-interface FROM ls_interface INDEX sy-tabix.
Start search help dialog
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
shlp = lx_shlp
TABLES
return_values = lt_retvalues
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0.
READ TABLE lt_retvalues INTO ls_retvalue
WITH KEY fieldname = 'CHARG'.
IF sy-subrc EQ 0.
lips-charg = ls_retvalue-fieldval.
gs_lips-charg = ls_retvalue-fieldval.
ENDIF.
ENDIF.
Regards
Reddy -
Hi
Can I run module pool program in batch mode....
If so how.... can anyone help me out.....
Thanks
JayhI,
Yes sure I need the help..... how to run in batch process this progra,/// can I go direct and define in sm36 or so....
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
Program
PROGRAM ZASSET .
tables: anla,zasset.
constants :
C_O(1) TYPE C VALUE 0,
C_INSERT(10) TYPE C VALUE 'INSERT'.
DATA: IT_ZASSET LIKE ZASSET.
DATA: V_emp_exist(1) type c,
V_ANLN1 like zASSET-ANLN1.
*--For Pf status
data: begin of it_pf occurs 0,
stat(8) type c,
end of it_pf.
DATA: SAVE TYPE C,
DELETE TYPE C,
CLEAR TYPE C,
EXIT TYPE C,
BACK TYPE C,
CANCEL TYPE C,
OK_CODE LIKE SY-UCOMM.
*& Module EXIT INPUT
text
MODULE EXIT INPUT.
case sy-ucomm.
when 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " EXIT INPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE. "OK_CODE.
WHEN 'INSERT'.
IF NOT ZASSET-ANLN1 IS INITIAL.
MOVE ZASSET-ANLN1 TO IT_ZASSET-ANLN1.
ENDIF.
WHEN 'SAVE'.
MOVE IT_ZASSET-ANLN1 TO ZASSET-ANLN1.
INSERT INTO ZASSET VALUES IT_ZASSET .
COMMIT WORK.
CLEAR IT_ZASSET.
*REFRESH IT_ZASSET.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
*APPEND IT_ZASSET.
*CLEAR ZASSET.
leave to screen 200.
*ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ASSET'.
SET PF-STATUS 'POOL'.
SET TITLEBAR 'UPDATING ZASSET TABLE'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module exitscreen INPUT
text
MODULE exitscreen INPUT.
Case OK_CODE. "_100.
WHEN EXIT.
Leave to screen 0.
when BACK.
Leave to screen 0.
when CANCEL.
Leave to screen 0.
Endcase.
ENDMODULE. " exitscreen INPUT
*& Module USER_COMMAND_0200 INPUT
text
*OK_CODE = SY-UCOMM.
*MODULE USER_COMMAND_0200 INPUT.
*Case OK_CODE.
When 'MODIFY'.
Perform move_values.
Perform lock_table.
Perform change_dbase.
Perform unlock_table.
Message s999(z1) with text-001.
Leave to screen 100.
When SAVE.
Perform move_values.
Perform lock_table.
Perform insert_dbase.
Perform unlock_table.
Message s999(z1) with text-002.
Leave to screen 100.
When c_delete.
Perform move_values.
Perform lock_table.
Perform delete_dbase.
Perform unlock_table.
Message s999(z1) with text-003.
Leave to screen 100.
When EXIT.
*Endcase.
*ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form check_emp_exist
text
--> p1 text
<-- p2 text
FORM check_emp_exist.
Clear IT_ZASSET-ANLN1.
Move zASSET-ANLN1 to IT_ZASSET-ANLN1.
Clear zASSET.
Select single * from zASSET where ANLN1 = IT_ZASSET-ANLN1.
If sy-subrc ne 0.
Clear v_emp_exist.
Else.
Clear zASSET.
Select * up to 1 rows from ztrytxn where empno = v_empno.
Endselect.
Move : ztrytxn-valfr to v_date,
C_x to v_emp_exist.
Endif.
ENDFORM. " check_emp_exist
*& Form move_values
text
--> p1 text
<-- p2 text
*FORM move_values.
**MOVE ZASSET-ANLN1 TO IT_ZASSET-ANLN1.
**MOVE IT_ZASSET-ANLN1 TO ZASSET-ANLN1.
**MOVE ZASSET-ANLN1 TO IT_ZASSET-ANLN1.
*MOVE IT_ZASSET-ANLN1 TO ZASSET-ANLN1.
*INSERT INTO ZASSET VALUES IT_ZASSET.
*COMMIT WORK.
**MODIFY ZASSET . "INDEX SY-TABIX. " FROM TABLE IT_ZASSET1 .
**COMMIT WORK.
**LEAVE TO SCREEN 100.
*ENDFORM. " move_values
ENDFORM. " change_dbase
*& Form delete_dbase
text
--> p1 text
<-- p2 text
FORM delete_dbase.
Delete zASSET from IT_ZASSET-ANLN1.
Commit work.
ENDFORM. " delete_dbase
*& Module check_BUKRS INPUT
validating bukrs
MODULE check_BUKRS INPUT.
if zasset-bukrs <> 0.
Message e999(z1) with text-005.
Endif.
ENDMODULE. " check_BUKRS INPUT -
Dear
we have a scenario batch pricing,in that we have requirement thatif price is not picked from the batch i should not allow to do invoice .Is it possible to do the customisation
please help
regards
DamodharHi All,
use FM SD_BATCH_CLASSIFICATION_DATA
Input parameters are
CH_CHARG -- batch number
CH_MATNR--- Material Number
CH_WERKS-- Plant
when the batcha are Unique at Plant level
please see tha code below it is internally calling 'CLAFCLASSIFICATION_OF_OBJECTS'_
function sd_batch_classification_data.
*"Globale Schnittstelle:
*" IMPORTING
*" CH_CHARG LIKE MCHA-CHARG
*" CH_MATNR LIKE MCHA-MATNR
*" CH_WERKS LIKE MCHA-WERKS
*" EXCEPTIONS
*" NO_CLASSIFICATION
*" NO_CLASSTYPES
data: "Internal Tables of Classes found
begin of i_class occurs 5.
INCLUDE STRUCTURE CLASS. "v_n_516772
include structure sclass. "^_n_516772
data:
end of i_class.
data:
ch_object like ausp-objek, "Object Key for Classification
begin of mcha_object, "Object Key MCHA
matnr like mcha-matnr,
werks like mcha-werks,
charg like mcha-charg,
end of mcha_object,
begin of mch1_object, "Object Key MCH1
matnr like mch1-matnr,
charg like mch1-charg,
end of mch1_object,
ch_level, "Level of batch definition
ch_classtype like klah-klart, "classtype batch
ch_table like tcla-obtab, "object table batch
table_lines like sy-tabix, "Number of Table Lines
popup_lines like sy-tabix. "Number of Lines in Popup
determine batch-level
call function 'VB_BATCH_DEFINITION'
importing
kzdch = ch_level.
read classification depending on batch level
clear ch_object.
if ch_level eq null.
ch_classtype = '022'.
ch_table = 'MCHA '.
mcha_object-matnr = ch_matnr. "Concatenate Object Key
mcha_object-werks = ch_werks. " ..
mcha_object-charg = ch_charg. " ..
move mcha_object to ch_object. " ..
else.
ch_classtype = '023'.
ch_table = 'MCH1 '.
mch1_object-matnr = ch_matnr. "Concatenate Object Key
mch1_object-charg = ch_charg. " ..
move mch1_object to ch_object. " ..
endif.
call function 'CLAF_CLASSIFICATION_OF_OBJECTS'
exporting
classtype = ch_classtype
features = 'X'
object = ch_object
objecttable = ch_table
tables
t_class = i_class
t_objectdata = i_clobjdat
exceptions
no_classification = 1
no_classtypes = 2.
case sy-subrc.
when 1.
raise no_classification.
when 2.
raise no_classtypes.
endcase.
describe table i_clobjdat lines table_lines.
if not table_lines is initial.
popup_lines = table_lines + 11.
if popup_lines > 20.
popup_lines = 20.
endif.
endif.
call screen 1000
starting at 10 06
ending at 80 popup_lines.
endfunction.
Out put will give all the batch classification, Charecter and Charecterstic value. -
Hi everybody
Ive run the tcode SHDB to get the recording of transaction XD02, in it, theres an input field called RMCLF-CLASS(01), but when Im running my program, its giving me an error message 'Field RMCLF-CLASS(1) is not an input field'.
Does anybody know why?heres the code
DATA : field1(20),
field2(20),
telf1 TYPE kna1-telf1,
adrnr TYPE kna1-adrnr,
ktokd TYPE kna1-ktokd,
wa_extab TYPE ty_tab1,
cname(20) VALUE 'KNVK-NAME1(00)',
banks(20) VALUE 'KNBK-BANKS(00)',
bankn(20) VALUE 'KNBK-BANKN(00)',
bankl(20) VALUE 'KNBK-BANKL(00)'.
DATA : field3(20) VALUE 'RCTMS-MNAME(00)',
field4(20) VALUE 'RCTMS-MWERT(00)',
pos(2) TYPE n VALUE 0.
DATA : head2(10).
DATA : t_smtp TYPE adsmtp OCCURS 0 WITH HEADER LINE.
FIELD-SYMBOLS : <fs1>, <fs2>,
<fs_ablad> TYPE ty_ablad.
CLEAR : bi_open, flags.
Fill in work area fields with the appropriate data
LOOP AT t_field ASSIGNING <fs_field>
WHERE value <> 00
AND flagname <> space.
CONCATENATE 'FLAGS' <fs_field>-flagname INTO field1
SEPARATED BY '-'.
ASSIGN (field1) TO <fs1>.
<fs1> = 'X'.
ENDLOOP.
IF flags-d0340 IS INITIAL AND p_unpnt = 'X'.
flags-d0340 = 'X'.
ENDIF.
IF flags-d0310a = 'X' AND flags-d0310 IS INITIAL.
flags-d0310 = 'X'.
ENDIF.
IF flags-d0320t = 'X' AND flags-d0320 IS INITIAL.
flags-d0320 = 'X'.
ENDIF.
IF p_bppy = 'X'.
flags-d0324 = 'X'.
ENDIF.
IF p_kzazu = 'X' AND flags-d0315 IS INITIAL.
flags-d0315 = 'X'.
ENDIF.
LOOP AT intab.
CLEAR: screen_cnt, t_ablad, t_knvp,
t_kssk.
REFRESH : t_ablad, t_knvp.
Fill in work area fields with the appropriate data
LOOP AT t_field ASSIGNING <fs_field>
WHERE value <> 00.
CONCATENATE :
Destination field
'WA_EXTAB' <fs_field>-sapname INTO field1 SEPARATED BY '-',
Source field
'INTAB-FIELD' <fs_field>-value INTO field2.
ASSIGN : (field1) TO <fs1>,
(field2) TO <fs2>.
<fs1> = <fs2>.
ENDLOOP.
Pad customer number
IF wa_extab-kunnr CO '0123456789 '.
UNPACK wa_extab-kunnr TO wa_extab-kunnr.
ENDIF.
CLEAR : telf1, adrnr, ktokd.
SELECT SINGLE telf1 adrnr ktokd FROM kna1
INTO (telf1,adrnr,ktokd)
WHERE kunnr = wa_extab-kunnr.
Check customer exists
IF sy-subrc <> 0.
MOVE : wa_extab-kunnr TO wa_errtab-kunnr,
text-001 TO wa_errtab-message.
INSERT wa_errtab INTO TABLE errtab. CLEAR wa_errtab.
CONTINUE.
ENDIF.
DPZ01
Check customer exists in sales area
SELECT SINGLE kunnr FROM knvv
INTO knvv-kunnr
WHERE kunnr = wa_extab-kunnr
AND vkorg = wa_extab-vkorg
AND vtweg = wa_extab-vtweg
AND spart = wa_extab-spart.
IF sy-subrc <> 0.
MOVE : wa_extab-kunnr TO wa_errtab-kunnr,
text-010 TO wa_errtab-message.
REPLACE : '&1' WITH wa_extab-vkorg INTO wa_errtab-message,
'&2' WITH wa_extab-vtweg INTO wa_errtab-message,
'&3' WITH wa_extab-spart INTO wa_errtab-message.
CONDENSE wa_errtab-message.
INSERT wa_errtab INTO TABLE errtab. CLEAR wa_errtab.
CONTINUE.
ENDIF.
DPZ01
Screens for the customer
PERFORM select_screens USING ktokd
CHANGING i_flags screens.
IF telf1 IS INITIAL.
wa_extab-sw_tel = 'X'.
ENDIF.
Number of contacts
SELECT COUNT( * ) FROM knvk INTO wa_extab-contact
WHERE kunnr = wa_extab-kunnr.
Number of bank accounts
SELECT COUNT( * ) FROM knbk INTO wa_extab-account
WHERE kunnr = wa_extab-kunnr.
IF p_unpnt = 'X'.
List of unloading points
SELECT ablad FROM knva APPENDING TABLE t_ablad
WHERE kunnr = wa_extab-kunnr.
UP exists in UP view ?
READ TABLE t_ablad WITH TABLE KEY ablad = c_up
ASSIGNING <fs_ablad>.
IF sy-subrc <> 0.
MOVE : wa_extab-kunnr TO wa_errtab-kunnr,
text-002 TO wa_errtab-message.
INSERT wa_errtab INTO TABLE errtab. CLEAR wa_errtab.
ENDIF.
ENDIF.
Class assigned to customer
IF NOT p_elevl1 IS INITIAL OR NOT p_elevl2 IS INITIAL OR
NOT p_elevl3 IS INITIAL OR NOT p_esfid IS INITIAL OR
NOT p_ehead IS INITIAL OR NOT p_etelcm IS INITIAL OR
*PCT
NOT p_ctype IS INITIAL OR
NOT p_eool IS INITIAL.
MOVE wa_extab-kunnr TO objek.
SELECT clint zaehl INTO CORRESPONDING FIELDS OF TABLE t_kssk
FROM kssk
WHERE objek = objek
AND klart = c_klart.
ENDIF.
BATCH INPUT
IF bi_open IS INITIAL.
PERFORM open_ses USING session_name.
bi_open = 'X'.
ENDIF.
First screen
DPZ01
PERFORM first_screen USING wa_extab-kunnr i_flags.
PERFORM first_screen USING wa_extab-kunnr wa_extab-vkorg
wa_extab-vtweg wa_extab-spart i_flags.
DPZ01
Address
IF i_flags-d0110 = 'X'.
PERFORM choose_okcode USING screens
CHANGING screen_cnt okcode.
PERFORM loadibatch USING : 'X' 'SAPMF02D' '111'.
fill_field : wa_extab-name1 'ADDR1_DATA-NAME1',
wa_extab-stras 'ADDR1_DATA-STREET',
wa_extab-pstlz 'ADDR1_DATA-POST_CODE1',
wa_extab-ort01 'ADDR1_DATA-CITY1',
wa_extab-land1 'ADDR1_DATA-COUNTRY',
wa_extab-spras 'ADDR1_DATA-LANGU',
wa_extab-telfx 'SZA1_D0100-FAX_NUMBER'.
Telephone number
IF NOT wa_extab-telf1 IS INITIAL.
IF wa_extab-sw_tel = 'X'.
No tel.nbr -> can put it in current screen
PERFORM loadibatch USING
' ' 'SZA1_D0100-TEL_NUMBER' wa_extab-telf1.
ELSE.
A tel.nbr exists -> add the new one
PERFORM loadibatch USING :
' ' 'BDC_OKCODE' '=$MTE',
'X' 'SAPLSZA6' '0200',
' ' 'BDC_OKCODE' 'NEWL',
'X' 'SAPLSZA6' '0200',
' ' 'ADTEL-TEL_NUMBER(01)' wa_extab-telf1,
' ' 'BDC_OKCODE' 'CONT',
'X' 'SAPMF02D' '0111'.
ENDIF.
ENDIF.
E-mail
IF NOT wa_extab-email IS INITIAL.
IF wa_extab-sw_mail = 'X'.
No e-mail -> can put it in current screen
PERFORM loadibatch USING
' ' 'SZA1_D0100-SMTP_ADDR' wa_extab-email.
ELSE.
An e-mail exists -> add the new one
PERFORM loadibatch USING :
' ' 'BDC_OKCODE' '=$INT',
'X' 'SAPLSZA6' '0600',
' ' 'BDC_OKCODE' 'NEWL',
'X' 'SAPLSZA6' '0600',
' ' 'ADSMTP-SMTP_ADDR(01)' wa_extab-email,
' ' 'BDC_OKCODE' 'CONT',
'X' 'SAPMF02D' '0111'.
ENDIF.
ENDIF.
IF NOT p_elevl1 IS INITIAL OR NOT p_elevl2 IS INITIAL OR
NOT p_elevl3 IS INITIAL OR NOT p_esfid IS INITIAL OR
NOT p_ehead IS INITIAL OR NOT p_etelcm IS INITIAL OR
*PCT
NOT p_ctype IS INITIAL OR
*PCT
NOT p_eool IS INITIAL.
CLEAR pos.
PERFORM loadibatch USING : ' ' 'BDC_OKCODE' 'KLAS',
'X' 'SAPLCLCA' '0602',
' ' 'RMCLF-KLART' c_klart,
' ' 'BDC_OKCODE' 'ENTE',
'X' 'SAPLCLFM' '0500'.
IF t_kssk[] IS INITIAL.
PERFORM create_new_class. "Create the first assignment
ELSE.
READ TABLE t_kssk WITH KEY clint = clint
ASSIGNING <kssk>.
IF sy-subrc = 0.
PERFORM change_class USING sy-tabix. "Change existing class
ELSE.
PERFORM create_add_class. "Add an assignment
ENDIF.
ENDIF.
IF NOT wa_extab-levl1 IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
PERFORM loadibatch USING : ' ' field3 c_level1,
' ' field4 wa_extab-levl1.
ENDIF.
IF NOT wa_extab-levl2 IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
PERFORM loadibatch USING : ' ' field3 c_level2,
' ' field4 wa_extab-levl2.
ENDIF.
IF NOT wa_extab-levl3 IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
PERFORM loadibatch USING : ' ' field3 c_level3,
' ' field4 wa_extab-levl3.
ENDIF.
IF NOT wa_extab-sfid IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
PERFORM loadibatch USING : ' ' field3 c_sfid,
' ' field4 wa_extab-sfid.
ENDIF.
IF NOT wa_extab-head IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
WRITE wa_extab-head TO head2 NO-ZERO.
PERFORM loadibatch USING : ' ' field3 c_head,
' ' field4 head2.
ENDIF.
IF NOT wa_extab-telecm IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
PERFORM loadibatch USING : ' ' field3 c_telecom,
' ' field4 wa_extab-telecm.
ENDIF.
IF NOT wa_extab-ool IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
PERFORM loadibatch USING : ' ' field3 c_ool,
' ' field4 wa_extab-ool.
ENDIF.
*PCT
IF NOT wa_extab-ctype IS INITIAL.
ADD 1 TO pos.
field312(2) = field412(2) = pos.
PERFORM loadibatch USING : ' ' field3 c_contract,
' ' field4 wa_extab-ctype.
ENDIF.
*PCT
PERFORM loadibatch USING : ' ' 'BDC_OKCODE' 'BACK',
'X' 'SAPLCLFM' '0500',
' ' 'BDC_OKCODE' 'ENDE',
'X' 'SAPMF02D' '0111'.
ENDIF.
PERFORM loadibatch USING ' ' 'BDC_OKCODE' okcode.
ENDIF.
PERFORM insert_ses USING 'XD02'.
FORM loadibatch USING start fname fvalue.
CLEAR ibatch.
IF start = 'X'.
ibatch-program = fname.
ibatch-dynpro = fvalue.
ELSE.
ibatch-fnam = fname.
ibatch-fval = fvalue.
ENDIF.
ibatch-dynbegin = start.
APPEND ibatch.
ENDFORM.
FORM create_new_class.
CONCATENATE 'RMCLF-CLASS(' '01)' INTO rmclf_class1.
PERFORM loadibatch USING:
' ' 'BDC_CURSOR' 'RMCLF-CLASS(01)',
' ' 'BDC_OKCODE' '=AUSW',
' ' 'RMCLF-CLASS(01)' c_class,
'X' 'SAPLCTMS' '0109'.
PERFORM loadibatch USING :
' ' 'RMCLF-CLASS(01)' c_class,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPLCTMS' '0109'.
ENDFORM. " create_new_class
*& Form create_add_class
Create a new assignment
FORM create_add_class.
PERFORM loadibatch USING : ' ' 'BDC_OKCODE' 'NEUZ',
'X' 'SAPLCLFM' '0500',
' ' 'RMCLF-CLASS(02)' c_class,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPLCTMS' '0109'.
ENDFORM. " create_add_class
*& Form change_class
Change an existing assignment
-->PAGPOS Position of the class
FORM change_class USING pagpos TYPE sy-tabix.
DATA : pagpos2(2) TYPE n,
field(20) VALUE 'RMCLF-KREUZ(00)'.
MOVE pagpos TO pagpos2.
REPLACE '00' WITH pagpos2 INTO field.
CONDENSE field NO-GAPS.
PERFORM loadibatch USING : ' ' field 'X',
' ' 'BDC_OKCODE' 'AUSW',
'X' 'SAPLCTMS' '0109'.
ENDFORM. " change_class -
Parallel Processing batch input
hello, i have problem ...
it possible work batch input in parallel processing ? ?FORM AGGIORNA.
PERFORM PRELEVA_FILE.
*perform controlli_preliminari.
PERFORM R7000-OPEN-BI. " open sessione batch input
LOOP AT TB_FILE.
REFRESH ALL_TABLES.
CLEAR ALL_TABLES.
PERFORM DETERMINA_TABELLA_COND.
READ TABLE TB_CAMPI WITH KEY CAMPO = 'RV130-SELKZ'.
VN_RIGA = SY-TABIX.
VN_TABIX = SY-TABIX.
PERFORM READ_CAMPO.
READ TABLE ALL_TABLES WITH KEY KOTAB = VA_CAMPO.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'Tabella sequenza '
VA_CAMPO 'inesistente'.
ENDIF.
VN_RIGA = SY-TABIX.
PERFORM R7100-CHARGE-TAB-BDC USING:
CA_START_DYNPRO 'SAPMV13A' '0100',
CA_FIELD_DYNPRO 'RV13A-KSCHL' VA_KSCHL,
CA_FIELD_DYNPRO CA_OK_CODE '=ANTA'.
CONCATENATE 'RV130-SELKZ(' VN_RIGA ')' INTO VA_FIELD.
PERFORM R7100-CHARGE-TAB-BDC USING:
CA_START_DYNPRO 'SAPLV14A' '0100',
CA_FIELD_DYNPRO VA_FIELD 'X',
CA_FIELD_DYNPRO CA_OK_CODE '=WEIT'.
CONCATENATE '1' ALL_TABLES-KOTABNR INTO VN_DYNPRO1.
PERFORM ALTRE_VIDEATA USING VN_DYNPRO1.
ENDLOOP.
PERFORM R7010-CLOSE-BI. " Close sessione batch input
MOVE VN_ELAB TO VN_RECELAB.
ENDFORM. " AGGIORNA -
Material batch characteristics
Hi all,
I have a requirement to fetch the material batch characteristics with delivery number as input and print the characteristics for the corresponding batches. Can you please say me the logic to fetch the details ? It is an urgent requirement..
Thanks & Regards,
RamaKrishnan .THi
See the sample code for fetching the BAtch characteristics of Material
report z21311r_batch_char no standard page heading
line-size 132
line-count 58(1)
message-id mm.
Declaration for Tables
tables: mara, " Material Master
mard, " Storage Location Data for Material
t001w, " Plants/Branches
t001l, " Storage Locations
cabn, " Characteristics
inob. " Link between Internal Number and Object
Declaration for Constants
constants : c_klart like ausp-klart value '023', " Class Type
c_obtab like inob-obtab value 'MCH1', " Database Table
c_flag type c value 'X', " Flag
c_c23 type i value '23', " Ratio
Constants for Ratio Categories
c_13 type p decimals 2 value '13.00', " For Ratio 13
c_1499 type p decimals 2 value '14.99', " For Ratio 14.99
c_15 type p decimals 2 value '15.00', " For Ratio 15
c_1699 type p decimals 2 value '16.99', " For Ratio 16.99
c_17 type p decimals 2 value '17.00', " For Ratio 17
c_1899 type p decimals 2 value '18.99', " For Ratio 18.99
c_19 type p decimals 2 value '19.00', " For Ratio 19
c_2099 type p decimals 2 value '20.99', " For Ratio 20.99
c_21 type p decimals 2 value '21.00', " For Ratio 21
c_2299 type p decimals 2 value '22.99', " For Ratio 22.99
c_23 type p decimals 2 value '23.00', " For Ratio 23
c_g23(4) type c value '>=23', " For Ratio >=23
c_ratio(5) value 'RATIO', " For Ratio
Constants for Storing Selected item field information
c_cursor1(15) value 'I_OUTPUT1-MEINS', " For Selected Base
" Unit of Measure
c_cursor2(15) value 'I_OUTPUT1-MATNR', " For Selected Base
" Material Number
c_cursor3(15) value 'I_OUTPUT1-MAKTX', " For Selected Base
" Material Des.
c_cursor4(15) value 'I_OUTPUT1-CLABS', "For Selected Base
" Stock Value
c_cursor5(15) value 'I_OUTPUT1-ATFLV', " For Selected Base
" Char.Value (Ratio)
c_cursor6(5) value 'C_G23'.
Declaration for Global Variables
data : g_exit type c, " Flag
g_clabs1(16) type c, " Quantity
g_clabs(18) type c, " Quantity
g_cursor(15) type c, " Cursor field name
g_matnr type mara-matnr, " Material Number
g_werks type mchb-werks, " Plant
g_atinn(30) type c. " Character.
Declaration for Internal tables
Internal table to hold Batch Stock data
data : begin of i_mchb occurs 0,
matnr like mchb-matnr, " Material Number
werks like mchb-werks, " Plant
lgort like mchb-lgort, " Storage Location
charg like mchb-charg, " Batch Number
clabs like mchb-clabs, " Stock Value
meins like mara-meins, " Unit of measure
atflo like ausp-atflv, " Char.Value (Ratio)
atflv like ausp-atflv, " Char.Value (Ratio)
end of i_mchb.
Internal table to hold Secondary List data
data : begin of i_mchb1 occurs 0,
werks like mchb-werks, " Plant
matnr like mchb-matnr, " Material Number
lgort like mchb-lgort, " Storage Location
charg like mchb-charg, " Batch Number
atinn like ausp-atinn, " Char.Value
clabs like mchb-clabs, " Stock Value
atflo like ausp-atflv, " Char.Value (Ratio)
atflv like ausp-atflv, " Char.Value (Ratio)
end of i_mchb1.
Internal table to get the Plant Name
data : begin of i_plant occurs 0,
werks like t001w-werks, " Plant
name1 like t001w-name1, " Name
end of i_plant.
Internal table to get the Material Description
data : begin of i_makt occurs 0,
matnr like makt-matnr, " Material
maktx like makt-maktx, " Description
end of i_makt.
Internal table to hold AUSP data
data : begin of i_ausp occurs 0,
objek like ausp-objek, " Object No
atinn like cabn-atinn, " Characteric value
atflv like ausp-atflv, " Characteristic Value
end of i_ausp.
Internal table to hold output data
data : begin of i_output occurs 0,
atinn like cabn-atinn, " Characteric value
werks like mchb-werks, " Plant
matnr like mchb-matnr, " Material Number
atnam like cabn-atnam, " Characteristic
atflv like ausp-atflv, " Char.Value (Ratio)
name1 like t001w-name1, " Plant Description
maktx like makt-maktx, " Material Description
clabs like mchb-clabs, " Stock Value
meins like mara-meins, " Base Unit of Measure
end of i_output.
Internal table to hold final Output data
data : begin of i_output1 occurs 0,
atinn like cabn-atinn, " Characteric value
werks like mchb-werks, " Plant
matnr like mchb-matnr, " Material Number
atnam like cabn-atnam, " Characteristic
atflv(32) type c, " Char.Value (Ratio)
name1 like t001w-name1, " Plant Description
maktx like makt-maktx, " Material Description
clabs like mchb-clabs, " Stock Value
meins like mara-meins, " Base Unit of Measure
end of i_output1.
Selection screen
selection-screen begin of block b1 with frame title text-001.
select-options: s_werks for t001w-werks obligatory, " Plant
s_lgort for t001l-lgort, " Stor.Location
s_matnr for mara-matnr obligatory, " Material No
s_atinn for cabn-atinn. " Character.
selection-screen end of block b1.
At selection screen
at selection-screen.
Validation of Selection Screen Fields
perform validate_screen.
Start of selection
start-of-selection.
Get the Material and Batch Stock data from MARA and MCHB Tables
perform get_mat_stock_data.
Get the Material Group Text and Plant Name from T023T and T001W Tables
perform get_plant_grp_data.
Append the data into final Output Internal Table after getting the
Characteristic Values data from INOB and AUSP Tables
perform append_final_data.
Processing if the Characteristics contain 'RATIO'
perform collect_ratio.
End-of-Page
end-of-page.
write /1(125) sy-uline.
End of selection
end-of-selection.
if g_exit <> c_flag.
Display the Report Output data
perform display_report.
endif.
Top-of-Page
top-of-page.
Write the Report and Column Headings
perform get_headings.
at line-selection
at line-selection.
if sy-lsind = 1.
perform display_batch.
endif.
Top of page during line-selection
top-of-page during line-selection.
perform heading_seclist.
Form validate_screen
Validation of Selection Screen fields
form validate_screen.
Validation of Plant
clear t001w.
if not s_werks[] is initial.
select werks
into t001w-werks
from t001w
up to 1 rows
where werks in s_werks.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Plant'(002).
endif.
endif.
Validation of Material Number
clear mara.
if not s_matnr[] is initial.
select matnr
into mara-matnr
from mara
up to 1 rows
where matnr in s_matnr.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Material'(003).
endif.
endif.
Validation of Storage Location
clear t001l.
if not s_lgort[] is initial.
select lgort
into t001l-lgort
from t001l
up to 1 rows
where lgort in s_lgort.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Storage Location'(004).
endif.
endif.
Validation of Characteristic Value
clear cabn.
if not s_atinn[] is initial.
select atinn
into cabn-atinn
from cabn
up to 1 rows
where atinn in s_atinn.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Characteristic Value'(005).
endif.
endif.
Validation of Plant, Material and Storage Location
clear mard.
select matnr werks lgort
into (mard-matnr, mard-werks, mard-lgort)
from mard
up to 1 rows
where matnr in s_matnr and
werks in s_werks and
lgort in s_lgort.
endselect.
if sy-subrc <> 0.
message e899 with 'No Data found for the Selection Criteria'(006).
endif.
endform. "validate_screen
*& Form get_headings
Write the Report and Column Headings
form get_headings.
data: l_repid type sy-repid.
l_repid = sy-repid.
call function 'Y_STANDARD_HEADING'
exporting
repid = l_repid
heading1 = sy-title.
write:/1(125) sy-uline.
format color col_heading on.
write : /1 sy-vline, 2(18) 'Material Number'(008) centered,
20 sy-vline, 21(40) 'Material Description'(011) centered,
61 sy-vline, 62(22) 'Ratio'(009) centered,
84 sy-vline, 85(18) 'Quantity'(010) centered,
103 sy-vline, 104(20) 'Base Unit of Measure'(015) centered,
125 sy-vline.
write:/1(125) sy-uline.
format color off.
endform. "get_headings
*& Form get_mat_stock_data
Get the Material and Batch Stock data from MARA and MCHB Tables
form get_mat_stock_data.
clear: i_mchb,i_output, i_output1.
refresh: i_mchb,i_output, i_output1.
select a~matnr " Material Number
b~werks " Plant
b~lgort " Storage Location
b~charg " Batch Number
b~clabs " Stock Value
a~meins " Base Unit of Measure
into table i_mchb
from mara as a inner join mchb as b
on amatnr eq bmatnr
where b~matnr in s_matnr and
b~werks in s_werks and
b~lgort in s_lgort.
if sy-subrc <> 0.
g_exit = c_flag.
message s899 with 'No Data found for the Selection Criteria'(006).
stop.
endif.
sort i_mchb by matnr werks lgort charg.
endform. " get_mat_stock_data
*& Form get_plant_grp_data
Get the Material Group Text and Plant Name from T023T and T001W
form get_plant_grp_data.
if not i_mchb[] is initial.
Get the Plant Description from t001w Table
clear i_plant.
refresh i_plant.
select werks " Plant
name1 " Name
into table i_plant
from t001w
for all entries in i_mchb
where werks = i_mchb-werks.
Get the Material Description from MAKT Table
clear i_makt.
refresh i_makt.
select matnr " Material number
maktx " Material Description
into table i_makt
from makt
for all entries in i_mchb
where matnr = i_mchb-matnr and
spras = sy-langu.
sort i_plant by werks.
delete adjacent duplicates from i_plant comparing werks.
sort i_makt by matnr.
delete adjacent duplicates from i_makt comparing matnr.
endif.
endform. "form get_plant_grp_data.
*& Form append_final_data
Append the data into final Internal Table
form append_final_data.
data : l_matbatch(28),
l_tabix like sy-tabix.
if not i_mchb[] is initial.
loop at i_mchb.
l_tabix = sy-tabix.
clear l_matbatch.
concatenate i_mchb-matnr i_mchb-charg into l_matbatch.
move-corresponding i_mchb to i_output.
Get the Plant Description from i_plant Table
read table i_plant with key werks = i_mchb-werks binary search.
if sy-subrc = 0.
i_output-name1 = i_plant-name1.
endif.
Get the Material Description from i_makt Table
read table i_makt with key matnr = i_mchb-matnr binary search.
if sy-subrc = 0.
i_output-maktx = i_makt-maktx.
endif.
Get the Characteristic Values data from INOB and AUSP Tables
clear inob.
select single cuobj from inob
into inob-cuobj
where klart = c_klart and
obtab = c_obtab and
objek = l_matbatch.
if sy-subrc = 0.
select objek
atinn
atflv
from ausp
into table i_ausp
where objek = inob-cuobj and
atinn in s_atinn and
klart = c_klart.
sort i_ausp by objek atinn.
loop at i_ausp.
clear cabn.
select single atinn atnam from cabn
into (cabn-atinn,cabn-atnam)
where atinn = i_ausp-atinn.
if sy-subrc = 0.
If the ratio value is between 13-14.99, display 13
if cabn-atnam cs c_ratio.
if i_ausp-atflv between c_13 and c_1499.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_13.
If the ratio value is between 15-16.99, display 15
elseif i_ausp-atflv between c_15 and c_1699.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_15.
If the ratio value is between 17-18.99, display 17
elseif i_ausp-atflv between c_17 and c_1899.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_17.
If the ratio value is between 19-20.99, display 19
elseif i_ausp-atflv between c_19 and c_2099.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_19.
If the ratio value is between 21-22.99, display 21
elseif i_ausp-atflv between c_21 and c_2299.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_21.
If the ratio value is greater than or equal to 23, display 23
elseif i_ausp-atflv >= c_23.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_23.
endif. " Condition for RATIO values
else. " If characteristic does contain RATIO
i_mchb-atflv = i_ausp-atflv.
endif.
i_output-atinn = cabn-atinn.
i_output-atnam = cabn-atnam.
i_output-atflv = i_ausp-atflv.
i_mchb1-matnr = i_mchb-matnr.
i_mchb1-werks = i_mchb-werks.
i_mchb1-lgort = i_mchb-lgort.
i_mchb1-charg = i_mchb-charg.
i_mchb1-clabs = i_mchb-clabs.
i_mchb1-atinn = i_ausp-atinn.
i_mchb1-atflo = i_mchb-atflv.
i_mchb1-atflv = i_ausp-atflv.
append : i_output, i_mchb1.
clear i_mchb1.
modify i_mchb index l_tabix transporting atflo atflv .
endif.
endloop.
endif.
endloop.
endif.
Checking whether the table is filled or not
if not i_output[] is initial.
sort i_output by atinn werks matnr atflv.
else.
g_exit = c_flag.
message s899 with 'No Data found for the Selection Criteria'(006).
endif.
Delete the records where RATIO is less than 13.
delete i_output where atnam cs c_ratio and atflv lt c_13.
endform. "append_final_data
*& Form display_report
Display the Report Output data
form display_report.
data: l_tabix like sy-tabix.
loop at i_output1.
l_tabix = sy-tabix.
At new Characteristic
at new atinn.
read table i_output1 index l_tabix.
format color 1 intensified on.
write: /1 sy-vline, 2(20) 'Characteristic Name:'(007),
23(40) i_output1-atnam,
125 sy-vline.
format color off.
format color 4 intensified on.
write: /1 sy-vline, 2(20) 'Plant Name :'(022),
23(4) i_output1-werks, 29(30) i_output1-name1,
125 sy-vline.
format color off.
write /1(125) sy-uline.
endat.
clear: g_clabs, g_clabs1.
format color col_normal.
write :/1 sy-vline, 2(18) i_output1-matnr,
20 sy-vline, 21(40) i_output1-maktx,
61 sy-vline.
if i_output1-atflv = c_c23.
write: 62(22) c_g23 centered.
else.
shift i_output1-atflv left deleting leading space.
write: 62(22) i_output1-atflv centered.
endif.
write: 84 sy-vline,
103 sy-vline,
110(5) i_output1-meins.
If the quantity value is negative
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
format color off.
hide : i_output1.
new-line.
At end of material
at end of matnr.
sum.
move : i_output1-matnr to g_matnr.
format color 3 intensified on.
write /1(125) sy-uline.
write :/1 sy-vline, 2(25) 'Total for Material :'(012),
28(18) g_matnr.
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
write: 125 sy-vline.
format color off.
write /1(125) sy-uline.
endat.
At end of plant
at end of werks.
sum.
move : i_output1-werks to g_werks.
format color 3 intensified off.
write :/1 sy-vline, 2(25) 'Total for Plant :'(013),
28(4) g_werks.
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
format color off.
write /1(125) sy-uline.
endat.
At end of characteristic
at end of atinn.
read table i_output1 index l_tabix.
sum.
format color 3 intensified on.
write :/1 sy-vline, 2(25) 'Total for Characteristic:'(014),
28(25) i_output1-atnam.
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
format color off.
write /1(125) sy-uline.
endat.
endloop.
endform. " display_report
*& Form DISPLAY_BATCH
Display the batch details for the seclected material *
form display_batch.
Get the batch details for the selected material
get cursor field g_cursor.
if g_cursor = c_cursor1 or
g_cursor = c_cursor2 or
g_cursor = c_cursor3 or
g_cursor = c_cursor4 or
g_cursor = c_cursor5 or
g_cursor = c_cursor6.
format color 3.
write: /1 sy-vline,
2(17) 'Material Number :'(020),
20(17) i_output1-matnr,
94 sy-vline.
format color off.
write /1(94) sy-uline.
loop at i_mchb1 where matnr = i_output1-matnr and
atinn = i_output1-atinn and
atflo = i_output1-atflv.
format color col_normal.
shift i_mchb1-charg left deleting leading '0'.
write :/1 sy-vline, 2(16) i_mchb1-lgort centered,
18 sy-vline, 19(17) i_mchb1-charg centered,
36 sy-vline.
if i_output1-atnam cs c_ratio.
write: 37(29) i_mchb1-atflv
exponent 0 decimals 2 centered.
else.
write : 37(29) i_mchb1-atflv
exponent 0 decimals 0 centered.
endif.
write : 66 sy-vline, 67(27) i_mchb1-clabs unit i_mchb-meins,
94 sy-vline.
format color off.
endloop.
write /1(94) sy-uline.
else.
message s899 with 'Invalid cursor position'(016).
exit.
endif.
endform. " DISPLAY_BATCH
*& Form HEADING_SECLIST
Write the Column Headings for Interactive Report
form heading_seclist.
write /1(94) sy-uline.
format color col_heading on.
write :/1 sy-vline, 2(16) 'Storage Location'(021),
18 sy-vline, 19(17) 'Batch Number'(017) centered,
36 sy-vline, 37(29) 'Characteristic Value'(018) centered,
66 sy-vline, 67(27) 'Quantity'(019) centered,
94 sy-vline.
write /1(94) sy-uline.
format color off.
endform. " HEADING_SECLIST
*& Form COLLECT_RATIO
Display the Characteristic ratio data
form collect_ratio.
loop at i_output.
clear g_atinn.
i_output1-atinn = i_output-atinn.
i_output1-atnam = i_output-atnam .
i_output1-werks = i_output-werks.
i_output1-name1 = i_output-name1.
i_output1-matnr = i_output-matnr.
i_output1-maktx = i_output-maktx.
i_output1-clabs = i_output-clabs.
i_output1-meins = i_output-meins.
call function 'CONVERSION_EXIT_ATINN_OUTPUT'
exporting
input = i_output-atinn
importing
output = g_atinn.
if g_atinn cs c_ratio.
If the ratio value is between 13-14.99, display 13
if i_output-atflv between c_13 and c_1499.
i_output1-atflv = c_13.
If the ratio value is between 15-16.99, display 15
elseif i_output-atflv between c_15 and c_1699.
i_output1-atflv = c_15.
If the ratio value is between 17-18.99, display 17
elseif i_output-atflv between c_17 and c_1899.
i_output1-atflv = c_17.
If the ratio value is between 19-20.99, display 19
elseif i_output-atflv between c_19 and c_2099.
i_output1-atflv = c_19.
If the ratio value is between 21-22.99, display 21
elseif i_output-atflv between c_21 and c_2299.
i_output1-atflv = c_21.
If the ratio value is greater than or equal to 23, display 23
elseif i_output-atflv >= c_23.
i_output1-atflv = c_23.
endif.
write i_output1-atflv to i_output1-atflv .
else.
write i_output-atflv to i_output1-atflv exponent 0 decimals 0.
endif.
collect i_output1.
clear i_output1.
endloop.
sort i_output1 by atinn werks matnr atflv.
endform. " COLLECT_RATIO
<b>Reward points for useful Answers</b>
Regards
Anji
Maybe you are looking for
-
Fire Wire issues with DAW and External Hardrive
Hello Everyone. I'm running a new Mac pro and I have several Firewire hardware plugged up to it. The main issue I have Is may DAW (Presonus FirePod) freezes and looses it's sound. I have to shut down and restart on a lot. I'm not sure if my fire wire
-
Is First Generation MacBook Pro worth further investment?
Good Morning! After running disk utility (from a startup disk), I was only able to run "verify disk". The critical messages were: -volume bit map needs minor repair -volume header needs minor repair -the volume MAC HD needs to be repaired I've tried
-
Setting datagrid column width according to itemrenderer.
Hi all, This is my first question ever in any forum i have visited, so if you find anything stupid about my way of asking question then Pls ignore. I have taken a datagrid and for one of the datagrid column I have an itemrendere which is an HBOX
-
I deleted lots of emails. I compacted the file. I emptied the trash. I rebooted. I deleted more emails. I rebooted. Nothing worked. Space left is approx. 50%. Pls help.
-
Bad Quality When Sharing with iWEB
Sorry if this is posted somewhere on here. I could not find it. I am having a problem with real choppy video when sharing with iWEB. My videos when viewed on my website are very blurry to the point that you can not see faces. Any help would be most w