01-25-2021 6:10 PM
Greetings!
Yes, I am new at ABAP; apologies for the lack of knowledge in advance.
I'm hoping someone can help me get the description field for the Target Region to populate.
There is obviously more code, but here's what I have tried thus far:
TABLES : mara, marc, makt, mvke , t023t, tvprt.
* Class Definitions
TYPES : BEGIN OF gty_final,
matnr TYPE mara-matnr,
maktx TYPE makt-maktx,
ersda TYPE mara-ersda,
matkl TYPE mara-matkl,
wgbez TYPE t023t-wgbez,
werks TYPE marc-werks,
vtext TYPE tvprt-vtext,
provg TYPE mvke-provg,
vkorg TYPE mvke-vkorg,
SELECT vtext
FROM TVPRT
INTO TABLE @DATA(IT_TVPRT2).
&---------------------------------
SELECT SINGLE vtext
INTO TABLE @DATA(IT_TVPRT2).
FROM TVPRT
I should add that I already have the Target Region (two-digit) populating, but this one is in a different table (tvprt) and I'm not sure how to go about getting it out.
Thank you in advance.
Keega
01-25-2021 8:52 PM
TABLES is obsolete. You don't need it and shouldn't use it.
Your select will put the contents of the field vtext in TVPRT into the matnr field. When you use INTO TABLE; it take the result set from the selection, and then just puts it to the table. It doesn't care about the structure of the internal table.
Use INTO CORRESPONDING FIELDS OF.
Please take the time to read the ABAP keyword documentation for ... well any ABAP statement you're having trouble with. Often you'll find the answer right there. It's what I had to do when I was learning. We didn't really have the internet to help us then.
01-25-2021 9:25 PM
Hi Matthew!
Yes, I've read that about tables, but I am modifying someone else's code and that person is long gone. I don't want to reinvent the entire thing right now since I'm on a deadline.
I'm still not able to get it to display using INTO CORRESPONDING FIELDS OF., but will continue to try.
Thanks for your response.
01-25-2021 10:24 PM
If it's any consolation, the Internet has not been very helpful. I too grew up without the Internet. I love my books!
01-25-2021 10:57 PM
Here's what I have done thus far but still no results:
*TYPES: BEGIN OF t_tvprt,
** include structure tvprt.
* mandt LIKE tvprt-mandt,
* spras LIKE tvprt-spras,
* provg LIKE tvprt-provg,
* vtext LIKE tvprt-vtext,
* END OF t_tvprt.
*
*DATA: it_tvprt TYPE t_tvprt,
* wa_tvprt TYPE t_tvprt.
*
*SELECT vtext
* FROM tvprt
* INTO CORRESPONDING FIELDS OF TABLE it_tvprt.
01-26-2021 7:43 AM
That's because it's all commented out. 😉
It looks fine to me. There is data in the table? That field is populated?
01-26-2021 3:56 PM
Ha! It wasn't at the time 😉 I'm going to play around with it a bit more.
Thanks so much Matthew.
01-26-2021 5:01 PM
When I implement this code:
TYPES: BEGIN OF t_tvprt,
* include structure tvprt.
mandt LIKE tvprt-mandt,
spras LIKE tvprt-spras,
provg LIKE tvprt-provg,
vtext LIKE tvprt-vtext,
END OF t_tvprt .
DATA: it_tvprt TYPE t_tvprt,
wa_tvprt TYPE t_tvprt .
SELECT vtext
FROM tvprt
INTO CORRESPONDING FIELDS OF TABLE it_tvprt.
I get this error message:
"IT_TVPRT" is not an internal table. "OCCURS n" specification is missing.
I'm researching and working on it.
01-26-2021 5:41 PM
01-26-2021 5:41 PM
I got Type "T_TVPRT" is unknown. I'm not sure how else to make it "known"
Any help would be greatly appreciated.
01-26-2021 6:55 PM
Have you considered going on an ABAP training course? That would cover this.
DATA: it_tvprt TYPE STANDARD TABLE OF t_tvprt WITH DEFAULT KEY,
wa_tvprt TYPE t_tvprt .
Try this book: https://www.sap-press.com/abap_4955/
01-26-2021 7:13 PM
Yes, I have. I am doing an online tutorial, but with working and learning at the same time, I sometimes need some help. I have nobody else to ask.
Thanks for your help.
01-26-2021 7:16 PM
I continue to get the "Type t_tvprt is unknown". I've researched, read, applied, cursed, and still cannot get this to behave. No big deal. Kind of done with this anyway.
01-26-2021 7:20 PM
FWIW, I did get the book you mentioned. I just started it, so since I cannot necessarily port the info into my fool head, I will continue to have questions.
My apologies for asking basic questions. I figured this was a place where I could learn.
01-26-2021 8:03 PM
It's fine. I'm just trying hard to teach rather than just supply the answer.
The problem is, as everyone who knows me well testify, I'm a terrible teacher because to me it's all so obvious.
01-26-2021 8:54 PM
I totally get it, Matthew. I prefer learning rather than just being told what/where. All good 😉 I'm just kind of stuck without many resources, but it will be fine. A couple of months from now, I'll be answering other people's questions and thinking how silly they must be for asking such basic things :^)
Here's what I've learned since our last communication:
There's an INCLUDE "top" to this report. I dropped the DATA (statement) into it and the error went away (yay!) but it's still not pulling data. It may simply be the test data I was given - I've since asked for a known-working sample.
Thank you again Matthew for your time.