Application Development 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: 

Sales Invoice Header text print in smartforms

dwarade
Explorer
0 Kudos
1,935

Hi,

All Kindly guide me how to print the header text in sales invoice i.e. vehicle no and transporter name or any others in smartforms.

Regards,

Dilip Warade.

1 ACCEPTED SOLUTION

tolga_polat
Active Participant
0 Kudos
271

Hi,

I think you mean long text. In text screen ( VF03 -> Head. Text ) click display log. you can see text id there ( 4 char near name of text ).

Now you can call read_text function with this id :

  DATA : ls_stxh TYPE stxh,

         lt_lines TYPE STANDARD TABLE OF tline,

         ls_lines TYPE tline.



  SELECT SINGLE *

           FROM stxh

           INTO ls_stxh

          WHERE tdobject = 'VBBK' " Object for Sales document

            AND tdname = vbrk-vbeln " Invoice number if you want to select item, concatenate vbeln and posnr

            AND tdid = 'Z000' " Text id from log

            AND tdspras = sy-langu.



  CHECK sy-subrc EQ 0. " If there is no recorded text dont need to call read_text



  CALL FUNCTION 'READ_TEXT'

    EXPORTING

*   CLIENT                        = SY-MANDT

      id                            = ls_stxh-tdid

      language                      = sy-langu

      name                          = ls_stxh-tdname

      object                        = ls_stxh-tdobject

*   ARCHIVE_HANDLE                = 0

*   LOCAL_CAT                     = ' '

* IMPORTING

*   HEADER                        =

    TABLES

      lines                         = lt_lines

   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.

* Implement suitable error handling here

  ENDIF.



  LOOP AT lt_lines

     INTO ls_lines.



  ENDLOOP.

With this you can send your text to smartforms and write.

Or you can call directly from smartforms :

In text choose text type : include text

Text name : &vbeln&

object VBBK

ID : text id from log

and check no error this will insert your long text.

Regards

Tolga

6 REPLIES 6

tolga_polat
Active Participant
0 Kudos
272

Hi,

I think you mean long text. In text screen ( VF03 -> Head. Text ) click display log. you can see text id there ( 4 char near name of text ).

Now you can call read_text function with this id :

  DATA : ls_stxh TYPE stxh,

         lt_lines TYPE STANDARD TABLE OF tline,

         ls_lines TYPE tline.



  SELECT SINGLE *

           FROM stxh

           INTO ls_stxh

          WHERE tdobject = 'VBBK' " Object for Sales document

            AND tdname = vbrk-vbeln " Invoice number if you want to select item, concatenate vbeln and posnr

            AND tdid = 'Z000' " Text id from log

            AND tdspras = sy-langu.



  CHECK sy-subrc EQ 0. " If there is no recorded text dont need to call read_text



  CALL FUNCTION 'READ_TEXT'

    EXPORTING

*   CLIENT                        = SY-MANDT

      id                            = ls_stxh-tdid

      language                      = sy-langu

      name                          = ls_stxh-tdname

      object                        = ls_stxh-tdobject

*   ARCHIVE_HANDLE                = 0

*   LOCAL_CAT                     = ' '

* IMPORTING

*   HEADER                        =

    TABLES

      lines                         = lt_lines

   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.

* Implement suitable error handling here

  ENDIF.



  LOOP AT lt_lines

     INTO ls_lines.



  ENDLOOP.

With this you can send your text to smartforms and write.

Or you can call directly from smartforms :

In text choose text type : include text

Text name : &vbeln&

object VBBK

ID : text id from log

and check no error this will insert your long text.

Regards

Tolga

Former Member
0 Kudos
271

Dear Dilip,

   Create the text in smartforms, in text change to "include text",

  Give the sales order "&v_vbeln&" in the text name column

  Text object as "VBBK"

  Text ID ---> check in the spro ---> sales & distribution ----> sales order ---> Header ----> Take required  text id .

  Language as 'En'

click on no error if no tetx exists .

Regards,

Madhukumar

dwarade
Explorer
0 Kudos
271

Sir,

Text name : &vbeln&

getting the error in smartforms.

Regards,

Dilip Warade

Former Member
0 Kudos
271

hello dilip,

                it is not & vbeln&, pass the text name as the &wa_vbeln& i.e,,, variable that containing the sale order number.

create temp variable in global definition as

v_vbeln type vbak-vbeln.

and initialise the variable 

v_vbeln = sale order number

then pass it to the text name  &v_vbeln&

0 Kudos
271

sir,

can i declare a this v_vbeln = sale order number in smartforms driver program clear me

Thank sir,

regards,

dilip

sir,

another is in gui_download i declare a field seperator ';' but it will not display it dispaly only space but it want a ','  in my text file which is save on my desktop what can i do or any solution on that .........

Regards,

Dilip

Former Member
0 Kudos
271

Hi Tolga,

I'm directly calling the text from smartform using include text.

Problem in my case is: all of the text is not being captured.

Doubt in my mind is that I've another fields right in front of <seal no> value which I am capturing in layout. Ref format:

Seal no                                                   Driver

                                                              Vehicle

Question is: Can it happen that header text (with include text method) is not being captured because of layout spacing or would that be solved by using READ TEXT FM!!

Kindly revert!