cancel
Showing results for 
Search instead for 
Did you mean: 

Long text problem in sap script

Former Member
0 Kudos

Hi Experts,

I have craeted sap script for payment print progrem.. in my sap script one window is text window... client want more then 300 char for that window. for that i use read_text function module... its working fine... but problem is it retrive only one line from long text editor. only 70 char i got.

below is my coding......

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = '0001'

LANGUAGE = sy-langu

NAME = NAME

OBJECT = 'DOC_ITEM'

TABLES

LINES = LINES .

IF SY-SUBRC <> 0.

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

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

ENDIF.

LOOP AT LINES.

n = 0.

l = 132.

text+n(l) = lines-tdline.

n = n + 132.

l = l + 132.

ENDLOOP.

in sap script i have direct pass lines-tdline

*&lines-tdline&

Please suggest me which point i missing?

Thanks

Jigar

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Jigar,

The INCLUDE statement in SAPscript lets texts be included - these texts can be long texts from documents so that every time it prints it includes different text depending on what was saved for the document. It is not like an ABAP INCLUDE statement which includes a (mostly) fixed set of source code.

All you need to do is use variables for the object name so that it substitutes in the required field values to enable the correct text to be read. You can either use standard variables like company code, document number, fiscal year for example to get the long text for a financial document printed. You just need to take care that the object name and other text key fields are formatted exactly how they are needed to read the text - including embedded zeros or spaces. The standard sapscripts supplied by SAP include lots of examples of how this can be done.

If the text or other key values cannot be derived and formatted in the script, you can always use a perform command to call an ABAP routine to read and format the text keys and pass them back as variables.

This is a better way to print text than trying to read it in ABAP and pass it to the sapscript as a set of character variables, as it allows the script to format the text lines correctly based on the font, window size, and other attributes.

Andrew

Former Member
0 Kudos

Hi All,

The standard text will be stored in Name = ORDCONF_TEXT_(sales org)_(distributionchannel)_(division)

Text ID = ZSD

Examples: ORDCONF_TEXT_4000_01_01 , ORDCONF_TEXT_4000_01_80 , ORDCONF_TEXT_1000_01_01.

Requirement :

The print program /form will need to pick up the appropriate standard text based on the Sales Area (combination of Sales Org / Distribution Center / Division) of the sales order [VBAK-VKORG / VTWEG / SPART], provided a standard text has been created for that Sales Area. Itu2019s not required that every sales area have a standard text, so if one is not found, this step should be skipped and the rest of the print program executed.

The new text should print after 2 blank lines after the Printable Notes text (which is after the line items and the Total Net Price prints).

The font should be the same size as the Printable Notes, but bolded rather than italicized.

The text should print in the same columns as the Printable Notes currently print in (Material Description / Scheduled Ship Date / Quantity) .

So the logic i have used is this below code:

I used a subroutine in the layout of the main window becoz i need to print it in the main window below after 2 blank lines of line items.

This is logic in the layout:

/:PERFORM GET_OBJECT IN PROGRAM ZSDRP001_ORD_CONF_IRE

/:USING &VBDKA-VBELN&

/:CHANGING &ORDCONF_TEXT&

/:ENDFORM

/:INCLUDE &ORDCONF_TEXT& OBJECT TEXT ID ZSD PARAGRAPH A1

I called this subroutine in the print program:

Logic in the print program:

FORM GET_OBJECT TABLES INPUT_TAB STRUCTURE ITCSY

OUTPUT_TAB STRUCTURE ITCSY.

DATA : TMP_VBELN LIKE vbdka-VBELN,

TMP_VKORG LIKE VBAK-VKORG,

TMP_VTWEG LIKE VBAK-VTWEG,

TMP_SPART LIKE VBAK-SPART,

TMP_TXNAM1(40) TYPE C VALUE 'ORDCONF_TEXT',

TMP_TXNAM2(100) TYPE C.

DATA: v_text LIKE tline-tdline.

DATA : P_V_TEXT LIKE tline-tdline.

CLEAR : TMP_TXNAM1, TMP_TXNAM2, TMP_VBELN, TMP_VKORG, TMP_VTWEG, TMP_SPART.

