Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Production order Text

Former Member
0 Kudos

Hi

Can Any One tel Abt how to replace the production order Long text with the appropriate sales order text

is there any sample program?

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Read the Sales order text with the appropriate parameters ,

TDNAME = '10chars vbeln value'.

TDID "Check this value once

TDOBJECT = 'VBBK' " if it is header , VBBP if it is item

Read the text using the READ_TEXT function. using the text , with the following parameters

TDNAME client(3)+ AUFNR(12)

TDID KOPF " for header

TDOBJECT AUFK

TEXT is sales orders text.

with this use SAVE_TEXT or CREATE_TEXT function and update.

9 REPLIES 9

former_member188685
Active Contributor
0 Kudos

Read the Sales order text with the appropriate parameters ,

TDNAME = '10chars vbeln value'.

TDID "Check this value once

TDOBJECT = 'VBBK' " if it is header , VBBP if it is item

Read the text using the READ_TEXT function. using the text , with the following parameters

TDNAME client(3)+ AUFNR(12)

TDID KOPF " for header

TDOBJECT AUFK

TEXT is sales orders text.

with this use SAVE_TEXT or CREATE_TEXT function and update.

0 Kudos

Hi Vijay

Thnk u

if u have any sample code canu send that

0 Kudos

Hi Surendra,

Check this sample code. This code is for fetching the sales order header text then adding your own text and then for saving it.


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

Abhijeet

0 Kudos

Hi

Thnk u for ur answer my requirement is retrive the all production orders for 1 sales order and change the long text in production order with the sales order items text

0 Kudos

Hi,

For that follow the approach told by Vijay.

0 Kudos

Hi

For that im getting errors

0 Kudos

What errors you are getting?

0 Kudos

Hi

I shows

TEXT sy-mandt+prodnum ID KOPF language E Not Found

0 Kudos

Hi Vijay

can u Plz tel the field name of long text in Production order