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

how to make condition value inactive

Former Member
0 Likes
1,183

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,100

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

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

5 REPLIES 5
Read only

former_member196490
Active Participant
0 Likes
1,100

It is not possible to set system variables (sy-subrc). I didn't understand the requirement completely. Could you please elaborate.

Read only

0 Likes
1,100

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.


Read only

0 Likes
1,100

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.

Read only

Former Member
0 Likes
1,101

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

Read only

Former Member
0 Likes
1,100

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.