2007 Oct 16 9:39 AM
I have a zBAPI. Now i have taken the import parameters and assigned to the fields of itab. i then inserted the data into i_out and later into DB table. so i got only one record. how is that i have to do for multiple records.
see my code as below.
DATA: TIMESTAMP(16).
CONCATENATE SY-DATUM SY-UZEIT INTO TIMESTAMP.
itab-SlNo = timestamp.
itab-type = persontype.
itab-organization = organisation.
itab-authorisedperson = authorisedperson.
itab-street = street.
itab-city = city.
itab-state = state.
itab-zip = zip.
itab-contact_numbers = contact_numbers.
itab-email = email.
append itab.
clear itab.
loop at itab.
read table itab with key SlNo = itab-SlNo.
move itab to i_out.
append i_out.
endloop.
loop at i_out.
if i_out-type = 'BUYER' or i_out-type = 'buyer'.
insert into zbuyer values i_out.
elseif i_out-type = 'SUPPLIER' or i_out-type = 'supplier'.
insert into zsupplier values i_out.
endif.
endloop.
refresh i_out.
regards,
srinivas
2007 Oct 16 9:50 AM
Hi,
I'm not shure if I understand you correctly, but if you already have alle the data you need in an internal table, you can simply insert this data into the db table using
INSERT <ztable> FROM TABLE <itab>.
Just make shure all the fields are filled correctly in the internal table (e. g. I always forget to fill the CLIENT field
Regards, Joerg
I have a zBAPI. Now i have taken the import parameters and assigned to the fields of itab. i then inserted the data into i_out and later into DB table. so i got only one record. how is that i have to do for multiple records.
see my code as below.
DATA: TIMESTAMP(16).
CONCATENATE SY-DATUM SY-UZEIT INTO TIMESTAMP.
itab-SlNo = timestamp.
itab-type = persontype.
itab-organization = organisation.
itab-authorisedperson = authorisedperson.
itab-street = street.
itab-city = city.
itab-state = state.
itab-zip = zip.
itab-contact_numbers = contact_numbers.
itab-email = email.
append itab.
clear itab.
loop at itab.
read table itab with key SlNo = itab-SlNo.
move itab to i_out.
append i_out.
endloop.
loop at i_out.
if i_out-type = 'BUYER' or i_out-type = 'buyer'.
insert into zbuyer values i_out.
elseif i_out-type = 'SUPPLIER' or i_out-type = 'supplier'.
insert into zsupplier values i_out.
endif.
endloop.
refresh i_out.
regards,
srinivas
2007 Oct 16 9:43 AM
Hi,
Why dont u create a structure for all the fields that are required to be entered by the user. Then in ur BAPI, in tables tab, define a table with the type of the created strcuture. User can then enter multiple entries at the same time and in the logic, u just need to loop at ur internal table and process in the same way as u r doing now.
Regards,
Himanshu
2007 Oct 16 9:50 AM
Hi,
I'm not shure if I understand you correctly, but if you already have alle the data you need in an internal table, you can simply insert this data into the db table using
INSERT <ztable> FROM TABLE <itab>.
Just make shure all the fields are filled correctly in the internal table (e. g. I always forget to fill the CLIENT field
Regards, Joerg
2007 Oct 16 10:11 AM
Hi joerg,
My requirement is that i have all the data in xml format. i need to read that using XI and transfer the data from xml file to R/3. in that case i need to write a BAPI where the import parameters are to be taken into a the internal table. i am having problems in getting multiple records to the internal. the scenario worked fine for me in the case of single record.
regards,
srinivas
2007 Oct 16 10:17 AM
Hi,
In that case you simply need a TABLES parameter in your BAPI. Just fill this TABLES parameter from XI and then INSERT the data into you table.
Regards, Joerg
2007 Oct 17 9:50 AM
Thanks guys for your valuable time. i am trying it out in my own way.
regards,
srinivas