Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI -- Points for Helpful Answers

Former Member
0 Likes
835

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
805

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

5 REPLIES 5
Read only

Former Member
0 Likes
805

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

Read only

Former Member
0 Likes
806

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

Read only

0 Likes
805

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

Read only

0 Likes
805

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

Read only

0 Likes
805

Thanks guys for your valuable time. i am trying it out in my own way.

regards,

srinivas