cancel
Showing results for 
Search instead for 
Did you mean: 

CONDITION IN SMARTFORM

Former Member
0 Kudos

Hi all

I want to define a condition in a smartform ; for example :

1. if field1 = 'xyz'

and

field2 <> 'abc'

then in the general attribute i want to hardcode the address1.

2. if field1 = 'xyz'

and

field = 'abc'

then in the general attribute i want to hardcode the address2.

I have defined field1 and field2 in global defination .

when i activate and print the same , instead of address2 shown up in print , it still gives me address1 .

Am i not defining the conditions correctly ?

please advice .

Early response is appreciated.

Thanks

Shweta

Accepted Solutions (1)

Accepted Solutions (1)

former_member195383
Active Contributor
0 Kudos

one clarification...

u are having 3 global fileds.. field, field1 and field2..right?

then the display of text nodes will depend on the conditions only..

if 1. if field1 = 'xyz'

and

field2 'abc'

1st address will be printed.....

if 2.if field1 = 'xyz'

and

field = 'abc'

2nd acddress will be printed...

if not...u have to debugg...do one thing...in the same window, create---->Prgram Lines.

now in the program line put a break point. Then execute the smartform. check at that point wats the value of field, field1, field2.

Then u can find out exactly wats happening...

Former Member
0 Kudos

Hi Rudra

actually i have 2 fields and i have defined two address nodes for both th condition .

in first node , i have defined the condition :

field1 ='xyz'

and

field2 not equal to 'abc'

then print address1.

in second node , i have defined the condition :

field1 ='xyz'

and

field2 = 'abc'

then print address2.

now , my requirement states that address2 should be printed as , the requirement is satisfied from the second node.

but still it prints the address1 instead of address2.

Thanks

shweta

former_member195383
Active Contributor
0 Kudos

Hi Swetha,

As i have advised in the previous post, just debugg the smartform, you will get the exact reason why the 2nd text node is not getting printed.

former_member181995
Active Contributor
0 Kudos

Sweta,

are you having both address in same variable?

if so than please do not clear before address2.

Amit.

Former Member
0 Kudos

yes , thats true .

its in one variable only .

how do i procced now .

thanks

shweta

former_member181995
Active Contributor
0 Kudos

Shweta,

now am lil sure the values are not getting update with address2 becasue it is having values only first address.

so shweta so you need to overwrite first address with new address once condition get failed for address1.

Amit.

Former Member
0 Kudos

Thanks Amit .

I have not mentioned any code for this in the smartform , i was just defining the conditions .

can you let me know wht do i code so as to get the second address when the first condition fails .

Thanks

shweta

former_member181995
Active Contributor
0 Kudos

Shweta,

ok.tell me from where your second address is comming?

also i would suggest you to use two variable to print both address if first condition fails than print variable2 otherwise variable1.

if more help you need pls post your whol code here.

Amit.

Former Member
0 Kudos

The conditions are as follows :

1.

W_VICNCN-ZZRE_PROVIDER = 'ANS'

STATE <> 'VI'

Then print : address1 ( hardcoded in general attribute tab )

2.

W_VICNCN-ZZRE_PROVIDER = 'ANS'

STATE = 'VI'

Then print : address1 ( hardcoded in general attribute tab ).

In the inisiatization the code defined is as follows.

INCLUDE ifrecpsf.

DATA: geoloc TYPE zgeoloc,

street TYPE ad_street,

city TYPE ad_city1,

zip TYPE ad_pstcd1.

  • general document data and options

CALL METHOD cl_recp_data_ca_general=>get_options

EXPORTING

id_guid = is_sfparam-content

IMPORTING

es_options = options

es_doc = doc

CHANGING

cf_error = lf_error.

mac_sf_exit_on_error.

    • general business-object data

CALL METHOD cl_recp_data_ca_general=>get_bus_object

EXPORTING

id_guid = is_sfparam-content

IMPORTING

es_bus_object = bus_object

CHANGING

cf_error = lf_error.

mac_sf_exit_on_error.

*

  • sender

CALL METHOD cl_recp_data_ca_general=>get_sender

EXPORTING

id_guid = is_sfparam-content

IMPORTING

es_sender = sender

CHANGING

cf_error = lf_error.

mac_sf_exit_on_error.

  • recipient

CALL METHOD cl_recp_data_ca_general=>get_recipient

EXPORTING

id_guid = is_sfparam-content

IMPORTING

es_recipient = recipient

CHANGING

cf_error = lf_error.

mac_sf_exit_on_error.

  • clerk and partner with other specific roles

