Application Development and Automation 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: 
Read only

Function module READ_TEXT in smartforms

former_member612655
Participant
2,540

Hi Experts,

I wanted to retrive long texts of terms of payment, terms of delivery, Dispatch Conditions, Warrenty, Technical Offer No, Packing Note, ld Clause, PVC, Industry Name into my smartform .Can you please provide program lines to retrive the long text of these fields by using Read_Text module.

Regards,

Bhavani.

1 ACCEPTED SOLUTION
Read only

Jelena_Perfiljeva
Active Contributor
2,404

There is no programming required to add such text to a Smartform. Smartforms have a special Text node that can be added to include such texts. Look at the standard form LB_BIL_INVOICE for an example, FOOTER window has a text node in it. The parameters for it would be pretty much the same as for READ_TEXT FM and can be either static values or variables.

(Tried to post a screenshot but for some reason it doesn't work at the moment.)

6 REPLIES 6
Read only

cdprasanna
Active Participant
2,404

hi,

you know SO10 object name or you are expecting that from here?

Read only

Former Member
2,404

..........

Read only

Sandra_Rossi
Active Contributor
2,404

You have hundreds of examples of "READ_TEXT" usage in the web (by the way it's always almost the same code because it's very simple). Or do you mean that your question is more about what codes (text objects and IDs) correspond to every type of text you mention?

The functional guys should provide test data, so it's easy to open the data via the standard transaction codes and do a SQL trace (ST05) and to retrieve the codes of long texts (SELECT on table STXH).

Read only

Jelena_Perfiljeva
Active Contributor
2,405

There is no programming required to add such text to a Smartform. Smartforms have a special Text node that can be added to include such texts. Look at the standard form LB_BIL_INVOICE for an example, FOOTER window has a text node in it. The parameters for it would be pretty much the same as for READ_TEXT FM and can be either static values or variables.

(Tried to post a screenshot but for some reason it doesn't work at the moment.)

Read only

0 Likes
2,404

I need to retrive all these corresponding long text.But in general atrributes tab ->text type->text include i am not getting these long text names etc can you please show me how to call all these text.when i used below code to retrive the texts but i didn't get any output


PARAMETERS : p_vbeln TYPE vbak-vbeln,

             p_kunnr type kna1-kunnr.

DATA : fname TYPE rs38l_fnam.



DATA:BEGIN OF i_vbak OCCURS 0,

     vbeln type VBELN_VF,

     END OF i_vbak.

DATA: lt_lines  TYPE STANDARD TABLE OF tline,

      wa_lines  TYPE tline.

DATA: ld_text(18) TYPE c.

*DATA: tdobname TYPE tdobname.

CONSTANTS: c_id TYPE thead-tdid VALUE  '0014',

                      c_object TYPE thead-tdobject VALUE 'VBBK'.

DATA: lv_name TYPE tdobname.



select vbeln from vbak into table i_vbak where vbeln eq p_vbeln.



loop at i_vbak.



read table i_vbak with key vbeln = i_vbak-vbeln.



endloop.



 lv_name = i_vbak-vbeln.



CALL FUNCTION 'READ_TEXT'

    EXPORTING

      id        = c_id

      language  = sy-langu

      name      = lv_name

      object    = c_object

*  IMPORTING

*    header    = ld_header

    TABLES

      lines     = lt_lines

    EXCEPTIONS

      id        = 1

      language  = 2

      name      = 3

      not_found = 4

      object    = 5.

    IF sy-subrc <> 0.

    ELSE.

      LOOP AT lt_lines INTO wa_lines.

        CONCATENATE ld_text wa_lines-tdline INTO ld_text.

      ENDLOOP.

    ENDIF.



CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

  EXPORTING

    formname                 = 'Z_SALE_ORDER1'

*   VARIANT                  = ' '

*   DIRECT_CALL              = ' '

 IMPORTING

   fm_name                  = fname

 EXCEPTIONS

   no_form                  = 1

   no_function_module       = 2

   OTHERS                   = 3

          .

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.



CALL FUNCTION fname

  EXPORTING

*   ARCHIVE_INDEX              =

*   ARCHIVE_INDEX_TAB          =

*   ARCHIVE_PARAMETERS         =

*   CONTROL_PARAMETERS         =

*   MAIL_APPL_OBJ              =

*   MAIL_RECIPIENT             =

*   MAIL_SENDER                =

*   OUTPUT_OPTIONS             =

*   USER_SETTINGS              = 'X'

    i_vbeln                    = p_vbeln

    i_kunnr                    = p_kunnr

* IMPORTING

*   DOCUMENT_OUTPUT_INFO       =

*   JOB_OUTPUT_INFO            =

*   JOB_OUTPUT_OPTIONS         =

 EXCEPTIONS

   formatting_error           = 1

   internal_error             = 2

   send_error                 = 3

   user_canceled              = 4

   OTHERS                     = 5

          .

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

PARAMETERS : p_vbeln TYPE vbak-vbeln,

             p_kunnr type kna1-kunnr.

DATA : fname TYPE rs38l_fnam.



DATA:BEGIN OF i_vbak OCCURS 0,

     vbeln type VBELN_VF,

     END OF i_vbak.

DATA: lt_lines  TYPE STANDARD TABLE OF tline,

      wa_lines  TYPE tline.

DATA: ld_text(18) TYPE c.

*DATA: tdobname TYPE tdobname.

CONSTANTS: c_id TYPE thead-tdid VALUE  '0014',

                      c_object TYPE thead-tdobject VALUE 'VBBK'.

DATA: lv_name TYPE tdobname.



select vbeln from vbak into table i_vbak where vbeln eq p_vbeln.



loop at i_vbak.



read table i_vbak with key vbeln = i_vbak-vbeln.



endloop.



 lv_name = i_vbak-vbeln.



CALL FUNCTION 'READ_TEXT'

    EXPORTING

      id        = c_id

      language  = sy-langu

      name      = lv_name

      object    = c_object

*  IMPORTING

*    header    = ld_header

    TABLES

      lines     = lt_lines

    EXCEPTIONS

      id        = 1

      language  = 2

      name      = 3

      not_found = 4

      object    = 5.

    IF sy-subrc <> 0.

    ELSE.

      LOOP AT lt_lines INTO wa_lines.

        CONCATENATE ld_text wa_lines-tdline INTO ld_text.

      ENDLOOP.

    ENDIF.



CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

  EXPORTING

    formname                 = 'Z_SALE_ORDER1'

*   VARIANT                  = ' '

*   DIRECT_CALL              = ' '

 IMPORTING

   fm_name                  = fname

 EXCEPTIONS

   no_form                  = 1

   no_function_module       = 2

   OTHERS                   = 3

          .

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.



CALL FUNCTION fname

  EXPORTING

*   ARCHIVE_INDEX              =

*   ARCHIVE_INDEX_TAB          =

*   ARCHIVE_PARAMETERS         =

*   CONTROL_PARAMETERS         =

*   MAIL_APPL_OBJ              =

*   MAIL_RECIPIENT             =

*   MAIL_SENDER                =

*   OUTPUT_OPTIONS             =

*   USER_SETTINGS              = 'X'

    i_vbeln                    = p_vbeln

    i_kunnr                    = p_kunnr

* IMPORTING

*   DOCUMENT_OUTPUT_INFO       =

*   JOB_OUTPUT_INFO            =

*   JOB_OUTPUT_OPTIONS         =

 EXCEPTIONS

   formatting_error           = 1

   internal_error             = 2

   send_error                 = 3

   user_canceled              = 4

   OTHERS                     = 5

          .

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.
Read only

2,404

bhavani123 - might want to remove the very long code fragment from the comment. It's mostly unreadable and is not relevant anyway.

You seem to be asking now what text IDs etc. you need for all these texts. For that, you'll need to ask a local functional consultant or do some research in your system. Every SAP customer can configure these texts differently, so it's simply impossible to get a correct answer on SCN for the question that is specific to your installation.

These details should've been part of your specification for the form, written by a functional consultant or a senior developer.