cancel
Showing results for 
Search instead for 
Did you mean: 

How to move value to other internal table.?

former_member635273
Participant
0 Kudos
 move: wa_item-venum to wa_count-lv_packno,
            1 to wa_count-lv_count.
            COLLECT wa_count INTO it_count.

      wa_item-total = wa_item-vemng * wa_item-netpr.
      APPEND wa_item TO it_item.
    ENDLOOP.

This value when i debug.

I want to move value lv_count to column PKG QTY.

I confuse how to do it.

Sandra_Rossi
Active Contributor
0 Kudos

It seems illogical to "move value LV_COUNT to column PKG QTY". A counter is usually not a quantity (except if the quantity is related to a unit of measure which is "number of pieces").

From what I understand right now (but I probably don't understand well), if you start from WA_COUNT and the other internal table is named GT_ZTBL_ITEM, it would be something like that:

gt_ztbl_item[ pkg_no = wa_count-lv_packno ]-pkg_qty = wa_count-lv_count.
former_member635273
Participant
0 Kudos

i still confuse. actually i want to fill column pkg qty with count of record that have same pkg_no.

former_member635273
Participant
0 Kudos

like this

Sandra_Rossi
Active Contributor
0 Kudos

I guess you want to aggregate the lines too, right?

former_member635273
Participant
0 Kudos

yes. do you have idea how to solve it?

Accepted Solutions (0)

Answers (2)

Answers (2)

dev_parbutteea
Active Contributor
0 Kudos

Something like this should work:

you need to have same field number in table it_count and GT_ZTBL_ITEM. let's say pkg_qty.

loop at it_count into wa_count

MODIFY GT_ZTBL_ITEM from wa_count where pkg_no = wa_count-lv_packno TRANSPORTING pkg_qty.

endloop.

former_member635273
Participant
0 Kudos
  LOOP AT it_res.
      MOVE-CORRESPONDING it_res TO wa_item.

        move: wa_item-venum to wa_count-lv_packno,
              1 to wa_count-lv_count.
              COLLECT wa_count INTO it_count.

           
      wa_item-total = wa_item-vemng * wa_item-netpr.
      APPEND wa_item TO it_item.
    ENDLOOP.
former_member635273
Participant
0 Kudos

that's my looping code. i want to append value of lv_count to wa_item-pkgqty. base on same pkgno.

dev_parbutteea
Active Contributor
0 Kudos

You have to put your code after the loop at it_res.

you need to have same field number in table it_count and it_res. let's say pkg_qty.

loop at it_count into wa_count

MODIFY it_item from wa_count where pkg_no = wa_count-lv_packno TRANSPORTING pkg_qty.

endloop.


former_member635273
Participant
0 Kudos

i get error.

dev_parbutteea
Active Contributor
0 Kudos

my mistake, put where clause at the end after transporting..

example : MODIFY GT_ZTBL_ITEM from wa_count TRANSPORTING pkg_qty where pkg_no = wa_count-lv_packno

.

former_member635273
Participant
0 Kudos

i hve tried like that, but still error.

you know why?

dev_parbutteea
Active Contributor
0 Kudos

please paste your code..

former_member635273
Participant
0 Kudos
TYPES : BEGIN OF ty_count,
           lv_packno(10) TYPE c,
           venum TYPE ztblzpsi_item-venum,
           packqty TYPE ztblzpsi_item-packqty,
           lv_count      TYPE i,
         END OF ty_count.

LOOP AT it_res.
      MOVE-CORRESPONDING it_res TO wa_item.

      MOVE: wa_item-venum TO wa_count-lv_packno,
            1 TO wa_count-lv_count.
      COLLECT wa_count INTO it_count.

      wa_item-total = wa_item-vemng * wa_item-netpr.
      APPEND wa_item TO it_item.
 ENDLOOP.

    LOOP AT it_count INTO wa_count.
      MODIFY it_item FROM wa_count  TRANSPORTING packqty WHERE venum = wa_count-lv_packno.
    ENDLOOP.

Himayatullah
Active Participant
0 Kudos

Hello,

what is the DB table which has PKG Qty column?

You can create an internal table corresponding to the above PKG Qty table and then map your count value for each PKG No in the PKG Qty field and update the same.

Regards

Himayat

former_member635273
Participant
0 Kudos

table is ZTBL_ITEM.