2015 Oct 04 8:45 AM
I am just trying to develop an ALV report without using field catalog to display MATNR,MBRSH,MTART & MEINS field for a range of material input, Below is the code for the ALV report using FM 'Reuse_alv_list_display' ....
REPORT ZALV_REPORT1.
TABLES : MARA.
TYPES : BEGIN OF TY_MARA,
MATNR TYPE MATNR,
MTART TYPE MTART,
MBRSH TYPE MBRSH,
MEINS TYPE MEINS,
END OF TY_MARA.
DATA :IT_MARA TYPE TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : S_MATNR TYPE MARA-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA_FROM_MARA.
*&---------------------------------------------------------------------*
*& Form GET_DATA_FROM_MARA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_DATA_FROM_MARA .
SELECT MATNR MTART MBRSH MEINS FROM MARA INTO TABLE IT_MARA
WHERE MATNR = S_MATNR.
ENDFORM. " GET_DATA_FROM_MARA
END-OF-SELECTION.
PERFORM DISP_MARA_ALV.
*&---------------------------------------------------------------------*
*& Form DISP_MARA_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISP_MARA_ALV .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'MARA'
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_MARA
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISP_MARA_ALV
The error which i am getting is GETWA_NOT_ASSIGNED with this explanation
Error analysis
You attempted to access an unassigned field symbol
(data segment 93).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
Now my question is
1. Why i am getting this error as i have not mentioned any field catalog ?
2. When i am using FM "Reuse_alv_grid_display" that time i am getting the output...why ???
2015 Oct 04 8:59 AM
2015 Oct 04 11:18 AM
hiii abdul ,
I am not getting what you want to say ...Please explain me why i am getting this error ? and if i use another FM then y i am not getting that error ?
2015 Oct 04 11:53 AM
You're wrong, because all importing parameters are commented, there is no need to uncomment keyword "importing". This would cause a syntax error.
2015 Oct 04 11:51 AM
This error is regularly caused by an incorrect field catalog. In your case, you say i_structure = 'MARA', but your ty_mara does not match all mara fields. This results into a pointer (running over all MARA fields) does not find some MARA fields in your ty_mara.
THe ALV grid does work completely different from this procedure, so this error won't occur.
2015 Oct 04 12:23 PM
Hallo
so you have 2 options,
1. Convert you fields to field catalog and pass the fieldcatlog to FM with your ITAB
2. or pass the structure and ITAB ( must be same ) to FM.
what you have done?
you have passed the ITAB which is different from the structure. ( cause Error)
so try this code, hopfully it will help you .
REPORT zibo_pg_test98.
TABLES : mara.
*TYPES : BEGIN OF TY_MARA,
* MATNR TYPE MATNR,
* MTART TYPE MTART,
* MBRSH TYPE MBRSH,
* MEINS TYPE MEINS,
* END OF TY_MARA.
*DATA :IT_MARA TYPE TABLE OF TY_MARA,
* WA_MARA TYPE TY_MARA.
DATA: it_mara TYPE TABLE OF mara,
wa_mara TYPE mara.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : s_matnr TYPE mara-matnr.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM get_data_from_mara.
*----------------------------------------------------------------------*
FORM get_data_from_mara .
SELECT matnr mtart mbrsh meins FROM mara INTO
CORRESPONDING FIELDS OF TABLE it_mara
WHERE matnr = s_matnr.
ENDFORM. " GET_DATA_FROM_MARA
END-OF-SELECTION.
PERFORM disp_mara_alv.
FORM disp_mara_alv .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_structure_name = 'MARA'
TABLES
t_outtab = it_mara.
IF sy-subrc <> 0.
RETURN.
ENDIF.
ENDFORM. " DISP_MARA_ALV
s
Regards
2015 Oct 04 1:41 PM
Hi Ebrahim ,
Thanks for your solution but i know that. My question was why i am getting GETWA_NOT_ASSIGNED error in this program and i think as mentioned by RALF this is the reason for this error.
Please correct me if i am wrong ....
Regards....
2015 Oct 04 1:43 PM
Thanks Folks for your suggestions but my 2nd question is still unanswered .... Please help me out to solve it.
2015 Oct 04 3:25 PM
Hi,
2. When i am using FM "Reuse_alv_grid_display" that time i am getting the output...why ???
let me to explain it for you please,
FM: Reuse_alv_LIST_display
this function module, converts the whole structure (MARA) to field catalog and compare the field catalogs with your ITAB , if one field from MARA i_structure_name = 'MARA'
does not match your ITAB ( does not exist in ITAB) , it will generate a DUMP.
But
FM: Reuse_alv_GRID_display has another technic, and it handles different.
this function is different from LIST,
it depends on ITAB and the structure,
if ITAB has 3 , A, B, C columns, and the structure has 6 columns , A,B.,C. D,. E, F., G
now it compares between the ITAB and the structure , if all fields of ITAB belongs to structure . then it will assign the value and generate the ALV; ,if not , it will generate a dump.
in your example i_structure_name = 'MARA' has more than 200 fields, and you ITAB has 4 fields, but the all of them belong to Mara,so it will generate the output, and assign the values, to MARA fields.
This FM, assign the values of ITAB to structure,
if your ITAB MARA, and your structure is SFLIGHT, but your ITAB is empty, it will generate an ALV-GRID with empty value, only fields name,
it will generate dump when you ITAB MARA has values, after assing the values, to structureSFLIGHT, it will find out, that SFLIGHT has not field with your ITAB , MATNR, etc,then it will generate a dump
if you try out to execute it without to fill theITAB, you will get only the structure of SFLIGHT. The error occurs during assigning the values of ITAB and it will realize that your ITAB does not match the structure.
At the end, they are different FMs:
Hopfully I could explain it good for you.
Regards
Ebrahim
2015 Oct 04 3:45 PM
That's what I said repeatedly - with more details. But I thinks that's not what he wants to read
2015 Oct 04 3:57 PM
Hallo Ralf,
you are right,you have written it before, but he could not get it, as I think. So I have tried to explain it more
2015 Oct 04 2:39 PM
As I told you, the grid works completely different due to fieldcatalog handling.