Application Development 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: 

Is this code valid for Substitution...?URGENT

Former Member
0 Kudos

FORM u041 USING b_result.

data: i_FKBER(16) TYPE C.

SELECT fkber FROM ZTFICO_CC_FA_MP into i_fkber

where kostl = bseg-kostl.

if sy-subrc = 0.

b_result = b_true.

MOVE i_fkber TO BSEG-FKBER.

endif.

if sy-subrc <> 0.

b_result = b_false.

MESSAGE E041(ygrfxx) WITH Bseg-hkont bseg-kostl.

endif.

ENDSELECT.

ENDFORM.

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Hi,

Check this


FORM u041 USING b_result.
SELECT single fkber 
       FROM ZTFICO_CC_FA_MP 
       into BSEG-FKBER
       where kostl = bseg-kostl.
if sy-subrc = 0.
 b_result = b_true.
else.
 b_result = b_false.
 MESSAGE E041(ygrfxx) WITH Bseg-hkont bseg-kostl.
endif.
ENDFORM. 

aRs

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

Hi,

Check this


FORM u041 USING b_result.
SELECT single fkber 
       FROM ZTFICO_CC_FA_MP 
       into BSEG-FKBER
       where kostl = bseg-kostl.
if sy-subrc = 0.
 b_result = b_true.
else.
 b_result = b_false.
 MESSAGE E041(ygrfxx) WITH Bseg-hkont bseg-kostl.
endif.
ENDFORM. 

aRs

0 Kudos

Thanks for the reply...

Let me try this buddy....will let u know and also update the points...

Thanks

Cheers: Sam

0 Kudos

Sam - Setting b_result wont work for FI substitution. It will work only for validation(OB28)

Try this code, it might work

FORM u041 USING b_result.

<b>loop at bool_data-bseg into bseg.</b>

SELECT single fkber

FROM ZTFICO_CC_FA_MP

into BSEG-FKBER

where kostl = bseg-kostl.

if sy-subrc = 0.

<b> MODIFY BOOL_DATA-BSEG FROM BSEG.</b>

else.

<b> MESSAGE E041(ygrfxx) WITH Bseg-hkont bseg-kostl.</b>

endif.

endloop.

ENDFORM.

0 Kudos

Hey Sam,

I have to do a line item substitution...i was coding the way u told me tooo but it was giving me a run time error...then i changed the exit title to field i.e. C_exit_param_field and code in this way...

when we see it in transaction FB50 it does the substitution but for an invalid value it doesnt throw the error message...

But let me try the way u said and see if it makes any change....

Thanks for all ur help and effort buddy...

Cheers: Sam

Let me know if u have any other inputs for me...