Skip to Content
0
Feb 02, 2021 at 11:36 AM

No entries made in reference feild

49 Views

Hi,

REPORT ZICICI_REVERSE_FEED_BAPI.
DATA  :   MESSTAB LIKE  BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA: w_textout LIKE t100-text.
TYPES : BEGIN OF TY_BSEG,
        TRANS_TYPE(20) TYPE C,
        SGTXT TYPE BSEG-SGTXT,
        ZUONR TYPE BSEG-ZUONR,
        UTR_NUM(60) TYPE C,
        DATE(60) TYPE C,
        AMOUNT(12) TYPE C,
        NAME(60) TYPE C,
        IFSC_CODE(20) TYPE C,
        CODE(60) TYPE C,
        DEBIT_NUM(20) TYPE C,
        MAKERS_ID(60) TYPE C,
        FIRST_APPROVER(60) TYPE C,
        SECOND_APPROVER(60) TYPE C,
        BELNR TYPE BSEG-BELNR,
        BUKRS TYPE BSEG-BUKRS,
        GJAHR TYPE BSEG-GJAHR,
        END OF TY_BSEG.
DATA : WA_DATATAB TYPE TY_BSEG,
      IT_DATATAB TYPE TABLE OF TY_BSEG.
TYPES: BEGIN OF ty_error,
        BELNR TYPE BSEG-BELNR,
        BUKRS TYPE BSEG-BUKRS,
        GJAHR TYPE BSEG-GJAHR,
        ZUONR TYPE BSEG-ZUONR,
        SGTXT TYPE BSEG-SGTXT,
         err_msg(73) TYPE c,
      END OF ty_error.
DATA: wa_error type ty_error ,
      it_error type  table of ty_error WITH HEADER LINE.
DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT TYPE SLIS_FIELDCAT_ALV,
      WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
data : it_event type slis_t_event,
      wa_event like line of it_event.
wa_event-name = 'user_command'.
wa_event-form = 'uc'.
append wa_event to it_event.
TYPES: BEGIN OF t_bseg,
        belnr type bseg-belnr,
        bukrs type bseg-bukrs,
        gjahr type bseg-gjahr,
        buzei type bseg-buzei,
        zuonr type bseg-zuonr,
        sgtxt type bseg-sgtxt,
        koart type bseg-koart,
        umskz type bseg-zumsk,
      END OF t_bseg.
data: wa_bseg type t_bseg,
      it_bseg type table of t_bseg.

data :gt_accchg like  table  of ACCCHG,
      gs_accchg like line of gt_accchg.
data :gt_acchg like  table  of ACCHD,
      gs_acchg like line of gt_acchg.
data: itab like table of alsmex_tabline,
      wa like line of itab.

FIELD-SYMBOLS <fs_data> like line of it_datatab.
FIELD-SYMBOLS <fs> type any.
data gv_com type i.

SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-001.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY .
SELECTION-SCREEN END OF BLOCK SCR1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      field_name = 'P_FILE'
    IMPORTING
      file_name  = P_file.

START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    FILENAME                      = P_file
    I_BEGIN_COL                   = '0001'
    I_BEGIN_ROW                   = '0004'
    I_END_COL                     = '0016'
    I_END_ROW                     = '6253'
  TABLES
    INTERN                        = itab
 EXCEPTIONS
   INCONSISTENT_PARAMETERS       = 1
   UPLOAD_OLE                    = 2
   OTHERS                        = 3
          .
sort itab by row col.

loop at itab into wa.

  at new row.
   append INITIAL LINE to it_datatab assigning <fs_data>.
    gv_com = 1.
    endat.
    ASSIGN COMPONENT gv_com OF STRUCTURE <fs_data> to <fs>.
    <fs> = wa-value.
    gv_com = gv_com + 1.
   endloop.
   IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

if it_datatab is not INITIAL.
    select belnr
           bukrs
           gjahr
           buzei
           koart
           zuonr
           sgtxt
           umskz
           from
           bseg into table it_bseg FOR ALL ENTRIES IN it_datatab
           where belnr = it_datatab-belnr
           and bukrs = '1000'
           and gjahr = '2020'
           and koart = 'K'.
      ENDIF.
LOOP AT IT_DATATAB INTO WA_DATATAB.


gs_accchg-fdname = 'BELNR'.
*gs_accchg-oldval = wa_bseg-zuon.
gs_accchg-newval = wa_datatab-belnr.

gs_accchg-fdname = 'BUKRS'.
*gs_accchg-oldval = wa_bseg-zuonr.
gs_accchg-newval = wa_datatab-bukrs.

gs_accchg-fdname = 'GJAHR'.
*gs_accchg-oldval = wa_bseg-zuonr.
gs_accchg-newval = wa_datatab-gjahr.

*gs_accchg-fdname = 'BUZEI'.
**gs_accchg-oldval = wa_bseg-zuonr.
*gs_accchg-newval = wa_BSEG-BUZEI.

gs_accchg-fdname = 'ZUONR'.
*gs_accchg-oldv,al = wa_bseg-zuonr.
gs_accchg-newval = wa_datatab-zuonr.
*APPEND gs_accchg TO gt_accchg.
*CLEAR gs_accchg.
gs_accchg-fdname = 'SGTXT'.
*gs_accchg-oldval = wa_bseg-sgtxt.
gs_accchg-newval = wa_datatab-sgtxt.

APPEND gs_accchg TO gt_accchg.
CLEAR gs_accchg.
* DATA: lv_aworg TYPE AWORG.
*
*     lv_aworg = gs_accchg-aworg+4(4).
*
*     check sy-subrc = 0.
  CALL FUNCTION 'FI_DOCUMENT_CHANGE'
   EXPORTING
*     I_AWTYP                    = gs_acchg-awtyp
*     I_AWREF                    = gs_acchg-awref
*     I_AWORG                    = gs_acchg-aworg
*     I_AWSYS                    = ' '
*     I_KUNNR                    = ' '
*     I_LIFNR                    = ' '
*     I_HKONT                    = ' '
*     I_OBZEI                    = ' '
*     I_BUZEI                    = wa_BSEG-buzei
*     I_BSEGC                    =
*     X_LOCK                     = 'X'
     I_BUKRS                    = wa_DATATAB-bukrs
     I_BELNR                    = wa_datatab-belnr
     I_GJAHR                    = wa_datatab-gjahr
    TABLES
      T_ACCCHG                  = gt_accchg
   EXCEPTIONS
     NO_REFERENCE               = 1
     NO_DOCUMENT                = 2
     MANY_DOCUMENTS             = 3
     WRONG_INPUT                = 4
     OVERWRITE_CREDITCARD       = 5
     OTHERS                     = 6
            .
 IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
   EXPORTING
     WAIT          = 'X'.

endloop.
when i am running this i am getting error like no entries made in reference feild  can you please tell me what wrong in my code