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

updation

Former Member
0 Likes
871

hi,

i have come up with a peculiar scenario. i writtena program to update the data to a customized table. and it has been working in development environment.

now i transported to QA and testing. here, table is not updating. i checked transported content too for proper transportation.

please do suggest me any to overcomethis issue.

regards

srini

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
821

Srini,

Could u pls send the piece of code, so that can have a glance and try to solve the prob.

Sujatha.

6 REPLIES 6
Read only

Former Member
0 Likes
821

did you hard code mandt field ?

or use sy-mandt?

just check that it may create problem.

regards

shiba dutta

Read only

Former Member
0 Likes
822

Srini,

Could u pls send the piece of code, so that can have a glance and try to solve the prob.

Sujatha.

Read only

0 Likes
821

Form update_data.

data: begin of udata occurs 0,

MANDT LIKE ZFIR008-MANDT,

WVBELN LIKE ZFIR008-WVBELN,

WPOSNR LIKE ZFIR008-WPOSNR,

WVGBEL LIKE ZFIR008-WVGBEL,

WVGPOS LIKE ZFIR008-WVGPOS,

WFKDAT LIKE ZFIR008-WFKDAT,

WCHARG LIKE ZFIR008-WCHARG,

WFKIMG LIKE ZFIR008-WFKIMG,

WNETWR LIKE ZFIR008-WNETWR,

WKZWI1 LIKE ZFIR008-WKZWI1,

WKUNNR LIKE ZFIR008-WKUNNR,

WAUBEL LIKE ZFIR008-WAUBEL,

WSITEM LIKE ZFIR008-WSITEM,

WARKTX LIKE ZFIR008-WARKTX,

WAUART LIKE ZFIR008-WAUART,

WAUFNR LIKE ZFIR008-WAUFNR,

WPITEM LIKE ZFIR008-WPITEM,

pginum like vbfa-vbeln,

end of udata.

data: begin of u_vbfa occurs 0,

VBELV like VBFA-VBELV,

POSNV like VBFA-POSNV,

VBELN like VBFA-VBELN,

POSNN like VBFA-POSNN,

VBTYP_N like VBFA-VBTYP_N,

VBTYP_V like VBFA-VBTYP_V,

end of u_vbfa.

data: begin of u_resb occurs 0,

aufnr like resb-aufnr,

charg like resb-charg,

end of u_resb.

data: begin of u_mseg occurs 0,

aufnr like mseg-aufnr,

charg like mseg-charg,

end of u_mseg.

data: begin of u_afpo1 occurs 0,

aufnr like afpo-aufnr,

kdauf like afpo-kdauf,

end of u_afpo1.

data: begin of u_vbfa1 occurs 0,

vbelv like vbfa-vbelv,

vbeln like vbfa-vbeln,

end of u_vbfa1.

select * into corresponding fields of table udata

from zfir008.

if sy-subrc = 0 and udata[] is not initial.

select vbelv posnv vbeln posnn vbtyp_n vbtyp_v

into table u_vbfa

from vbfa

for all entries in udata

where vbelv = udata-waubel

and vbtyp_n = 'J'.

if sy-subrc = 0.

loop at udata.

loop at u_vbfa where vbelv = udata-waubel

and posnv = udata-wsitem

and vbtyp_n = 'J'.

select single * from lips

where vbeln = u_vbfa-vbeln

and posnr = u_vbfa-posnn

and charg = udata-wcharg.

if sy-subrc = 0.

select single * from vbfa

where vbelv = u_vbfa-vbeln

and posnv = u_vbfa-posnn

and vbtyp_n = 'R'.

if sy-subrc = 0.

  • update PGI No.

UDATA-PGINUM = VBFA-VBELN.

Modify udata.

endif.

endif.

endloop.

endloop.

endif.

endif.

loop at udata where not pginum is initial

and warktx cp 'L1'.

  • if udata-warktx cp 'L1'.

select aufnr charg into table u_resb

from resb

where aufnr = udata-waufnr

and werks = 'S1'

and lgort = 'SSA'

and bwart = '541'.

if sy-subrc = 0.

loop at u_resb where charg ne space.

select aufnr charg into table u_mseg

from mseg

where charg = u_resb-charg

and bwart ='101'

and werks = 'S1'.

if sy-subrc = 0.

read table u_mseg.

select aufnr kdauf into table u_afpo1

from afpo

where aufnr = u_mseg-aufnr.

if sy-subrc = 0.

read table u_afpo1.

select vbelv vbeln into table u_vbfa1

from vbfa

where vbelv = u_afpo1-kdauf

and vbtyp_n = 'L'.

if sy-subrc = 0.

read table u_vbfa1.

delete from zfir008 where wvgbel = u_vbfa1-vbeln .

endif.

endif.

endif.

endloop.

clear: u_resb,

u_mseg,

u_afpo1,

u_vbfa1.

endif.

  • endif.

endloop.

  • Remove the records from UDATA which are delivered.

Loop at udata where pginum is not initial.

delete from zfir008 where wvbeln = udata-wvbeln.

endloop.

DELETE IDATA WHERE NOT PGINUM IS INITIAL.

endform.

Read only

0 Likes
821

use this FM to lock the table before deleting data from the table,before ur final loop -

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

tabname = 'BNKA' "give ur table name here

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE e000(0001) WITH 'Unable to lock table BNKA' .

ENDIF.

Loop at udata where pginum is not initial.

delete from zfir008 where wvbeln = udata-wvbeln.

endloop.

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

tabname = 'BNKA'. "give ur table name

Read only

0 Likes
821

Hi,

thanks for all your suggestions. now i rectified the error.

since the table had no key field , this problem came . now i maintained the key field and working fine.

regards

Read only

Former Member
0 Likes
821

Hello Srini,

As per ur code what is the value of Sy-subrc after executing line

select * into corresponding fields of table udata

from zfir008.

My guess is it is failing here and thereby not updating. As the table mentioned in the select stmt is custom table check if there are any entries.