‎2008 Mar 26 10:59 AM
hi guyz,
At the moment only one user can apply condition type if two users apply at the same time its taking the only one and declining the other...so now i want to make it sure it should work for both the users..
Program (at present) :
DATA: lv_discount(5) TYPE c,
lv_from(10) TYPE c,
lv_to(10) TYPE c,
lv_prkz LIKE mara-iprkz,
lv_save TYPE c.
CONSTANTS: c_system_msgtyp LIKE bdcmsgcoll-msgtyp VALUE 'S',
c_discountsave_msgid LIKE bdcmsgcoll-msgid VALUE 'VK',
c_discountsave_msgnr LIKE bdcmsgcoll-msgnr VALUE '023'.
CHECK gs_ci_include_x-zzdiscountam = 'X' OR
gs_ci_include_x-zzdiscountva = 'X'.
On creation all X fields are marked so check we have values
CHECK NOT gs_ci_include-zzdiscountva IS INITIAL.
IF gs_ci_include-zzdiscountam < 0.
lv_discount = gs_ci_include-zzdiscountam * -1.
ELSE.
CONCATENATE '-' gs_ci_include-zzdiscountam INTO lv_discount.
ENDIF.
CONDENSE lv_discount NO-GAPS.
WRITE sy-datum TO lv_from.
WRITE gs_ci_include-zzdiscountva TO lv_to.
* Update discount.
* Assumes only one discount per customer
CLEAR bdcdata. REFRESH bdcdata.
CLEAR messtab. REFRESH messtab.
PERFORM bdc_load USING 'SAPMV13A' '0100' 'X' ' ' ' '.
PERFORM bdc_load USING ' ' ' ' ' ' 'RV13A-KSCHL' 'K007'.
PERFORM bdc_load USING ' ' ' ' ' ' 'BDC_OKCODE' '/00'.
PERFORM bdc_load USING 'RV13A307' '1000' 'X' ' ' ' '.
PERFORM bdc_load USING ' ' ' ' ' ' 'F001'
gs_salesarea-salesarea-sales_org.
PERFORM bdc_load USING ' ' ' ' ' ' 'F002'
gs_salesarea-salesarea-channel.
PERFORM bdc_load USING ' ' ' ' ' ' 'F003-LOW' p_iv_customer.
PERFORM bdc_load USING ' ' ' ' ' ' 'BDC_OKCODE' '=HIZ1'.
PERFORM bdc_load USING 'SAPMV13A' '1307' 'X' ' ' ' '.
PERFORM bdc_load USING ' ' ' ' ' ' 'KOMG-KUNNR(01)' p_iv_customer.
PERFORM bdc_load USING ' ' ' ' ' ' 'KONP-KBETR(01)' lv_discount.
PERFORM bdc_load USING ' ' ' ' ' ' 'RV13A-DATAB(01)' lv_from.
PERFORM bdc_load USING ' ' ' ' ' ' 'RV13A-DATBI(01)' lv_to.
PERFORM bdc_load USING ' ' ' ' ' ' 'BDC_OKCODE' '=SICH'.
CALL TRANSACTION 'VK12' USING bdcdata
MODE gv_bdcmode
UPDATE 'S'
MESSAGES INTO messtab.
LOOP AT messtab.
IF messtab-msgtyp = c_system_msgtyp
AND messtab-msgid = c_discountsave_msgid
AND messtab-msgnr = c_discountsave_msgnr.
lv_save = 'X'.
ENDIF.
ENDLOOP.
IF lv_save IS INITIAL.
gv_exit = 'X'.
gt_errors-line = 'Failed to insert/update discount'.
LOOP AT messtab.
PERFORM message_capture USING messtab-msgid
messtab-msgnr
messtab-msgv1
messtab-msgv2
messtab-msgv3
messtab-msgv4
CHANGING gt_errors-line.
APPEND gt_errors.
ENDLOOP.
EXIT.
ENDIF.
Plz Advise,
Regards
‎2008 Mar 26 11:38 AM
‎2008 Mar 26 11:47 AM
Hi,
What Happens if your project manger and you are working on the same code at the same time he saves some thing and you too try to save some thing, some one has to loose his work...two people cannot update same condition type in VK12 as the TCODE locks the entries...so its not possible to update the database when it is already locked by others...
santhosh
Edited by: Kaluvala Santhosh on Mar 26, 2008 5:17 PM
‎2008 Mar 26 11:54 AM
Hi santosh ,
thanks for your reply...but to prevent this it is proposed that all discounts are 'collected' in a temp table to be processes by a seperate update job to be schedule to run on regular basis, this will allows us to contract creation and ensure all discounts condition records are being created and applied correctly.
How can we apply this on the present program...plz advise
regards..