brunch

You can make anything
by writing

C.S.Lewis

by 동네아밥 Nov 12. 2021

F4IF_INT_TABLE_VALUE_REQUEST

필드명 offset = intlen 

-------SETTING HANDLER

go_grid->register_f4_for_fields( it_f4 = value lvc_t_f4( ( fieldname = 'FIELDNAME' register  = 'X' ) ) ).


--------FORM ONF4.

form onf4  using    pv_fieldname    type lvc_fname
                     pv_fieldvalue   type lvc_value
                     ps_row_no       type lvc_s_roid
                     po_event_data   type ref to cl_alv_event_data
                     pt_bad_cells    type lvc_t_modi
                     pv_display      type char01.
 
  define _field_info.


     call function 'DDIF_FIELDINFO_GET'
       exporting
         tabname        = &1
         fieldname      = &2
         lfieldname     = &2
       importing
         dfies_wa       = lt_dfies
       exceptions
         not_found      = 1
         internal_error = 2
         others         = 3.
 
     lt_dfies-position = lines( lt_dfies ) + 1.
     lt_dfies-offset   = lv_offset.
     add lt_dfies-intlen to lv_offset.
     append lt_dfies. clear lt_dfies.


   end-of-definition.
 
   data: begin of lt_value occurs 0,
           matnr like marc-matnr,
           werks like marc-werks,
           mmsta like marc-mmsta,
         end of lt_value,
 
         lt_dfies   like dfies      occurs 0 with header line,
         lt_return  like ddshretval occurs 0 with header line,
 
         lv_offset  type dfies-offset,
         lv_display.
 
   field-symbols: <lt_modi> type lvc_t_modi.
 
 *----------------------------------------------------------------------*

   po_event_data->m_event_handled = 'X'.
 
   case pv_fieldname.
 
     when 'FIELDNAME'.
 

  clear lv_offset.
  _field_info: 'MARC'        'WERKS',
                'MARC'        'MATNR',
                'ZTAB0180' 'MODEL_CODE',
                'ZTAB0170' 'BOM_ID'.
 
  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
     exporting
       retfield        = 'BOM_ID'
       dynpprog        = sy-repid
       dynpnr          = sy-dynnr
*       dynprofield     = 'ZE_AUFK-ZZBOMID'  "SCREEN PAI에서 INTO FIELD 지정시에만 사용
       value_org       = 'S'
       display         = ' '
     tables
       field_tab       = lt_dfies
       value_tab       = gt_zzbomid
       return_tab      = lt_return
     exceptions
       parameter_error = 1
       no_values_found = 2
       others          = 3.
 
       if sy-subrc <> 0.
         message id sy-msgid
                 type 'S'
                 number sy-msgno
                 with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                 display like 'E'.
         exit.
       endif.
 

*이하는 ALV ONF4에서만 사용
       read table lt_return index 1.
       check sy-subrc = 0.
 
       assign po_event_data->m_data->* to <lt_modi>.
       append value lvc_s_modi( row_id    = ps_row_no-row_id
                                fieldname = pv_fieldname
                                value     = lt_return-fieldval
                              )
              to <lt_modi>.
 
   endcase.
 
 endform.

작가의 이전글 라우팅 구성부품할당내역 SQL 조회
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari