How to Read Texts in ME22N or ME23N to PO Print Form

Hi Anybody,
      I want read  ItemText, Info Record POText, Material POText, Delivery Text... from ME22N or ME23N in Smartforms from Each PO Item and Print into PO Print  Form.
Can u please anybody answer me.
Thanks,
S.Muthu.

Hi this will help u.
*&  Include           ZMFM06PE02
  Smart Form Print Routines                                          *
form entry_neu using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  data: ls_print_data_to_read type lbbil_print_data_to_read.
  data: ls_bil_invoice type lbbil_invoice.
  data: lf_fm_name            type rs38l_fnam.
  data: ls_control_param      type ssfctrlop.
  data: ls_composer_param     type ssfcompop.
  data: ls_recipient          type swotobjid.
  data: ls_sender             type swotobjid.
  data: lf_formname           type tdsfname.
  data: ls_addr_key           like addr_key.
  xscreen = ent_screen.
  clear ent_retco.
  if nast-aende eq space.
    l_druvo = '1'.
  else.
    l_druvo = '2'.
  endif.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
Fill up pricing condition table if calling from ME9F
  if l_doc-xtkomv is initial.
    select * into table l_doc-xtkomv from konv
                                     where knumv = l_doc-xekko-knumv.
  endif.
*Set the print Parameters
  perform set_print_param using     ls_addr_key
                          changing  ls_control_param
                                    ls_composer_param
                                    ls_recipient
                                    ls_sender
                                    ent_retco.
*Get the Smart Form name.
  if not tnapr-sform is initial.
    lf_formname = tnapr-sform.
  else.
    lf_formname = tnapr-fonam.
  endif.
Determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting
            formname           = lf_formname
       importing
            fm_name            = lf_fm_name
       exceptions
            no_form            = 1
            no_function_module = 2
            others             = 3.
  if sy-subrc <> 0.
error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
  call function lf_fm_name
       exporting
            archive_index      = toa_dara
            archive_parameters = arc_params
            control_parameters = ls_control_param
            mail_recipient     = ls_recipient
            mail_sender        = ls_sender
            output_options     = ls_composer_param
            zxekko             = l_doc-xekko  " user_settings = ' '
            zxpekko            = l_doc-xpekko
       tables
            l_xekpo            = l_doc-xekpo[]
            l_xekpa            = l_doc-xekpa[]
            l_xpekpo           = l_doc-xpekpo[]
            l_xeket            = l_doc-xeket[]
            l_xtkomv           = l_doc-xtkomv[]
            l_xekkn            = l_doc-xekkn[]
            l_xekek            = l_doc-xekek[]
            l_xkomk            = l_xkomk
       exceptions
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            others             = 5.
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
get SmartForm protocoll and store it in the NAST protocoll
    perform add_smfrm_prot.
  endif.
endform.
Mahnung
form entry_mahn using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  clear ent_retco.
  l_druvo = '3'.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
CALL FUNCTION 'ME_PRINT_PO'
      EXPORTING
           ix_nast        = l_nast
           ix_druvo       = l_druvo
           doc            = l_doc
           ix_screen      = ent_screen
           ix_from_memory = l_from_memory
           ix_toa_dara    = toa_dara
           ix_arc_params  = arc_params
      IMPORTING
           ex_retco       = ent_retco.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
Fill up pricing condition table if calling from ME9F
  if l_doc-xtkomv is initial.
    select * into table l_doc-xtkomv from konv
                                     where knumv = l_doc-xekko-knumv.
  endif.
*Set the print Parameters
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
*Get the Smart Form name.
  if not tnapr-sform is initial.
    lf_formname = tnapr-sform.
  else.
    lf_formname = tnapr-fonam.
  endif.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting
            formname           = lf_formname
       importing
            fm_name            = lf_fm_name
       exceptions
            no_form            = 1
            no_function_module = 2
            others             = 3.
  if sy-subrc <> 0.
error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
  call function lf_fm_name
       exporting
            archive_index      = toa_dara
            archive_parameters = arc_params
            control_parameters = ls_control_param
            mail_recipient     = ls_recipient
            mail_sender        = ls_sender
            output_options     = ls_composer_param
            zxekko             = l_doc-xekko  " user_settings = ' '
            zxpekko            = l_doc-xpekko
       tables
            l_xekpo            = l_doc-xekpo[]
            l_xekpa            = l_doc-xekpa[]
            l_xpekpo           = l_doc-xpekpo[]
            l_xeket            = l_doc-xeket[]
            l_xtkomv           = l_doc-xtkomv[]
            l_xekkn            = l_doc-xekkn[]
            l_xekek            = l_doc-xekek[]
            l_xkomk            = l_xkomk
       exceptions
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            others             = 5.
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
get SmartForm protocoll and store it in the NAST protocoll
    perform add_smfrm_prot.
  endif.
endform.
*eject
Auftragsbestatigungsmahnung
form entry_aufb using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  clear ent_retco.
  l_druvo = '7'.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
CALL FUNCTION 'ME_PRINT_PO'
      EXPORTING
           ix_nast        = l_nast
           ix_druvo       = l_druvo
           doc            = l_doc
           ix_screen      = ent_screen
           ix_from_memory = l_from_memory
           ix_toa_dara    = toa_dara
           ix_arc_params  = arc_params
      IMPORTING
           ex_retco       = ent_retco.
  if nast-adrnr is initial.
    perform get_addr_key changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
Fill up pricing condition table if calling from ME9F
  if l_doc-xtkomv is initial.
    select * into table l_doc-xtkomv from konv
    where knumv = l_doc-xekko-knumv.
  endif.
*Set the print Parameters
  perform set_print_param using    ls_addr_key
                          changing ls_control_param
                                   ls_composer_param
                                   ls_recipient
                                   ls_sender
                                   ent_retco.
*Get the Smart Form name.
  if not tnapr-sform is initial.
    lf_formname = tnapr-sform.
  else.
    lf_formname = tnapr-fonam.
  endif.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting
            formname           = lf_formname
       importing
            fm_name            = lf_fm_name
       exceptions
            no_form            = 1
            no_function_module = 2
            others             = 3.
  if sy-subrc <> 0.
error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
  call function lf_fm_name
       exporting
            archive_index      = toa_dara
            archive_parameters = arc_params
            control_parameters = ls_control_param
            mail_recipient     = ls_recipient
            mail_sender        = ls_sender
            output_options     = ls_composer_param
            zxekko             = l_doc-xekko  " user_settings = ' '
            zxpekko            = l_doc-xpekko
       tables
            l_xekpo            = l_doc-xekpo[]
            l_xekpa            = l_doc-xekpa[]
            l_xpekpo           = l_doc-xpekpo[]
            l_xeket            = l_doc-xeket[]
            l_xtkomv           = l_doc-xtkomv[]
            l_xekkn            = l_doc-xekkn[]
            l_xekek            = l_doc-xekek[]
            l_xkomk            = l_xkomk
       exceptions
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            others             = 5.
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
get SmartForm protocoll and store it in the NAST protocoll
    perform add_smfrm_prot.
  endif.
endform.
*eject
Lieferabrufdruck fur Formular MEDRUCK mit Fortschrittszahlen
form entry_lphe using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_xfz,
        l_doc   type meein_purchase_doc_print.
  clear ent_retco.
  l_druvo = '9'.
  l_xfz = 'X'.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
*Get the Smart Form name.
  if not tnapr-sform is initial.
    lf_formname = tnapr-sform.
  else.
    lf_formname = tnapr-fonam.
  endif.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = lf_formname
                variant            = ' '
                direct_call        = ' '
       importing  fm_name            = lf_fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.
  if sy-subrc <> 0.
  error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
move the value
  move-corresponding l_doc-xekko to l_zekko.
  move-corresponding l_doc-xpekko to l_xpekko.
  l_xekpo[] = l_doc-xekpo[].
  l_xekpa[] = l_doc-xekpa[].
  l_xpekpo[] = l_doc-xpekpo[].
  l_xeket[] = l_doc-xeket[].
  l_xtkomv[] = l_doc-xtkomv[].
  l_xekkn[] = l_doc-xekkn[].
  l_xekek[] = l_doc-xekek[].
*l_xaend[]    = l_doc-xaend[].
  call function lf_fm_name
    exporting
     archive_index              = toa_dara
  ARCHIVE_INDEX_TAB          =
     archive_parameters         = arc_params
     control_parameters         = ls_control_param
  MAIL_APPL_OBJ              =
     mail_recipient             = ls_recipient
     mail_sender                = ls_sender
     output_options             = ls_composer_param
     user_settings              = ' '
      zxekko                     = l_zekko
      zxpekko                    = l_xpekko
  l_xaend                    = l_xaend
   IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
    tables
      l_xekpo                    = l_xekpo
      l_xekpa                    = l_xekpa
      l_xpekpo                   = l_xpekpo
      l_xeket                    = l_xeket
      l_xtkomv                   = l_xtkomv
      l_xekkn                    = l_xekkn
      l_xekek                    = l_xekek
      l_xkomk                    = l_xkomk
   l_xaend                    = l_xaend
EXCEPTIONS
  FORMATTING_ERROR           = 1
  INTERNAL_ERROR             = 2
  SEND_ERROR                 = 3
  USER_CANCELED              = 4
  OTHERS                     = 5
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
    perform add_smfrm_prot.
  endif.
endform.
*eject
Lieferabrufdruck fur Formular MEDRUCK ohne Fortschrittszahlen
form entry_lphe_cd using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  clear ent_retco.
  l_druvo = '9'.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
  lf_formname = tnapr-fonam.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = lf_formname
                variant            = ' '
                direct_call        = ' '
       importing  fm_name            = lf_fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.
  if sy-subrc <> 0.
  error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
move the value
  move-corresponding l_doc-xekko to l_zekko.
  move-corresponding l_doc-xpekko to l_xpekko.
  l_xekpo[] = l_doc-xekpo[].
  l_xekpa[] = l_doc-xekpa[].
  l_xpekpo[] = l_doc-xpekpo[].
  l_xeket[] = l_doc-xeket[].
  l_xtkomv[] = l_doc-xtkomv[].
  l_xekkn[] = l_doc-xekkn[].
  l_xekek[] = l_doc-xekek[].
l_xaend[]    = l_doc-xaend[].
  call function lf_fm_name
    exporting
     archive_index              = toa_dara
  ARCHIVE_INDEX_TAB          =
     archive_parameters         = arc_params
     control_parameters         = ls_control_param
  MAIL_APPL_OBJ              =
     mail_recipient             = ls_recipient
     mail_sender                = ls_sender
     output_options             = ls_composer_param
     user_settings              = ' '
      zxekko                     = l_zekko
      zxpekko                    = l_xpekko
  l_xaend                    = l_xaend
   IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
    tables
      l_xekpo                    = l_xekpo
      l_xekpa                    = l_xekpa
      l_xpekpo                   = l_xpekpo
      l_xeket                    = l_xeket
      l_xtkomv                   = l_xtkomv
      l_xekkn                    = l_xekkn
      l_xekek                    = l_xekek
      l_xkomk                    = l_xkomk
   l_xaend                    = l_xaend
EXCEPTIONS
  FORMATTING_ERROR           = 1
  INTERNAL_ERROR             = 2
  SEND_ERROR                 = 3
  USER_CANCELED              = 4
  OTHERS                     = 5
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
    perform add_smfrm_prot.
  endif.
endform.
*eject
Feinabrufdruck fur Formular MEDRUCK mit Fortschrittszahlen
form entry_lpje using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_xfz,
        l_doc   type meein_purchase_doc_print.
  clear ent_retco.
  l_druvo = 'A'.
  l_xfz = 'X'.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
  lf_formname = tnapr-fonam.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = lf_formname
                variant            = ' '
                direct_call        = ' '
       importing  fm_name            = lf_fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.
  if sy-subrc <> 0.
  error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
move the value
  move-corresponding l_doc-xekko to l_zekko.
  move-corresponding l_doc-xpekko to l_xpekko.
  l_xekpo[] = l_doc-xekpo[].
  l_xekpa[] = l_doc-xekpa[].
  l_xpekpo[] = l_doc-xpekpo[].
  l_xeket[] = l_doc-xeket[].
  l_xtkomv[] = l_doc-xtkomv[].
  l_xekkn[] = l_doc-xekkn[].
  l_xekek[] = l_doc-xekek[].
l_xaend[]    = l_doc-xaend[].
  call function lf_fm_name
    exporting
     archive_index              = toa_dara
  ARCHIVE_INDEX_TAB          =
     archive_parameters         = arc_params
     control_parameters         = ls_control_param
  MAIL_APPL_OBJ              =
     mail_recipient             = ls_recipient
     mail_sender                = ls_sender
     output_options             = ls_composer_param
     user_settings              = ' '
      zxekko                     = l_zekko
      zxpekko                    = l_xpekko
  l_xaend                    = l_xaend
   IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
    tables
      l_xekpo                    = l_xekpo
      l_xekpa                    = l_xekpa
      l_xpekpo                   = l_xpekpo
      l_xeket                    = l_xeket
      l_xtkomv                   = l_xtkomv
      l_xekkn                    = l_xekkn
      l_xekek                    = l_xekek
      l_xkomk                    = l_xkomk
   l_xaend                    = l_xaend
EXCEPTIONS
  FORMATTING_ERROR           = 1
  INTERNAL_ERROR             = 2
  SEND_ERROR                 = 3
  USER_CANCELED              = 4
  OTHERS                     = 5
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
    perform add_smfrm_prot.
  endif.
