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

Modify Table

Former Member
0 Likes
911

Hi,

I have to update the table gt_zprice with created CreditMemo. I tried the following two ways, but nothing is working. Please guide me if I am doing something wrong here.

Thanks,

Neelu.

READ TABLE gt_zprice INTO gs_zprice.

IF sy-subrc EQ 0.

gs_zprice-crmemo = salesdocument.

MODIFY TABLE gt_zprice FROM gs_zprice

TRANSPORTING crmemo.

ENDIF.

READ TABLE gt_zprice INTO gs_zprice.

IF sy-subrc EQ 0.

gs_zprice-crmemo = salesdocument.

MODIFY TABLE gt_zprice FROM gs_zprice

TRANSPORTING mandt vkorg vtweg spart kunnr matnr crdate efdate

sprice eprice eohqty aohqty auart bstkd werks augru

xblnr crmemo.

ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
874

Hi,

Try this..


.................
DATA: v_tabix TYPE sytabix.

LOOP AT gt3_zprice INTO ls_zprice.
READ TABLE gt_zprice INTO gs_zprice INDEX ls_zprice-index.
IF sy-subrc EQ 0.

v_tabix = sy-tabix.

gs_zprice-crmemo = salesdocument.
MODIFY gt_zprice FROM gs_zprice INDEX v_tabix TRANSPORTING crmemo.

Thanks

Naren

7 REPLIES 7
Read only

Former Member
0 Likes
874

check this

READ TABLE gt_zprice INTO gs_zprice.

IF sy-subrc EQ 0.

gs_zprice-crmemo = salesdocument.

<b>MODIFY gt_zprice FROM gs_zprice

TRANSPORTING crmemo index sy-tabix.</b>

ENDIF.

Mahesh

Message was edited by:

I Can Solve It

Read only

Former Member
0 Likes
874

Try this way.

<b>DATA: v_index TYPE i.</b>

READ TABLE gt_zprice INTO gs_zprice.

IF sy-subrc EQ 0.

<b>v_index = sy-tabix.</b>

gs_zprice-crmemo = salesdocument.

MODIFY TABLE gt_zprice FROM gs_zprice

TRANSPORTING crmemo <b>INDEX v_index.</b>

ENDIF.

Read only

former_member194669
Active Contributor
0 Likes
874

Hi,

While reading gt_zprice wht will be key?


READ TABLE gt_zprice INTO gs_zprice with key <<< you need to mention>>.
IF sy-subrc EQ 0.
gs_zprice-crmemo = salesdocument.
MODIFY TABLE gt_zprice FROM gs_zprice 
  TRANSPORTING crmemo index sy-tabix. 
ENDIF.

aRs

Message was edited by:

a®

Read only

Former Member
0 Likes
874

sorry small change

READ TABLE gt_zprice INTO gs_zprice.

IF sy-subrc EQ 0.

gs_zprice-crmemo = salesdocument.

<b>MODIFY gt_zprice FROM gs_zprice index sy-tabix

TRANSPORTING crmemo .</b>

ENDIF.

Read only

0 Likes
874

Hi,

I tried all the ways but I am getting error saying 'No Component exists with name INDEX.' Please correct me if I am doing something wrong.

FORM update_pricetable.

DATA: ls_zprice TYPE ty_zprice.

LOOP AT gt3_zprice INTO ls_zprice.

READ TABLE gt_zprice INTO gs_zprice INDEX ls_zprice-index.

IF sy-subrc EQ 0.

gs_zprice-crmemo = salesdocument.

MODIFY TABLE gt_zprice FROM gs_zprice

transporting crmemo.

ENDIF.

ENDLOOP.

REFRESH:gt3_zprice.

ENDFORM. " update_pricetable

gt3_zprice contains few records of the table where CRMEMO has to be placed.

TYPES: BEGIN OF ty_zprice,

mandt TYPE mandt,

vkorg TYPE vkorg,

vtweg TYPE vtweg,

spart TYPE spart,

kunnr TYPE kunnr,

matnr TYPE matnr,

crdate TYPE zcrdate,

efdate TYPE zefdate,

sprice TYPE zprice3,

eprice TYPE zprice4,

eohqty TYPE zquantity1,

aohqty TYPE zquantity2,

auart TYPE auart,

bstkd TYPE bstkd,

werks TYPE werks_d,

augru TYPE augru,

xblnr TYPE xblnr,

crmemo TYPE vbeln,

index TYPE sy-index,

END OF ty_zprice.

Thanks,

Neelu.

Read only

Former Member
0 Likes
875

Hi,

Try this..


.................
DATA: v_tabix TYPE sytabix.

LOOP AT gt3_zprice INTO ls_zprice.
READ TABLE gt_zprice INTO gs_zprice INDEX ls_zprice-index.
IF sy-subrc EQ 0.

v_tabix = sy-tabix.

gs_zprice-crmemo = salesdocument.
MODIFY gt_zprice FROM gs_zprice INDEX v_tabix TRANSPORTING crmemo.

Thanks

Naren

Read only

0 Likes
874

Thank you Naren. It is displaying the CreditMemo number now.

I really appriciate your help.

Regards,

Neelu.