cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform PO Text Problem.

former_member212002
Active Contributor
0 Kudos

Hello Experts,

I have got a smartform where i have to print the PO text according to Material number.

Now my PO text is getting displayed in the screen but the text is not according to the material number.

If there are three materials, then the PO text of third material is getting displayed on all the three materials.


LOOP AT it_ekpo.
    SELECT SINGLE eindt FROM eket
    INTO it_ekpo-eindt
    WHERE ebeln = it_ekpo-ebeln
    AND   ebelp = it_ekpo-ebelp.
    MODIFY it_ekpo TRANSPORTING eindt.
    CONCATENATE it_ekpo-ebeln it_ekpo-ebelp INTO it_ekpo-item.
    SELECT SINGLE submi FROM ekko
    INTO it_ekpo-submi
    WHERE ebeln = it_ekpo-anfnr.
    MODIFY it_ekpo TRANSPORTING submi.
    l_desc = ''.
    REFRESH t_line.
    CLEAR wa_line.
    SELECT SINGLE ebeln ebelp FROM ekpo
                       INTO it_temp
                       WHERE ebeln = it_temp-ebeln.
    IF sy-subrc EQ 0.
      MOVE it_temp-ebeln TO l_ebeln1.
      MOVE it_temp-ebelp TO t_ebelp.
    ENDIF.
    CONCATENATE l_ebeln1 t_ebelp  INTO l_key.
    l_matnr1 = l_key.

    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        client                        = sy-mandt
        id                            = 'F03'
        language                      = 'E'
        name                          = l_matnr1
        object                        = 'EKPO'
*         ARCHIVE_HANDLE                = 0
*         LOCAL_CAT                     = ' '
*       IMPORTING
*         HEADER                        =
      TABLES
        lines                         = t_line
     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 <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    LOOP AT t_line INTO wa_line.
      IF l_desc IS INITIAL.
        l_desc = wa_line-tdline.
      ELSEIF l_desc IS NOT INITIAL.
        CONCATENATE l_desc wa_line-tdline INTO l_desc SEPARATED BY space.
      ENDIF.
    ENDLOOP.

How can i solve this problem,

Any kind of inputs or help will be really appreciated.

Regards,

Abhinab Mishra

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member212002
Active Contributor
0 Kudos

Well the solution was pretty simple.

Just a program lines with code getting data from FM Read_text, before the include text in form.

Thank you all for your replies and time.

former_member212002
Active Contributor
0 Kudos

Can anyone put some more light into this please.

Former Member
0 Kudos

Hi

The Problem which i find is that u r not appending the Texts into the internal table T_LINE..

Since U r using LOOP AT it_ekpo.

and then calling READ_TEXT for each line item

endloop .

but ultimately uR internal table T_LINE will have the last Line Item Text in it, so change the logic . what u can do use this IT_ekpo in the Smartform Loop and for each line item display the Text.

instead of writing in ur Driver program . ok

surya

former_member212002
Active Contributor
0 Kudos

Hi Surya,

Thank you for your valuable suggestion.

But I want my print program to throw the text, so can you please be more elaborative on that case and help me over come this,

because when i append the text in itab t_line it throws a short dump saying Size exceeded.

Thanks in ADV

Regards,

Abhinab

Former Member
0 Kudos

Hi Abhinav,

You can create program lines in your smartform in your table where you are displaying you line item data get the text using your code and then pass the value of text to the variable that you are using for printing other way would be to use include text in smartforms so for every loop you would get the correct text.

Regards,

Himanshu

Former Member
0 Kudos

Hi,

As far I understand the texts you are printing is the texts in the PO for each item.

And u r doing only select single where you get the single record.

AND though the name is same the textids vary so

Instead follow the below procedure

all the Texts will be stored in the STXH and STXL tables.

the name will be ur PO number and PO number combined with Item number

so fetch the all the data from STXH table with TDNAME as ur PO number

write as below

concatenate % po num %.

and the name looks like LV_NAME = % urpo num % ( EXAMPLE %12345678% )

select ........

from stxh......

where TDNAME like lv_name.

then loop the table in above select query and u can proceed as required.

in the above table you have all the details for paramaters to be passed to READ_TEXT fm

or u can use texts in smartform and change the type as include text and pass the data accordingly

hope I am clear

revert if any dbts