endform.
*eject
Feinabrufdruck fur Formular MEDRUCK ohne Fortschrittszahlen
form entry_lpje_cd using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  clear ent_retco.
  l_druvo = 'A'.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
  lf_formname = tnapr-fonam.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = lf_formname
                variant            = ' '
                direct_call        = ' '
       importing  fm_name            = lf_fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.
  if sy-subrc <> 0.
  error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
move the value
  move-corresponding l_doc-xekko to l_zekko.
  move-corresponding l_doc-xpekko to l_xpekko.
  l_xekpo[] = l_doc-xekpo[].
  l_xekpa[] = l_doc-xekpa[].
  l_xpekpo[] = l_doc-xpekpo[].
  l_xeket[] = l_doc-xeket[].
  l_xtkomv[] = l_doc-xtkomv[].
  l_xekkn[] = l_doc-xekkn[].
  l_xekek[] = l_doc-xekek[].
l_xaend[]    = l_doc-xaend[].
  call function lf_fm_name
    exporting
     archive_index              = toa_dara
  ARCHIVE_INDEX_TAB          =
     archive_parameters         = arc_params
     control_parameters         = ls_control_param
  MAIL_APPL_OBJ              =
     mail_recipient             = ls_recipient
     mail_sender                = ls_sender
     output_options             = ls_composer_param
     user_settings              = ' '
      zxekko                     = l_zekko
      zxpekko                    = l_xpekko
  l_xaend                    = l_xaend
   IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
    tables
      l_xekpo                    = l_xekpo
      l_xekpa                    = l_xekpa
      l_xpekpo                   = l_xpekpo
      l_xeket                    = l_xeket
      l_xtkomv                   = l_xtkomv
      l_xekkn                    = l_xekkn
      l_xekek                    = l_xekek
      l_xkomk                    = l_xkomk
   l_xaend                    = l_xaend
EXCEPTIONS
  FORMATTING_ERROR           = 1
  INTERNAL_ERROR             = 2
  SEND_ERROR                 = 3
  USER_CANCELED              = 4
  OTHERS                     = 5
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
    perform add_smfrm_prot.
  endif.
endform.
*eject
  INCLUDE FM06PE02                                                   *
form entry_neu_matrix using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  clear ent_retco.
  if nast-aende eq space.
    l_druvo = '1'.
  else.
    l_druvo = '2'.
  endif.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
  lf_formname = tnapr-fonam.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = lf_formname
                variant            = ' '
                direct_call        = ' '
       importing  fm_name            = lf_fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.
  if sy-subrc <> 0.
  error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
move the value
  move-corresponding l_doc-xekko to l_zekko.
  move-corresponding l_doc-xpekko to l_xpekko.
  l_xekpo[] = l_doc-xekpo[].
  l_xekpa[] = l_doc-xekpa[].
  l_xpekpo[] = l_doc-xpekpo[].
  l_xeket[] = l_doc-xeket[].
  l_xtkomv[] = l_doc-xtkomv[].
  l_xekkn[] = l_doc-xekkn[].
  l_xekek[] = l_doc-xekek[].
l_xaend[]    = l_doc-xaend[].
  call function lf_fm_name
    exporting
     archive_index              = toa_dara
  ARCHIVE_INDEX_TAB          =
     archive_parameters         = arc_params
     control_parameters         = ls_control_param
  MAIL_APPL_OBJ              =
     mail_recipient             = ls_recipient
     mail_sender                = ls_sender
     output_options             = ls_composer_param
     user_settings              = ' '
      zxekko                     = l_zekko
      zxpekko                    = l_xpekko
  l_xaend                    = l_xaend
   IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
    tables
      l_xekpo                    = l_xekpo
      l_xekpa                    = l_xekpa
      l_xpekpo                   = l_xpekpo
      l_xeket                    = l_xeket
      l_xtkomv                   = l_xtkomv
      l_xekkn                    = l_xekkn
      l_xekek                    = l_xekek
      l_xkomk                    = l_xkomk
   l_xaend                    = l_xaend
EXCEPTIONS
  FORMATTING_ERROR           = 1
  INTERNAL_ERROR             = 2
  SEND_ERROR                 = 3
  USER_CANCELED              = 4
  OTHERS                     = 5
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
    perform add_smfrm_prot.
  endif.
endform.
*eject
Angebotsabsage
form entry_absa using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  l_druvo = '4'.
  clear ent_retco.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
  lf_formname = tnapr-fonam.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = lf_formname
                variant            = ' '
                direct_call        = ' '
       importing  fm_name            = lf_fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.
  if sy-subrc <> 0.
  error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
