Skip to Content
0
Former Member
Nov 24, 2005 at 02:47 AM

Inserting fields from 1 internal table into another internal table

18 Views

Hi all,

I just started my first job and i'm asked to do ABAP. I've been assigned to develop my first ever ABAP program with no prior experience and manuals. I've been relying on the F1 key entirely. I hope i am doing fine. Anyway, my program has the following criteria:

1) to insert the Actual Delivery Date (BUDAT) from the WTAB internal table into the ITAB internal table and make it appear in the report. Have been unsuccessful in this matter. Tried LOOP AT WTAB, MODIFY ITAB ..., ENDLOOP but for some reason, only zeros appear.

Here's what i have done so far:

REPORT ZLPUPO100 NO STANDARD PAGE HEADING LINE-SIZE 86.

TABLES: EKKO,

EKPO,

EKBE,

EKET.

DATA: BEGIN OF ITAB OCCURS 0,

EBELN LIKE EKKO-EBELN, "PO Number

EBELP LIKE EKPO-EBELP, "Item Number

EINDT LIKE EKET-EINDT, "Delivery Date in PO

BUDAT LIKE EKBE-BUDAT, "Actual Delivery Date

END OF ITAB.

DATA: BEGIN OF WTAB OCCURS 0,

EBELN LIKE EKBE-EBELN, "PO Number

EBELP LIKE EKBE-EBELP, "Item Number

  • EINDT LIKE EKET-EINDT, "Delivery Date in PO

BUDAT LIKE EKBE-BUDAT, "Actual Delivery Date

END OF WTAB.

&----


*& SELECTION-SCREEN

&----


SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:

I_WERKS FOR EKPO-WERKS, "PLANT

I_BUKRS FOR EKKO-BUKRS, "COMPANY CODE

I_EBELN FOR EKKO-EBELN, "PO NUMBER

I_LIFNR FOR EKKO-LIFNR, "VENDOR NUMBER

I_MATNR FOR EKPO-MATNR, "MATERIAL NUMBER

I_BEDAT FOR EKKO-BEDAT. "PO DATE

SELECTION-SCREEN END OF BLOCK 1.

SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-002.

PARAMETERS: P_ONET RADIOBUTTON GROUP RFMT, "ON-TIME DELIVERY

P_ODUE RADIOBUTTON GROUP RFMT, "OVERDUE

P_ALLP RADIOBUTTON GROUP RFMT, "BOTH (SORT BY PO NO.)

P_ALLC RADIOBUTTON GROUP RFMT. "BOTH (SORT BY CATEGORY)

SELECTION-SCREEN END OF BLOCK 2.

&----


*& START-OF-SELECTION

&----


START-OF-SELECTION.

PERFORM SELECT_DATA.

END-OF-SELECTION.

&----


*& SELECT_DATA

&----


FORM SELECT_DATA.

*--> IF ON-TIME DELIVERY IS SELECTED

IF P_ONET EQ 'X'.

...

*--> IF OVERDUE DELIVERY IS SELECTED

ELSEIF P_ODUE EQ 'X'.

...

*--> IF BOTH IS SELECTED, SORT BY PO NUMBER

ELSEIF P_ALLP EQ 'X'.

SELECT AEBELN BEBELP C~EINDT

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM ( EKKO AS A

INNER JOIN EKPO AS B

ON BEBELN = AEBELN

INNER JOIN EKET AS C

ON CEBELN = BEBELN AND

CEBELP = BEBELP AND

C~ETENR = '1')

WHERE B~WERKS IN I_WERKS AND

B~LOEKZ = ' ' AND

A~BUKRS IN I_BUKRS AND

A~BSTYP = 'F' AND

A~EBELN IN I_EBELN AND

A~LIFNR IN I_LIFNR AND

B~MATNR IN I_MATNR AND

A~BEDAT IN I_BEDAT

ORDER BY AEBELN BEBELP.

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.

SELECT EBELN EBELP BUDAT

INTO CORRESPONDING FIELDS OF TABLE WTAB

FROM EKBE

WHERE EBELN IN I_EBELN AND

  • EBELP = ITAB-EBELP AND

VGABE = '1' AND

BEWTP = 'E'

ORDER BY EBELN EBELP.

FORMAT COLOR COL_POSITIVE.

ULINE.

WRITE: '|', 5 'PO No.',

14 '|', 16 'PO Item No.',

28 '|', 'PO Delivery Date',

47 '|', 'Actual Delivery',

65 '|', 'Overdue Days (+/-)',

86 '|'.

FORMAT COLOR COL-POSITIVE OFF.

ULINE.

NEW-LINE.

*--->> This is the part that is making me confused

LOOP AT WTAB.

MODIFY ITAB TRANSPORTING BUDAT

WHERE EBELN = WTAB-EBELN AND

EBELP = WTAB-EBELP.

ENDLOOP.

LOOP AT ITAB.

WRITE: '|', 3 ITAB-EBELN, "PO NO

14 '|', 19 ITAB-EBELP, "PO ITEM NO

28 '|', 33 ITAB-EINDT, "PO DELIVERY DATE

47 '|', 51 ITAB-BUDAT, "ACTUAL DELIVERY DATE

65 '|',

86 '|'.

NEW-LINE.

ENDLOOP.

ULINE.

*--> IF BOTH IS SELECTED, SORT BY CATEGORY (+/-)

ELSE.

...

ENDIF.

ENDFORM.

Any hints you could provide? i need this asap, as i have to deliver by the end of the week, i can't fail in my first task assigned to me, i'm still in my job probation period...eeek...i've read the forums on merging internal tables and i still don't know where i've gone wrong...