READ TABLE INPUT_TAB WITH KEY NAME = 'vbdka-VBELN'.

IF SY-SUBRC = 0.

tmp_vbeln = input_tab-value.

ENDIF.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING INPUT = TMP_VBELN

I

MPORTING OUTPUT = TMP_VBELN .

CLEAR VBAK.

SELECT SINGLE VKORG VTWEG SPART INTO (TMP_VKORG, TMP_VTWEG, TMP_SPART)

FROM VBAK WHERE VBELN EQ TMP_VBELN.

IF NOT TMP_VKORG IS INITIAL

AND NOT TMP_VTWEG IS INITIAL

AND NOT TMP_SPART IS INITIAL.

CONCATENATE TMP_TXNAM1 TMP_VKORG tmp_vtweg tmp_spart into TMP_TXNAM2 SEPARATED BY '_'.

endif.

CONDENSE TMP_TXNAM2 NO-GAPS.

PERFORM read_order_text USING TMP_TXNAM2 CHANGING v_text.

READ TABLE output_tab WITH KEY NAME = 'ORDCONF_TEXT'.

IF SY-SUBRC = 0.

output_tab-value = P_V_TEXT.

MODIFY output_tab index sy-tabix.

endif.

endform.

FORM READ_ORDER_TEXT USING P_TMP_TXNAM2 CHANGING P_V_TEXT LIKE tline-tdline.

DATA: ztdid LIKE thead-tdid,

zlang LIKE thead-tdspras,

zobj LIKE thead-tdobject,

zname LIKE thead-tdname.

DATA: tlines TYPE STANDARD TABLE OF tline WITH HEADER LINE

thead LIKE thead.

CLEAR P_V_TEXT.

ztdid = 'ZSD'.

zlang = 'E'.

zobj = 'TEXT'.

zname = P_TMP_TXNAM2.

CLEAR tlines.

REFRESH tlines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

object = zobj

name = zname

id = ztdid

language = zlang

IMPORTING

header = thead

TABLES

lines = tlines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT tlines WHERE NOT tdline IS INITIAL.

MOVE tlines-tdline TO P_V_TEXT.

ENDLOOP.

ENDFORM.

But still its not getting printed .Plz tell me where i am going wrong.

Thanks,

Suman

Former Member
0 Kudos

Hi ,

can u try using this Function Module : READ_TEXT_INLINE

Regards,

Sudhakar.

Former Member
0 Kudos

In a SAPscript you do not need to use ABAP code to retrieve long text - Just use the INCLUDE command in SAPSCRIPT - see help for details

/: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p]

this puts the complete long text in and formats it for the window

Andrew

Former Member
0 Kudos

Hi,

TRY this......

LOOP AT LINES.
n = 0.
l = 132.
text+n(132) = lines-tdline+n(132).
n = n + 132.
*l = l + 132.
ENDLOOP.

All the very best....

Regards,

Sreenivasa sarma K.

Edited by: sharmashree kashi on Mar 28, 2008 11:14 AM

Former Member
0 Kudos

Hi Sreenivasa,

i use your code but its not working... problem is lines-tdline has 72 length.. so it takes only 72 length every time. any other suggetion

Andrew: i cant use include statement in my sap script, because this is the script for multiple document, so every time document changed with long text. this is not fixed

can i use in sap script perform endperform statement........

give me some idea about perform endperform statement so i can use in my sap script

Thanks

Jigar

Former Member
0 Kudos

Hi all,

Can anyone suggest me??? how can i use perform statement?

give me some example..

Thanks

Jigar

Former Member
0 Kudos

Hi all,

Thanks for help me for long text... at last i solved my problem.

i use read_text function for read and stored in internal table and write in sap script i use "write_form_lines", from this function i get long text in my sap script window....

Thanks agian for help, i assign point also.

Thanks

Jigar

Former Member
0 Kudos

Hi All,

The standard text will be stored in Name = ORDCONF_TEXT_(sales org)_(distributionchannel)_(division)

Text ID = ZSD

Examples: ORDCONF_TEXT_4000_01_01 , ORDCONF_TEXT_4000_01_80 , ORDCONF_TEXT_1000_01_01.

Requirement :

