06-10-2020 2:46 PM
I am getting all the Purchasing document that is archived and I'm getting an error that "The work area "I_TAB" has fewer fields than selected." Can you tell me what is wrong with my code below?
TYPES: BEGIN OF t_tab,
ebeln LIKE ekpo-ebeln,
loekz LIKE ekko-loekz,
matnr LIKE ekpo-matnr,
werks LIKE ekpo-werks,
ewebaz LIKE ekpo-webaz,
eplifz LIKE ekpo-plifz,
END OF t_tab
DATA: i_tab TYPE STANDARD TABLE OF t_tab,
wa_tab TYPE t_tab.
SELECT
a~ebeln,
a~matnr,
a~werks,
a~webaz,
a~plifz,
b~ebeln,
b~loekz
INTO TABLE @i_tab
FROM ekpo AS a
LEFT OUTER JOIN
ekko AS b
ON a~ebeln EQ b~ebeln
WHERE
b~loekz NE 'X'.
06-10-2020 3:00 PM
You are selecting 7 fields while the work area have 6 fields , you selected ebeln twice & you should make a corresponding field to the selected fields in order to recognize it so this should look like :
TYPES: BEGIN OF t_tab,
ebeln LIKE ekpo-ebeln,
loekz LIKE ekko-loekz,
matnr LIKE ekpo-matnr,
werks LIKE ekpo-werks,
webaz LIKE ekpo-webaz,
plifz LIKE ekpo-plifz,
END OF t_tab.
DATA: i_tab TYPE STANDARD TABLE OF t_tab,
wa_tab TYPE t_tab.
SELECT
a~ebeln,
a~matnr,
a~werks,
a~webaz,
a~plifz,
b~loekz
INTO CORRESPONDING FIELDS OF TABLE @i_tab
FROM ekpo AS a
LEFT OUTER JOIN
ekko AS b
ON a~ebeln EQ b~ebeln
WHERE
b~loekz NE 'X'.
06-10-2020 3:00 PM
You are selecting 7 fields while the work area have 6 fields , you selected ebeln twice & you should make a corresponding field to the selected fields in order to recognize it so this should look like :
TYPES: BEGIN OF t_tab,
ebeln LIKE ekpo-ebeln,
loekz LIKE ekko-loekz,
matnr LIKE ekpo-matnr,
werks LIKE ekpo-werks,
webaz LIKE ekpo-webaz,
plifz LIKE ekpo-plifz,
END OF t_tab.
DATA: i_tab TYPE STANDARD TABLE OF t_tab,
wa_tab TYPE t_tab.
SELECT
a~ebeln,
a~matnr,
a~werks,
a~webaz,
a~plifz,
b~loekz
INTO CORRESPONDING FIELDS OF TABLE @i_tab
FROM ekpo AS a
LEFT OUTER JOIN
ekko AS b
ON a~ebeln EQ b~ebeln
WHERE
b~loekz NE 'X'.
06-10-2020 3:27 PM
06-10-2020 7:19 PM
Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).
06-10-2020 7:23 PM
The 6 fields of i_tab:
TYPES: BEGIN OF t_tab,
ebeln LIKE ekpo-ebeln,
loekz LIKE ekko-loekz,
matnr LIKE ekpo-matnr,
werks LIKE ekpo-werks,
ewebaz LIKE ekpo-webaz,
eplifz LIKE ekpo-plifz,
END OF t_tab
The 7 fields that you take to put into i_tab:
SELECT
a~ebeln,
a~matnr,
a~werks,
a~webaz,
a~plifz,
b~ebeln,
b~loekz
INTO TABLE @i_tab
The message:
The work area "I_TAB" has fewer fields than selected.
What do you not understand?
Moreover, pay attention to the order of fields (MATNR will go into LOEKZ, WERKS will go into MATNR, etc.)