Вы находитесь на странице: 1из 13

problem in smartforms | SCN http://scn.sap.

com/thread/3375711

Getting Started Newsletters Store

Welcome, Guest Login Register

Products Services & Support About SCN Downloads


Activity Communications Actions
Industries Training & Education Partnership Developer Center

Lines of Business University Alliances Events & Webinars Innovation Browse

36 Replies Latest reply: Jun 19, 2013 7:35 AM by Sanjeev Kumar

Share 0 Tweet

Sanjeev Kumar Jun 15, 2013 12:36 PM

problem in smartforms
This question has been Answered.

Hi all i have a smartform in which i need a requirement that if all the internal fields of the three fields(
Previous Bill, Current Bill, Cumulative Bill) remains blank,Then the first four fields( SL NO, Service
Number, Service Description, and Service Specification) also remains blank .

I have used the condition Like ,it_item-sl_no NE 0. in condition. but not getting the desired
output,please sujjest me how to get these four field also blank if
all the values related to it are blank.

Capture-SCN.PNG
68.1 K

Correct Answer
by Venkateswaran K on Jun 18, 2013 8:02 AM

Hi Sanjeev,

Please do the followint Steps.

1. in teh Smartform - where you might have defined the TABLE where you print this service table.

2. The table where HEADER, Main Area, FOOTER .....

add a Program lines between below HEADER and MAIN AREA.


In the Program lines define the variable flag as char with length 1.
In side the code, write your if condition that if all teh previous, curent , cummulative is initial
then set the flag = 'N' else flag = 'Y'.
Inside the Main area - you might have defined a Row...
Select that row, right click -- go to condition tab
set condition as Flag = 'Y'
3. Save
4. Activae the Form
5. Execute

You will get the desired result

Regards,
Venkat

Helpful Answers by Ravi Shankar, Mehwish Haq, Sanjeev Kumar, neha gupta, Sanjeev
Kumar, Ravi Shankar, Sanjeev Kumar, Venkateswaran K

1290 Views
Average User Rating

1 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

(0 ratings)

Ramesh T Jun 15, 2013 12:49 PM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hi sangeev,

Make Output field type C.

or

Try like this

Like (0)

Sanjeev Kumar Jun 15, 2013 1:07 PM (in response to Ramesh T)

Re: problem in smartforms

Hi Ramesh i have used this too, but not getting desired result.
By doing like that, all the fields related to any vlank values gets disappeared.

Capture1-scn.PNG
48.0 K

Like (0)

Ramesh T Jun 15, 2013 1:08 PM (in response to Sanjeev Kumar)

Re: problem in smartforms

change your output field type C.

data : outputfield(10) type c.

Like (0)

Sanjeev Kumar Jun 15, 2013 1:30 PM (in response to Ramesh T)

Re: problem in smartforms

Hi ramesh, where should i declare this.....in Global Definition or at different place, please
clear it.

Like (0)

Ramesh T Jun 15, 2013 1:38 PM (in response to Sanjeev Kumar)

Re: problem in smartforms

Yes in Global Definition only.

like this

2 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Like (0)

Sanjeev Kumar Jun 15, 2013 4:44 PM (in response to Ramesh T)

Re: problem in smartforms

Hi Ramesh, after defining in global definition nothing changes, still i am getting problem
as i have stated in previous screenshot, one more thing, as you have shown
wa_item-pre_menge NE 0.
I have written it for all variables, like it_item-pre_amnt NE 0, it_item-curr_menge NE 0 etc

But i am not getting what i need

Like (0)

Arindam Mondal Jun 15, 2013 2:49 PM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hi,

Are you looping on a table to get all the values or passing that table into smartform from calling program,
Why dont you filter the items before you display like copy items from the itab passed to a Global Itab
defined in Smartform and exclude those lines and then loop and display.

Say the ITAB you pass is ITAB_DATA. Create a new one in smartform say ITAB_DATA_TEMP copy the
item from ITAB_DATA and DELETE the blank entries (Suggested copy assuming that you want to keep
the original table if not so you can delete from main table) and display.

Cheers,
Arindam

Like (0)

Venkateswaran K Jun 15, 2013 3:02 PM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hi
You have to write a Program lines code... in Main_Area row of the Main Table (Next to Header)

