cancel
Showing results for 
Search instead for 
Did you mean: 

How to Print Header text in PO SAPScript

Former Member
0 Kudos

Hi Gurus,

I am working on PO Script (MEDRUCK). I copied the Standard to a Z form. ZMM_MEDRUCK, Now I need to print the the Header text at the end of MAIN window. I created a a perform and call it from the Script and read the heder text by using FM Read_text

DEFINE &TEXT1& = ' '

PERFORM GET_TERMS IN PROGRAM ZMM_MEDRUCK_ROUTINE

USING &EKKO-EBELN&

CHANGING &TEXT1&

ENDPERFORM

PROTECT

&TEXT1&

ENDPROTECT

but while returning I am getting only one line. Can any body suggest me how I can read the Header text in PO script. Please provide the sample Code.

Regards

Sony

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Just use the include command for header texts, there's no need to read the text first, just pass the same info to the INCLUDE as you would the READ_TEXT (tdname, tdobject, tdid).

/: INCLUDE &EKKO-EBELN& OBJECT EKKO ID F01

would print the Header text for the PO = EKKO_EBELN

Former Member
0 Kudos

Thanks to your valuable post. It helped me solve my issue.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Use INCLUDE TEXT Control command in the main window if the text.

/: INCLUDE <TEXT-NAME> OBJECT <OBJ> ID <id>.

Generally the purchase order header texts are saved using the PO number.

Please check the table 'STXH' to know the name of the text , Object and ID.

Regards,

Jagadeesh.

Former Member
0 Kudos

Hi,

Use this Function module 'READ_TEXT'

T_lines contains the header text, you can loop it and display it in sap script

  • Function module to read the header text

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'F01'

language = sy-langu

name = ekko-ebeln

object = ekko

TABLES

lines = t_lines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Regards

Krishna

Former Member
0 Kudos

Hi,

In Script Just use:

/: INCLUDE ZPO_TERMS_AND_CONDITIONS OBJECT TEXT ID ST LANGUAGE EN

where ZPO_TERMS_AND_CONDITIONS is the header text to be 'included' in the sap script.

Regards

Raju chitale

Former Member
0 Kudos

Please suggest how to create the ZPO_TERMS_AND_CONDITIONS and include it in custom PO Script.

Former Member
0 Kudos

Hi,

Goto So10 at there Create Standard text then include it corresponding window.

Former Member
0 Kudos

Hi,

after gettting the HEADER Text from FM 'READ_TEXT' into a table, U loop the Text lines table and call FM WRITE_FORM in the LOOP.

since we are loop the Text lines table it will display all the lines available in Header text of PO...

eg:

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = zvid

language = 'R'

name = zvname

object = 'VBBK'

IMPORTING

header = thead

TABLES

lines = line

EXCEPTIONS

OTHERS = 8.

LOOP AT line.

call function 'WRITE_FORM'

exporting

element = v1

window = 'HEADER'.

endloop.

Hope it helps!!

Regards,

Pavan

Former Member
0 Kudos

Thank you Pavan. I am using the element Last. So In Routine I coded like

loop at t_lines

call function 'WRITE_FORM'

exporting

element = 'LAST'

window = 'MAIN'.

endloop.

Can you please suggest me what i have to write in Element LAST in Script ??? Pls provide code.

I have written like the following in Script.

LAST

DEFINE &TEXT1& = ' '

PERFORM GET_TERMS IN PROGRAM ZMM_MEDRUCK_ROUTINE

USING &EKKO-EBELN&

CHANGING &TEXT1&

ENDPERFORM