28xx/12.4(25b) - Not able to append EEM CLI output to flash
Hi,
I am trying to use EEM on a 2800 running 12.4(25b) Adv IP, to capture some output, when a particular syslog message is seen. When the syslog is seen, EEM runs but bails out, since it cannot write to flash.
router#sh ver | i IOS
Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(25b), RELEASE SOFTWARE (fc1)
router#
My EEM policy:
event manager applet EEM-TEST
event syslog pattern "TRACKING-5-STATE: 1 rtr 999999 state Up->Down"
action 1.0 cli command "enable"
action 2.0 cli command "ping 4.2.2.2 source Loopback0 | append flash:EEM"
action 3.0 cli command "traceroute 4.2.2.2 source Loopback0 | append flash:EEM"
action 4.0 cli command "ping 4.2.2.2 | append flash:EEM"
action 5.0 cli command "traceroute 4.2.2.2 | append flash:EEM"
action 6.0 cli command "more flash:EEM.txt"
When the event occurs, I see the event in below command, which confirms EEM runs:
router#sh event manager history events detailed
Load for five secs: 7%/1%; one minute: 8%; five minutes: 9%
Time source is NTP, 14:54:44.748 PDST Mon Aug 29 2011
No. Time of Event Event Type Name
1 Sun Aug28 22:07:08 2011 syslog applet: EEM-TEST
msg {Aug 28 22:07:08.063: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down}
2 Sun Aug28 22:09:38 2011 syslog applet: EEM-TEST
msg {Aug 28 22:09:38.067: %TRACKING-5-STATE: 1 rtr 999999 state Down->Up}
3 Mon Aug29 04:06:39 2011 syslog applet: EEM-TEST
msg {Aug 29 04:06:39.943: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down}
4 Mon Aug29 09:36:41 2011 syslog applet: EEM-TEST
msg {Aug 29 09:36:41.057: %TRACKING-5-STATE: 1 rtr 999999 state Down->Up}
5 Mon Aug29 12:24:11 2011 syslog applet: EEM-TEST
msg {Aug 29 12:24:11.675: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down}
6 Mon Aug29 14:26:37 2011 syslog applet: EEM-TEST
msg {Aug 29 14:26:37.162: %TRACKING-5-STATE: 1 rtr 999999 state Down->Up}
7 Mon Aug29 14:30:12 2011 syslog applet: EEM-TEST
msg {Aug 29 14:30:12.167: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down}
8 Mon Aug29 14:37:12 2011 syslog applet: EEM-TEST
msg {Aug 29 14:37:12.176: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down}
9 Mon Aug29 14:44:12 2011 syslog applet: EEM-TEST
msg {Aug 29 14:44:12.186: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down}
10 Mon Aug29 14:48:42 2011 syslog applet: EEM-TEST
msg {Aug 29 14:48:42.192: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down}
router#
I did a "debug event manager action cli" and see below, which explains why flash does not have a 'EEM' file created:
Aug 29 14:48:42.192: %TRACKING-5-STATE: 1 rtr 999999 state Up->Down
Aug 29 14:48:42.196: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : CTL : cli_open called.
Aug 29 14:48:42.196: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN :
Aug 29 14:48:42.208: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT :
Aug 29 14:48:42.208: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router>
Aug 29 14:48:42.208: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router>
Aug 29 14:48:42.208: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router>
Aug 29 14:48:42.208: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN : >enable
Aug 29 14:48:42.220: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT :
Aug 29 14:48:42.220: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router#
Aug 29 14:48:42.220: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN : #ping 4.2.2.2 source Loopback0 | append flash:EEM
Aug 29 14:48:42.232: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : ^
Aug 29 14:48:42.232: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : % Invalid input detected at '^' marker.
Aug 29 14:48:42.232: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT :
Aug 29 14:48:42.232: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router#
Aug 29 14:48:42.232: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN : #traceroute 4.2.2.2 source Loopback0 | append flash:EEM
Aug 29 14:48:42.244: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : ^
Aug 29 14:48:42.244: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : % Invalid input detected at '^' marker.
Aug 29 14:48:42.244: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT :
Aug 29 14:48:42.244: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router#
Aug 29 14:48:42.244: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN : #ping 4.2.2.2 | append flash:EEM
Aug 29 14:48:42.260: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : ^
Aug 29 14:48:42.260: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : % Invalid input detected at '^' marker.
Aug 29 14:48:42.260: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT :
Aug 29 14:48:42.260: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router#
Aug 29 14:48:42.260: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN : #traceroute 4.2.2.2 | append flash:EEM
Aug 29 14:48:42.272: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : ^
Aug 29 14:48:42.272: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : % Invalid input detected at '^' marker.
Aug 29 14:48:42.272: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT :
Aug 29 14:48:42.272: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router#
Aug 29 14:48:42.272: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN : #more flash:EEM.txt
Aug 29 14:48:42.288: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT :
Aug 29 14:48:42.288: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : %Error opening flash:EEM.txt (File not found)
Aug 29 14:48:42.288: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : OUT : router#
Aug 29 14:48:42.288: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : IN : #exit
Aug 29 14:48:42.288: %HA_EM-6-LOG: EEM-TEST : DEBUG(cli_lib) : : CTL : cli_close called.
router#
Looks like parser does not like the flash:EEM part. I don't know why.
Some information on the file system and flash:
router#sh file systems
Load for five secs: 5%/1%; one minute: 7%; five minutes: 8%
Time source is NTP, 14:39:27.976 PDST Mon Aug 29 2011
File Systems:
Size(b) Free(b) Type Flags Prefixes
- - opaque rw archive:
- - opaque rw system:
- - opaque rw null:
- - network rw tftp:
* 64016384 16502784 disk rw flash:#
245752 143748 nvram rw nvram:
- - opaque wo syslog:
- - opaque rw xmodem:
- - opaque rw ymodem:
- - network rw rcp:
- - network rw pram:
- - network rw ftp:
- - network rw http:
- - network rw scp:
- - network rw https:
- - opaque ro cns:
router#show flash: all
Load for five secs: 6%/1%; one minute: 8%; five minutes: 9%
Time source is NTP, 14:54:13.851 PDST Mon Aug 29 2011
-#- --length-- -----date/time------ path
1 38187152 Jan 27 2010 17:17:40 -08:00 c2800nm-advipservicesk9-mz.124-25b.bin
2 1826 Aug 22 2006 12:55:44 -07:00 sdmconfig-28xx.cfg
3 4734464 Aug 22 2006 12:56:10 -07:00 sdm.tar
4 833024 Aug 22 2006 12:56:26 -07:00 es.tar
5 1052160 Aug 22 2006 12:56:44 -07:00 common.tar
6 1038 Aug 22 2006 12:57:00 -07:00 home.shtml
7 102400 Aug 22 2006 12:57:16 -07:00 home.tar
8 491213 Aug 22 2006 12:57:34 -07:00 128MB.sdf
9 1684577 Aug 22 2006 12:58:02 -07:00 securedesktop-ios-3.1.1.27-k9.pkg
10 398305 Aug 22 2006 12:58:22 -07:00 sslclient-win-1.1.0.154.pkg
11 4039 Sep 18 2006 14:03:12 -07:00 running-config
12 660 Jan 14 2009 16:46:34 -08:00 vlan.dat
16502784 bytes available (47513600 bytes used)
******** ATA Flash Card Geometry/Format Info ********
ATA CARD GEOMETRY
Number of Heads: 8
Number of Cylinders 490
Sectors per Cylinder 32
Sector Size 512
Total Sectors 125440
ATA CARD FORMAT
Number of FAT Sectors 62
Sectors Per Cluster 8
Number of Clusters 15629
Number of Data Sectors 125301
Base Root Sector 231
Base FAT Sector 107
Base Data Sector 263
ATA MONLIB INFO
Image Monlib size = 61400
Disk monlib size = 54784
Name = piptom-atafslib-m
Monlib Start sector = 2
Monlib End sector = 100
Monlib updated by = C2800NM-IPBASE-M12.3(8)T8
Monlib version = 1
router#
Thanks
Shimol
Hi,
Is there an EEM file present on flash?
I'm just guessing but it seems as though you would need to do something along the lines of:
Original
action 2.0 cli command "ping 4.2.2.2 source Loopback0 | append flash:EEM"
Proposed
action 1.9 cli command "delete /force flash:EEM"
action 2.0 cli command "ping 4.2.2.2 source Loopback0"
action 2.1 cli command "more $_cli_result | append flash:EEM"
Again, just a guess.
Thanks!
Addendum:
It is not possible to "more" a variable nor can you pipe ping. So to achieve the desired result you will need to use Tcl. When EEM 4.0 is released there may be some additional file manipulation abilities.
Similar Messages
-
I am not able to fill up my output table
I'm fresher to ABAP.
I am not able to fill up my output internal table. please help in correcting my select statements.
Please help me.
I am pasting my code here.
DATA: BEGIN OF marc_tab OCCURS 0,
matnr LIKE marc-matnr, " Material Number
eislo LIKE marc-eislo, " Minimum Safety Stock
mabst LIKE marc-mabst, " Maximum stock level
eisbe LIKE marc-eisbe, " Safety stock
werks LIKE marc-werks, " Plant
ekgrp LIKE marc-ekgrp, " Purchasing group
dispo LIKE marc-dispo, " MRP controller
END OF marc_tab.
DATA: BEGIN OF mard_tab OCCURS 0,
lgort LIKE mard-lgort, " Storage Location
speme LIKE mard-speme, " Blocked stock
umlme LIKE mard-umlme, " Stock in transfer
insme LIKE mard-insme, " Stock in quality inspection
retme LIKE mard-retme, " Blocked Stock Returns
labst LIKE mard-labst, " Valuated stock with unrestricted use
END OF mard_tab.
DATA: mard_tab1 LIKE STANDARD TABLE OF mard_tab WITH HEADER
LINE.
Material and description
DATA: BEGIN OF mara_makt_tab OCCURS 0,
matnr LIKE mara-matnr, "Material number
maktx LIKE makt-maktx, "Material description
END OF mara_makt_tab.
DATA: BEGIN OF eord_lfa1_tab OCCURS 0,
matnr LIKE eord-matnr, "Material number
ebeln LIKE eord-ebeln, "Scheduling Agreement
lifnr LIKE eord-lifnr, "Vendor's account number
name1 LIKE lfa1-name1, "Name 1
END OF eord_lfa1_tab.
DATA: BEGIN OF mseg_mkpf_tab OCCURS 0,
budat LIKE mkpf-budat, "Posting date in the document
mblnr LIKE mkpf-mblnr, "Number of material document
werks LIKE mseg-werks,
mjahr LIKE mseg-mjahr, "Material doc. year
menge LIKE mseg-menge, "Quantity
lgort LIKE mseg-lgort, "Storage location
bwart1 LIKE mseg-bwart, " Movement type (inventory management)
bwart2 LIKE mseg-bwart,
lifnr LIKE mseg-lifnr,
END OF mseg_mkpf_tab.
DATA: mseg_mkpf_tab1 LIKE STANDARD TABLE OF mseg_mkpf_tab WITH HEADER
LINE.
DATA: BEGIN OF mkol_tab OCCURS 0,
seinm LIKE mkol-seinm, " Restricted-use consignment stock
slabs LIKE mkol-slabs, " Unrestricted-use consignment stock
sobkz LIKE mkol-sobkz, " Special stock indicator
END OF mkol_tab.
DATA: BEGIN OF t_werks OCCURS 0,
werks LIKE t001w-werks, " plant
END OF t_werks.
**DATA: BEGIN OF mkpf_tab OCCURS 0,
budat LIKE mkpf-budat, "Posting date in the document
mblnr LIKE mkpf-mblnr, "Number of material document
END OF mkpf_tab.
DATA: BEGIN OF zresult_tab OCCURS 0,
matnr LIKE marc-matnr, " Material Number
maktx LIKE makt-maktx, "Material description
rev_lvl TYPE c, " Revision level
ebeln LIKE eord-ebeln, "Scheduling Agreement
ekgrp LIKE marc-ekgrp, " Purchasing group
dispo LIKE marc-dispo, " MRP controller
lifnr LIKE eord-lifnr, "Vendor's account number
name1 LIKE lfa1-name1, "Name 1
eislo LIKE marc-eislo, " Minimum Safety Stock
mabst LIKE marc-mabst, " Maximum stock level
eisbe LIKE marc-eisbe, " Safety stock
werks LIKE marc-werks, " Plant
bwart LIKE mseg-bwart, " Movement type (inventory management)
slabs LIKE mkol-slabs, " Unrestricted-use consignment stock
labst LIKE mard-labst, " Valuated stock with unrestricted use
speme LIKE mard-speme, " Blocked stock
umlme LIKE mard-umlme, " Stock in transfer
insme LIKE mard-insme, " Stock in quality inspection
retme LIKE mard-retme, " Blocked Stock Returns /added
seinm LIKE mkol-seinm, " Restricted-use consignment stock
sobkz LIKE mkol-sobkz, " Special stock indicator
lgort LIKE mseg-lgort, "Storage location
END OF zresult_tab.
*DATA: zresult_tab1 LIKE STANDARD TABLE OF zresult_tab WITH HEADER LINE.
DATA: BEGIN OF zresult_tab1 OCCURS 0,
matnr LIKE marc-matnr, " Material Number
maktx LIKE makt-maktx, "Material description
ebeln LIKE eord-ebeln, "Scheduling Agreement
ekgrp LIKE marc-ekgrp, " Purchasing group
dispo LIKE marc-dispo, " MRP controller
lifnr LIKE eord-lifnr, "Vendor's account number
name1 LIKE lfa1-name1, "Name 1
eislo LIKE marc-eislo, " Minimum Safety Stock
mabst LIKE marc-mabst, " Maximum stock level
eisbe LIKE marc-eisbe, " Safety stock
werks LIKE marc-werks, " Plant
bwart LIKE mseg-bwart, " Movement type (inventory management)
menge LIKE mseg-menge,
slabs LIKE mkol-slabs, " Unrestricted-use consignment stock
labst LIKE mard-labst, " Valuated stock with unrestricted use
speme LIKE mard-speme, " Blocked stock
umlme LIKE mard-umlme, " Stock in transfer
insme LIKE mard-insme, " Stock in quality inspection
lgort LIKE mard-lgort,
retme LIKE mard-retme, " Blocked Stock Returns
END OF zresult_tab1.
*DATA : begin of zresult_tab1 occurs 0,
*include zresult_tab LIKE zresult_tab.
*end of itab.
and the select statements are like this:
SELECT matnr
FROM mara
INTO TABLE zresult_tab
WHERE matnr IN s_matnr.
and werks in s_werks.
SELECT mkpfbudat mkpfmblnr
msegmblnr msegmjahr mseg~menge
mseglgort msegbwart
FROM mseg INNER JOIN mkpf
ON mkpfmblnr = msegmblnr
AND mkpfmjahr = msegmjahr
INTO CORRESPONDING FIELDS OF
TABLE mseg_mkpf_tab
WHERE
mseg~werks IN s_werks
AND lgort IN s_lgort1
AND lgort IN s_lgort2
AND bwart IN s_bwart1
AND bwart IN s_bwart2.
AND budat IN s_usgpid.
IF sy-subrc EQ 0.
special stocks from vendor/Vendor consignment stock
SELECT seinm slabs sobkz
FROM mkol
INTO CORRESPONDING FIELDS OF
TABLE mkol_tab
FOR ALL ENTRIES IN mseg_mkpf_tab
WHERE matnr IN s_matnr
AND werks = mseg_mkpf_tab-werks
AND lifnr in s_lifnr
AND sobkz = 'K'.
ENDIF.
SELECT lgort speme umlme insme retme labst
FROM mard INTO TABLE mard_tab
WHERE matnr = zresult_tab-matnr
AND werks IN s_werks
AND lgort IN s_lgort1
AND lgort IN s_lgort2.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'no data populated!!!'.
ENDIF.
SELECT matnr ebeln lifnr
FROM eord
INTO CORRESPONDING FIELDS OF
TABLE eord_lfa1_tab
WHERE matnr IN s_matnr
AND werks IN s_werks.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'fgdf'. ENDIF
SELECT matnr ebeln lifnr
FROM eord
INTO CORRESPONDING FIELDS OF
TABLE eord_lfa1_tab
WHERE lifnr IN s_lifnr
AND werks IN s_werks
IF sy-subrc NE 0.
MESSAGE i000 WITH 'No matching material found'.
ENDIF.
IF NOT p_endstk IS INITIAL.
CLEAR zresult_tab1.
LOOP AT mard_tab.
READ TABLE zresult_tab1 WITH KEY lgort = s_lgort1.
IF sy-subrc EQ 0.
COLLECT mard_tab INTO mard_tab1.
ENDIF.
MOVE mard_tab1-speme TO zresult_tab-speme.
MOVE mard_tab1-umlme TO zresult_tab-umlme.
MOVE mard_tab1-insme TO zresult_tab-insme.
MOVE mard_tab1-retme TO zresult_tab-retme.
MOVE mard_tab1-labst TO zresult_tab-labst.
APPEND zresult_tab.
ENDLOOP.
ENDIF.
IF NOT p_otrstk IS INITIAL.
CLEAR zresult_tab1.
LOOP AT mard_tab.
READ TABLE zresult_tab1 WITH KEY lgort = s_lgort1 lgort = s_lgort2
IF sy-subrc EQ 0.
COLLECT mard_tab INTO mard_tab1.
ENDIF.
MOVE mard_tab1-speme TO zresult_tab-speme.
MOVE mard_tab1-umlme TO zresult_tab-umlme.
MOVE mard_tab1-insme TO zresult_tab-insme.
MOVE mard_tab1-retme TO zresult_tab-retme.
move mard_tab1-labst to zresult_tab-labst.
APPEND zresult_tab.
ENDLOOP.
ENDIF.
IF NOT p_chk IS INITIAL.
CLEAR :mseg_mkpf_tab,mseg_mkpf_tab1.
LOOP AT zresult_tab1.
READ TABLE mseg_mkpf_tab WITH KEY bwart1 = s_bwart1
lifnr = s_lifnr budat = s_usgpid.
IF sy-subrc EQ 0.
COLLECT mseg_mkpf_tab INTO mseg_mkpf_tab1.
ENDIF.
MOVE mseg_mkpf_tab1-menge TO zresult_tab1-menge.
APPEND zresult_tab1.
ENDLOOP.
ENDIF.
and filling the zresult _tab like this:
LOOP AT zresult_tab1.
READ TABLE mseg_mkpf_tab.
IF sy-subrc EQ 0.
zresult_tab1-bwart = mseg_mkpf_tab-bwart1.
MODIFY zresult_tab1.
ENDIF.
ENDLOOP.
LOOP AT zresult_tab1.
READ TABLE mkol_tab.
IF sy-subrc EQ 0.
zresult_tab1-slabs = mkol_tab-slabs.
ENDIF.
MODIFY zresult_tab1.
ENDLOOP.
LOOP AT zresult_tab1.
READ TABLE marc_tab.
IF sy-subrc EQ 0.
zresult_tab1-eislo = marc_tab-eislo.
zresult_tab1-mabst = marc_tab-mabst.
zresult_tab1-eisbe = marc_tab-eisbe.
zresult_tab1-werks = marc_tab-werks.
zresult_tab1-ekgrp = marc_tab-ekgrp.
zresult_tab1-dispo = marc_tab-dispo.
ENDIF.
MODIFY zresult_tab1.
ENDLOOP.
LOOP AT zresult_tab1.
READ TABLE mard_tab.
IF sy-subrc EQ 0.
zresult_tab1-labst = mard_tab-labst.
zresult_tab1-lgort = mard_tab-lgort.
zresult_tab1-speme = mard_tab-speme.
zresult_tab1-umlme = mard_tab-umlme.
zresult_tab1-insme = mard_tab-insme.
ENDIF.
MODIFY zresult_tab1.
ENDLOOP.
Thanks
AlekhyaSome comments on your code ---
SELECT lgort speme umlme insme retme labst
FROM mard INTO TABLE mard_tab
WHERE matnr = zresult_tab-matnr
AND werks IN s_werks
AND lgort IN s_lgort1
AND lgort IN s_lgort2.
---> instead of using zresult_tab-matnr u should be using s_matnr...to populate the mard_tab internal table with the records for all material otherwise it would just do it for the last record of zresult_tab-matnr.
IF NOT p_endstk IS INITIAL.
CLEAR zresult_tab1.
LOOP AT mard_tab.
READ TABLE zresult_tab1 WITH KEY lgort = s_lgort1.
IF sy-subrc EQ 0.
COLLECT mard_tab INTO mard_tab1.
ENDIF.
MOVE mard_tab1-speme TO zresult_tab-speme.
MOVE mard_tab1-umlme TO zresult_tab-umlme.
MOVE mard_tab1-insme TO zresult_tab-insme.
MOVE mard_tab1-retme TO zresult_tab-retme.
MOVE mard_tab1-labst TO zresult_tab-labst.
APPEND zresult_tab.
ENDLOOP.
ENDIF.
--> I am quiet puzzled with the above code you are trying to read zresult_tab1 and appending data into zresult_tab. Also, for the read to be successful you should try and fill more key columns otherwise it would just fetch the first record.
--> Also in the final bit of code you are appending and modifying zresult_tab1 table and expecting result in zresult_tab table ?? Can you please check on the code with that respect.
Regards
Anurag -
Report Not able to generate values in output
hi gurus,
i am not able to get the output for this report,pls help me in correcting the code and suggest me a sloution.Urgent...............
*& Report ZRPP006
*& Modification History
*& Change # | By | Date | Purpose of Change
*& C0001 |pradeep.R | 20070629 | Total component request for sop&Copa
*& | | |
*& | | |
report zrpp006 line-size 180 line-count 90
no standard page heading.
Class
*class cl_gui_column_tree definition load.
*class cl_gui_cfw definition load.
*data tree1 type ref to cl_gui_alv_tree.
*data mr_toolbar type ref to cl_gui_toolbar.
Include
*include <icon>.
*include bcalv_toolbar_event_receiver.
*include bcalv_tree_event_receiver.
include zipp007.
selection screen
selection-screen begin of block selscrb with frame title text-s01.
parameters: ra_SOP radiobutton group GRP default 'X',
ra_COPA radiobutton group GRP.
selection-screen end of block selscrb.
Data:pa_m_frm(6) type c,
pa_m_to(6) type c,
pa_y_frm(4) type c,
pa_y_to(4) type c,
ra_mth,
ra_yea,
l_mode.
*parameter: pa_m_frm(6) type c,
pa_m_to(6) type c,
pa_y_frm(4) type c,
pa_y_to(4) type c..
data: so_matnr,
so_matkl,
pa_stprs,
pa_werks ,
pa_vrsio .
selection-screen skip 1.
initialization.
clear: ta_vrsio, ta_type.
refresh: ta_vrsio, ta_type.
*at selection-screen on value-request for pa_vrsio.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'VRSIO'
dynprofield = 'PA_VRSIO'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = ta_vrsio.
Start-of-selection.
if ra_SOP eq 'X'.
submit ZRPP023 via selection-screen and return.
elseif ra_COPA eq 'X'.
submit ZRPP026 via selection-screen and return..
endif.
select * into corresponding fields of table ta_vrsio
from p44v
where gstru = 'S076'.
sort ta_vrsio by vrsio.
delete adjacent duplicates from ta_vrsio.
move 'MONTH' to ta_type-out_type.
append ta_type.
move 'YEAR' to ta_type-out_type.
append ta_type.
at selection-screen output.
if ra_mth = 'X'.
loop at screen.
if screen-name = 'PA_M_FRM'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C001007_1000'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C002009_1000'.
screen-active = '1'.
modify screen.
endif.
if screen-name = 'PA_M_TO'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C003012_1000'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C004014_1000'.
screen-active = '1'.
modify screen.
endif.
if screen-name = 'PA_Y_FRM'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C005017_1000'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C006019_1000'.
screen-active = '0'.
modify screen.
endif.
if screen-name = 'PA_Y_TO'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C007022_1000'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C008024_1000'.
screen-active = '0'.
modify screen.
endif.
endloop.
elseif ra_yea = 'X'.
loop at screen.
if screen-name = 'PA_M_FRM'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C001007_1000'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C002009_1000'.
screen-active = '0'.
modify screen.
endif.
if screen-name = 'PA_M_TO'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C003012_1000'.
screen-active = '0'.
modify screen.
endif.
if screen-name = '%C004014_1000'.
screen-active = '0'.
modify screen.
endif.
if screen-name = 'PA_Y_FRM'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C005017_1000'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C006019_1000'.
screen-active = '1'.
modify screen.
endif.
if screen-name = 'PA_Y_TO'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C007022_1000'.
screen-active = '1'.
modify screen.
endif.
if screen-name = '%C008024_1000'.
screen-active = '1'.
modify screen.
endif.
endloop.
endif.
End-of-selection.
perform get_header_data.
perform get_top_page.
*& Form display_alv
text
form display_alv.
ALV ***
g_repid = sy-repid.
perform layout_init using gs_layout.
perform eventtab_build using gt_events[].
gs_variant-report = g_repid.
g_save = 'A'.
perform comment_build using gt_list_top_of_page[].
Display monthly report
if ra_mth = 'X' and
pa_m_frm <> 0 and
pa_m_to <> 0.
perform fieldcat_init_mth using gt_fieldcat[].
perform printer_setting using print_set.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_background_id = 'ALV_BACKGROUND'
i_buffer_active = 'X'
i_callback_program = g_repid
i_structure_name = 'ITAB_MSALE'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
it_sort = gt_it_sort[]
is_print = print_set
I_SCREEN_START_COLUMN = 0 "Use coordinates for
I_SCREEN_START_LINE = 0 "display as dialog box
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
importing
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
tables
t_outtab = itab_msale
exceptions
program_error = 1
others = 2.
if sy-subrc = 0.
if g_exit_caused_by_caller = 'X'.
*" Forced Exit by calling program
*" <do_something>.
else.
*" User left list via F3, F12 or F15
if gs_exit_caused_by_user-back = 'X'. "F3
*" <do_something>.
else.
if gs_exit_caused_by_user-exit = 'X'. "F15
*" <do_something>.
else.
if gs_exit_caused_by_user-cancel = 'X'. "F12
*" <do_something>.
else.
*" should not occur!
*" <do_Abnormal_End>.
endif.
endif.
endif.
endif.
else.
"Fatal error callin ALVAXXX(XY) WITH ...
endif.
Display yearly report
elseif ra_yea = 'X' and
pa_y_frm <> 0 and
pa_y_to <> 0.
perform fieldcat_init_yr using gt_fieldcat[].
perform printer_setting using print_set.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_background_id = 'ALV_BACKGROUND'
i_buffer_active = 'X'
i_callback_program = g_repid
i_structure_name = 'ITAB_YSALE'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_save = g_save
is_variant = gs_variant
it_events = gt_events[]
it_sort = gt_it_sort[]
is_print = print_set
I_SCREEN_START_COLUMN = 0 "Use coordinates for
I_SCREEN_START_LINE = 0 "display as dialog box
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
importing
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
tables
t_outtab = itab_ysale
exceptions
program_error = 1
others = 2.
if sy-subrc = 0.
if g_exit_caused_by_caller = 'X'.
*" Forced Exit by calling program
*" <do_something>.
else.
*" User left list via F3, F12 or F15
if gs_exit_caused_by_user-back = 'X'. "F3
*" <do_something>.
else.
if gs_exit_caused_by_user-exit = 'X'. "F15
*" <do_something>.
else.
if gs_exit_caused_by_user-cancel = 'X'. "F12
*" <do_something>.
else.
*" should not occur!
*" <do_Abnormal_End>.
endif.
endif.
endif.
endif.
else.
*"Fatal error callin ALV
MESSAGE AXXX(XY) WITH ...
endif.
else.
endif.
endform. "display_alv
*& Form get_top_page
text
form get_top_page.
move 'Total Component Requirement by Sales Forecast' to
gt_list_top_of_page-info.
gt_list_top_of_page-typ = 'H'.
append gt_list_top_of_page.
concatenate 'Plant :' pa_werks
into gt_list_top_of_page-info separated by space.
gt_list_top_of_page-typ = 'S'.
append gt_list_top_of_page.
select single vetxt into tp_vetxt
from p44v
where gstru = 'S076'
and vrsio = pa_vrsio.
concatenate 'Version :' pa_vrsio tp_vetxt
into gt_list_top_of_page-info separated by space.
gt_list_top_of_page-typ = 'S'.
append gt_list_top_of_page.
call function 'DATUMSAUFBEREITUNG'
EXPORTING
idate = sy-datum
IMPORTING
tdat8 = l_date_string
EXCEPTIONS
datfm_ungueltig = 1
datum_ungueltig = 2
others = 3.
concatenate sy-uzeit(2) ':' sy-uzeit2(2) ':' sy-uzeit4(2)
into l_time.
concatenate 'Date/Time :' l_date_string l_time
into gt_list_top_of_page-info separated by space.
gt_list_top_of_page-typ = 'S'.
append gt_list_top_of_page.
endform. "get_top_page
*& Form get_header_data
text
--> p1 text
<-- p2 text
form get_header_data.
select pmnux into ta_mat-matnr
from s076
where pmnux = so_matnr
and wenux = pa_werks
and vrsio = pa_vrsio.
append ta_mat.
clear ta_mat.
endselect.
if sy-subrc = 0.
sort ta_mat by matnr .
delete adjacent duplicates from ta_mat.
loop at ta_mat.
select matnr stlnr stlan stlal
appending corresponding fields of table ta_mat2
from mast
where matnr = ta_mat-matnr
and werks = pa_werks.
endloop.
loop at ta_mat2 into wa_ta_mat.
select stlst bmeng bmein into (tp_stlst,tp_bmeng,tp_bmein)
from stko where stlnr = wa_ta_mat-stlnr
and stlal = wa_ta_mat-stlal.
wa_ta_mat-stlst = tp_stlst.
wa_ta_mat-bmeng = tp_bmeng.
wa_ta_mat-bmein = tp_bmein.
append wa_ta_mat to ta_header.
endselect.
endloop.
perform checking. "checking if monthly or yearly report is being selected
else.
message i003(zwpp001).
endif.
endform. " get_header_data
*& Form checking
text
form checking.
data : date1 like vtbbewe-dbervon,
date2 like vtbbewe-dberbis.
data : emonths like vtbbewe-atage.
data : lv_m_frm(6) type n,
lv_m_to(6) type n,
lv_y_frm(4) type n,
lv_y_to(4) type n.
check if the Display monthly report is being selected *****
if ra_mth = 'X' and
pa_m_frm <> 0 and
pa_m_to <> 0.
check for correct input format
lv_m_frm = pa_m_frm.
lv_m_to = pa_m_to.
if lv_m_frm ge '200000' and lv_m_to ge '200000'.
calculate the months in between
clear date1.
clear date2.
concatenate pa_m_frm '01' into date1.
concatenate pa_m_to '01' into date2.
concatenate pa_m_to '31' into date2.
perform months_calculate using date1 date2 changing emonths.
check if months <= 36.
if emonths <= 36.
perform get_sales.
perform retrieve_bom.
else.
message i000(zwpp001).
exit. " error message
endif.
else.
message i002(zwpp001).
endif.
check if the Display yearly report is being selected *****
elseif ra_yea = 'X' and
pa_y_frm <> 0 and
pa_y_to <> 0.
itab_bom-requantity = lp_s076-absat. "for current year 2006 ."added by pradeep on 4/07/07
itab_bom-requantity = lp_s076-absat + 1. "ie 2007.
itab_bom-requantity = lp_s076-absat + 2. "ie 2008.
check for correct input format
lv_y_frm = pa_y_frm.
lv_y_to = pa_y_to.
if lv_y_frm ge '2000' and lv_y_to ge '2000'.
calculate the months in between
clear date1.
clear date2.
concatenate pa_y_frm '0101' into date1.
concatenate pa_y_to '1201' into date2.
concatenate pa_y_to '1231' into date2.
perform months_calculate using date1 date2 changing emonths.
check if months <= 36.
if emonths <= 36.
perform get_sales.
perform retrieve_bom.
else.
message i001(zwpp001).
exit. " error message
endif.
else.
message i002(zwpp001).
endif.
else.
exit.
endif.
added by pradeep on 04/07/07
if emonths = 4.
itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
endif.
if emonths = 5.
tp_totalprice = lp_s076-absat * ta_mat-stprs.
endif.
if emonths = 6.
itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
endif.
if emonths = 7.
tp_totalprice = lp_s076-absat * ta_mat-stprs.
endif.
if emonths = 8.
itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
endif.
endform. " checking
*& Form get_sales
text
form get_sales.
data: iseq type i,
tp_sales type p decimals 2,
tp_totalprice type p decimals 2,"added by pradeep on 03/07/07
tp_maktx like makt-maktx,
tp_tabix like sy-tabix,
tp_pmnux like s076-pmnux,
seq type i.
data: yr_frm(6) type c,
yr_to(6) type c.
data: year_frm(4) type c,
year_to(4) type c.
data: month1(2) type c,
month12(4) type c.
data: totalsales like zspp003-mth1.
data: yr_index like sy-subrc.
check if the Display monthly report is being selected *****
if ra_mth = 'X' and
pa_m_frm <> 0 and
pa_m_to <> 0.
retrieve months
perform get_months.
select * into corresponding fields of table lp_s076 from s076
where pmnux = so_matnr
and wenux = pa_werks
and vrsio = pa_vrsio
and spmon ge pa_m_frm
and spmon le pa_m_to.
iseq = 1.
seq = 0.
loop at lp_s076.
if sy-tabix = 1.
write : lp_s076-pmnux to tp_pmnux.
endif.
select single maktx into tp_maktx from makt
where matnr = lp_s076-pmnux.
clear wa.
read table ta_s076 into wa with key
matnr = lp_s076-pmnux.
if sy-subrc ne 0.
wa-seq = iseq.
wa-matnr = lp_s076-pmnux.
wa-maktx = tp_maktx.
endif.
move lp_s076-absat to tp_sales.
case lp_s076-spmon.
when t_mth1.
move tp_sales to wa-mth1.
move t_mth1 to wa-sp1.
ind1 = '1'.
when t_mth2.
move tp_sales to wa-mth2.
move t_mth2 to wa-sp2.
ind2 = '1'.
when t_mth3.
move tp_sales to wa-mth3.
move t_mth3 to wa-sp3.
ind3 = '1'.
when t_mth4.
move tp_sales to wa-mth4.
move t_mth4 to wa-sp4.
ind4 = '1'.
when t_mth5.
move tp_sales to wa-mth5.
move t_mth5 to wa-sp5.
ind5 = '1'.
when t_mth6.
move tp_sales to wa-mth6.
move t_mth6 to wa-sp6.
ind6 = '1'.
when t_mth7.
move tp_sales to wa-mth7.
move t_mth7 to wa-sp7.
ind7 = '1'.
when t_mth8.
move tp_sales to wa-mth8.
move t_mth8 to wa-sp8.
ind8 = '1'.
when t_mth9.
move tp_sales to wa-mth9.
move t_mth9 to wa-sp9.
ind9 = '1'.
when t_mth10.
move tp_sales to wa-mth10.
move t_mth10 to wa-sp10.
ind10 = '1'.
when t_mth11.
move tp_sales to wa-mth11.
move t_mth11 to wa-sp11.
ind11 = '1'.
when t_mth12.
move tp_sales to wa-mth12.
move t_mth12 to wa-sp12.
ind12 = '1'.
when t_mth13.
move tp_sales to wa-mth13.
move t_mth13 to wa-sp13.
ind13 = '1'.
when t_mth14.
move tp_sales to wa-mth14.
move t_mth14 to wa-sp14.
ind14 = '1'.
when t_mth15.
move tp_sales to wa-mth15.
move t_mth15 to wa-sp15.
ind15 = '1'.
when t_mth16.
move tp_sales to wa-mth16.
move t_mth16 to wa-sp16.
ind16 = '1'.
when t_mth17.
move tp_sales to wa-mth17.
move t_mth17 to wa-sp17.
ind17 = '1'.
when t_mth18.
move tp_sales to wa-mth18.
move t_mth18 to wa-sp18.
ind18 = '1'.
when t_mth19.
move tp_sales to wa-mth19.
move t_mth19 to wa-sp19.
ind19 = '1'.
when t_mth20.
move tp_sales to wa-mth20.
move t_mth20 to wa-sp20.
ind20 = '1'.
when t_mth21.
move tp_sales to wa-mth21.
move t_mth21 to wa-sp21.
ind21 = '1'.
when t_mth22.
move tp_sales to wa-mth22.
move t_mth22 to wa-sp22.
ind22 = '1'.
when t_mth23.
move tp_sales to wa-mth23.
move t_mth23 to wa-sp23.
ind23 = '1'.
when t_mth24.
move tp_sales to wa-mth24.
move t_mth24 to wa-sp24.
ind24 = '1'.
when t_mth25.
move tp_sales to wa-mth25.
move t_mth25 to wa-sp25.
ind25 = '1'.
when t_mth26.
move tp_sales to wa-mth26.
move t_mth26 to wa-sp26.
ind26 = '1'.
when t_mth27.
move tp_sales to wa-mth27.
move t_mth27 to wa-sp27.
ind27 = '1'.
when t_mth28.
move tp_sales to wa-mth28.
move t_mth28 to wa-sp28.
ind28 = '1'.
when t_mth29.
move tp_sales to wa-mth29.
move t_mth29 to wa-sp29.
ind29 = '1'.
when t_mth30.
move tp_sales to wa-mth30.
move t_mth30 to wa-sp30.
ind30 = '1'.
when t_mth31.
move tp_sales to wa-mth31.
move t_mth31 to wa-sp31.
ind31 = '1'.
when t_mth32.
move tp_sales to wa-mth32.
move t_mth32 to wa-sp32.
ind32 = '1'.
when t_mth33.
move tp_sales to wa-mth33.
move t_mth33 to wa-sp33.
ind33 = '1'.
when t_mth34.
move tp_sales to wa-mth34.
move t_mth34 to wa-sp34.
ind34 = '1'.
when t_mth35.
move tp_sales to wa-mth35.
move t_mth35 to wa-sp35.
ind35 = '1'.
when t_mth36.
move tp_sales to wa-mth36.
move t_mth36 to wa-sp36.
ind36 = '1'.
endcase.
move seq to itab_seq-seq.
append itab_seq.
tp_tabix = sy-tabix.
if sy-subrc = 0.
modify table ta_s076 from wa.
modify ta_s076 from wa index tp_tabix.
if lp_s076-pmnux = tp_pmnux.
seq = seq + 1.
move seq to itab_seq.
append itab_seq.
endif.
else.
append wa to ta_s076.
if lp_s076-pmnux = tp_pmnux.
seq = seq + 1.
move seq to itab_seq.
append itab_seq.
endif.
endif.
iseq = iseq + 1.
endloop. " endloop for lp_s076.
itb_sales[] = ta_s076[].
itb_sales12[] = ta_s076[].
check if the Display yearly report is being selected *****
elseif ra_yea = 'X' and
pa_y_frm <> 0 and
pa_y_to <> 0.
clear year1.
clear year2.
clear year3.
perform get_years.
loop at ta_mat.
loop at ta_yr.
clear yr_index.
yr_index = sy-tabix.
case yr_index.
when '1'.
year1 = ta_yr-year.
when '2'.
year2 = ta_yr-year.
when '3'.
year3 = ta_yr-year.
endcase.
clear yr_frm.
clear yr_to.
year_frm = ta_yr-year.
year_to = ta_yr-year.
month1 = '01'.
month12 = '12'.
concatenate year_frm month1 into yr_frm.
concatenate year_to month12 into yr_to.
select * into corresponding fields of table lp_s076 from s076
where pmnux = ta_mat-matnr
and wenux = pa_werks
and vrsio = pa_vrsio
and spmon ge yr_frm
and spmon le yr_to.
calculate total sales.
totalsales = 0.
loop at lp_s076.
at first.
sum.
totalsales = lp_s076-absat.
endat.
at end of absat."added by pradeep on 4/07/07
sum.
tp_totalprice = lp_s076-absat * ta_mat-stprs.
itab_bom-requantity = lp_s076-absat * itab_bom-comp_qty / itab_bom-xmeng.
endat.
endloop. "endloop for lp_s076
select single maktx into tp_maktx from makt
where matnr = ta_mat-matnr.
read table ta_s076 into wa with key
matnr = ta_mat-matnr.
if sy-subrc ne 0.
wa-matnr = lp_s076-pmnux.
wa-maktx = tp_maktx.
endif.
case yr_index.
when '1'.
move totalsales to wa-sales_y1.
move tp_totalprice to wa-sales_y1."added by pradeep
move ta_yr-year to wa-year1.
ind1 = '1'.
when '2'.
move totalsales to wa-sales_y2.
move tp_totalprice to wa-sales_y2.
move ta_yr-year to wa-year2.
ind2 = '1'.
when '3'.
move totalsales to wa-sales_y3.
move tp_totalprice to wa-sales_y3.
move ta_yr-year to wa-year3.
ind3 = '1'.
endcase.
tp_tabix = sy-tabix.
if sy-subrc = 0.
modify table ta_s076 from wa.
modify ta_s076 from wa index tp_tabix.
else.
append wa to ta_s076.
endif.
endloop. "endloop for ta_yr
endloop. "endloop for ta_mat
itb_sales[] = ta_s076[].
else.
exit.
endif.
endform. "get_sales
*& Form get_months
text
form get_months.
move pa_m_frm to t_mth1.
perform get_next_few_months
using t_mth1 '1'
changing t_mth2.
perform get_next_few_months
using t_mth2 '1'
changing t_mth3.
perform get_next_few_months
using t_mth3 '1'
changing t_mth4.
perform get_next_few_months
using t_mth4 '1'
changing t_mth5.
perform get_next_few_months
using t_mth5 '1'
changing t_mth6.
perform get_next_few_months
using t_mth6 '1'
changing t_mth7.
perform get_next_few_months
using t_mth7 '1'
changing t_mth8.
perform get_next_few_months
using t_mth8 '1'
changing t_mth9.
perform get_next_few_months
using t_mth9 '1'
changing t_mth10.
perform get_next_few_months
using t_mth10 '1'
changing t_mth11.
perform get_next_few_months
using t_mth11 '1'
changing t_mth12.
perform get_next_few_months
using t_mth12 '1'
changing t_mth13.
perform get_next_few_months
using t_mth13 '1'
changing t_mth14.
perform get_next_few_months
using t_mth14 '1'
changing t_mth15.
perform get_next_few_months
using t_mth15 '1'
changing t_mth16.
perform get_next_few_months
using t_mth16 '1'
changing t_mth17.
perform get_next_few_months
using t_mth17 '1'
changing t_mth18.
perform get_next_few_months
using t_mth18 '1'
changing t_mth19.
perform get_next_few_months
using t_mth19 '1'
changing t_mth20.
perform get_next_few_months
using t_mth20 '1'
changing t_mth21.
perform get_next_few_months
using t_mth21 '1'
changing t_mth22.
perform get_next_few_months
using t_mth22 '1'
changing t_mth23.
perform get_next_few_months
using t_mth23 '1'
changing t_mth24.
perform get_next_few_months
using t_mth24 '1'
changing t_mth25.
perform get_next_few_months
using t_mth25 '1'
changing t_mth26.
perform get_next_few_months
using t_mth26 '1'
changing t_mth27.
perform get_next_few_months
using t_mth27 '1'
changing t_mth28.
perform get_next_few_months
using t_mth28 '1'
changing t_mth29.
perform get_next_few_months
using t_mth29 '1'
changing t_mth30.
perform get_next_few_months
using t_mth30 '1'
changing t_mth31.
perform get_next_few_months
using t_mth31 '1'
changing t_mth32.
perform get_next_few_months
using t_mth32 '1'
changing t_mth33.
perform get_next_few_months
using t_mth33 '1'
changing t_mth34.
perform get_next_few_months
using t_mth34 '1'
changing t_mth35.
perform get_next_few_months
using t_mth35 '1'
changing t_mth36.
endform. "get_months
*& Form get_years
text
form get_years.
data : tp_yr_frm(4) type n.
data : tp_yr_to(4) type n.
data : yr_diff(4) type n.
move pa_y_frm to tp_yr_frm.
move pa_y_to to tp_yr_to.
move tp_yr_frm to ta_yr-year.
append ta_yr.
yr_diff = tp_yr_to - tp_yr_frm.
*number of years = 3
if yr_diff = 2.
do 2 times.
tp_yr_frm = tp_yr_frm + 1.
move tp_yr_frm to ta_yr-year.
append ta_yr.
enddo.
*number of years = 2
elseif yr_diff = 1.
tp_yr_frm = tp_yr_frm + 1.
move tp_yr_frm to ta_yr-year.
append ta_yr.
else.
exit.
endif.
endform. "get_years
*& Form get_next_few_months
text
-->LV_CURR_MONTH text
-->LV_MONTHS text
-->LV_TARGET_MTH text
form get_next_few_months using lv_curr_month lv_months
changing lv_target_mth.
data : tp_month_curr like sy-datum,
tp_month_plus like sy-datum.
concatenate lv_curr_month '01' into tp_month_curr.
call function 'SG_PS_ADD_MONTH_TO_DATE'
EXPORTING
months = lv_months
olddate = tp_month_curr
IMPORTING
newdate = tp_month_plus.
move tp_month_plus(6) to lv_target_mth.
endform. " get_months
*& Form months_calculate
text
-->P_DATE1 text
-->P_DATE2 text
<--P_EMONTHS text
form months_calculate using p_date1
p_date2
changing p_emonths.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = p_date1
I_KEY_DAY_FROM =
i_date_to = p_date2
I_KEY_DAY_TO =
I_FLG_SEPARATE = ' '
importing
E_DAYS =
e_months = p_emonths.
E_YEARS =
endform. " months_calculate
*& Form retrieve_bom
text
--> p1 text
<-- p2 text
form retrieve_bom .
retrieve BOM components
sort ta_header by matnr.
loop at ta_header where stlan = '1' and stlst = '01'.
tp_bmeng = '1'.
perform get_bom tables ta_stpo using
ta_header-matnr ta_header-werks ta_header-stlan ta_header-stlal tp_bmeng.
requirement quantity calculation for active bom
perform calculation1.
retrieve BOM components for pgm
sort itab_bom2 by idnrk ascending.
delete adjacent duplicates from itab_bom2 comparing matnr idnrk.
loop at itab_bom2. " commented by weihong
tp_stlan = '1'.
tp_stlal = '02'.
perform get_pgm tables ta_stpo12 using
itab_bom2-matnr ta_header-werks tp_stlan tp_stlal.
endloop. " endloop for itab_bom2.(commented by weihong)
requirement quantity calculation for inactive bom
perform calculation2.
refresh : itab_bom1, itab_bom2, itab_pgm, temp_bom1,itab_path.
clear : itab_bom1, itab_bom2, itab_pgm, temp_bom1,itab_path.
endloop. " endloop for ta_header.
**itab_msale itab_ysale
*break-point.
perform display_alv.
endform. "retrieve bom
*& Form get_bom
text
-->LV_MATNR text
-->LV_WERKS text
-->LV_STLAN text
-->LV_STLAL text
form get_bom tables lt_stpo structure stpox
using lv_matnr like mast-matnr
lv_werks like mast-werks
lv_stlan like mast-stlan
lv_stlal like stko-stlal
lv_emeng like stko-bmeng .
data: ta_topmat type cstmat,
tp_dstst like csdata-xfeld,
ta_matcat type cscmat occurs 0,
tp_index like sy-tabix,
tp_stufe like stpox-stufe,
tp_diff like stpox-stufe,
tp_indx like sy-tabix,
tp_date like sy-datum,
lv_stufe like stpox-stufe,
lv_wegxx like stpox-wegxx,
lv_stprs like stpox-stprs,
lv_waers like stpox-waers,
lv_cuky_new like cdpos-cuky_new,
lv_value_new like cdpos-value_new,
lv_index like sy-tabix,
lv_datum like sy-datum,"added by pradeep on 02-07-07
nxt_index like sy-tabix.
added by weihong.
data: tp_mtart like mara-mtart,
tp_matkl like mara-matkl,
tp_stprs like stpox-stprs,
tp_bomlv1 like mast-matnr,
tp_bomlv2 like mast-matnr,
tp_bomlv3 like mast-matnr,
tp_bomlv4 like mast-matnr,
tp_indln type i.
write : lv_matnr to itab_bom1-matnr.
write : lv_matnr to itab_bom2-matnr.
write : lv_matnr to itab_path-matnr.Hi gurus,actually this program selecion screen is linked to ..as
First screen is .Sop
.copa
Again for sop is having a selection screen and in this it is divide based on month and year seperately in two more screens.
same for copa also....
so pls tell me a correct solution where to correct and get values.
Priority is very highhhhhhhhhhhhhh,so pls help me in sorting out this. -
Not able to view the excel output from eBS
Hi All,
I am not able to open the reports for the first time and this error is keep on coming everyday whenever i try to open any report for the first time.
Microsoft office Excel cannot access the file 'http:// '. There are several possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook
But in the second time o/p opens without any issues.
Can you please let me know what will be the cause of the issue.
Thanks
RajeshWhat browser are you using?
If Chrome, try something else. Chrome works fine with help on the server but not locally. There is more in Snippets on my site about the Chrome issue.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
Not able to view the webhelp output in Robohelp 9
Hello,
I am in a project where we have to create webhelp output from Robohelp 9. Whenever I generate the webhelp ouput I am not able to view the the contents. Although, the webhelp is opening in a browser window but there are no topics present in the contents. The other ouputs like .chm and .dox are fine, but there is some problem with the webhelp which I am unable to figure out.
Regards,
RusoWhat browser are you using?
If Chrome, try something else. Chrome works fine with help on the server but not locally. There is more in Snippets on my site about the Chrome issue.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
Not able to append "/" with dbms_metadata.
Hi All,
I am using 11gr2 and need to generate ddl for objects grants . i order to do this , I am using dbms_metadata to generate it. I need to add "/" after each command , but it's only adding to last page of the grants. also, even the linsize has been set to 200, but the output is still wraps around before 200.
SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT', USERNAME) || '/' DDL
FROM DBA_USERS where username in (select grantee from dba_tab_privs) and username in ('user')
GRANT SELECT ON "PACKAGING"."ASSOCIATED_COMPONENTS
_V" TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."ASSOCIATED_COMPONENTS2_V" TO
"AALKHALI"
GRANT SELECT ON "PACKAGING"."ASSOCIATED_COMPONENTS3_V" TO "AALKHA
LI"
GRANT SELECT ON "PACKAGING"."STANDARDS_REPORT1_ALL_LOC_V" TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_REPORT1_BYL
OC_V" TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_MANIFEST_V" TO "A
ALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_MANIFEST2_V" TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_COMP_STDS_V"
TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_STDDEFAULT_V" TO "AALK
HALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_STD_DISTCODE_V" TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_STD_LOCATION
_V" TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_STD_LIB_V" TO "AALK
HALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_STDSLIST_V" TO "AALKHALI"
GRANT SELECT ON "PACKAGING"."STANDARDS_STDSLBLS_V" TO "
AALKHALI"Edited by: user11983993 on Jul 3, 2012 8:10 AMHi,
You have to use dbms_metadata.set_transform_param in order to specify the SQLTERMINATOR (either ; or /) before issuing the GET_DDL :System@my11g SQL>exec dbms_metadata.set_transform_param(dbms_metadata.SESSION_TRANSFORM,'SQLTERMINATOR',true);
PL/SQL procedure successfully completed.
System@my11g SQL>SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT', USERNAME) u_ddl
2 FROM DBA_USERS where username in (select grantee from dba_tab_privs) and username in ('SCOTT');
U_DDL
GRANT EXECUTE ON "SYS"."DBMS_SESSION" TO "SCOTT";
GRANT EXECUTE ON "SYS"."DBMS_LOCK" TO "SCOTT";
GRANT EXECUTE ON "SYS"."DBMS_ERRLOG" TO "SCOTT";
GRANT EXECUTE ON "SYS"."DBMS_CRYPTO" TO "SCOTT";
GRANT READ, WRITE ON DIRECTORY "FOLDER1" TO "SCOTT";
GRANT READ, WRITE ON DIRECTORY "FOLDER2" TO "SCOTT";
GRANT READ, WRITE ON DIRECTORY "FOLDER3" TO "SCOTT";
GRANT EXECUTE ON "SYS"."TRACEME" TO "SCOTT";
GRANT EXECUTE ON "SYS"."TRACEMEOFF" TO "SCOTT";
GRANT EXECUTE ON "SYS"."REMOVE_FLARCH" TO "SCOTT";
GRANT EXECUTE ON "SYSTEM"."REMOVE_FLARCH" TO "SCOTT";
GRANT READ, WRITE ON DIRECTORY "SCOTTDIR" TO "SCOTT"; -
Not able to flush the data output stream in n/w prg.
Hi,
I am trying to send and receive the data using TCP/IP channel using socket programming.
Following is the server side code I have
Socket socket = server_socket.accept();
OutputStream output = socket.getOutputStream();
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputMessage = (String) input.readLine();
System.out.println(inputMessage);
output.write("Message from server");
output.flush();I am able to receive the message from the client and as per the code the message is getting printed in the console. But I am unable to send the message back to the Client inspite of flushing the output stream.
I am sure that the problem is because of the flush method which is not acutally flushing the data. If I use the "println" method instead of the write & flush method, everything seems to be working fine. I do not want to use the "println" method because I get an extra new line character in the msg I send to the Client.
Any help on this is appreciated!No. I am not using BufferedReader to listen for the server response. Given below is my client side code.
Socket socket = new Socket(<ip>, <port>);
InputStream input = socket.getInputStream();
PrintWriter output = new PrintWriter(socket.getOutputStream(),true);
output.println("Request from the client");
System.out.println("Waiting for the server response...");
byte buffer[] = new byte[2000];
input.read(buffer);
System.out.println(new String(byte));I am not receiving the message from server, it hangs on "Waiting for the server response..". -
Not able to get the whole output from BBP_PROCDOC_GETLIST FM
Hi
I am using the BBP_POCDOC_GETLIST FM to display the Shopping Cart details in the ALV report.
But when Date range is large (suppose 1 month) in the FM then it is not displaying the every SC details in the Report. For small range it is working fine.
CALL FUNCTION 'BBP_PROCDOC_GETLIST'
EXPORTING
i_object_type = /infype/cl_common=>gc_object_type_sc
i_create_date = date-low
i_create_date_to = date-high
i_status_select_or = /infype/cl_common=>gc_x
i_item_not_deleted = /infype/cl_common=>gc_x
TABLES
i_range_object_id = lt_sc_no
e_pdlist = lt_sclist
e_messages = lt_messages.
Please help me on this.
Thanks in advance
PrathamHi Shiva,
It does not going to these includes at all. Message comes out with successfully done. The BApi is calling RHPP_COMMON_QUALI_READ inside, but this will not return any data. But if will call any qualification object ID, this BAPI will come up with data.
So the QP type LO profile will not come up with any kind of data, but if we pass the OTYPE as Q and pass any Qualification object ID then the data will be returned.
Is there any relationship or some other thing is missing? Any idea.
Thanks,
Sanket Sethi -
NOT Able to print the Report output in the Printer
Hello guys
I have a concurrent Program-which is a report.A printer is installed in Oracle apps and i have assigned that printer to the concurrent Program.Now the problem is when i run the report after giving number of copies as 1 in options button,the report is getting completed sucessfully but it is not getting printed in the printer.
please help me in this issue.
log message:
Printing output file.
Request ID : 56734501
Number of copies : 1
Printer : xx-printer
Finished executing request completion options.
thanksPl post your OS and EBS versions and pl confirm that you can print the file to the printer from the OS level using OS commands.
MOS Doc 297522.1 - How to investigate printing issues and work towards its resolution ?
HTH
Srini -
Not able to view the XML Output, after Output format changed to XML
Hello Everybody...
After running the concurrent program having output type of XML. Output is not getting generated.
But getting generated when output type is changed to Text.
Please find the below log file info. :
BioReliance Receivables: Version : UNKNOWN - Development
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXBRAXINVNEW module: XXBio Print Selected Invoices New
Current system time is 28-MAY-2009 05:31:28
+-----------------------------
| Starting concurrent program execution...
+-----------------------------
Arguments
p_order_by='TRX_NUMBER'
p_trx_number_low='9859529'
p_trx_number_high='9859529'
p_installment_number='1'
p_open_invoice='N'
p_check_for_taxyn='N'
p_choice='SEL'
p_header_pages='0'
p_debug_flag='N'
p_message_level='10'
p_userid='9092'
XML_REPORTS_XENVIRONMENT is :
/oraapps2/devukora/8.0.6/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
XENVIRONMENT is set to /oraapps2/devukora/8.0.6/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
American_America.UTF8
Spawned Process 14380
REP-3000: Internal error starting Oracle Toolkit.
MSG-00100: DEBUG: AfterPForm_Trigger +
MSG-00100: DEBUG: Multi Org established.
MSG-00100: DEBUG: AfterParam_Procs.Get_Country_Details
MSG-00100: DEBUG: AfterParam_Procs.Switch_On_Debug
MSG-00100: DEBUG: AfterParam_Procs.Get_Trx_Number_Low
MSG-00100: DEBUG: AfterParam_Procs.Get_Trx_Number_High
MSG-00100: DEBUG: AfterParam_Procs.Get_Tax_Option
MSG-00100: DEBUG: AfterPForm_Trigger -
MSG-00100: DEBUG: BeforeReport_Trigger +
MSG-00100: DEBUG: BeforeReport_Procs.Populate_Printing_Option
MSG-00100: DEBUG: BeforeReport_Procs.Populate_Tax_Printing_Option
MSG-00100: DEBUG: BeforeReport_Trigger.Get_Message_Details
MSG-00100: DEBUG: BeforeReport_Trigger.Get_Org_Profile.
MSG-00100: DEBUG: Organization Id: 102
MSG-00100: DEBUG: BeforeReport_Trigger.Build_Where_Clause
MSG-00100: DEBUG: P_Choice: SEL
MSG-00100: DEBUG: Choice is other than ADJ, setting ORDER BY.
MSG-00100: DEBUG: BeforeReport_Trigger -
MSG-05000: DEBUG: Trx No... 9859529
MSG-00010: 05:31 1 Transaction: 9859529
Report Builder: Release 6.0.8.25.0 - Production on Thu May 28 05:31:28 2009
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Enter Username:
Start of log messages from FND_FILE
End of log messages from FND_FILE
Executing request completion options...
------------- 1) PUBLISH -------------
Beginning post-processing of request 14767798 on node RCKBLADE05 at 28-MAY-2009 05:31:36.
Post-processing of request 14767798 failed at 28-MAY-2009 05:31:36 with the error message:
One or more post-processing actions failed. Consult the OPP service log for details.
------------- 2) PRINT -------------
Finished executing request completion options.
Concurrent request completed
Current system time is 28-MAY-2009 05:31:36
Please do the needful in resolving the issue.
Thans in Advance.
Abdul.Hello Hussein,
Thanks.
Before I could ask the DBA to chage the DIPLAY parameter, I could see error in FNDOPP*.txt file, as some issue with tag "split-by-page-break".
Accordingly I removed the tag from the template file ( RFT File). Now the request is getting Completed with Normal status. And generating the PDF output.
I found a hit in the metalink for this issue, which suggests a PATCH 4206181 (XDO.5.5) to get this functionality.
Accordingly the PATCH is applied.
Now when trying to query the template name from the XML Publisher Administrator Responsiblity, page is getting errored with the below message.
====================================================================
oracle.apps.fnd.framework.OAException: Message not found. Application: FND, Message Name: FND_VIEWOBJECT_NOT_FOUND. Tokens: VONAME = TemplateFilesForViewVO2; APPLICATION_MODULE = oracle.apps.xdo.oa.template.server.TemplatesAM;
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1223)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1960)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
at oa_html._OA._jspService(_OA.java:86)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
at oracle.jsp.JspServlet.service(JspServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
at org.apache.jserv.JServConnection.run(JServConnection.java:294)
at java.lang.Thread.run(Thread.java:534)
====================================================================
Please do the needful in resolving the issue.
Thanks,
Abdul. -
I am not able to modify the text in pdf output file using pdf editor
Hi,
We have upgrade the xml 5.6.1 in server level. After upgrading this, we are not able to modify the pdf output file. Previously we used to modify text and delete text in pdf file which is generated by oracle Application. As of now we cann't upgrade higher version. Can you suggest what to do?.Check the xdo configuration file option in the user guides. There should be options that allow / disallow modifying text specifically. If you are in EBS, you should be able to change the configuration file options from the XML Publisher Administrator UI.
Klaus -
Not able to debug the ZDEG(Z OUTPUT) MEDIUM Distribution Ale
Hi All,
I am not able to debug the ZDEG output type for Shipment (Medium is Distribution ALE).
Executing the VT02n providing the Shipment and selec the GOTO Menu the Output tab and Select one (EX ZDEG) Output type. I have kept the break point in the Program RANASTED and Form Routine ALE_PROCESSING.
Table record in TNAPR table.
023 ZDEG A V7 RSNASTED ALE_PROCESSING
Could you please let me know how to debug this output type code.
Thanks In Advance.
VenkataWhich ERP version that you are using? If the system is ECC 6.0, then you can activate the session break-point in the print program. You can also activate form debugging option on using transaction SE71, enter name of the form (ZDEG), from the menu, Utilities->Activate Debugger. Hope this help you.
-
How to append ALV grid output to LIST output
Hi,
I am working with Basis AUDIT MANUAL report for which i have to integrate around 50 standard transactions (SM37,SM35...etc) output and make it into one single report.
On execution of my report i have to get all the 50 transaction outputs sequentially.
Some standard transactions have ALV list display output and some have GRID display.I can able to append only list outputs by submit program and exporting list to memory.
Please suggest me how to get Alv grid output in midst of list output.
Regards
Kalpana.You should post your question to the ABAP forum:
ABAP Development -
Not Able to Generate Out of the Report by adding the new 2 fields
Hi,
I'm Very new to ABAP. I have created one report. after 2 new fields added they are EKNAM and EKGRP.
The Thing is the remaining fields are displaying in the output. The Newly added fields are not displaying the out. I was able to add this 2 fields in the head of the report. But issue is not able to get the data on these 2 fields.
Please see the below program and any one please help me out to display the data in this report for the fields eknam and ekgrp.
TABLES: eban,
lfa1,
ekko,
t024,
v_username.
DATA: BEGIN OF i_req_items OCCURS 10,
ernam LIKE eban-ernam, "Created by
lifnr LIKE eban-lifnr, "Desired vendor
ebeln LIKE eban-ebeln, "PO Number
ebelp LIKE eban-ebelp, "PO Item
eknam LIKE t024-eknam, "Pur.Grp Name
ekgrp LIKE t024-ekgrp, "Pur.Grp Number
flief LIKE eban-flief, "Fixed vendor
name1 LIKE lfa1-name1, "Vendor name
badat LIKE eban-badat, "Creation date
erdat LIKE eban-erdat, "Change date
banfn LIKE eban-banfn, "Requisition no.
bnfpo LIKE eban-bnfpo, "Req. item no.
bsart LIKE eban-bsart, "Document type
knttp LIKE eban-knttp, "Acct.assgmt category
txz01 LIKE eban-txz01, "PO item description
menge LIKE eban-menge, "Quantity
preis LIKE eban-preis, "Price
peinh LIKE eban-peinh, "Price unit
value(14) TYPE p DECIMALS 2, "Item Value
END OF i_req_items.
DATA: BEGIN OF i_reqs OCCURS 10,
ernam LIKE eban-ernam, "Created by
persn LIKE usr21-persnumber, "Person number
uname LIKE adrp-name_text, "User name
lifnr LIKE eban-lifnr, "Vendor
name1 LIKE lfa1-name1, "Vendor name
badat LIKE eban-badat, "Creation date
banfn LIKE eban-banfn, "Requisition no.
bnfpo LIKE eban-bnfpo, "Req. item no.
bsart LIKE eban-bsart, "Document type
knttp LIKE eban-knttp, "Acct.assgmt category
txz01 LIKE eban-txz01, "PO item description
eknam like t024-eknam, "Purchase Grp Name
ekgrp like t024-ekgrp, "Purchase Grp Number
value(14) TYPE p DECIMALS 2, "Item Value
END OF i_reqs.
DATA: BEGIN OF i_req_keys OCCURS 0,
ernam LIKE eban-ernam, "Created by
lifnr LIKE eban-lifnr, "Desired vendor
erdat LIKE eban-erdat, "Create or Change date
banfn LIKE eban-banfn, "Requisition no.
bnfpo LIKE eban-bnfpo, "Req. item no.
eknam like t024-eknam, "Purchase Grp Name
ekgrp like t024-ekgrp, "Purchase Grp number
END OF i_req_keys.
DATA: BEGIN OF i_req_keeper OCCURS 0,
ernam LIKE eban-ernam, "Created by
lifnr LIKE eban-lifnr, "Desired vendor
banfn LIKE eban-banfn, "Requisition no
END OF i_req_keeper.
DATA: wa_reqitems LIKE i_req_items.
DATA: BEGIN OF i_export OCCURS 10,
record(150) TYPE c,
END OF i_export.
CONSTANTS
CONSTANTS:
c_doccat LIKE eban-bstyp VALUE 'B',
c_creind LIKE eban-estkz VALUE 'R',
c_delflag LIKE eban-loekz VALUE 'L',
c_write(5) TYPE c VALUE 'WRITE',
c_slash(1) TYPE c VALUE '/',
*start ESPZC U8DK900439
c_delimiter TYPE x VALUE '09',
c_delimiter TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
*end ESPZC U8DK900439
c_sc(1) TYPE c VALUE ';',
c_x(1) TYPE c VALUE 'X',
c_usd(1) TYPE c VALUE '2',
c_export LIKE authb-filename VALUE '/BAY2/UBEM_SPLIT_REQS'.
WORKING VARIABLES
DATA: w_report_id LIKE syst-repid,
w_sttime LIKE syst-uzeit,
w_rpt_pagno LIKE syst-pagno,
w_rc LIKE sy-subrc,
w_datelow LIKE eban-badat,
w_datehigh LIKE eban-badat,
w_export LIKE c_export,
w_records TYPE i,
w_message(50) TYPE c.
TYPES number TYPE i.
SELECTION SCREEN / PARAMETERS
SELECTION-SCREEN BEGIN OF BLOCK org WITH FRAME TITLE text-001.
PARAMETERS: p_purorg LIKE eban-ekorg OBLIGATORY DEFAULT 'US02'.
SELECT-OPTIONS: s_doctyp FOR eban-bsart,
s_date FOR eban-badat.
PARAMETERS: p_timper(2) TYPE n.
SELECTION-SCREEN: COMMENT 37(37) text-002.
SELECTION-SCREEN END OF BLOCK org.
SELECTION-SCREEN BEGIN OF BLOCK outp WITH FRAME TITLE text-003.
PARAMETERS: p_onlin RADIOBUTTON GROUP outp DEFAULT 'X',
p_servr RADIOBUTTON GROUP outp.
SELECTION-SCREEN END OF BLOCK outp.
AT SELECTION SCREEN
AT SELECTION-SCREEN.
IF p_servr = c_x.
CLEAR w_rc.
PERFORM authority_check_dataset USING w_export
CHANGING w_rc.
IF w_rc <> 0.
MESSAGE e532 WITH text-006 w_export.
ENDIF.
CLEAR w_rc.
PERFORM verify_unix_path_and_file CHANGING w_rc.
IF w_rc <> 0.
MESSAGE e531 WITH w_message.
ENDIF.
ENDIF.
INITIALIZATION EVENT
INITIALIZATION.
PERFORM get_filename.
MOVE syst-uzeit TO w_sttime.
MOVE syst-repid TO w_report_id.
CLEAR: w_rpt_pagno.
START-OF-SELECTION.
PERFORM get_data.
IF p_onlin = c_x.
IF w_records GT 0.
PERFORM print_report_header.
PERFORM write_report.
ELSE.
MESSAGE i531 WITH text-007.
ENDIF.
ELSEIF p_servr = c_x.
PERFORM write_export.
ENDIF.
END-OF-SELECTION.
---- F O R M R O U T I N E S -
*& FORM get_filename
FORM get_filename.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = c_export
IMPORTING
file_name = w_export
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " get_filename
FORM authority_check_dataset
FORM authority_check_dataset USING p_filename
CHANGING p_rc.
CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
EXPORTING
activity = c_write
filename = p_filename
EXCEPTIONS
no_authority = 1
activity_unknown = 2
OTHERS = 3.
p_rc = sy-subrc.
ENDFORM. "authority_check_dataset
FORM verify_unix_path_and_file
FORM verify_unix_path_and_file CHANGING p_rc.
*start ESPZC U8DK900439
OPEN DATASET w_export FOR OUTPUT IN TEXT MODE
MESSAGE w_message.
OPEN DATASET w_export FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
MESSAGE w_message.
*end ESPZC U8DK900439
p_rc = sy-subrc.
ENDFORM. "verify_unix_path_and_file
FORM get_data
FORM get_data.
CLEAR w_datelow.
CLEAR w_datehigh.
w_datelow = s_date-low - p_timper.
w_datehigh = s_date-high + p_timper.
w_datehigh = s_date-high.
SELECT ernam lifnr ebeln ebelp flief badat erdat banfn bnfpo bsart
knttp menge preis peinh txz01
FROM eban
INTO CORRESPONDING FIELDS OF TABLE i_req_items
WHERE bstyp = c_doccat
AND estkz = c_creind
AND knttp <> space
AND bsart IN s_doctyp
AND loekz <> c_delflag
AND ekorg EQ p_purorg
AND ( ( badat BETWEEN w_datelow and w_datehigh ) OR
( erdat BETWEEN w_datelow AND w_datehigh ) ).
AND erdat BETWEEN w_datelow AND w_datehigh.
IF sy-subrc = 0.
LOOP AT i_req_items.
IF i_req_items-lifnr IS INITIAL.
IF NOT i_req_items-flief IS INITIAL.
MOVE i_req_items-flief TO i_req_items-lifnr.
MODIFY i_req_items.
ENDIF.
IF NOT i_req_items-ebeln IS INITIAL.
SELECT lifnr FROM ekko
INTO i_req_items-lifnr
WHERE ebeln = i_req_items-ebeln.
ENDSELECT.
MODIFY i_req_items.
ENDIF.
ENDIF.
IF i_req_items-erdat GT i_req_items-badat.
MOVE i_req_items-erdat TO i_req_items-badat.
MODIFY i_req_items.
ENDIF.
ENDLOOP.
PERFORM weed_out_unique_records.
PERFORM apply_time_period.
SORT i_req_items BY ernam lifnr banfn bnfpo.
LOOP AT i_req_items.
i_req_items-value = ( i_req_items-menge *
( i_req_items-preis / i_req_items-peinh ) ).
MODIFY i_req_items.
ENDLOOP.
Getting vendor name from table LFA1 -
CLEAR i_req_items.
LOOP AT i_req_items.
SELECT SINGLE name1 FROM lfa1
INTO i_req_items-name1
WHERE lifnr = i_req_items-lifnr.
MODIFY i_req_items.
ENDLOOP.
LOOP AT i_req_items.
MOVE-CORRESPONDING i_req_items TO i_reqs.
Getting user name from view v_username -
SELECT SINGLE name_text
FROM v_username INTO i_reqs-uname
WHERE bname = i_reqs-ernam.
APPEND i_reqs.
ENDLOOP.
ENDIF.
DESCRIBE TABLE i_reqs LINES w_records.
ENDFORM. "Get_data
FORM print_report_header
FORM print_report_header.
ADD 1 TO w_rpt_pagno.
CALL FUNCTION '/BAY2/UBEXBH_BAYER_HEADR_FUN'
EXPORTING
f_jobname = text-020
f_business_group = text-021
f_report_title = text-022
f_repid = w_report_id
f_sysid = syst-sysid
f_linsz = syst-linsz
f_pagno = w_rpt_pagno
f_mandt = syst-mandt
f_datum = syst-datum
f_uzeit = w_sttime.
FORMAT COLOR COL_HEADING.
WRITE: /1 text-010, "Created by CWID & user name
29 text-011, "Vendor #
38 text-012, "Vendor Name
69 text-013, "Req Number
79 text-014, "/Item
87 text-015, "Created On
98 text-017, "A (AcctAssgmtCat)
100(14) text-019 RIGHT-JUSTIFIED, "Item Value
116(30) text-018, "Item Description
148 text-030, "Pur.Grp Name
170 text-031. "Pur.Grp Number
FORMAT COLOR OFF.
ULINE.
ENDFORM. "print_report_header
*& Form WRITE_REPORT
FORM write_report.
LOOP AT i_reqs.
WRITE: /1 i_reqs-ernam,
9(18) i_reqs-uname,
29 i_reqs-lifnr,
38(30) i_reqs-name1,
69 i_reqs-banfn,
79 c_slash,
80 i_reqs-bnfpo,
87 i_reqs-badat,
98 i_reqs-knttp,
100(14) i_reqs-value CURRENCY c_usd,
116(30) i_reqs-txz01,
145 i_reqs-eknam,
160 i_reqs-ekgrp.
ENDLOOP.
ENDFORM. "write_report
*& Form WRITE_EXPORT
FORM write_export.
DATA: l_value(14) TYPE c,
l_bsart(100) TYPE c,
l_uname(7) TYPE c,
l_records(5) TYPE c,
l_header(150) TYPE c,
l_params(150) TYPE c,
i_char TYPE i.
LOOP AT i_reqs.
CLEAR l_value.
CLEAR l_uname.
l_value = i_reqs-value.
l_uname = sy-uname.
CONCATENATE: i_reqs-uname
i_reqs-ernam
i_reqs-lifnr
i_reqs-name1
i_reqs-banfn
i_reqs-bnfpo
i_reqs-badat
i_reqs-knttp
l_value
i_reqs-txz01 INTO i_export
SEPARATED BY c_delimiter.
APPEND i_export.
ENDLOOP.
CONCATENATE: text-008 "Created By Name
text-009 "CWID
text-011 "Vendor No
text-012 "Vendor Name
text-013 "Req Number
text-023 "Item
text-015 "Created On
text-017 "A
text-019 "Item Value
text-018 "Item Description
text-030 "Purchase Grp name
text-031 "Purchase Grp number
INTO l_header SEPARATED BY c_delimiter.
INSERT l_header INTO i_export INDEX 1.
IF sy-batch IS INITIAL.
MOVE sy-uname TO l_uname.
ELSE.
MOVE text-024 TO l_uname.
ENDIF.
PERFORM collect_bsart CHANGING l_bsart
i_char.
l_records = w_records.
CONCATENATE: sy-sysid
p_purorg
l_bsart(i_char)
s_date-low
s_date-high
p_timper
l_uname
sy-datum
l_records INTO l_params
SEPARATED BY c_delimiter.
INSERT l_params INTO i_export INDEX 1.
LOOP AT i_export.
CONDENSE i_export NO-GAPS.
TRANSFER i_export TO w_export.
ENDLOOP.
CLOSE DATASET w_export.
MESSAGE s533 WITH text-028 w_export text-029.
ENDFORM. "write_export
*& FORM collect_bsart
FORM collect_bsart CHANGING p_bsart
p_char.
CLEAR p_bsart.
LOOP AT s_doctyp.
IF sy-tabix = 1.
p_bsart = s_doctyp-low.
ELSE.
CONCATENATE: p_bsart c_sc s_doctyp-low INTO p_bsart.
ENDIF.
ENDLOOP.
CONDENSE p_bsart NO-GAPS.
p_char = strlen( p_bsart ).
ENDFORM. "collect_bsart
*& Form WEED_OUT_UNIQUE_RECORDS
FORM weed_out_unique_records.
DATA: i_l_req_items LIKE i_req_items OCCURS 0 WITH HEADER LINE.
DATA: i_l_req_final_items LIKE i_req_items OCCURS 0 WITH HEADER LINE.
DATA: l_count TYPE i,
l_sy_tabix LIKE sy-tabix,
l_banfn LIKE eban-banfn.
REFRESH i_l_req_items.
REFRESH i_l_req_final_items.
CLEAR l_banfn.
i_l_req_items[] = i_req_items[].
i_l_req_final_items[] = i_req_items[].
SORT i_req_items BY ernam lifnr.
SORT i_l_req_items BY ernam lifnr.
SORT i_l_req_final_items BY ernam lifnr.
LOOP AT i_l_req_items.
l_banfn = i_l_req_items-banfn.
CLEAR l_count.
LOOP AT i_req_items
WHERE ernam = i_l_req_items-ernam
AND lifnr = i_l_req_items-lifnr.
IF i_req_items-banfn <> l_banfn.
ADD +1 TO l_count.
ENDIF.
ENDLOOP.
IF NOT ( l_count > 0 ).
LOOP AT i_l_req_final_items
WHERE ernam = i_l_req_items-ernam
AND lifnr = i_l_req_items-lifnr.
DELETE i_l_req_final_items.
ENDLOOP.
ENDIF.
ENDLOOP.
REFRESH i_req_items.
i_req_items[] = i_l_req_final_items[].
ENDFORM. " WEED_OUT_UNIQUE_RECORDS
*& Form APPLY_TIME_PERIOD
FORM apply_time_period.
DATA: l_i_req_keys LIKE i_req_keys.
DATA: l_days_diff TYPE p,
l_no_of_key_recs TYPE i,
l_next_item LIKE sy-tabix,
l_finished_with_keys TYPE c VALUE 'N',
l_add_line TYPE c VALUE 'N',
l_count TYPE i,
l_req_ernam LIKE eban-ernam,
l_req_lifnr LIKE lfa1-lifnr,
l_req_banfn LIKE eban-banfn,
l_save_tabix like sy-tabix.
REFRESH: i_req_keys, i_req_keeper.
LOOP AT i_req_items.
MOVE-CORRESPONDING i_req_items TO
i_req_keys.
IF i_req_items-erdat IS INITIAL.
i_req_keys-erdat = i_req_items-badat.
ENDIF.
APPEND i_req_keys.
ENDLOOP.
SORT i_req_keys BY ernam lifnr erdat.
CLEAR l_no_of_key_recs.
DESCRIBE TABLE i_req_keys LINES l_no_of_key_recs.
LOOP AT i_req_keys.
IF l_add_line = 'Y'.
MOVE-CORRESPONDING i_req_keys
TO i_req_keeper.
APPEND i_req_keeper.
l_add_line = 'N'.
ENDIF.
IF l_finished_with_keys = 'Y'.
EXIT.
ENDIF.
CLEAR l_next_item.
l_save_tabix = sy-tabix.
COMPUTE l_next_item = sy-tabix + 1.
IF l_next_item = l_no_of_key_recs.
l_finished_with_keys = 'Y'.
ENDIF.
clear: l_i_req_keys.
READ TABLE i_req_keys INDEX l_next_item
INTO l_i_req_keys.
sy-tabix = l_save_tabix.
CLEAR l_days_diff.
l_days_diff = l_i_req_keys-erdat -
i_req_keys-erdat.
IF l_i_req_keys-ernam =
i_req_keys-ernam AND
l_i_req_keys-lifnr =
i_req_keys-lifnr AND
l_i_req_keys-banfn <>
i_req_keys-banfn AND
l_days_diff <= p_timper.
MOVE-CORRESPONDING i_req_keys
TO i_req_keeper.
APPEND i_req_keeper.
l_add_line = 'Y'.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM i_req_keeper
COMPARING ALL FIELDS.
SORT i_req_keeper BY ernam lifnr banfn.
LOOP AT i_req_items.
CLEAR l_count.
CLEAR: l_req_ernam,
l_req_lifnr,
l_req_banfn.
l_req_ernam = i_req_items-ernam.
l_req_lifnr = i_req_items-lifnr.
l_req_banfn = i_req_items-banfn.
LOOP AT i_req_keeper
WHERE ernam = i_req_items-ernam
AND lifnr = i_req_items-lifnr
AND banfn = i_req_items-banfn.
ADD +1 TO l_count.
ENDLOOP.
IF NOT ( l_count > 0 ).
LOOP AT i_req_items
WHERE ernam = l_req_ernam
AND lifnr = l_req_lifnr
AND banfn = l_req_banfn.
DELETE i_req_items.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDFORM. " APPLY_TIME_PERIODRajesh,
Put a breakpoint and try to debug the report step by step.
You will findout the reason very easily.
Whenever you have a select and are trying to append into an internal table, keep checking your internal table if it is been populated with the correct records.
This way, you will findout the cause and can correct is accordingly.
Thanks,
Suresh Ganti -
Sharepoint 2010 - Not able to access Sharepoint 2010 Public facing site on mobile browsers
Hi All,
Earlier, I posted a similar question in the forum , but did not get appropriate response . Posting it again with some more information .
We are not able to access Sharepoint public facing site on Mobile browsers like chrome, IE, Safari (However the site is working fine on Firefox mobile browser and on PC/Laptops as well .)
Following is the error we are getting :
"Cannot set custom attribute on mobile controls in this page. Custom attributes specified are Access Key=0."
I checked in the event logs , following was the exception :
Exception captured in Exception HttpModule: System.Web.HttpException: Server cannot append header after HTTP headers have been sent.
at System.Web.HttpResponse.set_RedirectLocation(String value)
at Microsoft.SharePoint.Utilities.SPMobileUtility.Redirect(String url, SPRedirectFlags flags, HttpContext context, String queryStrings)
at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.HandleMobilePageRequest(HttpContext context)
at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostResolveRequestCacheHandler(Object oSender, EventArgs ea)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Also, there was a microsoft OS security patching on our farm servers post which the error starts coming . Following were the patches that were installed
1. MS14-005
KB2916036 Security Update for Windows Server 2008 R2 x64
Edition (KB2916036)
MS14-009
KB2898857 Security Update for Microsoft .NET Framework 3.5.1
2. on Windows 7 and Windows Server 2008 R2 SP1 for x64-based Systems
(KB2898857)
3. MS14-009
KB2901112 Security Update for Microsoft .NET Framework 3.5.1
on Windows 7 and Windows Server 2008 R2 SP1 for x64-based Systems
(KB2901112)
4. MS14-009
KB2911501 Security Update for Microsoft .NET Framework 3.5.1
on Windows 7 and Windows Server 2008 R2 SP1 for x64-based Systems
(KB2911501)
5. MS14-011
KB2909210 Security Update for Windows Server 2008 R2 x64
Edition (KB2909210)
6. MS14-012
KB2925418 Cumulative Security Update for Internet Explorer 8
for Windows Server 2008 R2 x64 Edition (KB2925418)
7. MS14-015
KB2930275 Security Update for Windows Server 2008 R2 x64
Edition (KB2930275)
8. MS14-016
KB2923392 Security Update for Windows Server 2008 R2 x64
Edition (KB2923392)
Has anyone of you ever faced similar(site not opening on mobile browsers) issue after installing these patches on farm servers .
Any help would be much appreciated .
Thanks
Saquib KhanWe have found below error related in ULS as well as event viewer both :
Exception captured in Exception HttpModule: System.Web.HttpException: Server cannot append header after HTTP headers have been sent.
at System.Web.HttpResponse.set_RedirectLocation(String value)
at Microsoft.SharePoint.Utilities.SPMobileUtility.Redirect(String url, SPRedirectFlags flags, HttpContext context, String
queryStrings)
at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.HandleMobilePageRequest(HttpContext context)
at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostResolveRequestCacheHandler(Object oSender, EventArgs ea)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Saquib Khan
Maybe you are looking for
-
My ID3 tags not being recognized by iTunes 10.2.2
Can't quite find my unique problem on this board so hopefully someone can help me. I have imported a lot of MP3 files into iTunes, successfully, which have v2.4 ID3 tags on them. I screwed up the song titles on one (Grateful Dead) show, and all songs
-
I had QT and itunes working fine, but for some reason they both stoped. Tried downloading them but it would not install because I have a "newer version" which I obviously don't. I have deleted every trace downloaded various clean up programs but it s
-
My audio in Logic Pro disappeard when Im working in a project but the sound in my computer works. How can that be?
-
My laptop connects to the internet via my wireless network at home. My ipad will not bring up the internet using the same connection. It shows in the wi-fi settings as connected but when I bring up safari, nothing comes up. Any ideas?
-
Creating Maintenance sub order - Reg
Hi all, I am trying to create a maintenance sub order but the system is asking for the business area as it asks for the main order. But, even though the busines area is listed in the F4 entries, it is not getting accepted and the system is again aski