PROBLEM IN SXPG_COMMAND_EXECUTE
Hi,
Can anyone solve my problem I m using function module to zip three excel sheet which were present in the application file and shell script is written accordingly.
But my query is this is working fine in Production and in development but it is failing in Quality with SU 53 screen shot showing auth. object S_RZL_ADM Object class BC_A with acticvity 01 is highlighted in red.
Does these are in correspondence with each other?
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = c_zcompressall
additional_parameters = w_missingtargz
stdout = c_x
stderr = c_x
terminationwait = c_x
TABLES
exec_protocol = w_protocol
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
Here after executing the w_protocol is giving me two values
1.Can't exec external program (No such file or directory)
2.External program terminated with exit code 1
Would please suggest me why it is happening?
regards
M jacks
Hi All,
There is a Quality refresh happened which means the Production data overwrites the Quality In such case the path that is defined in SM69 of the external command Zcompressall got overwrite with the production path which is the reason for failing of the external command.
Cheers
Jacks M.
Similar Messages
-
Problem with FM SXPG_COMMAND_EXECUTE in deleting a file on server.
Hi All,
My Task is to delete a file with version number 6 and rename all other files, so that my new file will be version 0.
Am using the FM SXPG_COMMAND_EXECUTE to delete/rename a file on server.
Though, this is working fine in debugging mode I can see the file getting deleted in regular run, which is followed by renaming some files, it is NOT working in regular run.
Somehow the deletion and renaming are not happening correctly in regular run, but does happen successfully while in debugging.
Am I missing anything or any refresh or delay needed?
Here is my code for DELETE :
CONCATENATE P_PATH '\' P_TABNAME '_6.dat' INTO LF_FILE.
CONDENSE LF_FILE NO-GAPS.
*// Check if this file exists
OPEN DATASET LF_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
*// Delete this file
DELETE = LF_FILE.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
ADDITIONAL_PARAMETERS = DELETE
COMMANDNAME = 'ZDELETE'
OPERATINGSYSTEM = OPSYS
STDERR = 'X'
STDOUT = 'X'
TARGETSYSTEM = EHOST
TERMINATIONWAIT = TERMWAIT
TRACE = ' '
IMPORTING
STATUS = RETCODE
TABLES
EXEC_PROTOCOL = PROT
EXCEPTIONS
COMMAND_NOT_FOUND = 01
NO_PERMISSION = 02
PARAMETERS_TOO_LONG = 03
PARAMETER_EXPECTED = 04
PROGRAM_START_ERROR = 05
PROGRAM_TERMINATION_ERROR = 06
SECURITY_RISK = 07
TOO_MANY_PARAMETERS = 08
WRONG_CHECK_CALL_INTERFACE = 09
X_ERROR = 10
OTHERS = 11.
ENDIF.
Regards
Raj
Edited by: Rajasekhar Dinavahi on Apr 14, 2010 11:45 AMHi All,
Problem resolved.
We need ensure all files which are opened [by OPEN DATASET], are CLOSED before trying any operation like DELETE or RENAME on the files.
Regards
Raj -
SXPG_COMMAND_EXECUTE - FTP problem
Hi Guys,
I am transferring file from FTP server to SAP server using the F.M SXPG_COMMAND_EXECUTE but the same same program executes in QAS server but not in DEV server.
I have checked in External command in SM69 and SM49 in both the systems both are same and I debugged and found that CALL FUNCTION 'SAPXPG_END_XPG' in side the
SXPG_COMMAND_EXECUTE gives the error in DEV server.
I am using a .BAT file and additional parametes I am using the FTP command with primary- proxy
Pls find the log
ftp> Invalid command.#
ftp> *****************
Invalid command.#
ftp> *************
Not connected.#
ftp> cd *********
Not connected.#
ftp> ls
quit
> ftp: connect :Connection refused
where as in QAS server the BAT file executes and gives me the list of files which is in the respective FTP server.
Please let me know the error and I hope some thing to do with server profile setup.
regards,
PrabhuHi,
I am using the same FTP server logon id and password and after the the FM SXPG_COMMAND_EXECUTE if there is no permission it should return me sy-subrc = 1 but here in my case the Sy-subrc = 0 but I get the log as not connected.
Regards
Prabhu
Edited by: prabhu jayaraman on Mar 11, 2009 8:57 AM -
Hi....
I have an Interface which actually downloads the "MATERIAL MASTER DATA" from SAP to a flat file.
The current o/p of the interface looks like:
MAT NO. MAT DESCRIPTION Subst. Mat no......
Now they askd me to add 3 more fields to that existing program.
those are:
1.OUTSERT No.
2.MEDICATION PART No.
3.AWP PRICE.
So I have written 2 FORMS to retrieve these things.
1st FORM is for getting OUTSERT and MED. PART No.
2nd FORM for AWP PRICE.
(1) OUTSERT: This we get from STPO-IDNRK field. similarly
(2) MED. PART NO.: This also is from STPO-IDNRK field.
The method I used for getting these two things is:
Basically the OUTSERT and MED PART NO. is nothing but the BOM COMPONENTS [STPO-IDNRK].
There is a simple difference between these two things:
If the BOM Component contains 'O' or 'OP' in that value then it is taken as OUTSERT.
For Eg: If STPO-IDNRK value is 73543O or 98723OP then it is OUTSERT.
and If STPO-IDNRK value is 65489M or 68785MP then it is MED. PART NO.
and we have two conditions to be satisfied to calculate these two things,
1.The Material Group[MARA-MATKL] should be 'OST' or 'OSP'.
means MARA-MATKL = 'OST' or 'OSP'.
2.The Alternative BOM Text[STKO-STKTX] should be 'UNRESTRICTED'.
means STKO-STKTX = 'UNRESTRICTED'.
Coming to AWP PRICE, it should be get from field RATE[KONP-KBETR].
I have used tables STKO, STPO to get Outsert and Med. Part No and A505, KONP for AWP Price...
I have highlighted the part of the code which I have included in the existing program....
But there are some problems with that code...so i'm not getting results....
Plz look at the code and let me know wher I've gone wrong...
Thanks much,
The code is:
REPORT Z02.
Table definitions ----------------------------------------------------
TABLES: AUSP, " Characteristic Values
CABN, " Characteristic
CAWN, " Characteristic values
CAWNT, " Value Texts
LFA1, " Vendor master (general section)
MAKT, " Material Descriptions
MARA, " Material Master: General Data
MARM, " Units of Measure
MBEW, " Material Valuation
MVKE, " Material Master: Sales Data
TVMST, " Materials: SD Status: Texts
TVM3T, " Material pricing group 3: Description
TVM5T, " Material pricing group 5: Description
KOTD001, " Conditions: Substitution - Sample Structure
KONDD, " Material Substitution - Data Division
<b>mast,
stko,
stpo,
a505,
konp.</b>
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TITLE1.
SELECT-OPTIONS: S_BWKEY FOR MBEW-BWKEY
MEMORY ID DEFAULT_BWKEY OBLIGATORY
No-Extension No Intervals.
SELECTION-SCREEN END OF BLOCK B1.
PARAMETERS:
MATLFILE(100) LOWER CASE OBLIGATORY
DEFAULT '/sapinterface/ebusiness/matlfile'.
Constants ------------------------------------------------------------
CONSTANTS:
ZERO_DEC_3 TYPE P DECIMALS 3 VALUE 0,
ZEROS(9) TYPE N VALUE 0,
REC_TYPE(2) VALUE 'MM',
DELIMETER_QUOTE VALUE '"',
BEGIN OF DEFAULTS,
BWTAR LIKE MBEW-BWTAR VALUE SPACE,
VKORG LIKE MVKE-VKORG VALUE '1000',
VTWEG LIKE MVKE-VTWEG VALUE '10',
END OF DEFAULTS.
constants:
c_uncpath_material(43)
value '/sapinterface/unconverted/zvppo102_matlfile',
c_final_path(44)
value '/sapinterface/ebusiness/' ,
c_uncpath(26)
value '/sapinterface/unconverted/' .
Data Elements --------------------------------------------------------
DATA: PROGNAME LIKE SY-REPID,
PROG_START_DATE LIKE SY-DATUM,
PROG_START_TIME LIKE SY-UZEIT,
WRITE_COUNT TYPE I,
OUTFILE(100),
WK_STPRS LIKE MBEW-STPRS,
WK_AUSP LIKE AUSP,
WK_CABN LIKE CABN,
WK_MARA LIKE MARA,
WK_MARM LIKE MARM.
DATA: BEGIN OF MATERIAL_DATA occurs 0,
DELIMITER_START,
REC_TYPE LIKE REC_TYPE,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
SMATN LIKE KONDD-SMATN,
SMATN_START LIKE KOTD001-DATAB,
SMATN_END LIKE KOTD001-DATBI,
VMSTA LIKE MVKE-VMSTA,
VMSTB LIKE TVMST-VMSTB,
LAEDA LIKE MARA-LAEDA,
AENAM LIKE MARA-AENAM,
VENDOR_NUM LIKE MARA-MFRNR,
VENDOR_NM LIKE LFA1-NAME1,
PROD_LINE_CD LIKE MVKE-MVGR5,
PROD_LINE_DSC(20),
DEA_SCH_ID LIKE MVKE-MVGR3,
DEA_SCH_DSC(20),
NORMT LIKE MARA-NORMT,
STPRS(13),
LOGO_DESC(30),
PRESCRIPT_FLAG(1),
THER_CLASS(5),
THER_CLASS_DSC(30),
THER_SUB_CLASS(5),
THER_SUB_CLASS_DSC(30),
THER_EQUIV(2),
ITEM_PACKAGE_SIZE(10),
ITEM_PACKAGE_TYPE(2),
DOSAGE_FORM(3),
DOSAGE_FORM_DSC(30),
DOSE_ADMIN(3),
DOSE_ADMIN_DSC(30),
BOTTLE_SIZE(6),
BRAND_NAME(25),
BRAND_DISTR(20),
BRAND_COLOR(20),
BRAND_SHAPE(15),
ANDA_DATE LIKE SY-DATUM,
ANDA_NUMBER(9),
BIO_STUDY,
DESI_INDICATOR,
DRUG_TERM_DT LIKE SY-DATUM,
FDA_APPRV_DT LIKE SY-DATUM,
ITEM_REG_NM(30),
MARKET_DT LIKE SY-DATUM,
PRODUCT_COLOR(20),
PRODUCT_FLAVOR(15),
PRODUCT_SHAPE(15),
PRODUCT_STRENGTH(18),
MEINS LIKE MARA-MEINS,
BEGIN OF BASE_MEASURES,
WEIGHT(15), "* like mara-brgew
WT_UNIT LIKE MARA-GEWEI,
VOLUM(15), "* like mara-volum,
VOL_UNIT LIKE MARA-VOLEH,
PKG_LENGTH(15), "* like mara-laeng
PKG_WIDTH(15), "* like mara-breit
PKG_HEIGHT(15), "* like mara-hoehe
DIM_UNIT LIKE MARA-MEABM,
END OF BASE_MEASURES,
INR_CRTN_COUNT(6), "* like marm-umrez
INR_CRTN_MEASURES LIKE MATERIAL_DATA-BASE_MEASURES,
CASE_COUNT(6), "* like marm-umrez
CASE_MEASURES LIKE MATERIAL_DATA-BASE_MEASURES,
ITEM_NOTE(500),
DELIMITER_END,
<b>component like stpo-idnrk,
mguide like stpo-idnrk,
awp like konp-kbetr,</b>
END OF MATERIAL_DATA.
DATA : F_M_uncFILE(100) . " Material file(unconverted)
DATA: W_BRM(3) Value 'BRM'.
<b>data: str1(2) type c value 'O',
str2(2) type c value 'OP',
str3(2) type c value 'M',
str4(2) type c value 'MP'.</b>
<b>data: begin of i_material,
matnr like mara-matnr,
rate like konp-kbetr,
end of i_material.
data: begin of i_outsert occurs 0,
matnr like mara-matnr,
stktx like stko-stktx,
component like stpo-idnrk,
end of i_outsert.</b>
INITIALIZATION.
*--- Initialize text fields for selection screen.
TITLE1 = 'Set Default'.
SET PARAMETER ID 'DEFAULT_BWKEY' FIELD W_BRM.
START-OF-SELECTION.
PERFORM INITIAL_STUFF.
PERFORM MAIN_SELECT.
PERFORM WRAPUP.
Select all material master records for finished products.
FORM MAIN_SELECT.
SELECT MATNR
BISMT
LAEDA
AENAM
MEINS
BRGEW
GEWEI
VOLUM
VOLEH
LAENG
BREIT
HOEHE
MEABM
NORMT
INTO (MATERIAL_DATA-MATNR,
MATERIAL_DATA-SMATN,
MATERIAL_DATA-LAEDA,
MATERIAL_DATA-AENAM,
MATERIAL_DATA-MEINS,
WK_MARA-BRGEW,
MATERIAL_DATA-BASE_MEASURES-WT_UNIT,
WK_MARA-VOLUM,
MATERIAL_DATA-BASE_MEASURES-VOL_UNIT,
WK_MARA-LAENG,
WK_MARA-BREIT,
WK_MARA-HOEHE,
MATERIAL_DATA-BASE_MEASURES-DIM_UNIT,
MATERIAL_DATA-NORMT)
FROM MARA
WHERE MTART = 'FERT' "* Finished product
OR MTART = 'HAWA'
ORDER BY MATNR.
Assign default values for fields which may not be available.
PERFORM ASSIGN_DEFAULTS.
Get related data from other tables.
PERFORM GET_MATERIAL_DESCRIPTION.
PERFORM GET_STANDARD_PRICE.
PERFORM GET_MVKE.
PERFORM GET_MARM.
PERFORM GET_AUSP.
PERFORM GET_SUBSTITUTE_MATNR.
PERFORM GET_BASIC_DATA_TEXT.
PERFORM GET_VENDOR_NAME.
<b>perform get_outsert.
perform get_awp.</b>
SEARCH MATERIAL_DATA FOR '"'.
IF SY-SUBRC = 0.
REPLACE '"' WITH ' ' INTO MATERIAL_DATA.
ENDIF.
MATERIAL_DATA-DELIMITER_START = DELIMETER_QUOTE.
MATERIAL_DATA-DELIMITER_END = DELIMETER_QUOTE.
Write output record.
ADD 1 TO WRITE_COUNT.
TRANSFER MATERIAL_DATA TO F_M_UNCFILE .
Reinitialize work variables.
CLEAR: MATERIAL_DATA,
WK_STPRS,
WK_AUSP,
WK_CABN,
WK_MARA,
WK_MARM.
ENDSELECT.
ENDFORM. " main_select
Assign numeric fields to character fields for output.
FORM ASSIGN_DEFAULTS.
MATERIAL_DATA-REC_TYPE = REC_TYPE.
MATERIAL_DATA-BASE_MEASURES-WEIGHT = WK_MARA-BRGEW.
MATERIAL_DATA-BASE_MEASURES-VOLUM = WK_MARA-VOLUM.
MATERIAL_DATA-BASE_MEASURES-PKG_LENGTH = WK_MARA-LAENG.
MATERIAL_DATA-BASE_MEASURES-PKG_WIDTH = WK_MARA-BREIT.
MATERIAL_DATA-BASE_MEASURES-PKG_HEIGHT = WK_MARA-HOEHE.
Set character fields to 0 in case not found on DB.
MATERIAL_DATA-ANDA_NUMBER = ZEROS. "* ???
MATERIAL_DATA-ITEM_PACKAGE_SIZE = 0.
MATERIAL_DATA-INR_CRTN_COUNT = 0.
MATERIAL_DATA-CASE_COUNT = 0.
MATERIAL_DATA-INR_CRTN_MEASURES-WEIGHT = ZERO_DEC_3.
MATERIAL_DATA-INR_CRTN_MEASURES-VOLUM = ZERO_DEC_3.
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_LENGTH = ZERO_DEC_3.
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_WIDTH = ZERO_DEC_3.
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_HEIGHT = ZERO_DEC_3.
MOVE-CORRESPONDING MATERIAL_DATA-INR_CRTN_MEASURES
TO MATERIAL_DATA-CASE_MEASURES.
ENDFORM. " assign_defaults
FORM GET_VENDOR_NAME.
SELECT SINGLE NAME1
INTO MATERIAL_DATA-VENDOR_NM
FROM LFA1
WHERE LIFNR = MATERIAL_DATA-VENDOR_NUM.
ENDFORM. " get_vendor_name
FORM GET_OUTSERT *
<b>form get_outsert.
select matnr from mara into corresponding fields of table material_data
where mtart = 'FERT' or mtart = 'HAWA'.
select didnrk amatnr
into (i_outsert-component, i_outsert-matnr)
from stpo as d
inner join stko as c
on dstlnr = cstlnr
inner join mast as b
on cstlnr = bstlnr
inner join mara as a
on bmatnr = amatnr
for all entries IN material_data
where a~matnr = material_data-matnr.
append i_outsert.
endselect.
check i_outsert-stktx = 'UNRESTRICTED'.
if ( i_outsert-component cs str1 ) or ( i_outsert-component cs str2 ).
move i_outsert-component to material_data-component.
append material_data.
elseif ( i_outsert-component cs str3 ) or
( i_outsert-component cs str4 ).
move i_outsert-component to material_data-mguide.
append material_data.
endif.
modify material_data transporting component
where matnr = i_outsert-matnr.
endform. "get_outsert</b>
FORM GET_AWP *
<b>form get_awp.
select matnr from mara into corresponding fields of table material_data
where mtart = 'FERT' or mtart = 'HAWA'.
select bmatnr ckbetr into (i_material-matnr, i_material-rate)
from konp as c
inner join a505 as b
on cknumh = bknumh
inner join mara as a
on bmatnr = amatnr
for all entries IN material_data
where a~matnr = material_data-matnr
and b~kappl = 'V'
and b~kschl = 'ZR10'
and b~vkorg = '1000'
and b~pltyp = '01'
and b~datbi > sy-datum
and b~datab < sy-datum.
append i_material.
endselect.
move i_material-rate to material_data-awp.
append material_data.
modify material_data transporting awp
where matnr = i_material-matnr.
endform. "get_awp</b>
FORM GET_MATERIAL_DESCRIPTION.
SELECT SINGLE MAKTX
INTO MATERIAL_DATA-MAKTX
FROM MAKT
WHERE MATNR = MATERIAL_DATA-MATNR
AND SPRAS = SY-LANGU.
ENDFORM. " get_material_description
FORM GET_STANDARD_PRICE.
data: l_vprsv like mbew-vprsv,
l_verpr like mbew-verpr.
clear: l_Vprsv, l_verpr.
SELECT SINGLE VPRSV VERPR stprs
into (l_vprsv, l_verpr, WK_stprs)
FROM MBEW
WHERE MATNR = MATERIAL_DATA-MATNR
AND BWKEY IN S_BWKEY
AND BWTAR = DEFAULTS-BWTAR.
the need to change the assumption
that standard price is housed in MBEW-STPRS. This does not apply to
plant US18, so need to check to see what the price control field is
(MBEW-VPRSV) and if it is S, use standard price, if it is V, use the
moving average price.
IF L_VPRSV = 'V'.
WK_STPRS = L_VERPR.
ENDIF.
MATERIAL_DATA-STPRS = WK_STPRS.
ENDFORM. " get_standard_price
FORM GET_MVKE.
SELECT SINGLE MVGR3
VMSTA
MVGR5
INTO (MATERIAL_DATA-DEA_SCH_ID,
MATERIAL_DATA-VMSTA,
MATERIAL_DATA-PROD_LINE_CD)
FROM MVKE
WHERE MATNR = MATERIAL_DATA-MATNR
AND VKORG = DEFAULTS-VKORG
AND VTWEG = DEFAULTS-VTWEG.
IF SY-SUBRC = 0.
PERFORM GET_DEA_ID_DSC.
PERFORM GET_PROD_LINE_DSC.
PERFORM GET_VMSTB.
ENDIF.
ENDFORM. " get_mvke
FORM GET_DEA_ID_DSC.
SELECT SINGLE BEZEI
INTO MATERIAL_DATA-DEA_SCH_DSC
FROM TVM3T
WHERE SPRAS = SY-LANGU
AND MVGR3 = MATERIAL_DATA-DEA_SCH_ID.
ENDFORM. " get_dea_id_dsc
FORM GET_PROD_LINE_DSC.
SELECT SINGLE BEZEI
INTO MATERIAL_DATA-PROD_LINE_DSC
FROM TVM5T
WHERE SPRAS = SY-LANGU
AND MVGR5 = MATERIAL_DATA-PROD_LINE_CD.
ENDFORM. " form get_prod_line_dsc
FORM GET_VMSTB.
SELECT SINGLE VMSTB
INTO MATERIAL_DATA-VMSTB
FROM TVMST
WHERE SPRAS = SY-LANGU
AND VMSTA = MATERIAL_DATA-VMSTA.
ENDFORM. " form get_vmstb
Get measurements, etc. for inner carton and case from the MARM table.
FORM GET_MARM.
SELECT MEINH " alternative unit of measure for stockkeeping unit
UMREZ " numerator for conversion to base units of measure
LAENG " length
BREIT " width
HOEHE " height
MEABM " unit of dimension for length/width/height
VOLUM " volume
VOLEH " volume unit
BRGEW " gross weight
GEWEI " unit of weight
INTO (WK_MARM-MEINH,
WK_MARM-UMREZ,
WK_MARM-LAENG,
WK_MARM-BREIT,
WK_MARM-HOEHE,
WK_MARM-MEABM,
WK_MARM-VOLUM,
WK_MARM-VOLEH,
WK_MARM-BRGEW,
WK_MARM-GEWEI)
FROM MARM
WHERE MATNR = MATERIAL_DATA-MATNR
AND MEINH IN ('CS', 'PAK').
PERFORM EVALUATE_MEINH.
CLEAR WK_MARM.
ENDSELECT.
ENDFORM. " get_marm
Populate output record fields based on alternative unit of measure.
FORM EVALUATE_MEINH.
CASE WK_MARM-MEINH.
WHEN 'CS'.
MATERIAL_DATA-CASE_COUNT = WK_MARM-UMREZ.
MATERIAL_DATA-CASE_MEASURES-WEIGHT = WK_MARM-BRGEW.
MATERIAL_DATA-CASE_MEASURES-WT_UNIT = WK_MARM-GEWEI.
MATERIAL_DATA-CASE_MEASURES-VOLUM = WK_MARM-VOLUM.
MATERIAL_DATA-CASE_MEASURES-VOL_UNIT = WK_MARM-VOLEH.
MATERIAL_DATA-CASE_MEASURES-PKG_LENGTH = WK_MARM-LAENG.
MATERIAL_DATA-CASE_MEASURES-PKG_WIDTH = WK_MARM-BREIT.
MATERIAL_DATA-CASE_MEASURES-PKG_HEIGHT = WK_MARM-HOEHE.
MATERIAL_DATA-CASE_MEASURES-DIM_UNIT = WK_MARM-MEABM.
WHEN 'PAK'.
MATERIAL_DATA-INR_CRTN_COUNT = WK_MARM-UMREZ.
MATERIAL_DATA-INR_CRTN_MEASURES-WEIGHT = WK_MARM-BRGEW.
MATERIAL_DATA-INR_CRTN_MEASURES-WT_UNIT = WK_MARM-GEWEI.
MATERIAL_DATA-INR_CRTN_MEASURES-VOLUM = WK_MARM-VOLUM.
MATERIAL_DATA-INR_CRTN_MEASURES-VOL_UNIT = WK_MARM-VOLEH.
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_LENGTH = WK_MARM-LAENG.
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_WIDTH = WK_MARM-BREIT.
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_HEIGHT = WK_MARM-HOEHE.
MATERIAL_DATA-INR_CRTN_MEASURES-DIM_UNIT = WK_MARM-MEABM.
ENDCASE.
ENDFORM. " evaluate_meinh
Get characterics from the AUSP & CABN tables.
FORM GET_AUSP.
*--- Get object number for classification lookup.
data: l_objek like ausp-objek.
clear l_objek.
select cuobj into l_objek from inob up to 1 rows
where klart = '001'
and obtab = 'MARA'
and objek = material_data-matnr.
endselect.
SELECT A~ATINN " internal characteristic
A~ATWRT " characteristic value
A~ATAWE " unit of measurement
A~ATAW1 " unit of measurement
A~ATFLV " internal floating point from (value if date)
C~ATNAM " characteristic name
INTO (WK_AUSP-ATINN,
WK_AUSP-ATWRT,
WK_AUSP-ATAWE,
WK_AUSP-ATAW1,
WK_AUSP-ATFLV,
WK_CABN-ATNAM)
FROM AUSP AS A INNER JOIN
CABN AS C ON AATINN = CATINN
where a~objek = l_objek
AND C~ATNAM LIKE 'MM_%'
AND A~LKENZ = SPACE.
PERFORM EVALUATE_CHARACTERISTIC.
ENDSELECT.
ENDFORM. " get_ausp
Populate output record fields based on characteristic type.
FORM EVALUATE_CHARACTERISTIC.
DATA: SIZE_TEMP TYPE I.
CASE WK_CABN-ATNAM.
when 'MM_BOTTLE_SIZE'.
MATERIAL_DATA-BOTTLE_SIZE = WK_AUSP-ATWRT.
when 'MM_BRAND_COLOR'.
MATERIAL_DATA-BRAND_COLOR = WK_AUSP-ATWRT.
WHEN 'MM_BRAND_DISTRIBUTOR'.
MATERIAL_DATA-BRAND_DISTR = WK_AUSP-ATWRT.
when 'MM_BRAND_NAME'.
MATERIAL_DATA-BRAND_NAME = WK_AUSP-ATWRT.
when 'MM_BRAND_SHAPE'.
MATERIAL_DATA-BRAND_SHAPE = WK_AUSP-ATWRT.
WHEN 'MM_DOSAGE_FORM'.
MATERIAL_DATA-DOSAGE_FORM = WK_AUSP-ATWRT.
PERFORM GET_CHARACTERISTIC_DSC
USING WK_AUSP-ATINN
WK_AUSP-ATWRT
CHANGING MATERIAL_DATA-DOSAGE_FORM_DSC.
when 'MM_DOSE_ADMINISTRATION'.
MATERIAL_DATA-DOSE_ADMIN = WK_AUSP-ATWRT.
PERFORM GET_CHARACTERISTIC_DSC
USING WK_AUSP-ATINN
WK_AUSP-ATWRT
CHANGING MATERIAL_DATA-DOSE_ADMIN_DSC.
WHEN 'MM_ITEM_PACKAGE_SIZE'.
SIZE_TEMP = WK_AUSP-ATFLV.
MATERIAL_DATA-ITEM_PACKAGE_SIZE = SIZE_TEMP.
WHEN 'MM_ITEM_PACKAGE_TYPE'.
MATERIAL_DATA-ITEM_PACKAGE_TYPE = WK_AUSP-ATWRT.
when 'MM_LOGO_DESC'.
MATERIAL_DATA-LOGO_DESC = WK_AUSP-ATWRT.
when 'MM_PRESCRIPTION_FLAG'.
MATERIAL_DATA-PRESCRIPT_FLAG = WK_AUSP-ATWRT.
when 'MM_THERAPEUTIC_CLASS'.
MATERIAL_DATA-THER_CLASS = WK_AUSP-ATWRT.
PERFORM GET_CHARACTERISTIC_DSC
USING WK_AUSP-ATINN
WK_AUSP-ATWRT
CHANGING MATERIAL_DATA-THER_CLASS_DSC.
when 'MM_THERAPEUTIC_SUB_CLASS'.
MATERIAL_DATA-THER_SUB_CLASS = WK_AUSP-ATWRT.
PERFORM GET_CHARACTERISTIC_DSC
USING WK_AUSP-ATINN
WK_AUSP-ATWRT
CHANGING MATERIAL_DATA-THER_SUB_CLASS_DSC.
WHEN 'MM_THERAPEUTIC_RATING'.
MATERIAL_DATA-THER_EQUIV = WK_AUSP-ATWRT.
when 'MM_ANDA_DATE'.
PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
CHANGING MATERIAL_DATA-ANDA_DATE.
when 'MM_ANDA_NUMBER'.
MATERIAL_DATA-ANDA_NUMBER = WK_AUSP-ATWRT.
when 'MM_BIO_STUDY'.
MATERIAL_DATA-BIO_STUDY = WK_AUSP-ATWRT.
when 'MM_DESI_INDICATOR'.
MATERIAL_DATA-DESI_INDICATOR = WK_AUSP-ATWRT.
when 'MM_DRUG_TERMINATION_DATE'.
PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
CHANGING MATERIAL_DATA-DRUG_TERM_DT.
when 'MM_FDA_APPROVAL_DATE'.
PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
CHANGING MATERIAL_DATA-FDA_APPRV_DT.
when 'MM_ITEM_REGULATORY_NAME'.
MATERIAL_DATA-ITEM_REG_NM = WK_AUSP-ATWRT.
when 'MM_MARKET_DATE'.
PERFORM CONVERT_TO_DATE USING WK_AUSP-ATFLV
CHANGING MATERIAL_DATA-MARKET_DT.
when 'MM_PRODUCT_COLOR'.
MATERIAL_DATA-PRODUCT_COLOR = WK_AUSP-ATWRT.
when 'MM_PRODUCT_FLAVOR'.
MATERIAL_DATA-PRODUCT_FLAVOR = WK_AUSP-ATWRT.
when 'MM_PRODUCT_SHAPE'.
MATERIAL_DATA-PRODUCT_SHAPE = WK_AUSP-ATWRT.
when 'MM_PRODUCT_STRENGTH'.
MATERIAL_DATA-PRODUCT_STRENGTH = WK_AUSP-ATWRT.
WHEN 'MM_VENDOR'.
MATERIAL_DATA-VENDOR_NUM = WK_AUSP-ATWRT.
ENDCASE.
CLEAR SIZE_TEMP.
ENDFORM. " evaluate_characteristic
Get descriptive text from CAWN & CAWNT for characteristics.
FORM GET_CHARACTERISTIC_DSC USING PARM_ATINN
PARM_ATWRT
CHANGING PARM_DSC_TEXT.
CLEAR PARM_DSC_TEXT.
SELECT SINGLE ATWTB
INTO PARM_DSC_TEXT
FROM CAWN AS C1 INNER JOIN
CAWNT AS C2 ON C1ATINN = C2ATINN
AND C1ATZHL = C2ATZHL
WHERE C1~ATINN = PARM_ATINN
AND C1~ATWRT = PARM_ATWRT
AND C2~SPRAS = SY-LANGU
AND C2~ADZHL = 0.
ENDFORM. " get_characteristic_dsc
Call function CTCV_CONVERT_FLOAT_TO_DATE to convert floating point
number to a date in yyyymmdd format.
form convert_to_date using date
changing conv_date.
clear conv_date.
data: wrk_date(30) type c."Format YYYYMMDD changing it to MMDDYYYY
call function 'CTCV_CONVERT_FLOAT_TO_DATE'
EXPORTING
float = date
IMPORTING
date = wrk_date
EXCEPTIONS
others = 1.
CONV_DATE = WRK_DATE.
ENDFORM. " convert_to_date
Get substitute material number.
FORM GET_SUBSTITUTE_MATNR.
SELECT SINGLE SMATN
DATAB
DATBI
INTO (MATERIAL_DATA-SMATN,
MATERIAL_DATA-SMATN_START,
MATERIAL_DATA-SMATN_END)
FROM KOTD001 INNER JOIN
KONDD ON KOTD001~KNUMH = KONDD~KNUMH
WHERE KAPPL = 'V' "* Sales/Distribution
AND KSCHL = 'A001' "* Material Entered
AND MATWA = MATERIAL_DATA-MATNR
AND DATBI >= SY-DATUM
AND DATAB <= SY-DATUM
AND SUGRD = SPACE.
ENDFORM. " get_substitute_matnr.
Get basic data text for material item note.
If this is longer than 500 bytes, it will be truncated at 500.
FORM GET_BASIC_DATA_TEXT.
DATA: BEGIN OF TEXT_HEADER.
INCLUDE STRUCTURE THEAD. "* SAPscript: Text Header
DATA: END OF TEXT_HEADER.
DATA: BEGIN OF TEXT_LINES OCCURS 100.
INCLUDE STRUCTURE TLINE. "* SAPscript: text lines
DATA: END OF TEXT_LINES.
DATA: ITEM_NOTE_LENGTH TYPE I.
Set up text header for call to READ_TEXT.
TEXT_HEADER-TDOBJECT = 'MATERIAL'.
TEXT_HEADER-TDNAME = MATERIAL_DATA-MATNR.
TEXT_HEADER-TDID = 'GRUN'. "* Basic data text
TEXT_HEADER-TDSPRAS = SY-LANGU.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = TEXT_HEADER-TDID
LANGUAGE = TEXT_HEADER-TDSPRAS
NAME = TEXT_HEADER-TDNAME
OBJECT = TEXT_HEADER-TDOBJECT
ARCHIVE_HANDLE = 0
IMPORTING
HEADER =
TABLES
LINES = TEXT_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
CASE SY-SUBRC.
WHEN 0.
LOOP AT TEXT_LINES.
IF SY-TABIX = 1.
MATERIAL_DATA-ITEM_NOTE = TEXT_LINES-TDLINE.
ELSE.
Pass up to 500 bytes to Siebel.
ITEM_NOTE_LENGTH = STRLEN( MATERIAL_DATA-ITEM_NOTE ).
IF ITEM_NOTE_LENGTH > 498.
EXIT.
ELSE.
CONCATENATE MATERIAL_DATA-ITEM_NOTE
TEXT_LINES-TDLINE
INTO MATERIAL_DATA-ITEM_NOTE
SEPARATED BY SPACE.
ENDIF.
ENDIF.
ENDLOOP.
WHEN 4.
Not found; this is normal if no text was entered.
WHEN OTHERS.
MESSAGE E000(38) WITH 'Bad call to function READ_TEXT'.
ENDCASE.
ENDFORM. " get_substitute_matnr
Open files, set initial conditions, etc.
FORM INITIAL_STUFF.
data : w_length type i .
PROGNAME = SY-REPID.
WRITE: / 'Program: ', PROGNAME.
WRITE: / 'Execution start date: ', SY-DATUM.
WRITE: / 'Execution start time: ', SY-UZEIT.
WRITE: / .
CALL FUNCTION 'Z_SET_INTERFACE_FILENAME'
EXPORTING
INTERFACE_NAME = MATLFILE
DATE_TIME_SW = 'X'
EXTENSION_TYPE = 'txt'
IMPORTING
PATHNAME = OUTFILE
EXCEPTIONS
OTHERS = 1.
f_m_uncfile = outfile .
clear w_length.
w_length = strlen( matlfile ).
replace matlfile with c_uncpath_material into F_M_UNCFILE length
w_length .
open dataset F_m_UNCFILE for output in text mode .
if sy-subrc <> 0 .
MESSAGE E000(38) WITH 'Unable to open file ' F_m_UNCFILE.
endif.
ENDFORM. " initial_stuff.
Close files, etc.
FORM WRAPUP.
CLOSE DATASET F_M_UNCFILE.
PERFORM CONVERT_FILE.
WRITE: / 'Material interface file name: ', OUTFILE,
/ 'Number of records written to material file: ', WRITE_COUNT.
endform.
This form is included for testing and is performed if the test_rec
checkbox is checked.
FORM WRITE_FORMATTED_TEST_RECORD.
WRITE: /,
/ 'Beginning of new record :',
/ 'Start Delimiter :|' NO-GAP,
MATERIAL_DATA-DELIMITER_START NO-GAP, '|',
/ 'Record Type :|' NO-GAP,
MATERIAL_DATA-REC_TYPE NO-GAP, '|',
/ 'Material Number :|' NO-GAP,
MATERIAL_DATA-MATNR NO-GAP USING NO EDIT MASK, '|',
/ 'Material Description :|' NO-GAP,
MATERIAL_DATA-MAKTX NO-GAP, '|',
/ 'Substitute Material Number :|' NO-GAP,
MATERIAL_DATA-SMATN NO-GAP, '|',
/ 'Substitute Start Date :|' NO-GAP,
MATERIAL_DATA-SMATN_START NO-GAP, '|',
/ 'Substitute End Date :|' NO-GAP,
MATERIAL_DATA-SMATN_END NO-GAP, '|',
/ 'Status Code :|' NO-GAP,
MATERIAL_DATA-VMSTA NO-GAP, '|',
/ 'Status Description :|' NO-GAP,
MATERIAL_DATA-VMSTB NO-GAP, '|',
/ 'Date of last change :|' NO-GAP,
MATERIAL_DATA-LAEDA NO-GAP, '|',
/ 'User who changed record :|' NO-GAP,
MATERIAL_DATA-AENAM NO-GAP, '|',
/ 'Manufacturer Number :|' NO-GAP,
MATERIAL_DATA-VENDOR_NUM NO-GAP, '|',
/ 'Vendor Name :|' NO-GAP,
MATERIAL_DATA-VENDOR_NM NO-GAP, '|',
/ 'Product Line Code :|' NO-GAP,
MATERIAL_DATA-PROD_LINE_CD NO-GAP, '|',
/ 'Product Line Description :|' NO-GAP,
MATERIAL_DATA-PROD_LINE_DSC NO-GAP, '|',
/ 'DEA Schedule ID :|' NO-GAP,
MATERIAL_DATA-DEA_SCH_ID NO-GAP, '|',
/ 'DEA Schedule Description :|' NO-GAP,
MATERIAL_DATA-DEA_SCH_DSC NO-GAP, '|',
/ 'Labeller Code :|' NO-GAP,
MATERIAL_DATA-NORMT NO-GAP, '|',
/ 'Standard Price :|' NO-GAP,
MATERIAL_DATA-STPRS NO-GAP, '|',
/ 'Logo Description :|' NO-GAP,
MATERIAL_DATA-LOGO_DESC NO-GAP, '|',
/ 'Prescription Flag :|' NO-GAP,
MATERIAL_DATA-PRESCRIPT_FLAG NO-GAP, '|',
/ 'Therapeutic Class :|' NO-GAP,
MATERIAL_DATA-THER_CLASS NO-GAP, '|',
/ 'Therapeutic Class Description :|' NO-GAP,
MATERIAL_DATA-THER_CLASS_DSC NO-GAP, '|',
/ 'Therapeutic Subclass :|' NO-GAP,
MATERIAL_DATA-THER_SUB_CLASS NO-GAP, '|',
/ 'Therapeutic Subclass Description:|' NO-GAP,
MATERIAL_DATA-THER_SUB_CLASS_DSC NO-GAP, '|',
/ 'Therapeutic Equivalence :|' NO-GAP,
MATERIAL_DATA-THER_EQUIV NO-GAP, '|',
/ 'Item Package Size :|' NO-GAP,
MATERIAL_DATA-ITEM_PACKAGE_SIZE NO-GAP, '|',
/ 'Item Package Type :|' NO-GAP,
MATERIAL_DATA-ITEM_PACKAGE_TYPE NO-GAP, '|',
/ 'Dosage Form :|' NO-GAP,
MATERIAL_DATA-DOSAGE_FORM NO-GAP, '|',
/ 'Dosage Form Description :|' NO-GAP,
MATERIAL_DATA-DOSAGE_FORM_DSC NO-GAP, '|',
/ 'Dose Administration :|' NO-GAP,
MATERIAL_DATA-DOSE_ADMIN NO-GAP, '|',
/ 'Dose Administration Description :|' NO-GAP,
MATERIAL_DATA-DOSE_ADMIN_DSC NO-GAP, '|',
/ 'Bottle Size :|' NO-GAP,
MATERIAL_DATA-BOTTLE_SIZE NO-GAP, '|',
/ 'Brand Name :|' NO-GAP,
MATERIAL_DATA-BRAND_NAME NO-GAP, '|',
/ 'Brand Distributor :|' NO-GAP,
MATERIAL_DATA-BRAND_DISTR NO-GAP, '|',
/ 'Brand Color :|' NO-GAP,
MATERIAL_DATA-BRAND_COLOR NO-GAP, '|',
/ 'Brand Shape :|' NO-GAP,
MATERIAL_DATA-BRAND_SHAPE NO-GAP, '|',
/ 'ANDA Date :|' NO-GAP,
MATERIAL_DATA-ANDA_DATE NO-GAP, '|',
/ 'ANDA Number :|' NO-GAP,
MATERIAL_DATA-ANDA_NUMBER NO-GAP, '|',
/ 'Bio Study :|' NO-GAP,
MATERIAL_DATA-BIO_STUDY NO-GAP, '|',
/ 'DESI Indicator :|' NO-GAP,
MATERIAL_DATA-DESI_INDICATOR NO-GAP, '|',
/ 'Drug Term Date :|' NO-GAP,
MATERIAL_DATA-DRUG_TERM_DT NO-GAP, '|',
/ 'FDA Approval Date :|' NO-GAP,
MATERIAL_DATA-FDA_APPRV_DT NO-GAP, '|',
/ 'Item Regulatory Name :|' NO-GAP,
MATERIAL_DATA-ITEM_REG_NM NO-GAP, '|',
/ 'Market Date :|' NO-GAP,
MATERIAL_DATA-MARKET_DT NO-GAP, '|',
/ 'Product Color :|' NO-GAP,
MATERIAL_DATA-PRODUCT_COLOR NO-GAP, '|',
/ 'Product Flavor :|' NO-GAP,
MATERIAL_DATA-PRODUCT_FLAVOR NO-GAP, '|',
/ 'Product Shape :|' NO-GAP,
MATERIAL_DATA-PRODUCT_SHAPE NO-GAP, '|',
/ 'Product Strength :|' NO-GAP,
MATERIAL_DATA-PRODUCT_STRENGTH NO-GAP, '|',
/ 'Base Unit of Measure :|' NO-GAP,
MATERIAL_DATA-MEINS NO-GAP, '|',
/ 'Base Weight :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-WEIGHT NO-GAP, '|',
/ 'Base Weight Unit :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-WT_UNIT NO-GAP, '|',
/ 'Base Volume :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-VOLUM NO-GAP, '|',
/ 'Base Volume Unit :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-VOL_UNIT NO-GAP, '|',
/ 'Base Package Length :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-PKG_LENGTH NO-GAP, '|',
/ 'Base Package Width :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-PKG_WIDTH NO-GAP, '|',
/ 'Base Package Height :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-PKG_HEIGHT NO-GAP, '|',
/ 'Base Dimension Unit :|' NO-GAP,
MATERIAL_DATA-BASE_MEASURES-DIM_UNIT NO-GAP, '|',
/ 'Inner Carton Count :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_COUNT NO-GAP, '|',
/ 'Inner Carton Weight :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-WEIGHT NO-GAP, '|',
/ 'Inner Carton Weight Unit :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-WT_UNIT NO-GAP, '|',
/ 'Inner Carton Volume :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-VOLUM NO-GAP, '|',
/ 'Inner Carton Volume Unit :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-VOL_UNIT NO-GAP, '|',
/ 'Inner Carton Package Length :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_LENGTH NO-GAP, '|',
/ 'Inner Carton Package Width :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_WIDTH NO-GAP, '|',
/ 'Inner Carton Package Height :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-PKG_HEIGHT NO-GAP, '|',
/ 'Inner Carton Dimension Unit :|' NO-GAP,
MATERIAL_DATA-INR_CRTN_MEASURES-DIM_UNIT NO-GAP, '|',
/ 'Case Count :|' NO-GAP,
MATERIAL_DATA-CASE_COUNT NO-GAP, '|',
/ 'Case Weight :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-WEIGHT NO-GAP, '|',
/ 'Case Weight Unit :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-WT_UNIT NO-GAP, '|',
/ 'Case Volume :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-VOLUM NO-GAP, '|',
/ 'Case Volume Unit :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-VOL_UNIT NO-GAP, '|',
/ 'Case Length :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-PKG_LENGTH NO-GAP, '|',
/ 'Case Width :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-PKG_WIDTH NO-GAP, '|',
/ 'Case Height :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-PKG_HEIGHT NO-GAP, '|',
/ 'Case Dimension Unit :|' NO-GAP,
MATERIAL_DATA-CASE_MEASURES-DIM_UNIT NO-GAP, '|',
/ 'Item Note :|' NO-GAP,
MATERIAL_DATA-ITEM_NOTE NO-GAP, '|',
/ 'End Delimiter :|' NO-GAP,
MATERIAL_DATA-DELIMITER_END NO-GAP, '|',
ENDFORM. " write_formatted_test_record
Copy the output files to the appropriate archive folder.
FORM COPY_TO_ARCHIVE USING C_FILE.
DATA:
ARCHFILE(100),
COPYFILES(255),
ITAB LIKE BTCXPM OCCURS 0 WITH HEADER LINE,
W_LENGTH TYPE I ,
W_INFILE(100),
W_OUTFILE(100).
PERFORM BUILD_ARCHIVE_NAME USING C_FILE
CHANGING ARCHFILE.
CONCATENATE C_FILE C_UNCPATH INTO COPYFILES SEPARATED BY SPACE .
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = 'ZUNIXCOPY'
ADDITIONAL_PARAMETERS = COPYFILES
OPERATINGSYSTEM = SY-OPSYS
STDOUT = 'X'
STDERR = 'X'
TERMINATIONWAIT = 'X'
TABLES
EXEC_PROTOCOL = ITAB
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
WRONG_ASYNCHRONOUS_PARAMETERS = 12
CANT_ENQ_TBTCO_ENTRY = 13
JOBCOUNT_GENERATION_ERROR = 14
OTHERS = 15.
w_length = strlen( c_final_path ).
replace c_final_path with ' ' into c_file length w_length.
shift c_file left deleting leading space .
concatenate c_uncpath c_file into w_infile .
concatenate archfile c_file into w_outfile .
CALL FUNCTION 'Z_CONVERT_UNIX2DOS'
EXPORTING
INFILE = w_infile
OUTFILE = w_outfile
EXCEPTIONS
ERROR = 1
IDENTICAL_FILENAMES = 2
NO_INPUT_FILE = 3
OTHERS = 4.
IF SY-SUBRC = 0.
SKIP.
WRITE: / C_FILE, 'copied to', ARCHFILE.
ELSE.
MESSAGE E000(38) WITH 'Archive file copy failed.'.
ENDIF.
ENDFORM. " copy_to_archive.
Build Archive file pathnames.
FORM BUILD_ARCHIVE_NAME USING P_PATH
CHANGING P_ARCH.
DATA:
NODECOUNT TYPE I,
LASTNODE TYPE I,
BEGIN OF NODES OCCURS 25,
NODENAME(100),
END OF NODES.
SPLIT P_PATH AT '/' INTO TABLE NODES.
DESCRIBE TABLE NODES LINES NODECOUNT.
CLEAR P_ARCH.
LASTNODE = NODECOUNT - 1.
LOOP AT NODES.
CASE SY-TABIX.
WHEN LASTNODE.
CONCATENATE P_ARCH NODES-NODENAME '/archive/' INTO P_ARCH.
WHEN NODECOUNT.
WHEN OTHERS.
CONCATENATE P_ARCH NODES-NODENAME '/' INTO P_ARCH.
ENDCASE.
ENDLOOP.
ENDFORM. " build_archive_name
*& Form CONVERT_FILE
Move output files from unconverted directory to final destination
directory and convert from UNIX to DOS format in the process.
FORM CONVERT_FILE.
CONCATENATE MATLFILE '.txt' INTO OUTFILE.
Convert customer file from Unix to DOS
CALL FUNCTION 'Z_CONVERT_UNIX2DOS'
EXPORTING
INFILE = F_M_UNCFILE
OUTFILE = outFILE
EXCEPTIONS
ERROR = 1
IDENTICAL_FILENAMES = 2
NO_INPUT_FILE = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
write: /'Error converting file. Input file: ', F_M_UNCFILE.
write: /' Output file: ', outFILE.
ENDIF.
ENDFORM. " CONVERT_FILEHi Vijay,
thanks very much for the reply with valuable suggestion.
I have made couple of changes in the program like this:
i have created another Internal table like this...for selecting the data of MARA...
<b>data: begin of it_temp occurs 0,
matnr like mara-matnr,
end of it_temp.</b>
then I have changed the FORM like this ....
Plz have a look on that and let me know if any thing is wrong in that...
thnx much..
<b>form get_outsert.
select matnr from mara into corresponding fields of table
it_temp where mtart = 'FERT' or mtart = 'HAWA'.
select didnrk amatnr
into (i_outsert-component, i_outsert-matnr)
from stpo as d
inner join stko as c
on dstlnr = cstlnr
inner join mast as b
on cstlnr = bstlnr
inner join mara as a
on bmatnr = amatnr
for all entries IN it_temp
where a~matnr = it_temp-matnr.
append i_outsert.
endselect.
loop at i_outsert where matnr = it_temp-matnr.
if ( i_outsert-component cs str1 ) or ( i_outsert-component cs str2 ).
write i_outsert-component to material_data-component.
append material_data.
elseif ( i_outsert-component cs str3 ) or
( i_outsert-component cs str4 ).
write i_outsert-component to material_data-mguide.
append material_data.
endif.
modify material_data transporting component
where matnr = i_outsert-matnr.
endloop.
endform. "get_outsert</b> -
Problem in background processing
Hi all,
following Program is working fine in foreground, when i am scheduling it is not working, plz find if there is any problem in coding.
DATA: PATH(256) TYPE C.
DATA: DIR_SEC LIKE EPSF-EPSDIRNAM,
DIR_PROCESS LIKE EPSF-EPSDIRNAM,
DIR_INBOUND LIKE EPSF-EPSDIRNAM,
DIR_ERROR LIKE EPSF-EPSDIRNAM.
DATA: FILE_MASK LIKE EPSF-EPSFILNAM VALUE 'TEMP_.'.
DATA: FILE_INBOUND LIKE EPSFILI OCCURS 0 WITH HEADER LINE,
FILE_BACKUP LIKE EPSFILI OCCURS 0 WITH HEADER LINE.
DATA: LOC LIKE SXPGCOLIST-PARAMETERS,
RET_CODE LIKE EXTCMDEXEX-STATUS.
DATA: BEGIN OF PROT_TAB OCCURS 10.
INCLUDE STRUCTURE BTCXPM.
DATA: END OF PROT_TAB.
*DIR_SEC = '
172.19.2.249\pos\inbound'.
read directory
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
DIR_NAME = DIR_SEC
DIR_NAME = '
172.19.2.249\pos\inbound_pos'
FILE_MASK = FILE_MASK
IMPORTING
DIR_NAME =
FILE_COUNTER =
ERROR_COUNTER =
TABLES
DIR_LIST = FILE_INBOUND
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
NO_AUTHORIZATION = 4
READ_DIRECTORY_FAILED = 5
TOO_MANY_READ_ERRORS = 6
EMPTY_DIRECTORY_LIST = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
IF SY-SUBRC = 7.
MESSAGE S083(TRUST).
RETURN.
ELSE.
MESSAGE E081(TRUST) WITH DIR_SEC.
ENDIF.
ENDIF.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
DIR_NAME = DIR_SEC
DIR_NAME = '
172.19.2.249\pos\inbound_archive'
FILE_MASK = FILE_MASK
IMPORTING
DIR_NAME =
FILE_COUNTER =
ERROR_COUNTER =
TABLES
DIR_LIST = FILE_BACKUP
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
NO_AUTHORIZATION = 4
READ_DIRECTORY_FAILED = 5
TOO_MANY_READ_ERRORS = 6
EMPTY_DIRECTORY_LIST = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
IF SY-SUBRC = 7.
MESSAGE S083(TRUST).
RETURN.
ELSE.
MESSAGE E081(TRUST) WITH DIR_SEC.
ENDIF.
ENDIF.
LOOP AT FILE_INBOUND.
READ TABLE FILE_BACKUP WITH KEY NAME = FILE_INBOUND-NAME.
IF SY-SUBRC <> 0.
CONCATENATE '
172.19.2.249\pos\inbound_process\' FILE_INBOUND-NAME INTO DIR_PROCESS.
condense DIR_PROCESS.
CONCATENATE '
172.19.2.249\pos\inbound_pos\' FILE_INBOUND-NAME INTO DIR_INBOUND.
condense DIR_INBOUND.
CONCATENATE DIR_INBOUND DIR_PROCESS INTO LOC separated BY SPACE.
condense LOC.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = 'ZMOVE'
OPERATINGSYSTEM = 'Windows NT'
ADDITIONAL_PARAMETERS = LOC
STDERR = 'X'
STDOUT = 'X'
TARGETSYSTEM = DB_HOST
DESTINATION = XPG_DEST
TERMINATIONWAIT = 'X'
TRACE = ' '
IMPORTING
STATUS = RET_CODE
TABLES
EXEC_PROTOCOL = PROT_TAB
EXCEPTIONS
COMMAND_NOT_FOUND = 01
NO_PERMISSION = 02
PARAMETERS_TOO_LONG = 03
PARAMETER_EXPECTED = 04
PROGRAM_START_ERROR = 05
PROGRAM_TERMINATION_ERROR = 06
SECURITY_RISK = 07
TOO_MANY_PARAMETERS = 08
WRONG_CHECK_CALL_INTERFACE = 09
X_ERROR = 10
OTHERS = 11.
write 'sai'.
ELSE.
CONCATENATE '
172.19.2.249\pos\inbound_pos\' FILE_INBOUND-NAME INTO DIR_INBOUND.
condense DIR_INBOUND.
CONCATENATE '
172.19.2.249\pos\inbound_errorfile\' FILE_INBOUND-NAME INTO DIR_ERROR.
condense DIR_PROCESS.
CONCATENATE DIR_INBOUND DIR_ERROR INTO LOC separated BY SPACE.
condense LOC.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = 'ZMOVE'
OPERATINGSYSTEM = 'Windows NT'
ADDITIONAL_PARAMETERS = LOC
STDERR = 'X'
STDOUT = 'X'
TARGETSYSTEM = DB_HOST
DESTINATION = XPG_DEST
TERMINATIONWAIT = 'X'
TRACE = ' '
IMPORTING
STATUS = RET_CODE
TABLES
EXEC_PROTOCOL = PROT_TAB
EXCEPTIONS
COMMAND_NOT_FOUND = 01
NO_PERMISSION = 02
PARAMETERS_TOO_LONG = 03
PARAMETER_EXPECTED = 04
PROGRAM_START_ERROR = 05
PROGRAM_TERMINATION_ERROR = 06
SECURITY_RISK = 07
TOO_MANY_PARAMETERS = 08
WRONG_CHECK_CALL_INTERFACE = 09
X_ERROR = 10
OTHERS = 11.
ENDIF.
WRITE 'SAI'.
endloop.the only thing I can think of is that your function modules don't work in the Background ? Have you checked them ? Lot of FM's like GUI_DOWNLOAD etc don't work in the background. Perhaps your FM's function similarly ?
-
Error BT616 when calling function module SXPG_COMMAND_EXECUTE in background
Hi All,
We use function module SXPG_COMMAND_EXECUTE with a custom command we defined in SM69 to move files in unix (mv command).
The function module call has worked fine for almost a year and recently we have been seeing an error (BT616) in our job lob (SM37) when the program is run in background. We have not been able to reproduce the error in foreground mode and it seems to be occuring only periodically in the background. (The appropriate SAP authorization objects where assigned to the batch job ID and the steps on the batch job.) We are in the process of setting up the trace flag and performing analysis on the trace log via ST11 to help identify the issue.
After perform analysis on SXPG_COMMAND_EXECUTE, the error is occurring when calling function module SAPXPG_END_XPG for exception 2, system failure, yet function module SAPXPG_END_XPG does not exist. I assume this is a program at the operating system level and is just a signature of the parameters to be passed to the operating system program.
Below is part of the SAP function module SXPG_COMMAND_EXECUTE that is failing.
* Now we have to wait for the termination of the external
* command if the caller wants us to.
IF TERMINATIONWAIT = 'X'.
CALL FUNCTION 'SAPXPG_END_XPG'
DESTINATION DESTINATION
IMPORTING EXITSTAT = STATUS
EXITCODE = EXITCODE
TABLES LOG = LOG
EXCEPTIONS COMMUNICATION_FAILURE = 1 MESSAGE MSG
SYSTEM_FAILURE = 2 MESSAGE MSG.
I performed a where used on function module SXPG_COMMAND_EXECUTE, and most of SAP programs call the function module with the parameter TERMINATIONWAIT = 'X', so I assume we should pass X as well.
Any ideas on what could be causing this issue?
Mike VondranI also remember I have this kind of issue, as I have some UNIX script at OS( UNIX) level . The problem was with the ID , as it dont have proper authorization at OS level ( UNIX ) . Please check this ID authorization. This could be the one of reasons if youre sure from SAP standpoint.
Hope thisll give you some guide line..
Thanks
Bye -
Backup problem in SAP BW 3.5
Dear All,
I am using SAP BW 3.5 with Oracle 9.2. I started the job via DB13 after that I am receiving the error
Job started
Step 001 started (program RSDBAJOB, variant &0000000000029, user ID BASIS)
No application server on database host - rsh will be used
Execute logical command BRBACKUP On host biddb
Parameters:-u / -c force -t online -m all -p initBID.sap -w use_dbv
SXPG_COMMAND_EXECUTE failed for BRBACKUP - Reason: program_start_error: For More Information, See SYS
Job cancelled after system exception ERROR_MESSAGE
Please help me to solve the problem
Regards,
MMSKLook at the sapxpg logs for errors dev_cp, dev_xpg.
Regards
Juan -
Hello!
I have problems with clearing logs via transaction DB13.
When I start this operation for the first time after starting SAP system this job is finished successfully.
But then I have error in this job:
Job started
Step 001 started (program RSDBAJOB, variant &0000000000033, user ID SAP*)
Format "X_PAPER" not defined for printer "$LOCL"
Execute logical command BRCONNECT On host SAP-TSC
Parameters: -u / -jid CLNUP20140505004009 -c -f cleanup
External communication error at program start (see system log)
SAPXPG_START_XPG_LONG: sy-subrc ne 0
destination = %_TCPIP_%1
SXPG_STEP_COMMAND_START: SXPG_STEP_XPG_START returned: 1.006
SXPG_COMMAND_EXECUTE(LONG)
<timestamp> = 20140505004031
COMMANDNAME = BRCONNECT
ADDITIONAL_PARAMETERS = -u / -jid CLNUP20140505004009 -c -f cleanup
LONG_PARAMS
OPERATINGSYSTEM = ANYOS
TARGETSYSTEM = SAP-TSC
DESTINATION
SY-SUBRC = 902
SXPG_COMMAND_EXECUTE failed for BRCONNECT - Reason: x_error
Job cancelled after system exception ERROR_MESSAGE
And i have to restart the SAP for using DB13.
Why it's happening?
P.s. Yes, i changed SAPSR3 passwords via brtools and brconnect.
Thank you for answering.Hello Janos,
I checked SAPDBHOST parameter in DEFAULT.PFL:
SAPDBHOST = SAP-TSC
BRCONNECT is located in the directory with appropriate user rights.
Also I checked developer traces:dev_rd
LOCATION SAP-Gateway on host SAP-TSC / sapgw00
* ERROR timeout during allocate
* TIME Wen May 07 16:08:10 2014
* RELEASE 720
* COMPONENT SAP-Gateway
* VERSION 2
* RC 242
* MODULE gwr3cpic.c
* LINE 6070
* DETAIL no connect of TP sapxpg from host SAP-TSC.localdomain after 20
* sec
* COUNTER 11
But i can't understand why rebooting sap system the first clearing logs finish successfully, but then i have errors. -
Maintain Blanks in SXPG_COMMAND_EXECUTE additional parameters
Hello guys,
we are trying to execute some commands in a Z function calling the function SXPG_COMMAND_EXECUTE.
We have a command Z and in the additional parameters and we fill the command with CMD('COPY T:
Documents
PXXX2
IEXXX.DOC \"E:
WORK
600613 MATERIAL 100333 (12345)\" ').
We want to maintain the blanks, but during the execution of function SXPG_COMMAND_EXECUTE a CONDENSE of the field additional parameters is done.
There is any way to maintain the blanks calling this function? There is another function that also executes commands and maintain the blanks?
Many thanks in advance.
Regards,
Xavi.Hi,
thanks for the answer. But thats doesn't match my problem. What I want is to start a shell-script with parameter whereas some parameters might include one or more blanks. Like for examples a script with only one parameter:
shell-script 'this is a parameter'
What I found out while testing with SM49 is, when I put the parameter into apostrophe than the parameter is passed as a single parameter to the script. But SM49 elsewell SXPG_COMMAND_EXECUTE condense more than blank to only one blank. And the apostrophe remain in the parameter.
SM49:
shell-script 'This is a parameter'
The shell-script gets the parameter 'This is a parameter' , whereas the apostrophe ' and the start and at the end is part of the parameter.
Using the function modules SXPG_RFCDEST_OPEN_INT, SAPXPG_START_XPG and SAPXPG_END_XPG instead of SXPG_COMMAND_EXECUTE solves the problem of condensing the blanks to one blank. But the apostrophe is still part of the parameter. And I have to consider that the apostrophe might be originally part of the parameter.
And I have to solve this problem.
Regards
Karl-Wilhelm -
HI Experts.
My BI consultants are not able to pull the data while execute the Tcode: LISTCUBE.
I could not see any logs any short dumps but in RZ20 i found below error message.ora-00600
SXPG_COMMAND_EXECUTE failed for BRTOOLS - Reason: no_permission: Authorization object S_LOG_COM miss.
Even we checked with our security team even after they assigned full authorization they are getting the same problem.
Could some one provide the solution for this.
Regards
JANSeems to be confusing..
Any error while executing LISTCUBE tcode ?
If suspect authorization issue, did BI team run SU53 just after LISTCUBE ?
For S_LOG_COM, did you see this note once ?
Note 150315 - BW-Authorizations for Remote-User in BW and OLTP
However, following error seems to be confusing containing the term BRTOOLS, not sure what BRTOOLS doing here
SXPG_COMMAND_EXECUTE failed for BRTOOLS - Reason: no_permission: Authorization object S_LOG_COM miss
SXPG error comes for external commands, once check the Notes using this search term. For eg
Note 854060 - Authorizations for external commands
Note 1336776 - External commands: Security for calling side -
SXPG_COMMAND_EXECUTE return wrong parameter value
Dear all.
We have an Abap program that pulls an encrypted FTP file and saves it to our network.
After that we activate an external command via transaction SM69 by calling FM SXPG_COMMAND_EXECUTE.
This command is an execution of a batch file that executes a decryption method via PGP decryption software.
The problem is that we get an output parameter of this FM (STATUS) as u201CEu201D (error) although the decryption is being executed successfully.
We have the same process being activated same way successfully with another folders (rest is exactly the same).
Why does SXPG_COMMAND_EXECUTE return wrong status value ?
Regards,
RebekaSXPG_COMMAND_EXECUTE runs under certain operating system user account. Looks like that account does not have enough privileges to do what you want it to do. Look at the operating system for privileges (read,write,execute) of the user account SAPServiceuser or equivalent.
/Simo -
Hi,
Our Production server is in High Availability on Unix ( DB node active & CI Node active).
When I am executing the initialize tape or triggering the backup from DB13 in our production we are getting the below error.
SXPG_COMMAND_EXECUTE failed for BRTOOLS - Reason: program_start_error:
Even in DB12 when I click on the detailed log of any backup log, it is giving the same error.
In System log we got the below error.
Error 1003 when executing external command brtools on
(in=R,out=M,err=M,trc=0,trm=C. strtstat=,xpgid=0,convid=. msg:)
Error 1003 when executing external command brtools on
(in=R,out=M,err=M,trc=0,trm=C. strtstat=,xpgid=0,convid=. msg:)
RFC SAPXPG_DBDEST_<HOSTNAME> connection test giving the below error
Logon Connection Error
Error Details Error when opening an RFC connection
Error Details ERROR: timeout during allocate
Error Details LOCATION: SAP-Gateway on host ProdApp / sapgw00
Error Details DETAIL: no connect of TP sapxpg from host PROD-DB-SRV
after 20 sec
Error Details COMPONENT: SAP-Gateway
Error Details COUNTER: 869
Error Details MODULE: gwr3cpic.c
Error Details LINE: 2007
Error Details RETURN CODE: 242
Error Details SUBRC: 0
Error Details RELEASE: 700
Error Details TIME: Tue Mar 30 09:07:51 2010
Error Details VERSION: 2
I have created .rhosts and .rshosts files in both DB & CI nodes under path /home/trpadm as below
CI Node
ProdApp:trpadm 27> cat .rhosts
PROD-DB-SRV
PROD-APP-SRV
ProdApp:trpadm 28> cat .rshosts
PROD-DB-SRV trpadm
PROD-APP-SRV trpadm
trpadm
DB Node
ProdDB:trpadm 2> cat .rhosts
PROD-DB-SRV
PROD-APP-SRV
ProdDB:trpadm 3> cat .rshosts
PROD-DB-SRV trpadm
PROD-APP-SRV trpadm
trpadm
But below command is giving error
ProdApp:trpadm 24> rsh PROD-DB-SRV -l trpadm sapxpg
rshd: 0826-813 Permission is denied.
rsh is happening in both the nodes.
In CI node when iam doing rsh to DB node it is connecting. Pleas find the below logs
ProdApp:trpadm 17> rsh PROD-DB-SRV
trpadm's Password:
Welcome to AIX Version
6.1! *
Please see the README file in /usr/lpp/bos for information pertinent
to *
this release of the AIX Operating
System. *
Last login: Wed Mar 31 11:36:53 IST 2010 on /dev/pts/1 from
Prod_App_boot_1
ProdDB:trpadm 1>
In DB node when iam doing rsh to CI node it is connecting. Pleas find the below logs
ProdDB:trpadm 1> rsh PROD-APP-SRV
trpadm's Password:
Welcome to AIX Version
6.1! *
Please see the README file in /usr/lpp/bos for information pertinent
to *
this release of the AIX Operating
System. *
Last unsuccessful login: Tue Mar 23 16:05:26 IST 2010 on ftp
from ::ffff:10.0.1.39
Last login: Wed Mar 31 11:36:30 IST 2010 on /dev/pts/1 from
Prod_DB_boot_1
ProdApp:trpadm 1>
the below entries are already maintained in /etc/services file on both the nodes.
sapgw30 3330/tcp
sapdp30 3230/tcp
Please look into this and suggest us.Hi,
I have cross checked every thing, it is ok.
Praveen,
As per your suggest, i have changed the background server in DB13. It didnot help us.
Problem is RFC are giving errors.
Logon Connection Error
Error Details Error when opening an RFC connection
Error Details ERROR: timeout during allocate
Error Details LOCATION: SAP-Gateway on host <host> / sapgw00
Error Details DETAIL: no connect of TP sapxpg from host <host> after 20 sec
Error Details COMPONENT: SAP-Gateway
Error Details COUNTER: 4853
Error Details MODULE: gwr3cpic.c
Error Details LINE: 2007
Error Details RETURN CODE: 242
Error Details SUBRC: 0
Error Details RELEASE: 700
Error Details TIME: Mon Apr 5 09:18:49 2010
Error Details VERSION: 2
When i am doing rsh from one node to another node it is asking for password, but it should not ask.
and also the below error for sapxpg
rsh <hostname> -l <sid>adm sapxpg
rshd: 0826-813 Permission is denied.
i have created .rhosts in both the nodes and maintained the values for hostname with <sid>adm user correctly.
Please look into this and suggest.
Regards,
Raj -
SXPG_COMMAND_EXECUTE: ADDITIONAL_PARAMETERS contains Blanks
Hi to all,
I want to start a shell-script with SXPG_COMMAND_EXECUTE on Linux. Therefor I have maintained a command with SM69.
I have to fill ADDITIONAL_PARAMETERS with a list of parameters which are passed to the shell-script. Unfortunately some parameters contains blanks, such as a material description.
How do I have to call SXPG_COMMAND_EXECUTE so that a parameter "AA BB" or "CC DD" conserves as one parameter when it is passed to the shell-script and the shell-script can recognize these as one parameter and not as two or more.
Maybe someone has a suggestion for another solution to handle this problem.
Thanks in advance
Karl-WilhelmHi,
thanks for the answer. But thats doesn't match my problem. What I want is to start a shell-script with parameter whereas some parameters might include one or more blanks. Like for examples a script with only one parameter:
shell-script 'this is a parameter'
What I found out while testing with SM49 is, when I put the parameter into apostrophe than the parameter is passed as a single parameter to the script. But SM49 elsewell SXPG_COMMAND_EXECUTE condense more than blank to only one blank. And the apostrophe remain in the parameter.
SM49:
shell-script 'This is a parameter'
The shell-script gets the parameter 'This is a parameter' , whereas the apostrophe ' and the start and at the end is part of the parameter.
Using the function modules SXPG_RFCDEST_OPEN_INT, SAPXPG_START_XPG and SAPXPG_END_XPG instead of SXPG_COMMAND_EXECUTE solves the problem of condensing the blanks to one blank. But the apostrophe is still part of the parameter. And I have to consider that the apostrophe might be originally part of the parameter.
And I have to solve this problem.
Regards
Karl-Wilhelm -
SXPG_COMMAND_EXECUTE FUNCTION
Hi Everyone,
I have a problem to use this function :
The unix commande is copyoutbound .
I want to copy a file automatically using reflection from a unix path to other unix path.
But it doesn`t work in this test code.
Can someone help me .
Thanks a lot
Soufiene
REPORT ZTEST_SOU.
DATA: params LIKE sxpgcolist-parameters.
DATA: return_code LIKE btcxp3-exitstat.
DATA: unix_command LIKE sxpgcolist-name.
DATA: dest LIKE rfcdes-rfcdest.
DATA: FILENAME1(128) TYPE C,
FILENAME2(128) TYPE C.
DATA: single_quote(1) TYPE c VALUE '"'.
DATA: quoted_subject(32) TYPE c.
DATA: convert_flag(1) TYPE c.
DATA: BEGIN OF tabl OCCURS 0.
INCLUDE STRUCTURE btcxpm. "Structure for Logging message from
DATA: END OF tabl. "external program to calling program
DATA: ICN LIKE ICON-ID,
I_NEXT_DATE LIKE SY-DATUM,
I_COMP_DATE LIKE SY-DATUM,
T_EXEC LIKE SY-DATUM.
UNIX_COMMAND = 'Z_HR_FILE_TRANSFER'.
FILENAME1 = '/US/hrit-sdck/trsf0019.toc'.
FILENAME2 = '/test/esc/inbound/done'.
DEST = 'cib10'.
CONCATENATE FILENAME1 FILENAME2 INTO PARAMS SEPARATED BY SPACE.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = unix_command
destination = dest
additional_parameters = params
IMPORTING
status = return_code
TABLES
exec_protocol = tabl
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14.
IF return_code NE 'O'.
WRITE:/ 'UNIX status UNSUCCESSFUL TRANSFER RETURN CODE = ',return_code.
ENDIF.Script qui copie un fichier en utilisant le protocole ssh
Parametres Obligatoire:
$INTERFACE => Interface
$SOURCESID => SID d'origine
$TARGETSID => SID de destination
$AREA => Area
$LOCAL_AREA => Nom de repertoire qui doit figurer dans le path de source entre "interfaces" et "outbound".
$FILENAME => Filename (Could contain a wild card)
$LOCATION => Nom de repertoire qui doit figurer dans le path de destination entre "$TARGETSID" et "common"
$DIRECTION => inbound/outbound -
SXPG_COMMAND_EXECUTE failed when executing cleanuplogs in TR DB13
Hi,
I am getting SXPG_COMMAND_EXECUTE failed for BRCONNECT - Reason: x_error when executing cleanuplogs program in DB13. I have the correct DBHOSTNAME configured in profiles, my SAPXPG rfc is pointing correctly to the database. Also I have the required authorizations to execute SAPXPG program.Could you pls let me know what is the cause of this error and steps to resolve it.
Thanks,
ClarenceHi Sharath
Have you solved your problem? i have the same situation with you, i am very appreciate it if you can reply me
BS
Jon
Maybe you are looking for
-
In PSE8 I need to move some files into one file - how to do?
When I added some photos of a trip from my camera to my PSE8 Organizer instead of going in as one file by date loaded they went in under separate files names. Now I have a large amount of files and want to move them into one file. How do I make a new
-
How to load the values in excel sheet directly into the table of smart form
could u help me out of this
-
Hello! I faced with problem after installed Support Package SAPKITL436 (with SP26) on my Solution Manager 7.01 Support Package SAPKITL436 need to upgrade ST-A/PI,01M_CRM570 to ST-A/PI,01N_700SOL. After upgrading ST-A/PI and installed SP26 I try to R
-
I am running a MAC Yosimite 10.10.1 (latest) and have just updated Lightroom to 5.7 to allow me to manipulate files from my Canon 7D mark 2. When I go from Library to Develop there is no basic adjustments available? I have a histogram but no access t
-
Photoshop crashes after Mac OS 10.9 Update
I've recently updated my Mac OS to 10.9. Ever since, Photoshop will launch but as soon as I hit new or file open Photoshop (CS5) crashes. How can I fix this issue?