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: 

SAP Script : Condition on 3nd field.

Former Member
0 Kudos

Dear All,

I would like to display 3 text fields in a row but would like to put a condition for the 3rd field.

How Can I do that ??

Eg: &Sy-datum&,,&Sy-uzeit&,,&Matnr&

I would like to display &matnr& on condition.

So where should I write

IF ... CONDITION

&matnr&.

END IF

Please let me know, where Should I write the Code.

Thanking you.

Regards

Venkat.

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Hi,

in your script editior , under text element.

/:

IF a = '10'.
* &SY_DATUM&,,&SY_UZEIT&,,&MATNR&
/:ELSE
* &SY_DATUM&,,&SY_UZEIT&
/:ENDIF

Regards

vijay

9 REPLIES 9

LucianoBentiveg
Active Contributor
0 Kudos

IF condition

&Sy-datum&,,&Sy-uzeit&,,&Matnr&

ELSE

&Sy-datum&,,&Sy-uzeit&

ENDIF

Former Member
0 Kudos

Venkat,

i think ur talking about the case in smartforms

ok if this is the case go to the respective window go with edit mode

and place all these text fileds in between & & side by side

that means if fist one declaration is completed then beside to that first text field then define the second text field

and for the third text field define the logic in the print program with what ever the condition u like

i think it should work otherwise let me know

Regards

Naveen

former_member188685
Active Contributor
0 Kudos

Hi,

in your script editior , under text element.

/:

IF a = '10'.
* &SY_DATUM&,,&SY_UZEIT&,,&MATNR&
/:ELSE
* &SY_DATUM&,,&SY_UZEIT&
/:ENDIF

Regards

vijay

0 Kudos

Hi Guys,

Thanks for your inputs,

I dont mean that, I am sorry, My question was not clear enough.

I want to display all 3 three fields but there will be a condition on third field. The value changes according to the condition.

Actually the field is about terms. So all three fields remains but first two values are directly comming from printprogram withouot any condition, thrid field needs condition.

So If I keep Condition before this 2 fields, there values may effect, so I would like to keep IF condition after 2 field but all 3 fields should come in one single row.

I hope, question is clear now, Sorry for inconvience caused.

Thanks & regards

Venkat

0 Kudos

Hi Venkat,

how you want the third one (matnr) to be populated.from where you want to print that, do you want to go for perform , then fetch the data, and then show the same in the same line along with date and time.

Regards

vijay

0 Kudos

HI Vijay,

Thanks for your reply.

Actually that is not Matnr, just for example, I have given that.

I am working on Charge Back / Credit Memo / Debit Memo SAP script. I am using Std Script name F140_docu_exc_01 and print program for all three will be RFKORD50.

Now my problem is that I have 3 fields naming

Company Code, Customer Number, Terms.

I am getting data from BSEG table.

So I kept text-fields as

&BSEG-BUKRS&,,KNA1-KUNNR,, ?????

Now I have a condtion for terms

like &BSEG-SHKZG& EQ S AND &BSEG-BSCHL& = 01

Then I have to populate &BSEG-ZTERM&.

Else

'Net Due .....'

So, My question is that.. How Can I keeep that condition and populate third field.

Please advice me.

Vijay, I am not good at ABAP. So I am stucked up.

Please help me.

Thanks & Regards

Venkat

0 Kudos

Venkat

just check once

if so on so condition then = 01

&BSEG-BUKRS&&KNA1-KUNNR &BSEG-ZTERM&.

else

&BSEG-BUKRS&,,KNA1-KUNNR,, netval

check like this coding

it may work i think

Regards

Naveen

0 Kudos

Ok,

/: IF &BSEG-SHKZG& EQ 'S' AND &BSEG-BSCHL& = '01'.

= &BSEG-BUKRS&,,KNA1-KUNNR,,&BSEG-ZTERM&

/: ELSE.

= &BSEG-BUKRS&,,KNA1-KUNNR,, Net Due..

/: ENDIF.

but make sure you have populated BSEG-ZTERM.

Regards

vijay

0 Kudos

Hi Naveen / Vijay,

Thanks for your efforts..

I believe it will work out seeing your expertise.

Actually I was thinking to keep condition only on third condition, thinking that, condition may effrct others 2 fields. But Now I undertsood.

Thank you once again. I will allot points for both of u.

Will close the thread once, the issue is solved.

regards

Venkat