Skip to Content
author's profile photo
Former Member

How to Print Header text in PO SAPScript

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

Add comment
10|10000 characters needed characters exceeded

5 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Apr 13, 2009 at 03:58 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Apr 13, 2009 at 10:08 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo
    Former Member
    Posted on Apr 13, 2009 at 10:22 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Apr 13, 2009 at 11:53 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Apr 14, 2009 at 05:42 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded