Read table field with getString()
public String[] getExportSParams(JCO.Function function, String structure,
String[]tablefield) {
JCO.ParameterList export = function.getExportParameterList();
JCO.Structure structures = export.getStructure(structure);
String[] exportField = null;
for (int i =0; i<tablefield.length;i++){
exportField<i> = structures.getString(tablefield<i>);
return exportField;
Bit confusing.
Assuming that what ever you had given in your question is exactly the "copy paste" from your code...
?Both "tableField" and "exportField" are arrays right. Why are you using those variables directly in places where you are supposed to use a "String".
?You are trying to put some string into exportField (which is an array) which is not yet initialized.
Can you try this out -
/* I guess, you are trying to extract the content of the structure into an array of strings and send it back */
public String[] getExportSParams(JCO.Function function, String structure,
String[]tablefield) {
JCO.ParameterList export = function.getExportParameterList();
JCO.Structure structures = export.getStructure(structure);
String[] exportField = null;
if(tablefield!=null && tablefield.length>0)
exportField=new String[tablefield.length];
for (int i =0; i<tablefield.length;i++){
exportField<i> = structures.getString(tablefield<i>);
return exportField;
Similar Messages
-
How can I add table fields with existing structure ?
I like to add PSTLZ field to stucture KOMGG.Is it possible to add table field with the existind structure.If yes how can I do this?kindly help me on this.
hi
go to se11
in change mode select the button append
create new append which starts from Zpstlz in this komgg structure and add data element and domain to this field and activate with request number
then in field catalogue this field should be visible ,here ends your append
now it is ready to use in condition tables.
reward if helps !!!!! -
How to read table fields form a table having length of 7 characters
HI all,
could you please tell me how to read table fields from a table having length 7 characters, i have requirement that in my ztable i have 30 fields out of which 20 fields are location fields, i want to select 20 fields which have 7 characters length.
please could any body suggest me on this issue.
thanks,
sre.hi,
try like this
create a data variable of type i as
data: len type i.
create internal table for 20 fields as
data:begin of itab,
fld 1 type .......
end of itab.
data:itab type itab1 occurs 0 with header line.
loop at itab2. // original internal table which all fields.
read table itab2 with index sy-tabix.
len = strlen (itab2-fld).
if len eq 7.
move itab2 itab1.
append itab1.
endif.
endloop.
if helpful reward some points.
with regards,
Suresh.A -
Read Table ITAB with key Dynamic Value index 1
Here is sample Intenral table
Columnname-C01 / C02 / C03
Value-123 / 456 /789
I would like to search value of the internal table according to dynamic value given by the code.
i.e.
read table ITAB with key <Dynamic Value> index 1.Hi,
Apart from read, you can also use <b>SEARCH</b> statement.
Syntax
SEARCH
Searches for strings.
Syntax
SEARCH <f>|<itab> FOR <g> [ABBREVIATED]
[STARTING AT <n1>]
[ENDING AT <n2>]
[AND MARK]
[IN BYTE MODE|IN CHARACTER MODE].
Searches the field <f> or table <itab> for the string in the field <g>. The result is stored in SY-FDPOS. The additions let you hide intermediate characters, search from and to a particular position, and convert the found string into uppercase. In Unicode programs, you must specify whether the statement is a character or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions.
Hope this information is useful to you.
Regards,
Saumya -
READ TABLE bdcmsg WITH KEY msgtyp = 'E' msgtyp = 'A'.
In the ECC6.0 system,the following code is showing syntax error (msgtyp should be used only once)
READ TABLE bdcmsg WITH KEY msgtyp = 'E' msgtyp = 'A'.
Can anyone pls give me a solution.
Regards
SajidHI,
you can read the table only with different keys.
e.g.
READ TABLE bdcmsg WITH KEY msgtyp = 'E' msgart = 'A'.
I think you need to work with an workingarea so that you can go over more then one msgtyp.
e.g.
DATA: spfli_tab TYPE SORTED TABLE OF spfli
WITH UNIQUE KEY carrid connid,
spfli_key LIKE LINE OF spfli_tab.
FIELD-SYMBOLS <spfli> TYPE spfli.
SELECT *
FROM spfli
INTO TABLE spfli_tab
WHERE carrid = 'LH'.
spfli_key-carrid = 'LH'.
spfli_key-connid = '0400'.
READ TABLE spfli_tab FROM spfli_key ASSIGNING <spfli>.
IF sy-subrc = 0.
ENDIF.
regards
Nicole
Edited by: Nicole Lorenz on Mar 18, 2008 5:44 AM
Edited by: Nicole Lorenz on Mar 18, 2008 5:45 AM -
Hi,
Unfortunately i've been almost a year out of abap,so its kinda rusty, so pls bear with my question. I've to develop this upload program, which would read from file, but the catchy part is that to filter out the records by either pernr, bukrs, subty or any of the criteria simultaneously. I'm using select-options for pernr, subty, bukrs, but the problem is how do i filter it out, what sort of logic/ algorithm should i be using, READ TABLE itab WITH KEY or a LOOP statement, could any 1 give any suggestions as to how i should be designing the logic. please adviseHi
You want to upload data from a file on the basis of some criteria.
In this case I think you need to upload all the data from the file to an internal table.
Now the internal table contains all the data from the file.
then filter the data from that table on the basis of PERNR, BUKRS or SUBTY.
Like Below:
delete ITAB where PERNR not in S_PERNR (S_PERNR is your select option).
similarly for SUBTY or BUKRS.
Or if you want all these 3 fields together then use OR condition.
Like:
delete ITAB where PERNR not in S_PERNR OR
delete ITAB where PERNR not in S_SUBTY OR
delete ITAB where PERNR not in S_BUKRS.
the above code will delete all the data from ITAB where the data doesn't match with the entries in S_PERNR, S_SUBTY and S_BUKRS.
I hope this will work for you,
If you didn't get it then post your code.
Thanks
LG -
What is the difference between READ TABLE ITAB WITH KEY and TABLE KEY
Hi Experts,
what is the difference between
READ TABLE <ITAB> WITH KEY <K1> = <C1>
<Kn> = <Cn> .
and
READ TABLE <ITAB> WITH TABLE KEY <K1> = <C1>
<Kn> = <Cn> .
Thanks
Akash.Hi akashdeep,
Nice question. I also tried to find out, but no much success. My opinion is that for practical purposes there is no difference.
It may have difference in case of searching, especially sorted tables. (binary search or normal linear search).
Case1: If our table is sorted table with defined key fields, and we give WITH TABLE KEY, then faster binary search is used.
Case2 : If our table is sorted table with defined key fields, and we give WITH KEY, (and no field contained in the keys), then normal linear search is used.
regards,
amit m. -
Read Table ITAB with key Dynamic Value = Value
Here is sample Intenral table
Columnname-C01 / C02 / C03
Value-123 / 456 /789
I would like to search value of the internal table according to dynamic value given by the code.
i.e.
read table ITAB with key <Dynamic Value> index 1.Hi Rupesh,
Just try the following piece of code:
TYPES: BEGIN OF str,
A TYPE C,
B TYPE I,
C(2) TYPE C,
END OF STR.
DATA itab TYPE TABLE OF str WITH HEADER LINE.
itab-A = 'X'.
itab-B = '100'.
itab-C = 'YZ'.
APPEND itab.
PERFORM c_itab_read USING 'A' 'X'.
PERFORM c_itab_read USING 'B' '100'.
PERFORM c_itab_read USING 'C' 'YZ'.
FORM c_itab_read USING key TYPE ANY val TYPE ANY.
READ TABLE itab WITH KEY (KEY) = val.
IF SY-SUBRC IS INITIAL.
WRITE: 'Hurray!'.
ENDIF.
ENDFORM.
Hope this helps.
Reqard points if query answered.
Cheers,
~i1 -
Error in reading table TFK056A with interest key
While posting interest I am getting the following error "Error in reading table TFK056A with interest key". I have configured my interest keys well. Please assist.
Hi Panashesean,
The reason for this error could be you have in the line items an interest key (ikey) which is missing in table TFK056A. Though you have a different interest key in the master record the system will consider the line item first.
Interest Key Documentation states:
"If more than one interest key is defined for a line item, these interest keys are normally prioritized as follows:
1. Interest key in line item
2. Interest key that is defined for transactions identified as additional receivables
An interest can depend on the operative company code in the rule for
additional receivables.
3. Interest key in dunning level
4. Interest key in contract account master record"
You need to remove the interest key in the line item for the system to use the master record ikey OR or define (ikey) in table TFK056A.
I hope this works.
regards,
David -
Help with writing and retrieving data from a table field with type "LCHR"
Hi Experts,
I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
Thanks in advance,
C
SAVING THE LIST DATA TO DB
DATA: L_WA(800).
LOOP AT T_TAB into L_WA.
ZDBTAB-DATALEN = STRLEN( L_WA ).
MOVE: L_WA to ZDBTAB-RAWDATA.
ZDBTAB-LINENUM = SY-TABIX.
INSERT ZDBTAB.
READING THE DATA FROM DB
DATA: BEGIN OF T_DATA,
SEQNR type ZDBTAB-LINENUM,
DATA type ZDBTAB-RAWDATA,
END OF T_TAB.
Select the data.
SELECT linenum rawdata from ZDBTAB into table T_DATA
WHERE repid = w_repname
AND rundate = w_rundate
ORDER BY linenum.
Populate calling Internal Table.
LOOP AT T-DATA.
APPEND T_DATA to T_TAB.
ENDLOOP.Hi Anuj,
The unicode flag is active.
When I run our report and then to try and save the list data a dump is happening at the following point
LOOP AT T_TAB into L_WA.
As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
When I try to load a saved list the dump is happening at the following point
APPEND T_DATA-RAWDATA to T_TAB.
T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
Regards
C -
Hi GURUS,
Need your help, I wrote the below piece of code in my report program and I DINT GET ANY DATA IN "wa_it_ekpo"???
and there is no syntactical error when I execute the program pls help me get data into "wa_it_ekpo"..
LOOP AT it_lips into wa_it_lips.
MOVE-CORRESPONDING wa_it_lips TO wa_asnmain_ref.
SORT it_ekpo DESCENDING by ebeln ebelp .
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel ebelp = wa_it_lips-vgpos .
MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref.
*APPEND wa_it_ekpo to it_ekpo.
*MOVE-CORRESPONDING
*CONCATENATE wa_it_lips wa_it_ekpo INTO WA_ASNMAIN_ref.
*CLEAR wa_it_lips.
ENDLOOP.
Thanks,
DepI call form populate_data passing value Suppose s_vbeln = u2018180000056u2019.
FORM populate_data USING val_vbeln.
s_vbeln = val_vbeln.
SELECT single likpVBELN likpTRMTYP likpLIFNR likpERNAM likp~BLDAT from likp
into (wa_ittab1-vbeln , wa_ittab1-trmtyp, wa_ittab1-lifnr, wa_ittab1-ernam, wa_ittab1-bldat ) where vbeln = s_vbeln.
APPEND wa_ittab1 to it_tab1.
SELECT single LIPSWERKS LIPSVGBEL FROM lips into (wa_ittab4-werks , wa_ittab4-vgbel) where lips~vbeln = s_vbeln.
APPEND wa_ittab4 to it_tab4.
SELECT SINGLE NAME1 FROM T001W INTO WA_ITTAB3-NAME1T WHERE T001W~WERKS = WA_ITTAB4-WERKS.
SELECT SINGLE BEDAT FROM EKKO INTO WA_ITTAB3-BEDAT WHERE EKKO~EBELN = WA_ITTAB4-VGBEL.
SELECT SINGLE NAME1 FROM LFA1 INTO WA_ITTAB3-NAME1 WHERE LFA1~LIFNR = WA_ITTAB1-LIFNR.
SELECT SINGLE ADRNR FROM EKPO INTO WA_ITTAB3-ADRNR WHERE EKPO~EBELN = WA_ITTAB4-VGBEL.
DATA it_ekpo_unf TYPE ekpo OCCURS 0.
DATA wa_it_ekpo_unf TYPE ekpo.
DATA it_ekpo TYPE ekpo OCCURS 0.
DATA wa_it_ekpo TYPE ekpo.
DATA it_lips_unf TYPE lips OCCURS 0.
DATA wa_it_lips_unf TYPE lips.
DATA it_lips TYPE lips OCCURS 0.
DATA wa_it_lips TYPE lips.
SELECT VGBEL VGPOS MATNR EAN11 ARKTX LGORT FROM lips INTO CORRESPONDING FIELDS OF TABLE it_lips_unf WHERE lips~vgbel = WA_ITTAB4-VGBEL.
LOOP AT it_lips_unf into wa_it_lips_unf.
SHIFT wa_it_lips_unf-vgpos LEFT DELETING LEADING '0'.
APPEND wa_it_lips_unf to it_lips.
ENDLOOP.
SELECT EBELN EBELP MENGE MEINS UMREZ FROM EKPO INTO CORRESPONDING FIELDS OF TABLE it_ekpo_unf WHERE ekpo~ebeln = WA_ITTAB4-VGBEL.
LOOP AT it_ekpo_unf into wa_it_ekpo_unf.
SHIFT wa_it_ekpo_unf-ebelp LEFT DELETING LEADING '0'.
APPEND wa_it_ekpo_unf to it_ekpo.
ENDLOOP.
LOOP AT it_lips into wa_it_lips.
MOVE-CORRESPONDING wa_it_lips TO wa_asnmain_ref.
SORT it_ekpo DESCENDING by ebeln ebelp .
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel ebelp = wa_it_lips-vgpos .
MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref.
ENDLOOP. -
Can no longer select text in email template or read only field with mouse using IE or Firefox?
Hi Guys,
I can no longer select text in email template or read only field using my mouse in IE or Firefox anymore. We are using CRM 2011 rollup 18 applied with IE 11 and the latest version of Firefox. We only applied roll up 18 in Feb when this issue began.
Thanks
Dave
David KellyWhen you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
(1) Bypass Firefox's Cache
Use Ctrl+Shift+r to reload the page fresh from the server.
(You also can clear Firefox's cache completely using:
orange Firefox button ''or'' Tools menu > Options > Advanced
On the Network mini-tab > Cached Web Content : "Clear Now")
(2) Remove the site's cookies (save any pending work first) using either of these. While viewing a page on the site:
* right-click and choose View Page Info > Security > "View Cookies"
* Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
Then try reloading the page. Does that help?
These features rely on JavaScript, and it sounds as though you have scripting enabled if you get (the wrong) color changes. Some add-ons might alter the way scripts operate, so a standard diagnostic to bypass interference by extensions (and some custom settings) is to try Firefox's Safe Mode.
First, I recommend backing up your Firefox settings in case something goes wrong. See [[Backing up your information]]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)
Next, restart Firefox in Firefox's Safe Mode ([[Safe Mode]]) using
Help > Restart with Add-ons Disabled
In the dialog, click "Start in Safe Mode."
If those features work correctly, this points to one of your extensions or custom settings as the problem.
To also disable plugins, you can use this page:
orange Firefox button ''or'' classic Tools menu > Add-ons > Plugins category
Any change? -
How to populate dynamic internal table fields with data??
Hi Folks,
How to assign a particular internal table field to a dynamically assigned internal table?
I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE
Now i created a dynamic internal table which has the same column as in my DB table.
I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.
Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.
Looking for reply...
Best Regards,
Sayakhi,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '1000'
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
*declare intern_tmp as internal table tb_data in wich you want the data
*and declare a field symbol <fs_123>
LOOP AT intern.
ASSIGN COMPONENT intern-col OF STRUCTURE
intern_tmp TO <fs_123>.
IF NOT <fs_123> IS ASSIGNED.
CLEAR intern.
CLEAR intern_tmp.
CONTINUE.
ENDIF.
<fs_123> = intern-value.
AT END OF row.
CLEAR tb_data.
MOVE-CORRESPONDING: intern_tmp TO tb_data.
APPEND tb_data.
CLEAR intern_tmp.
ENDAT.
CLEAR intern.
ENDLOOP.
**paste this code and you can see the data in ur tables dynamically.
Thanks
Nitin Sachdeva -
Only multiple entries in BP when creating a new table/field with EEW
Hi,
I am creating new tables/fields for BP in CRM 4.0 using transaction EEWB.
This is working quite well but the fields that appear allows multiple entries per BP. I just want one single entry per BP.
The wizard talks about multiple options but I cannot see how I define that if it should be a single entry or multiple.
Any idea how to achieve that?
Thanks,
//andersHi
As i know the fields will be multiple only, u can try for 'default'
and also try in the wizard in step 2
The Process of EEW will be like this
1. To add new fields to the business partner, use the business object Business Partner (BUPA) and create an enhancement of the type "Add New Fields". A wizard helps you define the individual enhancements and provides you with the necessary information for each step.
2 For each field, you must define the field name, data type and, if necessary, the field length.
3 For each field, define whether a check table should be available.
4 For each field, you must also determine whether it should be transferred to SAP BI or to CRM Field Applications.
5 In the last wizard screen, the system shows you an overview of the fields you defined, together with their associated attributes.
6 To start generation, choose Complete.
I hope u can solve ur prob in Step 2 data type
cheers
Manohar -
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
Maybe you are looking for
-
I downloaded reader 11 and now i cant open any pdf files, i recieve internal error
after downloading reader 11 , I can not open any pdf files on my computer... i recieve internal error
-
Making LOV off of an exposed method from second application module
Hello, I am on JDev 11.1.1.4.0. My ADF project worked fine until the spec changed on how Lookups are going to be handled. Previuosly, all the lookup tables were in the same database as other tables. Change is that FND Lookups will be created in the "
-
HT3281 How can I sort the podcasts I download so that the smaller ones download first
Hi All A cool feature that I am looking for is a way to sort the podcasts that I downlod by size, so that I can download the smaller ones first and fast and then keep downloading untill all pocasts are downloaed. So for example: I subscribe to a podc
-
How to cast StyledDocument in to String
Hi there, I would like to know if it is possible to put a StyledDocument variable in to a String and how I can do this. Casting???
-
Please explain how smart render and mezzanine codecs work
What is the workflow for using mezzanine codecs (specifically ProRes and DNxHD) and smart render? I am interested in a faster render and export option. I never use camera footage, always original animation mov files from AE provided by our GFX team.