Application Development 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: 

Error when Updating Ztable.....

Former Member
0 Kudos

Hi,

i am trying to update one ztable by uploading data from flat file. the data was uploading correctly into the internal table.

But it was not inserting into the ztable and when the MANDT field was empty in the WA_RDATA i wrote the following logic to update the client number but it was showing error(STATEMENT "WA_RDATA-MANDT" is not defined. Check your spelling....).

WA_RDATA and IT_RDATA was similar to ZTFI_KHALIX table.

Can any one let me know why this error was coming and also why the Ztable was not inserting.

LOOP AT it_rdata INTO wa_rdata.

IF wa_rdata-mandt EQ space.

wa_rdata-mandt eq sy-mandt.

ENDIF.

break rtarpatl.

IF sy-subrc EQ 0.

INSERT into ztfi_khalix values wa_rdata.

ENDIF.

ENDLOOP.

Thanks & Regards,

Ramana

7 REPLIES 7

Former Member
0 Kudos

Hi,

Check your declaration for WA_RDATA, how the MANDT field was declared. It should be MANDT TYPE SY-MANDT.

Rgds,

Bujji

vinod_vemuru2
Active Contributor
0 Kudos

Hi Ramana,

How u declared ur work area WA_RDATA. Client field is not required actually. It will automatically fills from log on client. It is required only if u want to insert data for the client which is different from log on client.

Do like this.

*Change ur declaration like below.

DATA: WA_RDATA TYPE ztfi_khalix ,

it_rdata TYPE STANDARD TABLE OF ztfi_khalix .

It will work.

Thanks,

Vinod.

Former Member
0 Kudos

Hi,

You need to define the internal table with the same structure of the Z* table.

When you are uploading the data from the text file, specify the mandt value in that.

LOOP AT it_rdata INTO wa_rdata.

INSERT into ztfi_khalix values wa_rdata.

if sy-subrc = 0.

commit work.

else.

rollback work.

endif.

endloop.

Hope it helps.

Thanks

Yogesh

Former Member
0 Kudos

Make these changes in your code

IF wa_rdata-mandt EQ space.

wa_rdata-mandt = sy-mandt.

ENDIF.

You have put

wa_rdata-mandt eq sy-mandt.

awrd points if useful

Bhupal

Former Member
0 Kudos

loop at itab into wa.

wa_zefl_ib_data_two-mandt = sy-mandt

wa_zefl_ib_data_two-w_wa_type = wa-type.

wa_zefl_ib_data_two-w_part_fct = 'SOLD_TO_PARTY'.

wa_zefl_ib_data_two-w_sp_no = wa-part_no.

wa_zefl_ib_data_two-w_sp_fct = 'SHIP_TO_PARTY'.

wa_zefl_ib_data_two-w_bp_no = wa-partner.

wa_zefl_ib_data_two-w_bp_fct = 'SERVICE_BP'.

wa_zefl_ib_data_two-w_serv_org = wa-augrp1.

MODIFY zefl_ib_data_two FROM wa_zefl_ib_data_two.

try this...i think this will help u

if it usefull.plz reward

Regards

Anbu

Former Member
0 Kudos

Hi Ramana,

I have modified ur code .Plz check.

LOOP AT it_rdata INTO wa_rdata.

IF wa_rdata-mandt EQ space.

wa_rdata-mandt = sy-mandt.

modify it_rdata from wa_rdata.

ENDIF.

break rtarpatl.

IF sy-subrc EQ 0.

INSERT into ztfi_khalix values wa_rdata.

ENDIF.

ENDLOOP.

Former Member
0 Kudos

Use the Option client specified in the Insert statement