CALL METHOD cl_recp_data_ca_general=>get_partner_spec

EXPORTING

id_guid = is_sfparam-content

IMPORTING

es_clerk = clerk

es_partner_spec1 = partner_spec1

es_partner_spec2 = partner_spec2

CHANGING

cf_error = lf_error.

mac_sf_exit_on_error.

***& GET CONTRACT DATA

CALL METHOD cl_recp_data_cn_general=>get_contract

EXPORTING

id_guid = is_sfparam-content

IMPORTING

es_contract = contract

CHANGING

cf_error = lf_error.

mac_sf_exit_on_error.

  • invoice

CALL METHOD cl_recp_data_ra_invoice=>get_invoice

EXPORTING

id_guid = is_sfparam-content

IMPORTING

es_ra_invoice = ra_invoice

et_ra_invoice_item = t_ra_invoice_item

et_ra_tax_subtotal = t_ra_tax_subtotal

et_ra_object = t_ra_object

CHANGING

cf_error = lf_error.

mac_sf_exit_on_error.

**& GET LEASE ADDRESS

CLEAR: lease_add1,

lease_add2,

geoloc,

street,

city,

state,

zip,

ra_object.

LOOP AT t_ra_object ASSIGNING <ra_object>.

SPLIT <ra_object>-for_objinfo AT '/' INTO geoloc

street

city

state

zip.

CLEAR: <ra_object>-for_objinfo.

CONCATENATE street city state zip INTO <ra_object>-for_objinfo

SEPARATED BY ','.

ENDLOOP.

MOVE street TO lease_add1.

***&

CLEAR lease_add1.

***&

CONCATENATE city state zip INTO lease_add2 SEPARATED BY ','.

***& GET DOCUMENT PROVIDER FIELD

SELECT SINGLE * FROM vicncn INTO w_vicncn

WHERE intreno EQ contract-intreno.

***& GET INVOICE DATE

LOOP AT t_ra_invoice_item INTO ra_invoice_item.

IF inv_date IS INITIAL.

inv_date = ra_invoice_item-docdate.

ENDIF.

IF NOT ra_invoice_item-refdocid IS INITIAL.

CLEAR: i_bseg[],

w_bseg,

w_zfbdt,

w_zbd1t,

w_mandt,

w_bukrs,

ra_invoice_item-refdocid,

w_gjahr,

w_buzei.

SPLIT ra_invoice_item-docitemid AT '/' INTO w_mandt

w_bukrs

ra_invoice_item-refdocid

w_gjahr

w_buzei.

***& GET DOCUMENT TYPE

CLEAR: w_blart.

SELECT SINGLE blart FROM bkpf INTO w_blart

WHERE bukrs EQ w_bukrs

AND belnr EQ ra_invoice_item-refdocid

AND gjahr EQ w_gjahr.

clear: w_buzei.

move ra_invoice_item-refitemno TO w_buzei.

SELECT SINGLE * FROM bseg INTO w_bseg

where BUKRS eq W_BUKRS

AND belnr EQ ra_invoice_item-refdocid

AND gjahr EQ w_gjahr

AND buzei EQ w_buzei.

MOVE-CORRESPONDING ra_invoice_item TO w_invoice_item.

w_invoice_item-itemsrcind = 'P'.

  • IF w_bseg-shkzg = 'H'.

  • w_invoice_item-grossamount = w_bseg-wrbtr * ( -1 ).

  • w_invoice_item-netamount = w_bseg-pswbt * ( -1 ).

  • ELSE.

  • w_invoice_item-grossamount = w_bseg-wrbtr.

  • w_invoice_item-netamount = w_bseg-pswbt.

  • ENDIF.

w_invoice_item-pymtmeth = space.

w_invoice_item-blinedate = w_bseg-zfbdt + w_bseg-zbd1t.

CLEAR: w_txt1,

w_txt2,

w_txt3.

SPLIT w_bseg-sgtxt+1(49) AT '-' INTO w_txt1

w_txt2

w_txt3.

CONCATENATE w_txt3

w_txt1

'-'

w_txt2 INTO w_invoice_item-xmacctsheetitem

SEPARATED BY space.

IF NOT w_bseg-mwskz IS INITIAL.

IF w_blart NE 'Z2'

OR w_blart NE 'DI'.

CONCATENATE 'Sales Tax'

w_invoice_item-xmacctsheetitem

INTO w_invoice_item-xmacctsheetitem

SEPARATED BY ' - '.

ENDIF.

ENDIF.