move the value
  move-corresponding l_doc-xekko to l_zekko.
  move-corresponding l_doc-xpekko to l_xpekko.
  l_xekpo[] = l_doc-xekpo[].
  l_xekpa[] = l_doc-xekpa[].
  l_xpekpo[] = l_doc-xpekpo[].
  l_xeket[] = l_doc-xeket[].
  l_xtkomv[] = l_doc-xtkomv[].
  l_xekkn[] = l_doc-xekkn[].
  l_xekek[] = l_doc-xekek[].
l_xaend[]    = l_doc-xaend[].
  call function lf_fm_name
    exporting
     archive_index              = toa_dara
  ARCHIVE_INDEX_TAB          =
     archive_parameters         = arc_params
     control_parameters         = ls_control_param
  MAIL_APPL_OBJ              =
     mail_recipient             = ls_recipient
     mail_sender                = ls_sender
     output_options             = ls_composer_param
     user_settings              = ' '
      zxekko                     = l_zekko
      zxpekko                    = l_xpekko
  l_xaend                    = l_xaend
   IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
    tables
      l_xekpo                    = l_xekpo
      l_xekpa                    = l_xekpa
      l_xpekpo                   = l_xpekpo
      l_xeket                    = l_xeket
      l_xtkomv                   = l_xtkomv
      l_xekkn                    = l_xekkn
      l_xekek                    = l_xekek
      l_xkomk                    = l_xkomk
   l_xaend                    = l_xaend
EXCEPTIONS
  FORMATTING_ERROR           = 1
  INTERNAL_ERROR             = 2
  SEND_ERROR                 = 3
  USER_CANCELED              = 4
  OTHERS                     = 5
  if sy-subrc <> 0.
    ent_retco = sy-subrc.
    perform protocol_update_i.
    perform add_smfrm_prot.
  endif.
endform.
*eject
Lieferplaneinteilung
form entry_lpet using ent_retco ent_screen.
  data: l_druvo like t166k-druvo,
        l_nast  like nast,
        l_from_memory,
        l_doc   type meein_purchase_doc_print.
  data: l_zekko like ekko,
        l_xpekko like pekko,
        l_xekpo like table of ekpo,
        l_wa_xekpo like ekpo.
  data: l_xekpa like ekpa occurs 0,
        l_wa_xekpa like ekpa.
  data: l_xpekpo  like pekpo occurs 0,
        l_wa_xpekpo like pekpo,
        l_xeket   like table of eket with header line,
        l_xekkn  like table of ekkn with header line,
        l_xekek  like table of ekek with header line,
        l_xekeh   like table of ekeh with header line,
        l_xkomk like table of komk with header line,
        l_xtkomv  type komv occurs 0,
        l_wa_xtkomv type komv.
  data: ls_addr_key           like addr_key.
  clear ent_retco.
  if nast-aende eq space.
    l_druvo = '5'.
  else.
    l_druvo = '8'.
  endif.
  call function 'ME_READ_PO_FOR_PRINTING'
       exporting
            ix_nast        = nast
            ix_screen      = ent_screen
       importing
            ex_retco       = ent_retco
            ex_nast        = l_nast
            doc            = l_doc
       changing
            cx_druvo       = l_druvo
            cx_from_memory = l_from_memory.
  check ent_retco eq 0.
  if nast-adrnr is initial.
    perform get_addr_key
                         changing ls_addr_key.
  else.
    ls_addr_key = nast-adrnr.
  endif.
  perform set_print_param using      ls_addr_key
                            changing ls_control_param
                                     ls_composer_param
                                     ls_recipient
                                     ls_sender
                                     ent_retco.
*Get the Smart Form name.
  if not tnapr-sform is initial.
    lf_formname = tnapr-sform.
  else.
    lf_formname = tnapr-fonam.
  endif.
determine smartform function module for invoice
  call function 'SSF_FUNCTION_MODULE_NAME'
       exporting  formname           = lf_formname
                variant            = ' '
                direct_call        = ' '
       importing  fm_name            = lf_fm_name
       exceptions no_form            = 1
                  no_function_module = 2
                  others             = 3.
  if sy-subrc <> 0.
  error handling
    ent_retco = sy-subrc.
    perform protocol_update_i.
  endif.
