Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Modifying contents of internal Table.

Hi all,

I am tryint to modify the contents of an internal table. This is the code I have written . But it doesn't work. However hard I try to debug and see the code it goes wromng when I reach the modify statement. I tried in many ways but couldn't suceed. Can anyone please help me ?

I am attaching my code too.

FORM get_values_into_t_item.

LOOP AT t_header.

SELECT posnr

vgbel

vgpos

matnr

arktx

prctr

fkimg

vrkme

brgew

gewei

netwr INTO CORRESPONDING FIELDS OF TABLE t_item

FROM vbrp

WHERE vbeln EQ t_header-vbeln AND

vgbel IN s_vgbel AND

matnr IN s_matnr AND

arktx IN s_arktx AND

prctr IN s_prctr AND

fkimg IN s_fkimg AND

vrkme IN s_vrkme AND

brgew IN s_brgew AND

gewei IN s_gewei AND

netwr IN s_netwr.

ENDLOOP.

clear t_item.

LOOP AT t_item.

SELECT SINGLE vbeln

FROM lips INTO w_vbeln

WHERE vbeln EQ t_item-vgbel AND

posnr EQ t_item-vgpos .

IF sy-subrc EQ 0.

SELECT SINGLE tknum

FROM vttp INTO w_tknum

WHERE vbeln EQ w_vbeln.

IF sy-subrc EQ 0.

SELECT tknum

exti1

dtabf INTO CORRESPONDING FIELDS OF TABLE t_item

FROM vttk

WHERE tknum = w_tknum.

  • MODIFY t_item from t_item.

ENDIF.

ENDIF.

MODIFY t_item.

ENDLOOP.

ENDFORM. " get_values_into_t_item

Thanks and Regards,

Varun.

Tags:
Former Member
replied

This would work definitely:

<b>The problem with your earlier code is that in the last select you have use the INTO CORRESPONDING FIELDS OF TABLE statement .

This would get the values into the table directly,whereas our aim is to get that values into the header first and then use modify statement.</b>

FORM get_values_into_t_item.

LOOP AT t_header.

SELECT posnr

vgbel

vgpos

matnr

arktx

prctr

fkimg

vrkme

brgew

gewei

netwr INTO CORRESPONDING FIELDS OF TABLE t_item

FROM vbrp

WHERE vbeln EQ t_header-vbeln AND

vgbel IN s_vgbel AND

matnr IN s_matnr AND

arktx IN s_arktx AND

prctr IN s_prctr AND

fkimg IN s_fkimg AND

vrkme IN s_vrkme AND

brgew IN s_brgew AND

gewei IN s_gewei AND

netwr IN s_netwr.

ENDLOOP.

clear t_item.

LOOP AT t_item.

SELECT SINGLE vbeln

FROM lips INTO w_vbeln

WHERE vbeln EQ t_item-vgbel AND

posnr EQ t_item-vgpos .

IF sy-subrc EQ 0.

SELECT SINGLE tknum

FROM vttp INTO w_tknum

WHERE vbeln EQ w_vbeln.

IF sy-subrc EQ 0.

SELECT single tknum

exti1

dtabf <b>INTO ( t_item-tknum , t_item-exti1 , t_item-dtabf )</b>

FROM vttk

WHERE tknum = w_tknum.

MODIFY t_item from t_item.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. " get_values_into_t_item

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question