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

Modfiy database table from work area or variable issue

Former Member
0 Likes
783

Hi Guys ,

I need to modfiy database table from the value in workare .iam dooing the code as below ..

modify Zdata_base from ls_inter_numb.

but it is not working ..

Can any one give right approach .

Regards,

Sri

7 REPLIES 7
Read only

Former Member
0 Likes
713

what is the error you getting ?

Create the same workarea structure as your database table structure.

Can you paste the code of your workarea declaration ?

Read only

0 Likes
713

Hi,

below is the sample code ...

Select mara from Zmaterial into ls_mara

where ZMPN = <ls_INPUT_row>-ZMPN and

ZMNFR = <ls_INPUT_row>-ZGLBMF_CODE.

IF sy-subrc NE 0.

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

NR_RANGE_NR = '01'

OBJECT = 'ZOBJ_MPN'

IMPORTING

NUMBER = LS_INTER_NUMB.

modfiy zmaterial from LS_INTER_NUMB.

Like this iam dooing ..

Regards,

Sri

Read only

0 Likes
713

I hope the Database table(ZMATERIAL) has only one field MARA. If not then your logic is wrong...

Read only

Former Member
0 Likes
713

Hi Sri,

1) Make sure that the structure of the internal table / Work area is same as the structure of the data base table.

2) Write COMMIT WORK statement after the MODIFY statement and check.

Regards,

Kumar Bandanadham

Read only

0 Likes
713

Try to use a where clause and observe the Sy-subrc after that.

Thanks,

Mathivanan.G

Read only

Former Member
0 Likes
713

Hi,

Please check the strucutre of the work area is same with the ztable

Loop at itab into ls_inter_numb.

modify Zdata_base from ls_inter_numb.

commit work.

endloop.

this must resolve your issue.. if dont please post the code -> ztable updating

Read only

Former Member
0 Likes
713

Hi Sriram,

Collect all the data into an internal table and then modify in database.

For example:

Append ls_workarea TO it_table.

SORT it_table BY field.

IF NOT it_table[] IS INTIAL.

MODIFY Z_DB_TABLE from TABLE it_TABLE.

ENDIF.

This will work.

Regards,

Prashant