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 smartforms

former_member187748
Active Contributor
0 Likes
12,758

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.

1 ACCEPTED SOLUTION
Read only

venkateswaran_k
Active Contributor
0 Likes
9,932

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

36 REPLIES 36
Read only

former_member209120
Active Contributor
0 Likes
9,932

Hi sangeev,

Make Output field type C.

or

Try like this

Read only

0 Likes
9,932

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.

Read only

former_member209120
Active Contributor
0 Likes
9,932

change your output field type C.

data : outputfield(10) type c.

Read only

0 Likes
9,932

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

clear it.

Read only

0 Likes
9,932

Yes in Global Definition only.

like this

Read only

0 Likes
9,932

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

Read only

arindam_m
Active Contributor
0 Likes
9,932

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

Read only

venkateswaran_k
Active Contributor
0 Likes
9,932

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

Read only

0 Likes
9,932

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)

Read only

Former Member
0 Likes
9,932

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

Read only

0 Likes
9,932

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"

Read only

0 Likes
9,932

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

Read only

0 Likes
9,932

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.

Read only

0 Likes
9,932

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.

Read only

0 Likes
9,932

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,

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

Regards,

Ravi Shankar L

Read only

0 Likes
9,929

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.

Read only

0 Likes
9,929

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

Read only

0 Likes
9,929

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

Read only

0 Likes
9,929

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.

Read only

former_member188827
Active Contributor
0 Likes
9,929

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

Read only

0 Likes
9,929

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)

Read only

former_member420878
Active Participant
0 Likes
9,929

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.

Read only

0 Likes
9,929

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.

Read only

0 Likes
9,929

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   ( IS INITIAL ) ).

   ENDIF.


Read only

0 Likes
9,929

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.

Read only

0 Likes
9,929

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

Read only

0 Likes
9,929

Hi Sanjeev,

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.

Read only

Former Member
0 Likes
9,929

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

Read only

0 Likes
9,929

Hi Virat,

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

Read only

0 Likes
9,929

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

Read only

Former Member
0 Likes
9,929

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.

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.

Read only

venkateswaran_k
Active Contributor
0 Likes
9,933

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

Read only

0 Likes
9,929

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.

Read only

0 Likes
9,929

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.

Read only

0 Likes
9,929

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

Read only

0 Likes
9,929

Thanks a lot Venkat.

My Problem solved completely.