The print program /form will need to pick up the appropriate standard text based on the Sales Area (combination of Sales Org / Distribution Center / Division) of the sales order [VBAK-VKORG / VTWEG / SPART], provided a standard text has been created for that Sales Area. Itu2019s not required that every sales area have a standard text, so if one is not found, this step should be skipped and the rest of the print program executed.

The new text should print after 2 blank lines after the Printable Notes text (which is after the line items and the Total Net Price prints).

The font should be the same size as the Printable Notes, but bolded rather than italicized.

The text should print in the same columns as the Printable Notes currently print in (Material Description / Scheduled Ship Date / Quantity) .

So the logic i have used is this below code:

I used a subroutine in the layout of the main window becoz i need to print it in the main window below after 2 blank lines of line items.

This is logic in the layout:

/:PERFORM GET_OBJECT IN PROGRAM ZSDRP001_ORD_CONF_IRE

/:USING &VBDKA-VBELN&

/:CHANGING &ORDCONF_TEXT&

/:ENDFORM

/:INCLUDE &ORDCONF_TEXT& OBJECT TEXT ID ZSD PARAGRAPH A1

I called this subroutine in the print program:

Logic in the print program:

FORM GET_OBJECT TABLES INPUT_TAB STRUCTURE ITCSY

OUTPUT_TAB STRUCTURE ITCSY.

DATA : TMP_VBELN LIKE vbdka-VBELN,

TMP_VKORG LIKE VBAK-VKORG,

TMP_VTWEG LIKE VBAK-VTWEG,

TMP_SPART LIKE VBAK-SPART,

TMP_TXNAM1(40) TYPE C VALUE 'ORDCONF_TEXT',

TMP_TXNAM2(100) TYPE C.

DATA: v_text LIKE tline-tdline.

DATA : P_V_TEXT LIKE tline-tdline.

CLEAR : TMP_TXNAM1, TMP_TXNAM2, TMP_VBELN, TMP_VKORG, TMP_VTWEG, TMP_SPART.

READ TABLE INPUT_TAB WITH KEY NAME = 'vbdka-VBELN'.

IF SY-SUBRC = 0.

tmp_vbeln = input_tab-value.

ENDIF.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING INPUT = TMP_VBELN

I

MPORTING OUTPUT = TMP_VBELN .

CLEAR VBAK.

SELECT SINGLE VKORG VTWEG SPART INTO (TMP_VKORG, TMP_VTWEG, TMP_SPART)

FROM VBAK WHERE VBELN EQ TMP_VBELN.

IF NOT TMP_VKORG IS INITIAL

AND NOT TMP_VTWEG IS INITIAL

AND NOT TMP_SPART IS INITIAL.

CONCATENATE TMP_TXNAM1 TMP_VKORG tmp_vtweg tmp_spart into TMP_TXNAM2 SEPARATED BY '_'.

endif.

CONDENSE TMP_TXNAM2 NO-GAPS.

PERFORM read_order_text USING TMP_TXNAM2 CHANGING v_text.

READ TABLE output_tab WITH KEY NAME = 'ORDCONF_TEXT'.

IF SY-SUBRC = 0.

output_tab-value = P_V_TEXT.

MODIFY output_tab index sy-tabix.

endif.

endform.

FORM READ_ORDER_TEXT USING P_TMP_TXNAM2 CHANGING P_V_TEXT LIKE tline-tdline.

DATA: ztdid LIKE thead-tdid,

zlang LIKE thead-tdspras,

zobj LIKE thead-tdobject,

zname LIKE thead-tdname.

DATA: tlines TYPE STANDARD TABLE OF tline WITH HEADER LINE

thead LIKE thead.

CLEAR P_V_TEXT.

ztdid = 'ZSD'.

zlang = 'E'.

zobj = 'TEXT'.

zname = P_TMP_TXNAM2.

CLEAR tlines.

REFRESH tlines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

object = zobj

name = zname

id = ztdid

language = zlang

IMPORTING

header = thead

TABLES

lines = tlines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

LOOP AT tlines WHERE NOT tdline IS INITIAL.

MOVE tlines-tdline TO P_V_TEXT.

ENDLOOP.

ENDFORM.

But still its not getting printed .Plz tell me where i am going wrong.

Thanks,

Suman