‎2007 Jan 03 2:07 AM
Hi,
I have an internal table, the structure are
TYPES: BEGIN OF T_LIST_DATA,
EBELN TYPE EKKO-EBELN, "Purchasing Document Number(10)
EBELP TYPE EKPO-EBELP, "Item# of Purchasing Document(5)
EMATN TYPE EKPO-EMATN, "Material number(18)
MENGE TYPE EKPO-MENGE, "Purchase order quantity(13)
MEINS TYPE EKPO-MEINS, "Order Unit(3)
TXZ01 TYPE EKPO-TXZ01, "Material Text(40)
NAME1 TYPE LFA1-NAME1, "Vendor Name(35)
BANFN TYPE EKET-BANFN, "Purchase requisition number(10)
END OF T_LIST_DATA.
DATA: GT_LIST_DATA TYPE T_LIST_DATA OCCURS 0 WITH HEADER LINE.
For the first query, i will select all the fields from table of EKPO and LFA1 except BANFN
SELECT ... from ekpo inner join lfa1 on... INTO TABLE GT_LIST_DATA
Currently i facing a problem, i don't know how to update the field of BANFN of GT_LIST_DATA, the data will get from another query. Thanks!
‎2007 Jan 03 2:11 AM
You could loop at the internal table and do the select query inside, then modify it.
Loop at GT_LIST_DATA .
* Select query and fill the field BANFN.
Modify GT_LIST_DATA .
endloop.Or you could do one select and use FOR ALL ENTRIES in GT_LIST_DATA, then Loop the table and do a READ against it to fill the GT_LIST_DATA table.
Regards,
RIch Heilman
‎2007 Jan 03 2:11 AM
You could loop at the internal table and do the select query inside, then modify it.
Loop at GT_LIST_DATA .
* Select query and fill the field BANFN.
Modify GT_LIST_DATA .
endloop.Or you could do one select and use FOR ALL ENTRIES in GT_LIST_DATA, then Loop the table and do a READ against it to fill the GT_LIST_DATA table.
Regards,
RIch Heilman
‎2007 Jan 03 2:55 AM
I use the code as follow, but it can't work. I can see the GV_LAST_PR value, but without any effect for GT_LIST_DATA, Thanks!
LOOP AT GT_LIST_DATA.
PERFORM GET_LAST_PR.
GT_LIST_DATA-BANFN = GV_LAST_PR.
MODIFY GT_LIST_DATA .
ENDLOOP.
‎2007 Jan 03 3:05 AM
‎2007 Jan 03 3:06 AM
Please try by making the following changes:
DATA: TABIX LIKE SY-TABIX.
LOOP AT GT_LIST_DATA.
TABIX = SY-TABIX.
PERFORM GET_LAST_PR.
GT_LIST_DATA-BANFN = GV_LAST_PR.
MODIFY GT_LIST_DATA INDEX TABIX TRANSPORTING BANFN.
ENDLOOP.
Regards
Eswar
‎2007 Jan 03 3:18 AM
Yeah, It's work, i made some mistake before. Thanks
Beside, it is a typical way to update the internal table?
‎2007 Jan 03 3:24 AM
‎2007 Jan 03 3:25 AM
‎2007 Jan 03 2:27 AM
Hi
We can directly get the PR number from table EKPO.
If you are extracting from EKET, you can still include this in the join of the extraction.
From other source, proceed as below:
LOOP AT GT_LIST_DATA INTO <WA>.
READ TABLE IT_EKET INTO WA_EKET WITH KEY EBELN = <WA>-EBELN
EBELP = <WA>-EBELP.
IF SY-SUBRC EQ 0.
<WA>-BANFN = WA_EKET-BANFN.
MODIFY GT_LIST_DATA FROM <WA> TRANSPORTING BANFN.
ENDIF.
ENDLOOP.Kind Regards
Eswar