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

Problem in If condition

Former Member
0 Likes
796

HI,

Below is my code :

LOOP AT gt_fxentries.

  • SELECT single waers INTO TABLE gt_t001 FROM t001 CLIENT SPECIFIED WHERE mandt =

  • sy-mandt AND bukrs = gt_fxentries-zz_bukrs.

SELECT SINGLE waers INTO gt_t001 FROM t001

CLIENT SPECIFIED WHERE mandt = sy-mandt AND bukrs = gt_fxentries-bukrs.

MOVE : gt_t001-zzlcl_curr TO gt_final_ic_fx-zzlcl_curr.

*Get the Decimals and Currency key from TCURX table into gt_tcurx.

SELECT * INTO CORRESPONDING FIELDS OF gt_tcurx

FROM tcurx WHERE currkey = gt_fxentries-waers.

ENDSELECT.

*Check whether doc. currency and local currency equal to USD.

  • If not equal to USD move the values to GT_FINAL_IC_FX.

IF gt_fxentries-waers NE 'USD' AND gt_t001-zzlcl_curr NE 'USD'.

MOVE : gt_fxentries-hkont TO gt_final_ic_fx-hkont,

gt_fxentries-bukrs TO gt_final_ic_fx-zz_bukrs,

gt_fxentries-monat TO gt_final_ic_fx-monat,

gt_fxentries-blart TO gt_final_ic_fx-zzdoc_type.

IF gt_fxentries-shkzg EQ 'H'.

IF gt_tcurx-currkey = gt_fxentries-waers.

IF gt_tcurx-currdec = 3.

gt_fxentries-wrbtr = gt_fxentries-wrbtr / 10.

ELSEIF gt_tcurx-currdec = 0.

gt_fxentries-wrbtr = gt_fxentries-wrbtr * 100.

ENDIF.

ENDIF.

gt_fxentries-wrbtr = gt_fxentries-wrbtr * -1.

MOVE gt_fxentries-wrbtr TO gt_final_ic_fx-zzamt_dc.

ELSE.

IF gt_tcurx-currkey = gt_fxentries-waers.

IF gt_tcurx-currdec = 3.

gt_fxentries-wrbtr = gt_fxentries-wrbtr / 10.

ELSEIF gt_tcurx-currdec = 0.

gt_fxentries-wrbtr = gt_fxentries-wrbtr * 100.

ENDIF.

ENDIF.

MOVE gt_fxentries-wrbtr TO gt_final_ic_fx-zzamt_dc.

ENDIF.

MOVE : gt_fxentries-waers TO gt_final_ic_fx-zzdoc_curr.

IF gt_fxentries-shkzg EQ 'H'.

IF gt_tcurx-currkey = gt_fxentries-waers.

IF gt_tcurx-currdec = 3.

gt_fxentries-dmbtr = gt_fxentries-dmbtr / 10.

ELSEIF gt_tcurx-currdec = 0.

gt_fxentries-dmbtr = gt_fxentries-dmbtr * 100.

ENDIF.

ENDIF.

gt_fxentries-dmbtr = gt_fxentries-dmbtr * -1.

MOVE gt_fxentries-dmbtr TO gt_final_ic_fx-zz_dmbtr.

ELSE.

IF gt_tcurx-currkey = gt_fxentries-waers.

IF gt_tcurx-currdec = 3.

gt_fxentries-dmbtr = gt_fxentries-dmbtr / 10.

ELSEIF gt_tcurx-currdec = 0.

gt_fxentries-dmbtr = gt_fxentries-dmbtr * 100.

ENDIF.

ENDIF.

MOVE gt_fxentries-dmbtr TO gt_final_ic_fx-zz_dmbtr.

ENDIF.

MOVE : gt_fxentries-dmbtr TO gt_final_ic_fx-dmbtr.

IF gt_fxentries-shkzg EQ 'H'.

  • IF gt_tcurx-currkey = gt_fxentries-waers.

  • IF gt_tcurx-currdec = 3.

  • gt_fxentries-dmbe2 = gt_fxentries-dmbe2 / 10.

  • ELSEIF gt_tcurx-currdec = 0.

  • gt_fxentries-dmbe2 = gt_fxentries-dmbe2 * 100.

  • ENDIF.

  • ENDIF.

gt_fxentries-dmbe2 = gt_fxentries-dmbe2 * -1.

MOVE gt_fxentries-dmbe2 TO gt_final_ic_fx-zzamt_gcc.

ELSE.

  • IF gt_tcurx-currkey = gt_fxentries-waers.

  • IF gt_tcurx-currdec = 3.

  • gt_fxentries-dmbe2 = gt_fxentries-dmbe2 / 10.

  • ELSEIF gt_tcurx-currdec = 0.

  • gt_fxentries-dmbe2 = gt_fxentries-dmbe2 * 100.

  • ENDIF.

  • ENDIF.

MOVE gt_fxentries-dmbe2 TO gt_final_ic_fx-zzamt_gcc.

ENDIF.

MOVE: gt_fxentries-prctr TO gt_final_ic_fx-prctr,

gt_fxentries-belnr TO gt_final_ic_fx-zz_belnr,

gt_fxentries-gjahr TO gt_final_ic_fx-gjahr,

gt_fxentries-budat TO gt_final_ic_fx-budat,

gt_fxentries-vbund TO gt_final_ic_fx-vbund,

gt_fxentries-pprct TO gt_final_ic_fx-zz_pprct,

gt_fxentries-kostl TO gt_final_ic_fx-kostl,

gt_fxentries-projk TO gt_final_ic_fx-projk,

gt_fxentries-sgtxt TO gt_final_ic_fx-zz_sgtxt,

gt_fxentries-mandt TO gt_final_ic_fx-mandt.

APPEND gt_final_ic_fx.

CLEAR gt_final_ic_fx.

ENDIF.

ENDLOOP.

I used the select statement to get the data from Bsis table.

Then I am looping the gt-fxentries table, in that first I will get the currency key waers from t001 table for that company code.

BSIS-WAERS = Doc. Currency

If BSIS-waers equal NE USD and gt_localcurr-waers NE USD.

Then only I need to move further and move to gt_final_ic_fx.

But, when I select one company code 1234 its local currency is GBP (UK dollar) and document currency is USD.

Even though it is comming out of the loop.

Please help me out.

Thanks,

Pavan.

7 REPLIES 7
Read only

Former Member
0 Likes
758

Hi,

Change your IF condition from AND to OR.

IF gt_fxentries-waers NE 'USD' <b>OR</b> gt_t001-zzlcl_curr NE 'USD'.

Regards,

Raghav

Read only

0 Likes
758

If two conditions satisfies then only I need to move further.

As per your suggestions it will fails I think.

Thanks,

Pavan.

Read only

0 Likes
758

In that case what your program is executing is right as your checking for both docuemnt currency and local currency.

Just check the program processing in that particular point of time by putting a break point.

Read only

0 Likes
758

I checked that by debugging.

It is skiping out.

Let me know what to do.

Thanks,

Pavan.

Read only

0 Likes
758

is it is skipping unconditionally or by satisfying your condition. If it is skipping by satisfying your condition you need to re-think about your validation, make a tria with OR also and check in debuggin what it will does. Whichever will fit your requirement as AND or OR .Choose that

Read only

Former Member
0 Likes
758

I checked that by debugging.

It is skiping out.

Read only

Former Member
0 Likes
758

I think now i understood your prblem. Please check with this coding.

IF ( gt_fxentries-waers NE gt_t001-zzlcl_curr ) and 
  ( gt_t001-zzlcl_curr  NE 'USD') .

Regards,

Raghav