cancel
Showing results for 
Search instead for 
Did you mean: 

Conditon in smartforms to print an include text

Former Member
0 Kudos

Dear all ,

I am printing a PO which includes a special instructions at the end of PO.

So, there are 8 lines in the special instructions.

In the 7th line there is a text related to warranty.

All the 8 lines are printed in same Text.

Now the requirement is ... in the 7th line i need to print an include text which is being fetched from me22n transaction.

If the include text is initial then the layout should remain as usual . else the include text should be printed in the 7th line.

Remember ,, all the 8 lines are in one text only...

Kindly guide me ,

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Create a template with 8 lines and in 7th line create include text and pass text name , text object , text id and language and don't forget to check checkbox "No error if no text exist".

Thanks,

Vijay

Former Member
0 Kudos

Hi Rahul,

use the READ_TEXT function module.

CONSTANTS:

c_txtid TYPE thead-tdid

VALUE 'F08',,

c_txtobj TYPE thead-tdobject

VALUE 'EKKO',

c_lang TYPE thead-tdspras

VALUE 'E'.

DATA:

lt_lines TYPE STANDARD TABLE

OF tline.

DATA:

lfs_line TYPE tline,

lfs_ekpo type ekpo.

DATA:

lw_name TYPE thead-tdname.

READ TABLE IT_EKPO INTO lfs_ekpo INDEX 1.

IF SY-SUBRC EQ 0.

LW_NAME = lfs_ekpo-EBELN.

ENDIF.

data:

GT_TXTLINES type STANDARD TABLE OF TLINE,

GFS_TXTLINE type tline.

refresh GT_TXTLINES.

clear GFS_TXTLINE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = c_txtid

language = c_lang

name = lw_name

object = c_txtobj

archive_handle = 0

local_cat = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = GT_TXTLINES

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.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

read table GT_TXTLINES INTO GFS_TXTLINE INDEX 1.

Regards,

Pratap

Former Member
0 Kudos

Dear Pratap ,

Thanks for your inputs ..

As I told you earlier , the include text that i need to insert is at the 7th position of text of 8 lines in total.

Now I want to know how to insert this include text in 7th position ? And one more thing , the no of lines in the text is uncertain , some times it is 4 lines and some times it is 6 lines ,,, so the length should be dynamically specified. So how to do this ?

Hope you understood.

FYI .. I am able to get the text using READ_TEXT,,, no issues with that,, only prob is to print in required position.

Former Member
0 Kudos

Hi ,

As there is no way to findout the line.Ask user to enter the warranty line with WARRANY work.In code you find this work and print text immedialty next to that line.

Former Member
0 Kudos

Include texts can be nested up to a certain hierarchy level. 2 or 3 nested should be no problem.