CONCATENATE w_txt16(4) w_txt1(2) w_txt13(2) INTO w_calfrm.

CONCATENATE w_txt26(4) w_txt2(2) w_txt23(2) INTO w_calto.

IF ( w_calfrm EQ ra_invoice_item-calcfrom ) AND

( w_calto EQ ra_invoice_item-calcto ).

APPEND w_invoice_item TO i_ra_invoice_item.

ELSE.

CONCATENATE ra_invoice_item-obj_key+10(4)

ra_invoice_item-obj_key(10)

ra_invoice_item-obj_key+14(4) INTO w_name.

w_object = 'BELEG'.

CLEAR: t_line[].

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = '0003'

language = sy-langu

name = w_name

object = w_object

TABLES

lines = t_line

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR: w_invoice_item-xmacctsheetitem,

w_line.

READ TABLE t_line INTO w_line INDEX 1.

w_invoice_item-xmacctsheetitem = w_line-tdline.

IF NOT w_bseg-mwskz IS INITIAL.

IF w_blart NE 'Z2' OR

w_blart NE 'DI'.

CONCATENATE 'Sales Tax'

w_invoice_item-xmacctsheetitem

INTO w_invoice_item-xmacctsheetitem

SEPARATED BY ' - '.

ENDIF.

ENDIF.

APPEND w_invoice_item TO i_ra_invoice_item.

ENDIF.

CLEAR: w_invoice_item,

w_txt1,

w_txt2,

w_txt3.

ELSE.

MOVE-CORRESPONDING ra_invoice_item TO w_invoice_item.

APPEND w_invoice_item TO i_ra_invoice_item.

CLEAR w_invoice_item.

ENDIF.

ENDLOOP.

CLEAR: t_ra_invoice_item[].

t_ra_invoice_item[] = i_ra_invoice_item[].

sort t_ra_invoice_item by refdocid BLINEDATE CALCFROM CALCTO.

CLEAR: i_ra_invoice_item[].

***& GET LEASE ANALYST PHONE NUMBER

CALL FUNCTION 'API_RE_CN_GET_DETAIL'

EXPORTING

id_bukrs = contract-bukrs

id_recnnr = contract-recnnr

IMPORTING

et_partner = t_et_partner

EXCEPTIONS

error = 1

OTHERS = 2.

IF NOT t_et_partner[] IS INITIAL.

LOOP AT t_et_partner INTO w_et_partner WHERE role = 'Z00016'.

w_partner = w_et_partner-partner.

EXIT.

ENDLOOP.

CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'

EXPORTING

businesspartner = w_partner

valid_date = sy-datlo

TABLES

bapiadtel = t_bapiadtel.

LOOP AT t_bapiadtel INTO w_bapiadtel.

CONCATENATE '('

w_bapiadtel-telephone+0(3)

')'

w_bapiadtel-telephone+3(3)

'-'

w_bapiadtel-telephone+6(4)

INTO w_contact_num.

EXIT.

ENDLOOP.

ENDIF.

PACK ra_invoice-invno TO w_inv_num.

CONDENSE w_inv_num.

former_member181995
Active Contributor
0 Kudos

Sweta,

am bit afraid to see your WHOLE code ;-).

only thing you can do in very simple manner just collect both address in different variable than put condition as you post in your first posting.

it should work.

unfortunatly am not front of SAP now

Amit.

Former Member
0 Kudos

any update on this one ?????

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Use alternative and provide the condition in the general attribute and if the condition is satisfied then true part address will be printed and if it is not so then the false part will be printed.

Regards,

Ram

Former Member
0 Kudos

Hi Swetha,

Create an alternate node and in that provide the field comparisions in the general attributes.

under true

display the address 1

under false

display the address 2

regards

padma

former_member195383
Active Contributor
0 Kudos

Hi Swetha

Create one text node. in your window. Then go to condition tab. put the condition as

field1 = 'xyz'

field2 = 'abc'

create another text node...in the same window

in the 2nd text node.. go to condition tab, and put the condition as

field1 = 'xyz'

field = 'abc'

as you are telling you want to hard code the address , so use text node...

Edited by: Rudra Prasanna Mohapatra on Jul 24, 2008 1:41 PM

Former Member
0 Kudos

I am doing exactly same as wht u suggested .

still unable to get the correct output .

former_member181995
Active Contributor
0 Kudos

Sweta,

why you not give this condition in condition tab.

Amit.

Former Member
0 Kudos

Thanks Amit for the quick response ,

but i am defining this in condition tab only.