cancel
Showing results for 
Search instead for 
Did you mean: 

Need help in printing Footer address without spaces

Former Member
0 Kudos

Hi All,

I have a requirement to print the Footer address on every Page. As of now I am printing the footer address fields in the Master pages as static ( Fixed position ). I have declared text fields. In case any of the field is missing then automatically the next field should take the above field place. I mean there should not be an empty place if that field is not printing.

For example :

Name: ABC

Tel: 1234

Fax: 1234

Email : abc@xyz.com

As I have declared it as static text fields, in case of any field is not printing, the empty space would be printed. But I wanted the next field to move up so that empty sapce is not printed in the layout.

For example in case above TEL is mising the output should be as below.

Name: ABC

Fax: 1234

Email : abc@xyz.com

To achieve this I have created an internal table with one coloumn and tried to print. But somehow its not printing.

Can anyone help me out in achieving the same?

Thanks and Regards,

Karthik Ganti.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Karthik,

You can achieve this by using flowed subform and hidden properties of a text field.

1. Create a subform with flowed content type.

2. In this subform, create 4 textfields (name,tel,fax,email), make sure the width of your text field should occupy the full width of your subform. This is to prevent your next field to go up and appear next to the previous field.

3. in initialize event, check if this field is empty, set .presence = "hidden"

Thanks.

regards,

Xiang Li

Former Member
0 Kudos

Hi Xiang Li,

Thanks  you. I was working on other part of develpment, so could not fix the above. Now I have tried it, but couldnot achieve it. Below is the code written in java script. I have tested writing in initalize, formready and layout ready events. but still it didnot work.

if ( this.rawvalue == null )

{

this.presence = "hidden";

}

As you suggested above, I have taken a subform whose content is flowed type,with four text fields in it. On every text field , I have written the above logic in various events. But still I am able to print the spaces in case if any of the text is not there.

Can you please help me out in this. Is the above logic correct ?

Thanks and Regards,

Karthik Ganti.

Former Member
0 Kudos

Hello All,

Can anyone help me out in fixing the above issue ?

Thanks and Regards,

Karthik Ganti.

pavan_prabhu
Active Participant
0 Kudos

Hello Karthik,

     Whenever you use the fields in master pages, their position is fixed no matter whether they have been hidden or not even though they are put in a flowed sub form(top to bottom).

Internal tables wont work well in master page since those are designed to be dynamic and only to be used in Design view.

So you can achieve this using below approach.

You can create a structure with number of fields and fill them dynamically and bind them in the layout. The footer in your case will have 4 lines. So create 4 fields one below other in master page. create a structure with these 4 fields. Let the name of fields be LINE1, LINE2, LINE3 and LINE4. Let the  name of the structure be ZSTRUCT.

Fetch the label name and value in ABAP itself.

For example : if first line is Name: ABC, then Name is label and ABC is value.

First fetch the value of name i.e ABC from your business logic. If the value is present, only then fetch the label "Name" from standard text using READ_TEXT function module. So If you get both value and label only then concatenate both label and value and store it in lst_values-value. Then append it in internal table using append lst_values to li_values.


Now repeat the above steps for all the labels and values like, Telephone, Fax, Email etc.

Now after the internal table is ready, the below logic will fill the fields in the structure dynamically. If Name is not filled in 1st line, then Telephone will be filled in this place and so on.


loop at li_values into lst_values.

      do

            assign component sy-index of structure ZSTRUCT to <lfs_field>.

                   if <lfs_field> is assigned.

                          if <lfs_field> is inital.

                                 <lfs_field> = lst_values-value.

                                 exit.

                          endif.

                   endif.

            unassign <lfs_field>.

       enddo

endloop.

In the layout bind the 1st text field with ZSTRUCT-LINE1, 2nd text field with ZSTRUCT-LINE2, 3rd text field with ZSTRUCT-LINE3 and 4th text field with ZSTRUCT-LINE4.

Former Member
0 Kudos

Hi Karthik,

Sorry been busy with project.

The concept is simple,

1. A subform (light blue) with flowed type

2. Fields (blue color, with each of them has hidden scripting when value is blank during initialize event, also the width of the field should fully occupy the whole width of subform)

Few things to check:

1. I would suggest you to do individual test on your scripting as well to make sure it is working, example run your form with one of the field with hidden script without any condition.

2. Also check if your form has interactive enabled, docparam interactive = 'X' in your print program.

There is another method using floating fields. But sorry to say I do not have system with ADS ready for me to test it. Please try above method and let me know if it is still not working.

Thanks.

p/s: Sorry for ugly photo above from using mspaint & mousepad & old man shaking hand.

regards,

Xiang Li

Former Member
0 Kudos

Hello everyone,

It looks like reasonable answer. I faced the same problem and I have ended up with similar workaround.

Nevertheless Master Page is not a good place for creation of dynamically placed objects.

Please refer to solution:

Hidden Subform blank space not being reclaimed | SCN

As author of thread found out  note 1506782 is helpful

Best regards,

Radek

0 Kudos

Hi Karthik,

I have also used this in one of my development and it worked perfectly fine.

In Layout:ready* event , Javascript Language , Client.

if(this.rawValue == null)

{

  this.presence = "hidden";

}

Thanks,

Shweta