2022 Oct 18 2:10 PM
Hello Folks,
gs_head-smtp_addr = mt_adr6 [ kunnr = gs_vbrk-kunag ]-smtp_addr.
How to read the above syntax so that I can understand what it is doing ?
Thanks,
K Kiran.
2022 Oct 18 2:17 PM
I want the line of the internal table MT_ADR6 where the field KUNNR equal the value of the field gs_vbrk-kunag and I want in output only the value of the field SMTP_ADDR
READ TABLE mt_adr6 INTO @data(ls_line_adr6) WITH KEY kunnr = gs_vbrk-kunag.
if sy-subrc eq 0.
gs_head-smtp_addr = ls_line_adr6-smtp_addr.
endif.
2022 Oct 18 4:30 PM
Hello Fredric,
The problem is when I debug I am not able to find any value for mt_adr6-kunnr.
It is not reecognising mt_adr6 in debugging.
Thanks,
K Kiran.
2022 Oct 19 6:32 AM
mt_adr6 should be an internal table, so in debug you should see something.
As we don't see how it is declared and populated it is little bit hard to help you.
Could you post screenshot of the debugger with the mt_adr6 ?
2022 Oct 19 11:21 AM
Hello Folks,
The problem is when I debug I am not able to find any value for mt_adr6-kunnr or mt_adr6-smpt_addr
It is not reecognising mt_adr6 internal table in debugging ie I am not finding any value when I type mt_adr6-kunnr or mt_adr6-smtp_addr but in internal table it is present.
Kindly refer to the attached screenshsot.
.
Thanks,
K Kiran.
2022 Oct 19 11:47 AM
The debugger show you the table MT_ADR6, you see there is one line in this table.
If you double click, you will change the tab from Desktop to Tables and see the content of the table.
when you put MT_ADR6-KUNNR or -SMTP_ADDR you are trying to display the content of one line, but it will not work as SAP doesn't know witch line you would like to display. You could for this by specified the line you would like to show : MT_ADR6[1]-KUNNR
Second point, MT_ADDR6-KUNNR in old abap code works, because there was a link between internal table and a header line. But it is not the case anymore.
2022 Oct 18 2:18 PM
2022 Oct 18 2:22 PM
Actually you need to catch exception CX_SY_ITAB_LINE_NOT_FOUND.
Otherwise it will dump when there is no line for that customer.
TRY.
gs_head-smtp_addr = mt_adr6[ kunnr = gs_vbrk-kunag ]-smtp_addr.
CATCH cx_sy_itab_line_not_found INTO DATA(r_exc).
MESSAGE r_exc->get_text( ) TYPE 'E'.
ENDTRY.
2022 Oct 18 3:03 PM
2022 Oct 18 3:04 PM
what is mt_adr6?
what components does mt_adr6 have?
I think you can deduce a few things yourself.
2022 Oct 18 3:58 PM
Hi.
1. There are 3 work areas => `gs_head`, `mt_adr6`, and `gs_vbrk`
2. Both `gs_head` work area and `mt_adr6` work area has a field called `smtp_addr`
3. `mt_adr6` work area also has a field called `kunnr`
4. `gs_vbrk` work area has a field called `kunag`
5. What the code is trying to do is assign the `smtp_addr` field value in`mt_adr6` work area to`smtp_addr` field in`gs_head` work area BUT ONLY WHEN THE `kunnr` field value from `mt_adr6` work area match with the `kunag` field value from the `gs_vbrk` work area
Hope it helps!
2022 Oct 18 4:30 PM
Hello Folks,
The problem is when I debug I am not able to find any value for mt_adr6-kunnr.
It is not reecognising mt_adr6 in debugging.
Thanks,
K Kiran.
2022 Oct 19 7:01 AM
Hi kiran.k8
For More Information about ABAP Expressions 7.5 in clear explanation Check Out this link: ABAP Expressions (7.4+) – Discovering ABAPWhich might help you