In that for every record, you need to check the three values and assing space to the remaining fields
accordingly.

Regards,
Venkat

Like (0)

Sanjeev Kumar Jun 15, 2013 4:44 PM (in response to Venkateswaran K)

Re: problem in smartforms

Hi Venkat, i am doing this by calling a driver program associated with it, i have declared my fields
as it_item-pre_menge, it_item-pre_amnt.....etc for all the three field( PREVIOUS BILL, CURRENT
BILL, CUMULATIVE BILL).
Could you sujjest me how can i write code in my smartforms to check the entries in all the three
fields, and then to assign space for the variables whom i wish to be empty, (when all the three
fields contain blank values, then the fields corresponding to it gets disabled)

3 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Like (0)

Ravi Shankar Jun 15, 2013 3:49 PM (in response to Sanjeev Kumar)

Helpful Answer Re: problem in smartforms

Hi,
Please write program lines inside loop,

IF ( itab-Previous Bill
AND itab-Current Bill
AND itab-Cumulative Bill ) IS INITIAL.

flg = 'X'.

ENDIF.

Than check from where this following texts are printing,


SL NO, Service Number, Service Description, and Service Specification

In condition tab write as follows,

flg <> 'X'.

Automatically this four fields won't print.


Try this and let me know the results plz.

Regards,
Ravi Shankar L

Like (0)

Sanjeev Kumar Jun 17, 2013 8:34 AM (in response to Ravi Shankar)

Re: problem in smartforms

Hi Ravi,

Hi,
i have written this code

IF ( it_item-pre_menge
AND it_item-pre_amnt
AND it_item-curr_menge
AND it_item-curr_amnt
AND it_item-cumm_menge
AND it_item-cumm_amnt ) IS INITIAL.

flg = 'X'.
ENDIF.
But i am getting this error "Relational Operator AND is not supported"

Like (0)

Venkateswaran K Jun 17, 2013 8:53 AM (in response to Sanjeev Kumar)

Re: problem in smartforms

Sanjeev,
I would say the following work around if you face issue in AND operator.

Instead of AND operator, define a wa_test variable as P decimals 2,


wa_test = sum of it_item-pre_menge it_item-pre_amnt it_item-curr_menge
it_item-curr_amnt it_item-cumm_menge it_item-cumm_amnt .
If the wa_test = 0 or wa_test > 0, accordingly use your logic.

Regards,
Venkat

Like (0)

4 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Sanjeev Kumar Jun 17, 2013 10:03 AM (in response to Venkateswaran K)

Re: problem in smartforms

Hi Venkat,
thanks for your reply, but my issue is to ommit all those values in left hand side for which
all the six fields values are blank....as you have told why i will take a sum of all these
fields...
i am not getting your points......also this format of code is giving error of arithmatic
operation error.

Like (0)

Sanjeev Kumar Jun 17, 2013 1:40 PM (in response to Ravi Shankar)

Re: problem in smartforms

Hi Ravi,
i have written my code as you sujjested, but it is working for all fields having any empty field, but
unfortunately its not working for those rows whome had all the three field values.
I means to say, on next page of my smartform on 7th row it has all the six field values
(pre_menge,pre_amnt, curr_menge, curr_amnt, cumm_menge, cumm_amnt), and 6th row having
blank values, but when executed it gives the result for first 5 row in which current bill is absent, but
after skipping 6th row it only printing values of 7 row and not printing any corresponding text , or S.
NO values.

Please tell me what i am doing wrong.I hv written this code and provided LV_FLAG <> 'X' in the
condition tab of each field for which i wants to print values.

TYPES : LV_flag type FLAG.

IF ( it_item-pre_menge IS INITIAL ) and ( it_item-pre_amnt IS INITIAL )


and ( it_item-curr_menge IS INITIAL ) and ( it_item-curr_amnt IS INITIAL )
and ( it_item-cumm_menge IS INITIAL ) and ( it_item-cumm_amnt IS INITIAL ).

lv_flag = 'X'.

ENDIF.

Like (0)

Ravi Shankar Jun 17, 2013 4:15 PM (in response to Sanjeev Kumar)

Helpful Answer Re: problem in smartforms

Hi Sanjeev Kumar,

Sorry for late reply,

My suggestion is please remove the flag check in the condition tab for printing
corresponding texts.

