2023 Aug 21 5:40 PM
Hi Team
i need to read value of field (Check) from the below deep structure ,
HRDATA.STAR_CHEQUE-CHEQUE_FPAYHX-CHECK..
here HRDATA is structure of /1PYXXFO/ZHR_PAYSTUB.
STAR_CHEQUE is table type defined on /1PYXXFO/ZHR_PAYSTUB_____M0030.
CHEQUE_FPAYHX is defined on structure FPAYHX
CHECK is field of char13 field of FPAYHX.
i tried the below code ,
DATA table_descr TYPE REF TO cl_abap_tabledescr.
DATA struct_descr TYPE REF TO cl_abap_structdescr.
DATA columns TYPE abap_compdescr_tab.
FIELD-SYMBOLs
<column> LIKE LINE OF columns.
table_descr
?= cl_abap_typedescr=>describe_by_data( HRDATA-STAR_CHEQUE ).
struct_descr ?= table_descr->get_table_line_type( ).
columns = struct_descr->components.
now i went a level where i see the fields of STAR_CHEQUE are moved to field symbol columns. now how do i read CHEQUE_FPAYHX structure then the filed CHECK?
Please help with this?
Thanks
NK
Same question for ASSIGN with dynamic naming, isn't your variable HRDATA typed statically? Do you mean that you don't have this line of code (or parameter)?
DATA hrdata TYPE /1PYXXFO/ZHR_PAYSTUB.If so, you don't need ASSIGN, its components may be accessed directly.PS: minus character in names is obsolete and forbidden in ABAP Objects.
2023 Aug 21 7:49 PM
2023 Aug 21 8:34 PM
Hi Sandra ,
Thanks for the reply , the above code is reference from another post. now i tried the alternative way , but i see componet of <FS-STRCT2> is not assigning to <FS-STRCT2> . Please suggest
FIELD-SYMBOLS : <FS-STRUCT1> TYPE any,
<FS-STRUCT2> TYPE ANY ,
<fs_wa> type FPAYHX.
data: lv_comp_name(20) type c value 'CHEQUE_FPAYHX'.
ASSIGN HRDATA-STAR_CHEQUE[] to <FS-STRUCT1>.
ASSIGN COMPONENT lv_comp_name OF STRUCTURE <FS-STRUCT1> TO <FS-STRUCT2>.
2023 Aug 22 5:22 AM
Same question for ASSIGN with dynamic naming, isn't your variable HRDATA typed statically? Do you mean that you don't have this line of code (or parameter)?
DATA hrdata TYPE /1PYXXFO/ZHR_PAYSTUB.If so, you don't need ASSIGN, its components may be accessed directly.PS: minus character in names is obsolete and forbidden in ABAP Objects.
2023 Aug 22 5:27 AM
If your ABAP release is >= 7.40, use:
LOOP AT hrdata-star_cheque ASSIGNING FIELD-SYMBOL(<line_of_star_cheque>).
IF <line_of_star_cheque>-cheque_fpayhx IS INITIAL.
...
ENDIF.
ENDLOOP.PS: I advise using "good" names, bad practice in your code is to name <STRUCT1> a field symbol which refers to the internal table STAR_CHEQUE.
2023 Aug 22 6:00 PM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |