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

Updating database table using function module

Former Member
0 Likes
6,018

Hi All.

I need to insert some records from report program to database table. before that Am Sending set of records to customized function module for some validation. IT_PO is a table parameter in the function module. its using to pass records from report to FM. I have to insert record from table parameter IT_PO to my ZTABLE in the FM itself. Here is getting error like The Work area IT_PO is not long enough

Please guide me.

Thanks in Advance.

14 REPLIES 14
Read only

Former Member
0 Likes
3,007

chk if the structure of both the itab and the data base table are the same.

Read only

Former Member
0 Likes
3,007

Hi Raj

Did you declare it_po as of the same TYPE as the FM parameter table?

Pushpraj

Read only

Former Member
0 Likes
3,007

Hi Raj,

Only in one case you will got that error. That is Internal table Or Work area Structure is not Equal to Database table. So you can declare the Corresponding ITab or Work area Equal to Database table Fields list.

Read only

Former Member
0 Likes
3,007

Hi,

The error may occur due to Internal table may not match with the database,

if not then the functional module used for validation might raise error.

It is better not use FM for inserting data into the database...

can u able tell the functional module used for validation...

Read only

0 Likes
3,007

Hi guys,

IT_PO like ZPO as table parameter in FM using this syntax to insert records.

INSERT ZTAB FROM IT_PO .

COMMIT WORK.

ZPO and ZTAB both are same structre.

Please guide me.

Thanks.

Read only

0 Likes
3,007

Hi Rajkumar,

What problem are you facing to declare , IT_PO like ZTAB.

Do this change , it'll work.

and Press F1 on INSERT, MODIFY and UPDATE statement, U'll get lot of inputs.

Read only

former_member222860
Active Contributor
0 Likes
3,007

Hi,

Check in the Debug mode, whether values are getting into IT_PO.

Read only

0 Likes
3,007

Hi Mahesh,

i am getting the values in itab while debugging it..

Read only

0 Likes
3,007

Hi,

Declare your IT_PO like ZTAB

and the stmt. as

INSERT ZTAB FROM TABLE IT_PO.

Pl. check .

thanks

Read only

Former Member
0 Likes
3,007

after getting the entries to ur itab. jus modify ur database table from this itab transporting the fields.

any error u r gettin here?

Read only

0 Likes
3,007

Hi,

Yes getting error like The Work area IT_PO is not long enough.

Read only

Former Member
0 Likes
3,007

i mean r u getting this at modify statement? chk sy-subrc after the fm and also at modify.

else try: u jus loop at itab.

fetch value to a wa.

modify the database table from wa.

endloop.

Read only

Former Member
0 Likes
3,007

Hi,

You import parameter IT_ PO in the FM, instead of that

create table type for the ZTABLE (ztable-table_type),

change it_po type ztable to

-


IT_PO TYPE ZTABLE-TABLE_TYPE.

Hope it helps u...

Read only

former_member653066
Participant
0 Likes
3,007

hi,

dear experts, i have an typical issue. plz get me out this.

details are below,

we all are familiar with ME9K , this is used to print the purchase documents which is released,

customer wants to see the po docs which is not released, i tried to create a z## prog but enhancements is not going to copy as per sap standards, no enhancements were found in my side..

plz help me this,,,