Your code also comes under loop you please check the following things,
1. Please do not use flag value check in corresponding texts.
2. I think you have created separate text for header and values please confirm this as
follows,

And also please check your code lines and flag set before printing the header text element.

The example I have shown here is for example it does not contain any condition tab.

This is to print header text

This is used to print item values,

5 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Hope it works now for you!Cheers!!!!

Regards,
Ravi Shankar L

Like (0)

Sanjeev Kumar Jun 18, 2013 7:08 AM (in response to Ravi Shankar)

Re: problem in smartforms

Hi Ravi,
this is not working properly, after removing condition in text, i am getting like this, which is
not desired.
My requirement is to

hide all the fields for which all the six field values(pre_menge, pre_amnt, curr_menge,
curr_amnt, cumm_menge, cumm_amnt) are blank.

Yes i have used separate text to print values for Header and Item level.
But its working for inserting condition in each text, the only problem is that i get desired
output in my first page of output but its not printing the values
in S. No., Service No, Service Des, etc in my second page output.

Like (0)

Sanjeev Kumar Jun 18, 2013 7:54 AM (in response to Ravi Shankar)

Re: problem in smartforms

Hi Ravi,
as you can see i am getting blank values in left hand side fields for which all the six field
values are there, please tell me how to resolve this problem

6 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Like (0)

Ravi Shankar Jun 18, 2013 9:01 AM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hi Sanjeev,

Ignore my previous message,Now the problem you are facing if all the values like
previous bill,current bill and cummulative fields values are there than sl.no,service
no,service desc, unit and rate values are not printing.

If previous bill,current bill and cummulative fields values are not there it is not
printing it so there is no issues in this point?

Just check values for sl.no,service no,service desc, unit and rate values for other
fields are filled in internal table.

If values are filled from interface,Just put watchpoint and check where this data
have been cleared,While you have starting the loops all values are filled in internal
table?

If values are there in internal table please check condition tab whether it is getting
failed there to print the values.

Just check and let me know we will try it.

Regards,
Ravi Shankar L

Like (0)

Sanjeev Kumar Jun 18, 2013 4:41 PM (in response to Ravi Shankar)

Re: problem in smartforms

Hi Ravi,
from the stated points of post from Venkateswaran K, i am getting each field
values, the only problem i am facing is it is taking S. No. as 7 after 5 rows in first
page(it is to be 6), now only concern is that where to put my code, because this
time i have written it for separate text, but i have to write it somewhere else...So
just wana know where to put my code so that S. No get printed accordingly.
Thanks for your reply.

Like (0)

Mehwish Haq Jun 15, 2013 5:24 PM (in response to Sanjeev Kumar)

Helpful Answer Re: problem in smartforms

on the condition tab of text element on which you are printing SL NO, enter condition
Previous Bill <> initial
Current Bill <> initial
Cumulative Bill <> initial

Repeat the same condition on Service Number, Service Description, and Service Specification.

Regards

7 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Like (0)

Sanjeev Kumar Jun 17, 2013 8:33 AM (in response to Mehwish Haq)

Helpful Answer Re: problem in smartforms

Hi
i have used in condition tab as
it_item-pre_menge <> INITIAL
it_item-pre_amnt <> INITIAL
it_item-curr_menge <> INITIAL
it_item-curr_amnt <> INITIAL
it_item-cumm_menge <>INITIAL
it_item-cumm_amnt <> INITIAL

for first three fields (S. No, Service No, Service No, but it disappers all the three fields values for all
those items having any one field zero, and keep those values only which all these fields are
non-zero)

My req. is that, if it finds, all the six fields values zero, then only left hand sided fields gets ommited.
(I don't have defined fields like Previous Bill, Current Bill, Cummulative Bill, i am taking the values
in my smartforms as above stated fields)

Like (0)

neha gupta Jun 17, 2013 9:33 AM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hi Sanjeev,

use program lines in starting of main area and try to write thwe below logic.

IF (it_item-pre_menge not INITIAL) and (it_item-pre_amnt not INITIAL)


