cancel
Showing results for 
Search instead for 
Did you mean: 

sap script-standard text in order confirmation

Former Member
0 Kudos

Hi Experts,

Can anybody solve my problem.I f my problem is solved they will definetely be rewarded with points.

The standard text will be stored as 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

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.

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:

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

IMPORTING

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 '_'.

  • CONCATENATE TMP_VKORG TMP_VTWEG TMP_SPART into TMP_TXNAM 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

&----


  • text

----


  • -->P_TMP_TXNAM2 text

  • <--P_V_TEXT text

----


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. " READ_ORDER_TEXT

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

Thanks,

Sirishaa

Moderator message - Cross thread locked

Edited by: Rob Burbank on Nov 10, 2009 9:51 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You do not need to use the subroutine READ_ORDER_TEXT to get another text name because you already have it: TMP_TXNAM2 .

Pass this value back to your SAPscript, and it is okay.

Or you can even check the text object is empty or not, if no text is found, print 2 empty lines:

still use your subroutine to read the text, if no line is found, set TMP_TXNAM2 to empty, otherwise, no change,

In SAPscript, check the value is empty or not, then print 2 empty line or the text object...