Quantcast
Channel: ABAP Development
Viewing all articles
Browse latest Browse all 948

How to Print image over data in smartforms from Include texts.

$
0
0

In Standard Scripts you may find data as such variable logo and variable data(variable in the sense, image and data change as per document) are combined in a include text and printed.where as same include text doesn't get printed in smartforms.

 

Becasue smartforms doesn't have the functionality to execute include texts line by line as we have it in scripts.

In such a case, first you need to separate data using read text(because data may vary according to the document) and print using some internal table.


Identify the logo and upload it in se78 to print it in smartforms using graphics.

In scripts we use protect and end protect to use overlap data with the image.
However in smartform you need to use template and print logo and data in the same row of template, i.e same Output structure

 

Following is the example illustrating the same :

 

data is maintained in text as below :

 

script_data.PNG

below code extracts data and particular image.

 

DATA : lw_flag TYPE c.

REFRESH: gt_tline,gt_tline1.

CLEAR: gw_name, gst_tline,lw_flag.

gw_name = '0084568432'.


CALL FUNCTION 'READ_TEXT'

      EXPORTING
         id                                  = 'ZH20'
         language                      = 'E'
         name                            gw_name
         object                            = 'VBBK'
     TABLES
         lines                               = gt_tline
     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 Eq 0.

   LOOP at gt_tline INTO gst_tline.

     if lw_flag IS INITIAL.

     if gst_tline-tdformat EQ '*'.
       APPEND gst_tline to gt_tline1.
       DELETE gt_tline Index 1.
     else.
       lw_flag = 'X'.
     endif.
     endif.

    if lw_flag = 'X'.
     if gst_tline-tdformat NE '*'.
       if gst_tline-tdline CS 'ZHEX-SQUARE'.
         gw_logo_name = 'Z_SQUARE'.
        endif.
          DELETE gt_tline Index sy-tabix.
      endif.
      endif.
   ENDLOOP.
   CONDENSE gw_logo_name.

endif.

 

Loop at header data is data in GT_TLINE1.

grphic_1.PNG

 

graphic.PNG


and the image looks as below :

 

data.PNG
Please let me know if any queries . thanks


Viewing all articles
Browse latest Browse all 948

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>