2005 Oct 07 10:15 PM
Hi,
I have seen this topic here before but the answers didn't help me. Maybe I,m doing something wrong.
The problem is that I defined the following structure on the |Types| tab of the |Global Definitions| section:
TYPES: BEGIN OF DETAILS,
EBELP TYPE EKPO-EBELP,
BSMNG TYPE EBAN-BSMNG,
LFDAT TYPE RM06P-LFDAT,
END OF DETAILS.
Then defined the following definition on the |Global Data| section:
WA_DETAILS TYPE STANDARD TABLE OF DETAILS WITH HEADER LINE
The problem is that when I try to assign a value to one of the fields in the program code like this:
LOOP AT WA_EKPO.
WA_DETAILS-EBELP = WA_EKPO-EBELP.
WA_DETAILS-EMATN = WA_EKPO-EMATN.
MODIFY WA_DETAILS.
ENDLOOP.
gives me the following error:
"WA_DETAILS" is not an internal table -the "OCCURS n" specification is missing.
Then if I add the "OCCURS 10" to the definition of the Global Data the error "OCCURS 10" is not expected.
How can I define, assign values and use as a parameter an internal table defined with types for use it with the table painter?
2005 Oct 07 10:38 PM
2005 Oct 07 11:21 PM
Sorry I ommit a few lines for the lenght of the post wasn't too big. The original definition in types is:
TYPES: BEGIN OF DETAILS,
EBELP TYPE EKPO-EBELP,
EMATN TYPE EKPO-EMATN,
TXZ01 TYPE EBAN-TXZ01,
MSEHT TYPE T006A-MSEHT,
BSMNG TYPE EBAN-BSMNG,
LFDAT TYPE RM06P-LFDAT,
TDTEXT TYPE TTXIT-TDTEXT,
END OF DETAILS.
The same error appears when use append WA_DETAILS instead of modify WA_DETAILS.
2005 Oct 07 10:43 PM
The following seems to work:
REPORT ztest.
TYPES: BEGIN OF details,
ebelp TYPE ekpo-ebelp,
bsmng TYPE eban-bsmng,
lfdat TYPE rm06p-lfdat,
ematn TYPE ekpo-ematn,
END OF details.
DATA: wa_details TYPE STANDARD TABLE OF details WITH HEADER LINE,
wa_ekpo TYPE STANDARD TABLE OF details WITH HEADER LINE.
wa_ekpo-ebelp = '1'.
append wa_ekpo.
LOOP AT wa_ekpo.
wa_details-ebelp = wa_ekpo-ebelp.
wa_details-ematn = wa_ekpo-ematn.
append wa_details.
ENDLOOP.
You can't use the modify because your not in a loop for wa_details.
Rob
2005 Oct 07 11:45 PM
I have almost the same exact code that you posted <i>R.Burbank</i> (including the append) and that works fine but only if you keep it inside that code module. Also the WA_EKPO is an internal table type of EKPO and I cannot define it like DETAILS. If you add the name of the table WA_DETAILS1 to the Output Parameters of the code module then the error:
"Field 'WA_DETAILS1' is unknown is not a specified table or defined with a 'DATA' statement".
Then if I add:
'WA_DETAILS1 TYPE DETAILS WITH HEADER LINE'
or
'WA_DETAILS1 TYPE STANDARD TABLE OF DETAILS WITH HEADER LINE'
to the Global Data of the Global Definitions the error:
"'WA_DETAILS1' has already been declared" appears.
2005 Oct 08 8:06 PM
I think you should post the relevant code including data declarations and the module that you're calling.
Rob
2005 Oct 07 11:28 PM
Hi,
if it is one record in wa_details. you can directly write as follows..
REPORT ZCR_TEST1 .
TYPES: BEGIN OF details,
ebelp TYPE ekpo-ebelp,
bsmng TYPE eban-bsmng,
lfdat TYPE rm06p-lfdat,
ematn TYPE ekpo-ematn,
END OF details.
DATA: wa_details TYPE STANDARD TABLE OF details WITH HEADER LINE,
wa_ekpo TYPE STANDARD TABLE OF details WITH HEADER LINE.
wa_details-ebelp = '1'.
append wa_details.
wa_ekpo-ebelp = '3'.
append wa_ekpo.
LOOP AT wa_ekpo.
wa_ekpo-ebelp = wa_details-ebelp.
wa_ekpo-ematn = wa_details-ematn.
modify wa_ekpo.
endloop.
Normally it wont be one record, so u need to put <b>read statement with key</b> in LOOP and ENDLOOP.
Regards,
Sriram
2005 Oct 08 12:04 AM
The code you wrote <i>Sriram</i>, works fine in a report or program but in code window of a Smart Forms I can't make it happen.
The WA_EKPO table is passed as an Input Parameter and already had data on it, so there is no problem on making a LOOP at it.
Also I can assign values to the fields of the table like 'WA_DETAILS1-EBELP = WA_EKPO-EBELP.' but the error trigers when I try to use an APPEND or MODIFY command.
Apparently I can assign data to the field of an internal table but I can't add more than one row of data to a table.