‎2019 Apr 20 7:54 AM
i am getting error uncaught_exception cx_sy_ref_is_initial while export to excel format, code is as below:
SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }
FORM DISPLAY.
gt_fieldcat = VALUE #(
( fieldname = 'MATNR' OUTPUTLEN = '12' seltext_l = 'ParentCode' tabname = 'IT_STDBOM' )
( fieldname = 'OJTXB' OUTPUTLEN = '50' seltext_l = 'ParentCodeDesc' tabname = 'IT_STDBOM' )
( fieldname = 'IDNRK' OUTPUTLEN = '12' seltext_l = 'ChildCode' tabname = 'IT_STDBOM')
( fieldname = 'OJTXP' OUTPUTLEN = '50' seltext_l = 'ChildCodeDesc' tabname = 'IT_STDBOM')
( fieldname = 'MTART' OUTPUTLEN = '5' seltext_l = 'MTGroup' tabname = 'IT_STDBOM')
( fieldname = 'DISMM' OUTPUTLEN = '5' seltext_l = 'MRPType' tabname = 'IT_STDBOM')
( fieldname = 'MATMK' OUTPUTLEN = '5' seltext_l = 'MatSubType' tabname = 'IT_STDBOM')
( fieldname = 'MNGLG' OUTPUTLEN = '20' seltext_l = 'CompQty' tabname = 'IT_STDBOM')
( fieldname = 'FPINHOUSEC' OUTPUTLEN = '20' seltext_l = 'Parent.InHouseCost' DO_SUM = 'X' tabname = 'IT_STDBOM')
( fieldname = 'FPBOUGHTC' OUTPUTLEN = '20' seltext_l = 'Parent.BoughtOutCost' DO_SUM = 'X' tabname = 'IT_STDBOM')
( fieldname = 'FPINFOREC' OUTPUTLEN = '20' seltext_l = 'Parent.InfoRec' DO_SUM = 'X' tabname = 'IT_STDBOM')
( fieldname = 'FINHOUSEC' OUTPUTLEN = '20' seltext_l = 'InHouseCost' DO_SUM = 'X' tabname = 'IT_STDBOM')
( fieldname = 'FBOUGHTC' OUTPUTLEN = '20' seltext_l = 'BoughtOutCost' DO_SUM = 'X' tabname = 'IT_STDBOM')
( fieldname = 'FINFOREC' OUTPUTLEN = '20' seltext_l = 'InfoRec' DO_SUM = 'X' tabname = 'IT_STDBOM')
( fieldname = 'TOTALCOST' OUTPUTLEN = '20' seltext_l = 'TotalCost' DO_SUM = 'X' tabname = 'IT_STDBOM')
).
wasort-spos = 1.
wasort-fieldname = 'MATNR'.
wasort-UP = 'X'.
wasort-subtot = 'X'.
APPEND wasort TO itsort.
gs_layout-colwidth_optimize = 'X'.
CLEAR ALV_HEADING.
CONCATENATE 'Standard BOM Costing : ' P_MATNR INTO alv_heading.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZCLASS_STD_COST_NEW'
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
I_GRID_TITLE = alv_heading
* I_GRID_SETTINGS =
IS_LAYOUT = gs_layout
IT_FIELDCAT = gt_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
IT_SORT = itsort[]
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'X'
* IS_VARIANT = g_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
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = it_stdbom
EXCEPTIONS
program_error = 1
OTHERS = 2.
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
‎2019 Apr 20 12:47 PM
A Form? They're obsolete. And the fm for ALV? Use cl_salv_table. Much easier.
Also, you'll get more help if you post your code using the code button in the editor. And right click, post as plain text.
Finally, this is a question asked about once a week. Try searching.
‎2019 Apr 20 1:49 PM