and (it_item-curr_menge not INITIAL) and (it_item-curr_amnt not INITIAL
and (it_item-cumm_menge not INITIAL) and (it_item-cumm_amnt not INITIAL).

lv_flag = 'X'.

endif.

now add conditions node (having 2 options - true, false). -> In general tab put condition (for example
=> lv_flag = 'X'. )
leave true option as it is. - if your above condition got satisfied, then it will not display anything for 1st
field.
In false option - add text node which you were supposed to display for 1st field.

repeat this for next first 3 fields as well.

Thanks.

Like (0)

Sanjeev Kumar Jun 17, 2013 10:01 AM (in response to neha gupta)

Re: problem in smartforms

Hi Neha, i have written code like this....


IF ( it_item-pre_menge IS INITIAL ) and ( it_item-pre_amnt IS INITIAL )
and ( it_item-curr_menge IS INITIAL ) and ( it_item-curr_amnt IS INITIAL )L
and ( it_item-cumm_menge IS INITIAL ) and ( it_item-cumm_amnt IS INITIAL).

lv_flag = 'X'.

ENDIF.

But it is giving error that "Incorrect logical expression: Comparison /SELECT-OPTION can only be
followed by "AND", "OR", or )"

Tell me where i am wrong in writing this code.

8 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Like (0)

neha gupta Jun 17, 2013 10:10 AM (in response to Sanjeev Kumar)

Helpful Answer Re: problem in smartforms

Please try again this code.

IF ( ( a IS INITIAL ) and ( b IS INITIAL )


and ( c IS INITIAL ) and ( d IS INITIAL )
and ( e IS INITIAL ) and ( f IS INITIAL ) ).

ENDIF.

Like (0)

Sanjeev Kumar Jun 17, 2013 12:33 PM (in response to neha gupta)

Helpful Answer Re: problem in smartforms

Hi Neha,
as you told ,i have done coding for that, and also wrote,LV_FLAG = 'X' in each condition
tab of each field, but unfortunately i am getting all my fields blank, although i have written
nothing in TRUE part, and written corresponding text in FALSE part, but not getting any
value in any fields.(when i writes corresponding text in TRUE part and kept FALSE part
vacant, results are abrupted).
Tell me where i am doing wrong.

TYPES : LV_flag type FLAG.

IF ( it_item-pre_menge IS INITIAL ) and ( it_item-pre_amnt IS INITIAL )


and ( it_item-curr_menge IS INITIAL ) and ( it_item-curr_amnt IS INITIAL )
and ( it_item-cumm_menge IS INITIAL ) and ( it_item-cumm_amnt IS INITIAL ).

lv_flag = 'X'.

ENDIF.

Like (0)

Sanjeev Kumar Jun 17, 2013 12:54 PM (in response to neha gupta)

Re: problem in smartforms

Hi Neha,
i have done some changes, like LV_FLAG <> 'X', in the condition tab of each field, now
the smartform
is consists of 2 pages, all the fields are getting printed for first page, but in the second
page it has only
one row consisting of all the six values, so for this row it is not printing any field value.
Can you sujjest me what to do to get all these values.
(First page of smartforms consist of 5 rows for which the code are working, and from
second page of smartforms, row 6 have Blank values, so get ommited, but row 7 consist
of all the six field values, pre_menge,pre_amnt, curr_menge, curr_amnt, cumm_menge,
cumm_amnt).But for this row it is only showing values of this field and ommiting S. No,
Service No., Service Specification etc fields.

Please tell me how to resolve this problem

Like (0)

neha gupta Jun 17, 2013 1:26 PM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hi Sanjeev,

9 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Please place the break <sy-uname> in ur table program lines and debug the form.
There you will get to know the exact reason of failing.

If you have program lines inside the table and you placed break point there, it will
stop you line by line and page by page.

Please check.

Like (0)

Avirat Patel Jun 17, 2013 9:44 AM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hi sanjeev,

you have to do nothing more in this.

just delete the internal table where desire fields having values 0

and print as usual..

Avirat

Like (0)

Sanjeev Kumar Jun 17, 2013 10:01 AM (in response to Avirat Patel)

Re: problem in smartforms

Hi Virat,
i am not getting your points, please be specific and clear that where should i do that.

Like (0)

Avirat Patel Jun 17, 2013 10:39 AM (in response to Sanjeev Kumar)

Re: problem in smartforms

your main internal table where you holds actual data that is to be print.

you have to delete records with 0 values or which is not required.

hopt this helps at this time..

Avirat

Like (0)

