Skip to Content
author's profile photo Former Member
Former Member

regarding read_text

hi

iam using read_text FM to pass text to script

iam facing problem regarding tdname

tdname is the combination of RFQ no and ITEM NO

but in my sap script only one text is repeating i.e of first line item 60000006950010 i.e JET TYPE to other line item also where text is different for other line item i.e for 60000006950020 and 60000006950030

so my question how to pass this different combination of RFQ no and ITEM NO

to tdname

here is my coding pls chechk whether it is correct

REPORT ZLALI.

tables : ekko,ekpo.

data: begin of itab occurs 0,

ebeln like ekko-ebeln,

aedat like ekko-aedat,

angdt like ekko-angdt,

lifnr like ekko-lifnr,

bsart like ekko-bsart,

matnr like ekpo-matnr,

ebelp like ekpo-ebelp,

maktx like makt-maktx,

ktmng like ekpo-ktmng,

lmein like ekpo-lmein,

TXZ01 like ekpo-TXZ01,

name1 like lfa1-name1,

adrnr like lfa1-adrnr,

telf1 like lfa1-telf1,

telfx like lfa1-telfx,

WERKS LIKE EKPO-WERKS,

EINDT LIKE EKET-EINDT,

LINESX LIKE TLINE-TDLINE,

  • TDNAME like stxh-tdname,

*

end of itab.

data : begin of itab1 occurs 0,

TDOBJECT like STXH-TDOBJECT,

tdname like stxh-tdname,

tdid like stxh-tdid,

end of itab1.

data: testfld like thead,

li like tline-tdline,

tdname like thead-tdname.

data: begin of linesx occurs 0.

include structure tline.

DATA: end of linesx.

******************************************************************************************

selection-screen : begin of block b1 with frame title text-001.

select-options: ebeln for ekko-ebeln,

lifnr for ekko-lifnr,

werks for ekpo-werks.

selection-screen:end of block b1.

******************************************************************************************

select ebeln lifnr aedat angdt

into (itab-ebeln,itab-lifnr,itab-aedat,itab-angdt)

from ekko

where ebeln in ebeln

and lifnr in lifnr

and bsart = 'AN'

and ekorg in ('9600','9500')

and ekgrp in ('951','952','953','954','955','956','957','961','962','964','965','966').

select ebeln matnr ebelp ktmng lmein aedat werks TXZ01 into (ITAB-ebeln ,ITAB-matnr,ITAB-ebelp,ITAB-ktmng,ITAB-lmein,ITAB-aedat,itab-werks,itab-TXZ01)

from ekpo

where ebeln in ebeln

and werks in werks.

select single maktx into ITAB-maktx

from makt

where matnr = ITAB-matnr.

select LIFNR name1 adrnr telf1 telfx into (itab-lifnr,itab-name1,itab-adrnr,itab-telf1,ITAB-telfx)

from lfa1

where lifnr in lifnr.

SELECT SINGLE EINDT INTO ITAB-EINDT

FROM EKET

WHERE EBELN in EBELN.

append ITAB.

clear : ITAB.

endselect.

endselect.

endselect.

LOOP AT ITAB.

concatenate ITAB-ebeln ITAB-ebelp into TDNAME.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

id = 'A01'

language = 'E'

name = TDNAME

object = 'EKPO'

IMPORTING

HEADER = TESTFLD

tables

lines = linesx

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.

ENDIF.

ENDLOOP.

LOOP AT LINESX.

ITAB-linesx = LINESX-TDLINE.

ENDLOOP.

*

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'ZLALIT'

LANGUAGE = SY-LANGU.

LOOP AT ITAB.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'IT2'

WINDOW = 'MAIN'

.

IF sy-subrc <> 0.

ENDIF.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM' .

IF sy-subrc <> 0.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06:57 AM

    Hi Lalith,

    Use the following code.

    loop at itab.

    PERFORM read_txt USING 'A01'.

    endloop.

    &----


    *& Form read_txt

    &----


    • text

    ----


    • -->P_0980 text

    ----


    FORM read_txt USING p_l_tid.

    data: t_name type tdname.

    REFRESH tlines1.

    clear t_name.

    concatenate ITAB-ebeln ITAB-ebelp into T_NAME

    CALL FUNCTION 'READ_TEXT'

    EXPORTING

    client = sy-mandt

    id = p_l_tid

    language = 'E'

    name = t_name

    object = 'EKPO'

    TABLES

    lines = tlines1

    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.

    flag = 1.

    ELSEIF sy-subrc = 0.

    flag = 0.

    LOOP AT tlines1 INTO wa_line1.

    t_long_text-tdobname = p_l_tid.

    t_long_text-tdline = wa_line1-tdline.

    APPEND t_long_text.

    ENDLOOP.

    ENDIF.

    pass t_long_text in script.

    It will be helpfull to u.

    If helpfull do reward.

    Regards

    Srimanta

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.