2007 Jun 06 7:33 AM
The following select statement of mine sometime picks up two invoice nos (more than one) for a single gate entry number.
SELECT INVOICE_NO GATE_ENTRY_NUM
INTO CORRESPONDING FIELDS OF TABLE I_ZFBPS_INV_LINK
FROM ZFBPS_INV_LINK
FOR ALL ENTRIES IN GATEIN_ITAB
WHERE GATE_ENTRY_NUM = GATEIN_ITAB-GATE_ENTRY_NUM.
Now when I try to modify my GATEIN_ITAB (main internal table) for the INVOICE_NO in the following manner the system encounters the two Invoice Nos against the Gate_Entry_Number in where clause and doesn't modify the table.
LOOP AT I_ZFBPS_INV_LINK.
LOOP AT GATEIN_ITAB WHERE GATE_ENTRY_NUM =
I_ZFBPS_INV_LINK-GATE_ENTRY_NUM.
GATEIN_ITAB-INVOICE_NO = I_ZFBPS_INV_LINK-INVOICE_NO.
MODIFY GATEIN_ITAB INDEX SY-TABIX.
ENDLOOP.
ENDLOOP.
I want both the invoice nos in my output against this gate entry number.
How to do this please advice.
Regards,
Alok.
you will need to modify the existing entry in your original table but insert duplicate entries for the subsequent enties.
Something like:
data l_index type sy-tabix.
LOOP AT I_ZFBPS_INV_LINK.
clear l_index.
LOOP AT GATEIN_ITAB WHERE GATE_ENTRY_NUM =
I_ZFBPS_INV_LINK-GATE_ENTRY_NUM.
add 1 to l_index.
GATEIN_ITAB-INVOICE_NO = I_ZFBPS_INV_LINK-INVOICE_NO.
first time for this gate entry....
if l_index = 1.
*...change original
MODIFY GATEIN_ITAB INDEX SY-TABIX.
else.
subsequent...insert duplicate
append gatein_itab.
endif.
ENDLOOP.
ENDLOOP.
2007 Jun 06 7:40 AM
you will need to modify the existing entry in your original table but insert duplicate entries for the subsequent enties.
Something like:
data l_index type sy-tabix.
LOOP AT I_ZFBPS_INV_LINK.
clear l_index.
LOOP AT GATEIN_ITAB WHERE GATE_ENTRY_NUM =
I_ZFBPS_INV_LINK-GATE_ENTRY_NUM.
add 1 to l_index.
GATEIN_ITAB-INVOICE_NO = I_ZFBPS_INV_LINK-INVOICE_NO.
first time for this gate entry....
if l_index = 1.
*...change original
MODIFY GATEIN_ITAB INDEX SY-TABIX.
else.
subsequent...insert duplicate
append gatein_itab.
endif.
ENDLOOP.
ENDLOOP.
2007 Jun 06 11:24 AM
hi ...
please use the condition when you want to modify it
SELECT INVOICE_NO GATE_ENTRY_NUM
INTO CORRESPONDING FIELDS OF TABLE I_ZFBPS_INV_LINK
FROM ZFBPS_INV_LINK
FOR ALL ENTRIES IN GATEIN_ITAB
WHERE GATE_ENTRY_NUM = GATEIN_ITAB-GATE_ENTRY_NUM.
LOOP AT I_ZFBPS_INV_LINK.
read table GATEIN_ITAB with key GATE_ENTRY_NUM = I_ZFBPS_INV_LINK-GATE_ENTRY_NUM
****just have if logic it will work
IF GATEIN_ITAB-INVOICE_NO = I_ZFBPS_INV_LINK-INVOICE_NO .
MODIFY GATEIN_ITAB INDEX SY-TABIX.
ENDIF .
ENDLOOP.
Reward points ...
girish
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |