FM GUI_UPLOAD returns subrc 8
hi guys,
i have coded below but the subrc is always 8 , pls advice
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'S:\GAB\BOOK1.XLS'
filetype = 'ASC'
has_field_separator = ''
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
HI ,
Just u check the filename (Path)
filename = 'S:\GAB\BOOK1.XLS'
Or ,
you use FM " TEXT_CONVERT_XLS_TO_SAP" , instead of FM GUI_upload
Similar Messages
-
Hello,
I'm working with crystal reports SP3 connected to SAP ERP. I'm already working with other reports and works fine. The problem is with one of the reports that when I refresh it it shows me this error,
CRYSTAL/OSQL_EXECUTE_QUERY returned: subrc: 4. Message: "CONTENT-2-0" has already been declared
Any idea?
Thanks & Regards
SUHi Diana,
I am also having the same problem. When we refresh a report, I added allia R/3 table in my Crystal report. I got the following error:
/CRYSTAL/OSQL_EXECUTE_QUERY returned: subrc: 4. Message: "CONTENT-4-0" has already been declared.. Line: 53. Word: 0.
Did you find a solution for your issue? If you had a solution, please share with me.
Thanks in advance,
Regards,
Venkata. -
Hi Experts,
Is the FM CONVERT_OTF_2_PDF obsolete in ECC 6? as it is returning subrc 1 (exception: err_conv_not_possible).
Also please suggest the best way to convert smartforms into PDF in ecc 6.
Helpful answers will be fully rewarded
Regards,
KHi
You will get this from the fun module of the samrtform
see the sample code
DATA: ls_job_info TYPE ssfcrescl.
call smartform invoice
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_appl_obj =
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = space
is_bil_invoice = ls_bil_invoice
is_nast = nast
is_repeat = repeat
importing job_output_info = <b>ls_job_info</b>
TABLES
GS_WIRING = GS_ITAB3
document_output_info =
job_output_options =
EXCEPTIONS formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
the Internal table ls_job_info consists of the Spool ID for the samrtform generated.
<b>Reward points for useful Answers</b>
Regards
Anji -
MB_CREATE_GOODS_MOVEMENT returning subrc = 5
Hiii guyz...
Need some help up here ...
In the below code ..we were calling these FMs to create and post goods movement.Here I have made a lill change, initially we were passing MIGO in parameter now I am passing MIGO_GO and now FM is returing subrc = 5 instead of 1. No other parameter has been changed.
v_imkpf-budat = budat.
v_imkpf-bldat = bldat.
v_imkpf-pr_print = migo_elikz.
v_imkpf-wever = wever.
v_imkpf-weverx = weverx.
v_imseg-global_counter = v_imseg-aufps
= v_imseg-posnr
= v_imseg-line_id
= 1.
v_imseg-called_by = 'MIGO_GO'. "Change of Jahan
v_imseg-bwart = bwart.
v_imseg-matnr = matnr.
v_imseg-werks = werks.
v_imseg-lgort = lgort.
v_imseg-charg = charg.
v_imseg-kzbew = kzbew.
v_imseg-menge = v_imseg-erfmg
= erfmg.
v_imseg-meins = v_imseg-erfme
= erfme.
v_imseg-migo_elikz = migo_elikz.
v_imseg-lgnum = lgnum.
v_imseg-hsdat = hsdat.
v_imseg-aufnr = aufnr.
v_imseg-bukrs = bukrs.
v_imseg-weanzx = weanzx.
v_imseg-wempfx = wempfx.
v_imseg-abladx = abladx.
APPEND v_imseg TO t_imseg.
CALL FUNCTION 'MB_CREATE_GOODS_MOVEMENT'
EXPORTING
imkpf = v_imkpf
xallp = 'X'
xallb = 'X'
xallr = 'X'
ctcod = 'MIGO_GO' "Change of Jahan
IMPORTING
emkpf = v_emkpf
TABLES
emseg = t_emseg
imseg = t_imseg.
IF v_emkpf-subrc = 1.
CALL FUNCTION 'MB_POST_GOODS_MOVEMENT'
IMPORTING
emkpf = v_emkpf.
ELSE.
I tried to dubug , but couldnt figure out any thing.
Any ideas experts ..!
Thanks
Jahan.Hi ,
Please check in table T158B is MIGO_GO entry with a movement type you passing has been maintained or not .
If you read the documenattion of FM MB_CREATE_GOODS_MOVEMENT for the Input CTCOD it mentions that entry should be in table T158 and T158B For the Transaction code you are passing .
Please reward if useful. -
Hello,
I'm using GUI_UPLOAD in 'BIN' mode to upload a file to a dictionary table field (type RAW(254)). Everything goes fine, except for the last line. Since my document is not a multiple of 254, the last line is not completely filled. The function module fills this line with zeroes, but when I download this file again, these zeroes are seen as an illegal character. Any ideas how to bypass this?GUI_UPLOAD returns file size using import parameter FILELENGTH, use it as export parameter BIN_FILESIZE of GUI_DOWNLOAD.
Regards
Sridhar -
How to populate internal table field with text data?
Hello Experts,
I was able to load text file to a internal table but data is not populating each field. Can someone help me how to populate each field of internal table from text file?
Here is the text file:
io_name, io_type, io_txsht, io_txlng, io_datatype, io_length
ZEA_IO1, CHA, IO Test, IO Test 1, CHAR, 20
ZEA_IO2, CHA, IO Test, IO Test 2, CHAR, 20
Here is the Code:
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab-bapi[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
I appreciate your help.
Regards,
MauI have used tab delimited file.
Here are file contents
io_name io_type io_txsht io_txlng io_datatype io_length
ZEA_IO1 CHA IO Test IO Test 1 CHAR 20
ZEA_IO2 CHA IO Test IO Test 2 CHAR 20
And here is program used
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
<b>FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'</b>
TABLES
data_tab = itab-bapi[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
This program is working fine. You can test it.
Only problem is as the column headings are big for some columns, they are getting truncated which you can always change by changing the column width in declaration
Please let me know if this helps.
ashish -
File Attachement using BAPI_EH_ADDEVENTMSG02
HI,
I am trying to upload a png file (Proof of Delievery) through BAPI_EH_ADDEVENTMSG02.
Can someone kindly provide a sample example, what to fill in the tables TRACKFILEHEADER and TRACKFILEBIN to upload the signature.png from my system. Also Kindly suggest how to get the binary data from png file.
Thanks in advance:)Hi,
to upload a file from your PC and test it you can use.
In the Selection screen enter an existing Tacking Code Set and Tracking ID and choose your local file e.g. picture
REPORT Z_FILE_ATTACH.
* type declaration for bin and asc
types: begin of zzfilebin,
line type raw255,
end of zzfilebin.
types: begin of zzfileasc,
line type char255,
end of zzfileasc.
* Selection screen for event message information
parameters:
* Internal Event Code
p_evtid type /saptrx/ev_evtid,
* Tracking Code Set
p_trcod type /saptrx/trxcod,
* Tracking ID
p_trxid type /saptrx/trxid,
* Path to file
p_fnup type text100 default 'C:\test.jpg',
* File type (BIN or ASC)
p_ftyp type char10 default 'BIN',
p_hlen type i default '0'.
* data declaration
data:
lt_hdr type /saptrx/bapi_hdr_tabtyp,
lt_afh type /saptrx/bapi_afh_tabtyp,
lt_afb type /saptrx/bapi_afb_tabtyp,
lt_afc type /saptrx/bapi_afc_tabtyp,
lt_return type table of bapiret2,
ls_hdr like line of lt_hdr,
ls_afh like line of lt_afh,
ls_afb like line of lt_afb,
ls_afc like line of lt_afc,
lv_tst type tzntstmps,
lv_synch_flag type /saptrx/synchronous_flag value 'X',
ld_filename_up type string,
ld_filename_up2 type text100 ,
ld_filename_down type string,
ld_filelength_up type i,
ld_filelength_down type i,
lt_tabfil_bin type table of zzfilebin,
lt_tabfil_asc type table of zzfileasc,
ls_tabfil_bin like line of lt_tabfil_bin,
ls_tabfil_asc like line of lt_tabfil_asc,
lv_numlines type i,
lv_mod_numlines type i,
l_tempstring type string.
ld_filename_up = p_fnup.
* uploads file from PC harddisk
if p_ftyp = 'BIN'.
call function 'GUI_UPLOAD'
exporting
filename = ld_filename_up
* FILETYPE = 'ASC'
filetype = p_ftyp
* HAS_FIELD_SEPARATOR = 'X'
header_length = p_hlen
importing
filelength = ld_filelength_up
* HEADER =
tables
data_tab = lt_tabfil_bin
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
message s398(00) with
'GUI_UPLOAD failed'
'SUBRC =' sy-subrc ''.
exit.
else.
message s398(00) with 'Upload ok:'
ld_filename_up 'Bytes:' ld_filelength_up.
endif.
else.
* TEXT FILE
call function 'GUI_UPLOAD'
exporting
filename = ld_filename_up
* FILETYPE = 'ASC'
filetype = p_ftyp
* HAS_FIELD_SEPARATOR = 'X'
header_length = p_hlen
importing
filelength = ld_filelength_up
* HEADER =
tables
data_tab = lt_tabfil_asc
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
message s398(00) with
'GUI_UPLOAD failed'
'SUBRC =' sy-subrc ''.
exit.
else.
message s398(00) with 'Upload ok:'
ld_filename_up 'Bytes:' ld_filelength_up.
endif.
endif.
*** fill tables: header + file info
* header
ls_hdr-evtcnt = '1' .
ls_hdr-evtid = p_evtid.
ls_hdr-trxcod = p_trcod.
ls_hdr-trxid = p_trxid.
ls_hdr-evtdat = sy-datlo.
ls_hdr-evttim = sy-timlo.
ls_hdr-sndcod = 'US'.
ls_hdr-sndid = 'SENDER'.
ls_hdr-evttst = lv_tst.
append ls_hdr to lt_hdr .
* FILE
* Numlines
lv_mod_numlines = ld_filelength_up mod 255.
if lv_mod_numlines = 0.
lv_numlines = ld_filelength_up div 255.
else.
lv_numlines = ( ld_filelength_up div 255 ) + 1.
endif.
ls_afh-filename = 'picture.jpg'.
ls_afh-evtcnt = '1'.
ls_afh-fileclass = 'BIN'.
ls_afh-mimetype = 'application/postscript'.
*ls_afh-qualifier_code = 'DSIGN'.
*ls_afh-qualifier_text = 'Picture'.
ls_afh-filesize = ld_filelength_up.
ls_afh-numlines = lv_numlines.
append ls_afh to lt_afh .
if p_ftyp = 'BIN'.
* FILE IS BINARY: converts table in RAWstring
loop at lt_tabfil_bin into ls_tabfil_bin.
* save current string
ls_afb-evtcnt = '1'.
ls_afb-filename = 'picture.jpg'.
ls_afb-line = ls_tabfil_bin-line.
ls_afb-line_counter = sy-tabix.
append ls_afb to lt_afb.
endloop.
call function '/SAPTRX/BAPI_EH_ADDEVENTMSG_02'
exporting
synchronous = lv_synch_flag
tables
trackingheader = lt_hdr
trackfileheader = lt_afh
trackfilebin = lt_afb
return = lt_return.
else.
* FILE IS TEXT
loop at lt_tabfil_asc into ls_tabfil_asc.
* save current string
ls_afc-evtcnt = '1'.
ls_afc-filename = 'text.txt'.
ls_afc-line = ls_tabfil_asc-line.
ls_afc-line_counter = sy-tabix.
append ls_afc to lt_afc.
endloop.
call function '/SAPTRX/BAPI_EH_ADDEVENTMSG_02'
exporting
synchronous = lv_synch_flag
tables
trackingheader = lt_hdr
trackfileheader = lt_afh
trackfilechar = lt_afc
return = lt_return.
endif.
call function 'BAPI_TRANSACTION_COMMIT'. -
Place InfoObjects under InfoObject Catalog
Hi Guys,
I have few InfoObjects (IO) under unassigned infoarea and want to place under particular infoarea. I am telling IO name, IO Catalog name etc. reading a tab delimited text file which are already exists in server. Here is the structure:
IO_CAT IO_NAME IO CAT_TEXT IO CAT_TYPE IO CAT IAREA
ZTEST_AS ZIO_DM1 ZTEST AS CHA ZEA_PLAY_AREA
ZTEST_AS ZIO_DM2 ZTEST AS CHA ZEA_PLAY_AREA
File reading is ok but when I call FM 'BAPI_IOBC_CHANGE', it's throwing an error.
Here are the code - can some one help me please where I am doing wrong:
REPORT ZAS_BAPI_TEST2.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
Data: BEGIN OF bapi_cat OCCURS 0,
io_cat(30) TYPE C,
io_name(30) TYPE C,
io_cattxt(60) TYPE C,
io_cattype(3) TYPE C,
io_infoarea(30) TYPE C,
END OF bapi_cat.
DATA ibapi LIKE STANDARD TABLE OF bapi_cat.
DATA: WS_BAPI LIKE ibapi.
DATA: lt_return type BAPIRET2 occurs 0 with header line.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
**Copy the file from the workstation to the server/ internal table**
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = bapi_cat[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
ENDIF.
*Place all IOs under InfoObject Catalog through BAPI Function
CALL FUNCTION 'BAPI_IOBC_CHANGE'
EXPORTING
INFOOBJCAT = bapi_cat-io_cat
DETAILS = bapi_cat
TABLES
INFOOBJECTS = bapi_cat
RETURN = lt_return.
loop at lt_return.
if lt_return-type = 'E'.
MESSAGE ID lt_return-ID TYPE lt_return-TYPE NUMBER
lt_return-NUMBER
WITH lt_return-MESSAGE_V1 lt_return-MESSAGE_V2
lt_return-MESSAGE_V3 lt_return-MESSAGE_V4.
endif.
endloop.
*ENDLOOP.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Thanks,
MauTo assign your Infoobject you must use a separate BAPI:
BAPI_IOBC_CHANGE
This function module changes an existing InfoObject catalog. Enter all the InfoObject catalog properties in the DETAILS parameter
If the Catalog doesn't exist you have another BAPI:
BAPI_IOBC_CREATE
This function module creates a new InfoObject catalog. You have to give all the InfoObject catalog properties in the DETAILS parameter
Regards,
Sergio -
InfoObject Creation Dynamically
Hello Experts,
I need to create thousands of custom infoobjects and trying to implement through BAPI. I am trying to create infoobject reading the infoobject structure from tab delimited tax file:
io_name io_type io_txsht io_txlng io_datatype io_length
ZEA_IO1 CHA IO Test IO Test 1 CHAR 20
ZEA_IO2 CHA IO Test IO Test 2 CHAR 20
I was able to load the text file to internal table. Now I have to work with the following function modules (please check the code):
'BAPI_IOBC_CHANGE' - To get the InfoObject Catalog so that all the infoobject will be created under InfoObject Catalog. What would be the code?
Call Function 'BAPI_IOBJ_CREATE' -
IMPORTING - Is that right?
What to write under EXPORTING to check the error validation one by one?
RETURN = BAPIRET2 ??
Call Function 'BAPI_IOBJ_ACTIVATE_MULTIPLE' - To activate all the infoobjects. What would be the code?
Here is my Code:
*& Report ZBAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZBAPI_TEST .
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab_bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab_bapi.
DATA ibapi LIKE STANDARD TABLE OF itab_bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
**Copy the file from the workstation to the server/ internal table**
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab_bapi[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ENDIF.
loop at itab_bapi.
write: /5 itab_bapi-io_name,
20 itab_bapi-io_type,
30 itab_bapi-io_txsht,
50 itab_bapi-io_txlng,
75 itab_bapi-io_datatype,
85 itab_bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Change InfoObject Catalog through BAPI Function
*CALL FUNCTION 'bapi_iobc_change'
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INFOOBJCAT) LIKE BAPI6113-INFOOBJCAT
*" VALUE(DETAILS) LIKE BAPI6113 STRUCTURE BAPI6113
*" TABLES
*" INFOOBJECTS STRUCTURE BAPI6113IO
*" RETURN STRUCTURE BAPIRET2 OPTIONAL
Create InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_CREATE'
IMPORTING
INFOOBJECT = itab_bapi-io_name
TYPE = itab_bapi-io_type
TEXTSHORT = itab_bapi-io_txsht
TEXTLONG = itab_bapi-io_txlng
DATATP = itab_bapi-io_datatype
INTLEN = itab_bapi-io_length.
*EXPORTING
INFOOBJECT = itab_bapi-io_name
RETURN = BAPIRET2.
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*" TABLES
*" INFOOBJECTS STRUCTURE BAPI6108IO
*" RETURN STRUCTURE BAPIRET2 OPTIONAL
*" INFOOBJECTS_ERROR STRUCTURE BAPI6108IO OPTIONAL
If anyone knows any better idea creating IO dynamically, I can look at that too. Appreciate your help.
Regards,
Mauwhat are your reference points
Is it always from current date then it that case your data will change daily.
Also is there a created date or something else associated with store id. how do you determine that -
Unable to delete a file on application server
Hello Experts,
I have gone through couple of post and sample nothing worked that's the reason Iam posting a query here.
Please help me with your valuable suggestions.
I am reading a file from the application server running a BDC program to update my ztable all works fine.
now i wanted to move this file to another folder thats too working perfectly but now when i try deleting the older one it is not getting deleted.
I have closed the dataset and checked the authorization that is not a concern but still it is not getting deleted.
I have pasted the code below.
For READ and CLOSE dataset it returns subrc as 0 but after delete it returns 4.
data : mess type string.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT message mess.
IF SY-SUBRC = 0.
DO.
READ DATASET ld_file INTO wa_string.
if sy-subrc eq 0.
append wa_string to it_string.
clear wa_string.
else.
exit.
endif.
enddo.
close dataset ld_file.
delete dataset ld_file.
else.
WRITE 'Unable to open source file to move the content'.
endif.
Regards,
Ranjith NHello Mr Ghode,
Thaking you for your response on my query.
as you said to handle exception this is what i have done.
kindly verify the same would be of great help.
still iam unable to delete the file.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
DO.
READ DATASET ld_file INTO wa_string. "LV_LINE is variable to hold line contents being read
if sy-subrc eq 0.
append wa_string to it_string.
clear wa_string.
else.
exit.
endif.
enddo.
close dataset ld_file.
if sy-subrc eq 0.
try.
delete dataset ld_file.
catch CX_dynamic_check into t_ref.
err_txt = t_ref->get_longtext( ).
endtry.
endif.
endif.
Regards,
Ranjith N -
Using save_text to change long text of sales
Hi All,
I am trying edit the long text on sales order header using FM save_text , But it does not work ,
the fm is returning subrc value 0 but the long text does nnot change i have also used commit_text .
data td1 type thead .
data : tdlin1 type table of tline.
data : wa_tdlin1 like line of tdlin1.
td1-TDOBJECT = 'VBBK'.
td1-TDname = '188238'.
td1-tdid = '0002'.
td1-tdspras = 'EN'.
td1-tdtxtlines = '1'.
wa_tdlin1-TDformat = 'U1'.
wa_tdlin1-tdline = 'this chnaged by vinay to test'.
append wa_tdlin1 to tdlin1.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = td1
INSERT = ' '
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
tables
lines = tdlin1
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
object = 'VBBK'
id = 'ZINT'
language = sy-langu.Hi Guys ,
I figured out the problem and its working now .
Cheers
vinay -
File to Idoc .If order is their need to send mail
Hi All,
I have scenario like this.
Sending file (order) to SAP -IDoc
I using RFC lookup .There is funtion module which has been developed in SAP R/3 it contains 5 import parameters and return SUBRC.
If the result is subrc = 4
This is the normal situation and the order / idoc should be
generated as normally.
If the result is subrc = 0
Now we are in a situation where we earlier have received this order.
Instead of generation an IDOC, an email must be send to respective persons with contents
SUBJECT: We have already received this EDI -order before.
And the mail should contain following:
We have already received this EDI-order before.
Purchase order no: <value of purchase order no>
Sold-to: <value of sold-to>
Salesorganisation: <value of salgsorganisation>
Distribution channel: <value of distribution channel>
Division: <value of division>
Note : BPM not recomended
Thanks
MMVHi,
Check the following link
/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
it is possible to configure the mail adpater to send attachemnts without any ABAP coding. Just check out these
blogs by michal that deal with the mail adapter,
/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
You can also check these links on SAP help for configuring the mail adapter,
http://help.sap.com/saphelp_nw04/helpdata/en/ad/bf93409c663228e10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/23/c093409c663228e10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
Please reward points if it helps
Thanks
Vikranth -
Not able to use filed-get macro
Hi Experts,
I am trying to develop a small web aplication in integrated ITS. My web page containes a textarea and a pushbutton . In the PAI of the modulepool i have includede the below code.
lv_next = 1.
DO.
CLEAR lt_text.
REFRESH lt_text.
field-get 'GT_SCR_SPEC_NOTE' lv_next lt_text lv_datalan.
IF sy-subrc = 0.
READ TABLE lt_text INDEX 1.
gt_scr_spec_note-text = lt_text.
APPEND gt_scr_spec_note.
lv_next = lv_next + 1.
IF lt_text IS NOT INITIAL.
lv_last_not_blank = sy-tabix.
ENDIF.
ELSE.
lv_last_index = sy-tabix.
EXIT.
ENDIF.
ENDDO.
I have defined all the variables perfectly and in the front end I have included the textarea tag like this
<textarea style="font-family:courier;font-size:11px;"
id="GT_SCR_SPEC_NOTE:132[]" name="GT_SCR_SPEC_NOTE:132[]"
cols="40" rows="4" wrap="physical" title="`#AREA_INFO`">`
repeat with r in GT_SCR_SPEC_NOTE;write (r, "\r\n");end
`</textarea>
When I reied to debug the program from the front end, when the control comes to the field-get macro it is going to the FM ALEWEB_GET_CONTEXT in that the parameters are passed correctly like
FIELDNAME = GT_SCR_SPEC_NOTE
GT_SCR_SPEC_NOTE = 1
In this FM there is a call to another remote FM ALEWEB_GET_CONTEXT_EXT this FM is raising an exception saying "invalid_index" ( sy-subrc = 2). But the fieldindex field is filled with value 1 when this FM is called. I could not get into this FM as it is a RFC.
can anybody please let me knoe what might be the problem (or) if you have any sample code for transferring the data from the web to the r/3, please provide me with the sample code.
thanks
sankarHi,
I have a similar issue, with integrated ITS on SRM 5.0 in a migration project. When I try to register the certificate into USREXTID, before was implemented by the next steps:
1.- field-get '~http_auth_cert' 1 usercert_base64_c_tab certlen.
2.- CALL 'SNC_ABAP_INFO' ID 'OPCODE' FIELD get_cert_info
ID 'CERT' FIELD usercert_base64
ID 'CERTLEN' FIELD certlen
ID 'SUBJECT' FIELD subject
ID 'ISSUER' FIELD issuer
ID 'SNUMBER' FIELD serialno.
But, now the call to makro field-get not work whit the param '~http_auth_cert' , and I have to pass the value DN of the certificate (CN=name- NIF xxxxxxxy, OU=xxxxxxx, OU=xxxxxx Clase x CA, O=xxx, C=xx), and works fine executing the next ALEWEB_GET_CONTEXT function. Then the call to system function 'SNC_ABAP_INFO', returns subrc 300.
In this version, the standar service certmap do it similar.
Sorry, can anybody help me.
Tx and regards. -
Creating new record in infotype during BADI
Hi all,
We want to use the BADI HRPAD00INFTY "Update / Infotype maintenance" for trigering an automatic creation of some infotype records using FM HR_INFOTYPE_OPERATION.
The creation should only happen when a new record of infotype 2001 subtype GT01 is created.
Every time when we try something we get an error on the first insert we do using the FM.
The Enqueue goes fine (returns subrc = 0) but when doing the insert with the FM we get the error "EPG 428A complex application error has occurred" in the return.
We checked the data that we're passing thru the FM and there everything is fine.
Is it possible that due to the lock of the original save is generating we can't insert anything else and how can we work around this problem?
We also have this problem when using the user exit and we tried to do a submit to another report but there we can't even make the lock.
Regards,
OlivierForum post in ABAP, General: Infotype reecord creation in a BAdI - Issue
Infotype 0008 reecord creation in a BAdI - Issue
Reward Points if useful. -
Hi master
Sir
I use enter_query through button and give 10 in deptno textbox
But I execute_query through button no give result
An use form menu then give result easily what happen
Enter_query code
Go_block(emp);
Enter_query;
execute_query code
Go_block(emp);
execute_query;
and
execute_query code
execute_query;
and how use option button
please give me idea
thanking youHi Karen,
We have just run into this issue...trying to find out more, but the Crystal Report developer stated...
"When I alias a table in crystal and use a field from that alias I get the following error:"
Database connector error: /CRYSTAL/OSQL_EXECUTE_QUERY returned: subrc: 4. message "CONTENT-0-0" has already been declared.
Was this the same OSQL_EXECUTE_QUERY error you received? and by chance did you get it resolved.
Also having the resource go through the checks on the transports per Ingo.
Thanks.
Kevin
Maybe you are looking for
-
Data transfer problem between Oracle 9 and Oracle 8
We have two enviroments one in oracle 9 and other is oracle 8, both are on different unix servers. There is a DBlink for Oracle 8 on the oracle 9 database. Now when we try to select any data from oracle 9 and insert into oracle 8 using the dblink all
-
Methods of One Class In Another
Can I make the methods of one class work in another?
-
from where can i download the zonestat utility, somebody can help me, i need to know the information about my non-global-zones but the zonestat utility isn't isntalled
-
Outstanding DB conversions found
Hi .. I am using the EHP installer tool (enhacement package installer tool) to upgrade my Netweaver (BI) 7.0 to 7.01 but I received the error message "Outstanding DB conversions found" on STEP 2 "Extraction" in two tables or Infocubes or infoobje
-
does this standard workflow post leave data to IT2001 after the leave request is approved, or it just basically changed the request status only? Thanks.