move the value
  move-corresponding l_doc-xekko to l_zekko.
  move-corresponding l_doc-xpekko to l_xpekko.
  l_xekpo[] = l_doc-xekpo[].
  l_xekpa[] = l_doc-xekpa[].
  l_xpekpo[] = l_doc-xpekpo[].
  l_xeket[] = l_doc-xeket[].
  l_xtkomv[] = l_doc-xtkomv[].
  l_xekkn[] = l_doc-xekkn[].
  l_xekek[] = l_doc-xekek[].
  call function lf_fm_name
    exporting
     archive_index              = toa_dara
  ARCHIVE_INDEX_TAB          =
     archive_parameters         = arc_params
     control_parameters         = ls_control_param
  MAIL_APPL_OBJ              =
     mail_recipient             = ls_recipient
     mail_sender                = ls_sender
     output_options             = ls_composer_param
     user_settings              = ' '
      zxekko                     = l_zekko
      zxpekko                    = l_xpekko
  l_xaend                    = l_xaend
   IMPORTING
  DOCUMENT_OUTPUT_INFO       =
  JOB_OUTPUT_INFO            =
  JOB_OUTPUT_OPTIONS         =
    tables
      l_xekpo                    = l_xekpo
      l_xekpa                    = l_xekpa
      l_xpekpo                   = l_xpekpo
      l_xeket                    = l_xeket
      l_xtkomv                   = l_xtkomv
      l_xekkn                    = l_xekkn
      l_xekek                    = l_xekek
      l_xkomk                    = l_xkomk
exceptions
   formatting_error           = 1
   internal_error             = 2

