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

alv grid

Former Member
0 Likes
708

Hi,

I am tryimng to pick up the text from VA)2.

This is my code can any body let me know where I have done the mistake, actually when ever ,my user entering some text in va02 in trasit insurance, at that time all the input text should display inmy alv grid report.

here is my code

inv is the invoice number.

on the basis of invoice number the transitory insurance should come to my alv grid report.

NAME1 = WA_ORD-INV.
        SELECT SINGLE * FROM STXH
            INTO CORRESPONDING FIELDS OF STXH
            WHERE TDOBJECT = 'VBBK'
            AND   TDNAME   =  NAME1
            AND   TDID     = 'Z036'
            AND   TDSPRAS  = SY-LANGU.
        IF SY-SUBRC EQ 0.
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
              CLIENT   = SY-MANDT
              ID       = 'Z036'
              LANGUAGE = SY-LANGU
              NAME     = NAME1
              OBJECT   = 'VBBK'
            TABLES
              LINES    = XTLINE.
          READ TABLE XTLINE INDEX 1.
          CONDENSE XTLINE-TDLINE.
          WA_ORD-TRANSIT = XTLINE-TDLINE.
          CLEAR: XTLINE[], XTLINE, STXH.
        ENDIF.

Moderator message: please use more descriptive subject lines and code tags from now on.

Edited by: Thomas Zloch on Aug 26, 2010 3:19 PM

Hi,

I am tryimng to pick up the text from VA)2.

This is my code can any body let me know where I have done the mistake, actually when ever ,my user entering some text in va02 in trasit insurance, at that time all the input text should display inmy alv grid report.

here is my code

inv is the invoice number.

on the basis of invoice number the transitory insurance should come to my alv grid report.

NAME1 = WA_ORD-INV.
        SELECT SINGLE * FROM STXH
            INTO CORRESPONDING FIELDS OF STXH
            WHERE TDOBJECT = 'VBBK'
            AND   TDNAME   =  NAME1
            AND   TDID     = 'Z036'
            AND   TDSPRAS  = SY-LANGU.
        IF SY-SUBRC EQ 0.
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
              CLIENT   = SY-MANDT
              ID       = 'Z036'
              LANGUAGE = SY-LANGU
              NAME     = NAME1
              OBJECT   = 'VBBK'
            TABLES
              LINES    = XTLINE.
          READ TABLE XTLINE INDEX 1.
          CONDENSE XTLINE-TDLINE.
          WA_ORD-TRANSIT = XTLINE-TDLINE.
          CLEAR: XTLINE[], XTLINE, STXH.
        ENDIF.

Moderator message: please use more descriptive subject lines and code tags from now on.

Edited by: Thomas Zloch on Aug 26, 2010 3:19 PM

5 REPLIES 5
Read only

Former Member
0 Likes
673

Hi

Use the function module read_text.

Ragards,

Raghu.

Read only

0 Likes
673

Hi Raghu,

I have already used the function module, I have laso provided the code.

But unable to find out where I am missing, so that unable to pick up the text.

Read only

0 Likes
673

Hi,

Read_text fm is used to get text from sap and place that text into the our internal table. we get the data in internal table and place this data in sap script..etc.

Ex:

If u want get text written sales order item level. Use the follwing

code:

The Object field what we given in Read_text FM varied from header level and item level.

DATA : name TYPE thead-tdname,
g_tline TYPE TABLE OF tline WITH HEADER LINE,
it_vbap TYPE TABLE OF vbap WITH HEADER LINE.

vbeln = vbak-vbeln.
select * from vbap into
table it_vbap where vbeln = vbeln.


CONCATENATE vbeln it_vbap-posnr INTO name.
CONDENSE name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'Z001'
language = sy-langu
name = name
object = 'VBBP'
TABLES
lines = g_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 0.


MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO 
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. 
ENDIF.

CALL FUNCTION 'FORMAT_TEXTLINES'
EXPORTING
cursor_column = 0
cursor_line = 0
endline = 99999
formatwidth = 45
linewidth = 45
startline = 1
language = sy-langu

IMPORTING 
NEW_CURSOR_COLUMN = 
NEW_CURSOR_LINE = 
TABLES
lines = g_tline

EXCEPTIONS 
BOUND_ERROR = 1 
OTHERS = 2 
.
IF sy-subrc 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO 
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. 
ENDIF.

g_tline : having text data in salesorder item level.

Whatever data we got is not properly formated. U can format the data using the FM:Format_Textlines

The Object field in Read_text FM Stores in table:TTXOB.

U see the function module documentation for the Read_text fm.

Finding parameters to pass in read_text fm:

U can go to va02,

give sales order number,

click on item number,

goto the Texts tab.

One big box is there. Place the cursor and double click

select the Goto menu/ Header .

If select the item Header.

It will shows thew Text name , Language,Text id and Text object.

May it helps you.

Furthermore variety of question has been asked on this topic.

Please search for that.

Regards,

DS.

Read only

0 Likes
673

Hi Deepak,

What you have told here is for item data, I am fetching the text from header data.

I went to VA02 and then there i have done all the thing s you have told me ,

Only the problem is with me is I ma not getting the text in my ALV Grid out put in my transi insurance.

Can you identify where I ahave done wrong.

ok this is include decalration

types: TRANSIT TYPE CHAR20, " Transit Insurrance

INV TYPE VBRK-VBELN, " INVOICE

data: it_itab is the internal table and wa_ord is my work area

DATA: NAME1 TYPE THEAD-TDNAME.

Now this is my main program.

NAME1 = WA_ORD-INV.

SELECT SINGLE * FROM STXH

INTO CORRESPONDING FIELDS OF STXH

WHERE TDOBJECT = 'VBBK'

AND TDNAME = NAME1

AND TDID = 'Z036'

AND TDSPRAS = SY-LANGU.

IF SY-SUBRC EQ 0.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z036'

LANGUAGE = SY-LANGU

NAME = NAME1

OBJECT = 'VBBK'

TABLES

LINES = XTLINE.

READ TABLE XTLINE INDEX 1.

CONDENSE XTLINE-TDLINE.

WA_ORD-TRANSIT = XTLINE-TDLINE.

CLEAR: XTLINE[], XTLINE, STXH.

ENDIF.

Read only

0 Likes
673

Hi Deepak,

I went to the debugging mod ewhen I debugged I found that my data is in the work areas but when I checked in the internal table in debug mode, on those field s there are no data.

can will you be let me know what went wrong. So that I could able to resolve the issue.

Thanks in Advance.