2012 May 10 6:24 AM
Hi Gurus,
I have scenario like this,
If condition value (KWERT) is equal or less than '0', then sy-subrc is set to '4' in order to make the condition type inactive during sales order creation or change.
For this I have written logic like this,
loop at XKOMV .
IF KOMK-VKORG = 'UK20' AND XKOMV-KWERT LE 0. "for sale org 'Uk20'
XKOMV-KINAK = 'X'.
SY-SUBRC = 4.
MODIFY XKOMV .
ENDIF.
ENDLOOP .
but it is not going to be inactive during sales order creating or change.
Can anybody help me in this regards,
Thanks,
Syed
2012 May 10 6:43 AM
Hi Fayyaz,
If your requirement is correct and you want to set the SY-SUBRC = 4, then try as follows;
LOOP at XKOMV .
IF KOMK-VKORG = 'UK20' AND XKOMV-KWERT LE 0. "for sale org 'Uk20'
XKOMV-KINAK = 'X'.
MODIFY XKOMV .
SY-SUBRC = 4.
ENDIF.
ENDLOOP .
I think the modify statement is overwritting the sy-subrc value to 0. so using the modify statement before assigning SY-SUBRC might solve your problem.
Regards,
Karthik
2012 May 10 6:26 AM
It is not possible to set system variables (sy-subrc). I didn't understand the requirement completely. Could you please elaborate.
2012 May 10 6:33 AM
Hi Neha,
The functional has given the logic as below:
If Sales Org = ‘UK20’ , and if XKMOV-XKWERT LE ‘0’ then set sy-subrc = 4. Pls note XKOMV will have multiple entries.Whenever, a Sales Order is created this routine will be triggered through the pricing procedure attached to it and condition type will become inactive during sales order creation or change.
2012 May 10 6:43 AM
System variables cannot be set by assignment. You need to get in touch with the functional person to understand the requirement in more detail to ignore the condition type.
2012 May 10 6:43 AM
Hi Fayyaz,
If your requirement is correct and you want to set the SY-SUBRC = 4, then try as follows;
LOOP at XKOMV .
IF KOMK-VKORG = 'UK20' AND XKOMV-KWERT LE 0. "for sale org 'Uk20'
XKOMV-KINAK = 'X'.
MODIFY XKOMV .
SY-SUBRC = 4.
ENDIF.
ENDLOOP .
I think the modify statement is overwritting the sy-subrc value to 0. so using the modify statement before assigning SY-SUBRC might solve your problem.
Regards,
Karthik
2012 May 10 6:53 AM
Hey,
i used it . its working fine in my program.
ans sy-sbrc become 4.
use coding where you are fetching data in your final table.
loop at it_vbak into wa_vbak.
MOVE: wa_vbak-vbeln to wa_final-vbeln,
wa_vbak-KUNNR to wa_final-kunnr,
wa_vbak-WAERK to wa_final-waerk,
IF wa_final-vbeln ne 0.
sy-subrc = 4.
ENDIF.
endloop.