Similar Messages

  • How to read text in .kep files

    hey friends,
    how to read text in .kep files
    please help me .
    with regards,
    s.jagadeesh babu

    Hi,
    check this link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/8f/42a293e35011d29b340000e8a4b41d/content.htm
    .kep files are SapShow Training Files. They can be played with sapshow.exe in Knowledge Warehouse.
    SAP Show is KW Viewer Application. You can use it to see “Kep” files. It can be run in windows without the SAP environment. To run SAP Show (4.6D version) you just need 3 files. First is SAP show executable file, another two are “Sapstg.dll” and “ZLib.dll”. You can easily find these files on internet.
    Regards,
    Niraj

  • How to read text file line by line...?

    how to read text file line by line, but the linefeed is defined by user, return list of string, each line of file is a item of list?
    please help me.
    Thanks very much

    Brynjar wrote:
    In Groovy, you would do something like:
    linefeed = "\n" //or "\r\n" if the user chose so
    lines = new File('pathtofile').text.split("${linefeed}")This is one of the things that has always annoyed me about Sun's sdk, i.e. the lack of easy ways to do things like that. You always end up making your own utilities or use something like Apache's commons.io. Same goes for jdbc and xml - I'll wait for appropriate topics to show how easy that is in Groovy :)I generally agree, but what I really don't like about the Groovy text-file handling niceties: They don't care about encoding/always use the default encoding. And as soon as you want to specify the encoding, it gets a lot more complex (granted, it's still easier than in Java).

  • Step by Step"How JSP read text file :

    Hi ,
    Any one know or have a good site to show step by step how JSP read text file.
    TQ.

    There is no difference Between reading a text file from JSP and reading a text file from Java.
    Just follow the same steps for JSP also.

  • How to read text from a web page

    I want to read text from a web page. Can any body tell me how to do it.

    Ok i tell you detail. visit the site " http://seriouswheels.com/" you will a index from A to Z which are basically car name index i want to read each page get car name and its model and store it in data base. I you can provide me the code i will be very thankful.

  • How to read text file content in portal application?

    Hi,
    How do we read text file content in portal application?
    Can anyone forward the code to do do?
    Regards,
    Anagha

    Check the code below. This help you to know how to read the text file content line by line. You can display as you require.
    IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
    IResourceContext resourceContext = new ResourceContext(user);
    String filePath = "/documents/....";
    RID rid = RID.getRID(filePath);
    IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
    InputStream inputStream = resource.getContent().getInputStream();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    String line = reader.readLine();
    while(line!=null) {
          line = reader.readLine();
         //You can append in string buffer to get file content as string object//
    Regards,
    Yoga

  • How to read text file contain chinese character ?

    Hi XI Expert,
    I have scenario to read text file contain Chinese Character using sender file adapter. but every i was check from sxmb_moni all the chinese character looks different. and also the target file also i has changes.
    Please advise me how to maintaine the chinese character in PI 7.0 SP17.
    Thank You and Best Regards
    Fernand

    Hi,
    Refer these threads..
    Receiver file adapter corrupting characters
    Problem in converting special characters in input text file
    Here is one more useful guide..
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
    Regards,
    Sarvesh
    Edited by: Sarvesh Singh on Nov 17, 2008 3:47 PM

  • How to read text file?

    Dear Everyone
    I have coding below.
    {color:#3366ff}*Text file scores.txt*
    {color}1 1 1
    2 2 2
    *{color:#3366ff}Java class jtableone.class{color}*
    import javax.swing.*;
    public class jtableone extends JApplet {
    public static void main(String[] args) throws Exception {
    {color:#ff0000}//Read file scores.txt{color}
    java.io.File file = new java.io.File("scores.txt");
    Scanner input = new Scanner(file);
    while (input.hasNext()){
    String id = input.next();
    String firstname = input.next();
    String lastname = input.next();
    {color:#ff0000}//System.out.println(id +" "+ firstname +" "+ lastname);
    {color}}
    input.close();
    {color:#ff0000}//Crearte JTable{color}
    private String[] columNames =
    {"ID", "First Name", "Last Name"};
    private Object[][] data = {
    //{"12", "Tom", "Clark"},
    //{"13", "helen", "Tan"}
    {color:#ff0000}//Display JTable{color}
    private JTable jTable1 = new JTable(data, columNames);
    public jtableone(){
    add(new JScrollPane(jTable1));
    Can you tell me What i do next?
    Create a Object[][] data which can read text file.
    Thanks
    sevenlon

    sevenlon wrote:
    Can you tell me What i do next?How are we supposed to know? We have no knowledge of what your assignment is.
    Create a Object[][] data which can read text file.Then do that. Create the 2D array and store the data in it.
    Also when posting code use code tags. Paste code, highlight it and click CODE button.

  • How to read text from PDF and HTML

    I have got solution to read text form .txt file but did'nt get code for PDF and HTML.
    I dont want to convert PDF to txt.
    Please help me ...

    reading from a file is always the same. using the same strategy used for a .txt will allow you to read a .pdf file.
    Offcourse in itself it will be useless becuase pdf files have a special internal structure.
    html files are identical to txt files.
    What are you trying to accomplisch with the files you are reading ?

  • How to read text file efficiently?

    I use CharBuffer to read text file:
    private List<String> load() throws IOException {
            final String B = "<BODY>";
            final String E = "</BODY>";
            List<String> docs = new ArrayList<String>();
            for (File file : files) {
                FileReader reader = new FileReader(file);
                CharBuffer buffer = CharBuffer.allocate(BSIZE);
                StringBuilder sb = new StringBuilder();
                while (reader.read(buffer) != -1) {
                    char[] dst = new char[buffer.length()];
                    buffer.get(dst);
                    sb.append(dst);
                    buffer.clear();
                String s = sb.toString();
                System.out.println(file + ": " + s.length());
                int start = 0;
                int i, j;
                while ((i = s.indexOf(B, start)) != -1) {
                    j = s.indexOf(E, i + B.length());
                    docs.add(s.substring(i + B.length(), j));
                    start = j + E.length();
                    //System.out.printf("%d %d %d%n", i, j, start);
            return docs;
        }The file size is 1324350, but the code say it is 772802.
    What's wrong with this code?
    I want to read text file as quickly as possible.
    Is this code the right way to read file?
    Should I use FileReader or nio Channel and ByteBuffer?
    Any suggestions are welcome!

    You are reading the file as if it were encoded in UTF-16. Each character uses two bytes so you have half the number of characters as you had bytes.
    The following code reads an entire file in one hit.
        public static String readText(File file) throws IOException {
            byte[] bytes = new byte[(int) file.length()];
            DataInputStream dis = new DataInputStream(new FileInputStream(file));
            try {
                dis.readFully(bytes);
            } finally {
                dis.close();
            return new String(bytes, "UTF-8"); // or whatever your file encoding is.
        }But you can still have less characters than bytes if there are any non ASCII-7 characters.

  • HI,,,How to read text file from my emulators root

    hi friends,
    Actully i m having problem with file connection i.e. i cant read text file from my root of the emulator.....
    i have tried like this...
    plz help me out
    String uri = "file:///C:/WTK22/appdb/DefaultColorPhone/filesystem/root1/New Folder/main.txt";
    InputConnection conn = (InputConnection)Connector.open( uri,Connector.READ );
    InputStream in = conn.openInputStream();
    conn.close();
         for(int j=0;j<12;j++)
         ch=in.read();
         str.append((char)ch);
    par1=str.toString();
    in.close();
         screen4.append(par1);
         display.setCurrent(screen4);

    still its not working.........
    String uri = "file:///C:/WTK22/appdb/DefaultColorPhone/filesystem/root1/readme.txt";
                        FileConnection conn = (FileConnection)Connector.open( uri,Connector.READ);
                        InputStream in = conn.openInputStream();
                        conn.close();
                   String ss="";
                   String str1="";     
                   int ch=0;
                   byte b[]=new byte[753];     
                             ch=in.read(b,0,753);
                             str1= new String(b,0,ch);
                                  ss=str1.substring(493,501);                     
                        screen4.append(ss);
                        display.setCurrent(screen4);
                        }catch(IOException io){}

  • How to handle text of iframe to send to remote printer in client side?

    Hello everybody,
    I am having problem to handle the printing text of iframe to send to remote printer. I am using JDK 1.5, JSP and JBOSS. My clients have to print the information displayed in iframe to their remote Printer. I am using javascript code below to print:
    /* CODE IS IN JAVASCRIPT */
         document.frames[frameName].focus();
         document.frames[frameName].print(); But the main problem is that it takes a lot of times about 2 mins. Why is the above code taking so long time? Is it due to javascript code or the printing process? Is there any method or function to send printing text of iframe to printer faster?
    can anyone help me to solve this problem.....
    Thank You.
    Edited by: ritesh163 on Aug 20, 2008 2:45 PM

    ritesh163 wrote:
    Hello stevejluke,
    I am seeking for the suggestion whether it can be done through javascript or there is any other function or method in JSP that can replay javascript code and also work faster.
    Thank you.But JSP has nothing to do with it. JSP lives on the server, not the client. If can't control the client printer, can't know about it, and can't print to it. This is purely client-side, which means not JSP.

  • How to read text and it's font details (Family and size) using Acrobat plugin?

    Hello,
           I have query about reading PDF, I wanted to extract text and it's font details (Family and size) using Acrobat plugin. How can I achieve that?
    Any suggestions are welcome.
    Thanks
    Rohit Shinde

    Look at the samples in the SDK around PDFEdit and the PDEdit APIs.

  • How to read text in Production Memo tab of Production Order using READ_TEXT

    Hi all,
    Please help me, I was able to develop a program that using READ_TEXT function module to read the Production Order long text.
    Now my requirement is to read the text in the Production memo tabe of production order.
    Can some one tell mee how to do it? the same program is now not working.
    do i need to do any changes?

    Hi,
    TDOBJECT --> AUFK
    TDID -->KOPF
    IF your given same means it's correct i think check your coding
    i will give u sample coding analyze .
    REPORT  z_test1.
    TABLES:
      thead.
    PARAMETERS:
      p_vbeln TYPE vbak-vbeln.
    PARAMETERS:
      p_textid TYPE thead-tdid.
    DATA:
      BEGIN OF t_thead OCCURS 0.
            INCLUDE STRUCTURE thead.
    DATA:
    END OF t_thead.
    DATA:
      w_line TYPE i,
      w_idx TYPE i,
      w_flag TYPE i.
    DATA:
      BEGIN OF t_tline OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA:
    END OF t_tline.
    DATA:
      w_test TYPE thead-tdname,
      w_temp TYPE string VALUE 'TEST'.
    START-OF-SELECTION.
      w_test = p_vbeln.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          client                  = sy-mandt
          id                      = p_textid
          language                = sy-langu
          name                    = w_test
          object                  = 'VBBK'
        TABLES
          lines                   = t_tline
        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 NE 0.
        MESSAGE 'HEADER TEXT NOT FOUND' TYPE 'I'.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT t_tline.
        IF t_tline-tdline = w_temp.
          w_flag = 1.
        ENDIF.
      ENDLOOP.
      IF w_flag NE 1.
        t_tline-tdline = w_temp.
        APPEND t_tline.
      ENDIF.
      REFRESH t_thead.
      t_thead-tdobject = 'VBBK'.
      t_thead-tdname = w_test.
      t_thead-tdid =   p_textid.
      t_thead-tdspras = sy-langu.
      APPEND t_thead.
      CALL FUNCTION 'SAVE_TEXT'
        EXPORTING
          client          = sy-mandt
          header          = t_thead
          savemode_direct = 'X'
        TABLES
          lines           = t_tline
        EXCEPTIONS
          id              = 1
          language        = 2
          name            = 3
          object          = 4.
      IF sy-subrc NE 0.
        WRITE: / 'ERROR'.
      ELSE.
        COMMIT WORK.
        WRITE: / 'TEXT SAVED'.
      ENDIF.
      LOOP AT t_tline.
        WRITE: / t_tline-tdline.
      ENDLOOP.
    Regards
    swamy

  • How to read text file by clicking on text file ?

    Hello.. friends
    I have made a java editor. I want to pass file name to a function in application by clicking on particular text file.
    I assoiciated *.text file type with my application. when I click on text file application is run but I file is not read by my java application.
    For example : in windows System all text are oppened in notepad when we click on any text file.
    How to do this thing. please suggest me and if possible show me a sample code.
    Thanks

    If you are doing this in a web application you can set the content type appropriately and the file will open.
    If you are doing this standalone you can use the Java RunTime class and execute something like this as the command "notepad.exe c:\\myfile.txt" which should open it up on a Windows operating system.

Maybe you are looking for