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

Field value is getting double while updating the database table

Former Member
0 Likes
1,203

Hi Experts,

A simple doubt :

there is a standard program through which a zfunction module is getting triggered, through this zfunction module i am updating the database table.

Now what happening is one of the field(KCQTY) value in database is getting double at a time when i am executing the Program with same variant only.

I have also done the CLEAR & REFRESH internal tables starting of the Function module.

Can you please help me out.

Max points wil be awarded.

thanks

rico.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,162

HI,

how is the code for the update-function.

Do you work with modify or update? With index? With workarea?

Regards

Nicole

Hi Experts,

A simple doubt :

there is a standard program through which a zfunction module is getting triggered, through this zfunction module i am updating the database table.

Now what happening is one of the field(KCQTY) value in database is getting double at a time when i am executing the Program with same variant only.

I have also done the CLEAR & REFRESH internal tables starting of the Function module.

Can you please help me out.

Max points wil be awarded.

thanks

rico.

10 REPLIES 10
Read only

Former Member
0 Likes
1,163

HI,

how is the code for the update-function.

Do you work with modify or update? With index? With workarea?

Regards

Nicole

Read only

0 Likes
1,162

Hi Nicole,

this is the part of the coding where you can see how the field KCQTY is getting moved in the loop statement.

*****************************************************************************

DELETE IT_CE20002B_815 WHERE

KONDA = SPACE OR

WERKS = SPACE OR

VVB01001 < 0.

LOOP AT IT_CE20002B_815.

INDX = SY-TABIX.

CONCATENATE IT_CE20002B_815-PERBL0(4) IT_CE20002B_815-PERBL5(2)

INTO MONAT.

  • MOVE itab_ce20001b-perbl TO monat.

CLEAR S815.

READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA

BINARY SEARCH.

SELECT SINGLE * FROM S815 WHERE VRSIO = '000'

AND SPMON = MONAT

AND KONOB = 'APO'

AND MVGR2 = IT_CE20002B_815-KONDA

AND PRODH = IT_CE20002B_815-PRDHA

AND WERKS = IT_CE20002B_815-WERKS.

  • AND VTWEG EQ CO_VTWEG_99.

  • BREAK SAMEE.

IF SY-SUBRC EQ 0.

  • Eintrag in S810 existiert

IF S815-AEMENGE <= IT_CE20002B_815-VVB01001.

  • wenn die Auftragseingangsmenge kleiner gleich der Kontingentsmenge

  • wird die Kontingentmenge in das Steploop übernommen

MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.

*Liste ausgeben

  • PERFORM AUSGABE4.

PERFORM AUSGABE4_815.

ELSE.

  • Ausgabe Fehlermeldung, wenn die Auftragsmenge größer als die

  • Kontingentmenge ist.

*Liste mit fehlermeldungen ausgeben, Kontingent trotzdem übernehmen

MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.

  • PERFORM AUSGABE_FEHLER4.

PERFORM AUSGABE_FEHLER4_815.

  • delete it_ce20002b index indx.

  • continue.

ENDIF.

ELSE.

  • Es existiert kein Eintrag in S810, dann direkt eingeben

MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.

MODIFY IT_CE20002B_815 INDEX INDX.

*Liste ausgeben (Kein Eintrag in S810)

  • PERFORM EINTRAG2.

PERFORM EINTRAG2_815.

ENDIF.

*Übergabestructur für die Weiterverarbeitung durch das Copymanagement

*im Functionsbaustein wird gefüllt.

W_T_DATA_815-SPMON = MONAT. "itab_ce20001a-perbl.

W_T_DATA_815-KONOB = CO_KONOB_APO.

READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA

BINARY SEARCH.

IF SY-SUBRC EQ 0.

W_T_DATA_815-MVGR2 = CO_MVGR2_999.

ELSE.

W_T_DATA_815-MVGR2 = IT_CE20002B_815-KONDA.

ENDIF.

W_T_DATA_815-WERKS = IT_CE20002B_815-WERKS.

W_T_DATA_815-PRODH = IT_CE20002B_815-PRDHA.

  • W_T_DATA_815-VTWEG = '99'.

  • W_T_DATA_815-KUNNR = '9999999999'.

W_T_DATA_815-KCQTY = IT_CE20002B_815-VVB01001.

W_T_DATA_815-BASME = IT_CE20002B_815-VVB01_ME.

  • JR181005 - begin of ins.

  • w_t_data_810-matkl = it_ce20002b-matkl.

  • JR181005 - end of ins.

APPEND W_T_DATA_815 TO TAB_DATA.

CLEAR IT_CE20002B_815.

ENDLOOP.

thanks for reply

rico

Read only

0 Likes
1,162

Hi,

the only idea I have is, that your field IT_CE20002B_815-VVB01001 has to much datas for W_T_DATA_815-KCQTY.

The rest looks right.

Best way to find the error is, to set a breakpoint for the modify to see which datas are inside the field and if the index INDX is set right.

Regards

Nicole

Read only

0 Likes
1,162

Hi Nicole,

once again thanks

what i saw through debugging is you can see in the

loop IT_CE20002E_815 there is a COLLECT statement here the value is getting double.

do u have any idea about this.

thanks.

rico

Read only

0 Likes
1,162

Hi,

unfortanly I have no possiblity to test this coding in our systems, but try it with

clear it_ce2002b_815.

after the modify.

Is there any modify inside the performs?

regards

Nicole

Read only

0 Likes
1,162

Hi Nicole,

yes there u can see after movin the quantity field

MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.

MODIFY IT_CE20002B_815 INDEX INDX.

thanks

rico

Read only

0 Likes
1,162

inside the performs???

that modify is the right one inside the coding i can see here.

Read only

0 Likes
1,162

No its not there, no modify inside the performs

Read only

0 Likes
1,162

Hm, that´s not easy.

The last tipp, only work with modify and not with modify index.

You don`t need the index if you have an internal table with header and you are inside a loop.

Hope this is the solution.

Points if helpfull

Nicole

Read only

Former Member
0 Likes
1,162

HI,

Put a breakpoint before the function module and check the value. I guess this value is doubled during the program execution and not during the DB update.

Shruthi