DEVANAND D SHENOY Jun 17, 2013 1:24 PM (in response to Sanjeev Kumar)

Re: problem in smartforms

Hope You are dealing with Table in Smart form for displaying your contents in the print.

just before the table placed in the smart form, Create a Flow Logic.
For creating a Flow Logic take the smart form in Edit mode place the cursor just above the table ->
Right click -> Create -> Flow Logic -> Program Lines

In that program lines provide your internal table and work area as the Import parameter.
after that loop your table

Loop itab into wa_tab.


if wa_tab-Previous Bill is initial and wa_tab-Current Bill is initial and wa_tab-Cumulative Bill is
initial.
Clear :wa_tab-slno, wa_tab-servno, wa_tab-serv.desc.
modify itab from wa_tab.
endif.
endloop.

Delete itab where servno is initial.

10 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

This will check whether the bills are initial or not if all are initial it will clear the initial fields such as serial
number, service number, service description etc and updates the table.

then delete the itab which is having service no blank(hope that for every valid line there will be a service
number or replace sevr no with a similar field). This will avoid blank line in the table.

The output will contain only valid entries having values in your bill only.

Try and Revert.

Like (0)

Venkateswaran K Jun 18, 2013 8:02 AM (in response to Sanjeev Kumar)

Correct Answer Re: problem in smartforms

Hi Sanjeev,

Please do the followint Steps.

1. in teh Smartform - where you might have defined the TABLE where you print this service table.

2. The table where HEADER, Main Area, FOOTER .....

add a Program lines between below HEADER and MAIN AREA.


In the Program lines define the variable flag as char with length 1.
In side the code, write your if condition that if all teh previous, curent , cummulative is initial then
set the flag = 'N' else flag = 'Y'.
Inside the Main area - you might have defined a Row...
Select that row, right click -- go to condition tab
set condition as Flag = 'Y'
3. Save
4. Activae the Form
5. Execute

You will get the desired result

Regards,
Venkat

Like (1)

Sanjeev Kumar Jun 18, 2013 4:41 PM (in response to Venkateswaran K)

Helpful Answer Re: problem in smartforms

Hi Venkat,
thanks for your reply, i have used this method for each text field separately, now its printing
values.But a problem still arises, first page of smartform has 5 row, its printing well, but for second
page of smartform 6th row have blank values, so get ommited, but for 7 row its printing
values, but S. No. is coming as 7, although it has to be 6, so should i have to write a single code
line in betwwen Header and Main area....

One thing more that where should i have to write my single code to fetch the correct values.

11 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Like (0)

Sanjeev Kumar Jun 18, 2013 4:15 PM (in response to Venkateswaran K)

Re: problem in smartforms

Hi Venkat,
as you told, its working fine , but i am facing a problem in S. No. field, as it is printing the usual S.
No
in which the values of the fields are present. The problem is that, in first page of smartform it has 5
rows so it is printing for five rows, but in next page 6 th row have no values, so get ommited, and it
is printing
the next row value and the S. No. is 7 (it must to be 6).
In simple words the S. No. is printing those values in which data are present, but it must follow a
series.
I have taken a variable to count it increasing, but its not working.Kindly tell me what changes i have
to perform in S. No. field so that it increases outomatically for each record, not only for those
record in which it finds any values.

Like (0)

Venkateswaran K Jun 18, 2013 11:38 PM (in response to Sanjeev Kumar)

Helpful Answer Re: problem in smartforms

Okay,

Define a global variable called G_SRNO..

In the code where you set the flag as Y or N ( as i mentioned above ).

In the same place you write

if the flag = 'Y'


G_SRNO = G_SRNO + 1
endif.

In the Output variable for the column Sr.No use the above variable G_SRNO.

Regards,
Venkat

Like (0)

12 of 13 23-05-2014 12:23 PM
problem in smartforms | SCN http://scn.sap.com/thread/3375711

Sanjeev Kumar Jun 19, 2013 7:35 AM (in response to Venkateswaran K)

Re: problem in smartforms

Thanks a lot Venkat.


My Problem solved completely.

Like (0)

Share 0 Tweet

Site Index Contact Us SAP Help Portal


Follow SCN
Privacy Terms of Use Legal Disclosure Copyright

13 of 13 23-05-2014 12:23 PM

Вам также может понравиться