Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Updation of blank field in internal table

Former Member
0 Kudos
291

Hi,

I want to update the blank businees area field with the header item of that particular business area belnr.

i am sending you the updation of business area code plz find out where rhe error and rectify please.

points given

****************************

REPORT zfir_vendorwise_grir_balances NO STANDARD PAGE HEADING

LINE-SIZE 142

LINE-COUNT 65.

TABLES: bsis,bkpf,bseg,ekko,lfa1.

TYPE-POOLS: slis.

CONSTANTS:

gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,

gs_layout TYPE slis_layout_alv ,

gs_print TYPE slis_print_alv,

gt_sort TYPE slis_t_sortinfo_alv ,

gt_filter TYPE slis_t_filter_alv,

gt_sp_group TYPE slis_t_sp_group_alv,

gt_alv_graphics TYPE dtc_t_tc,

gt_excluding TYPE slis_t_extab ,

gt_events TYPE slis_t_event .

DATA: g_repid LIKE sy-repid.

DATA: gt_list_top_of_page TYPE slis_t_listheader.

DATA: g_boxnam TYPE slis_fieldname VALUE 'BOX',

p_f2code LIKE sy-ucomm VALUE '&ETA',

p_lignam TYPE slis_fieldname VALUE 'LIGHTS',

g_save(1) TYPE c,

g_default(1) TYPE c,

g_exit(1) TYPE c,

gx_variant LIKE disvariant,

g_variant LIKE disvariant.

DATA : g_user_command(30) VALUE 'USER_COMMAND'.

DATA : g_status_set(30) VALUE 'PF_STATUS_SET'.

DATA: BEGIN OF it_final OCCURS 0,

awkey TYPE awkey,

grir(10) TYPE c,

bukrs LIKE bsis-bukrs,

hkont LIKE bsis-hkont,

gjahr LIKE bsis-gjahr,

belnr LIKE bsis-belnr,

budat LIKE bsis-budat,

waers LIKE bsis-waers,

xblnr LIKE bsis-xblnr,

blart LIKE bkpf-blart,

buzei like bseg-buzei,

bschl LIKE bseg-bschl,

shkzg LIKE bseg-shkzg,

gsber LIKE bseg-gsber,

dmbtr LIKE bseg-dmbtr,

wrbtr LIKE bsis-wrbtr,

sgtxt LIKE bseg-sgtxt,

ebeln LIKE bseg-ebeln,

lifnr LIKE ekko-lifnr,

ps_psp_pnr LIKE ekkn-ps_psp_pnr,

name1 LIKE addr1_data-name1,

END OF it_final.

DATA : it_po LIKE it_final OCCURS 0 WITH HEADER LINE.

DATA : it_ebeln LIKE it_final OCCURS 0 WITH HEADER LINE.

DATA : it_awkey LIKE it_final OCCURS 0 WITH HEADER LINE.

DATA : wa_final LIKE LINE OF it_final.

DATA : BEGIN OF it_lifnr OCCURS 0,

ebeln TYPE ebeln,

lifnr TYPE lifnr,

END OF it_lifnr.

DATA : BEGIN OF it_name1 OCCURS 0,

lifnr TYPE lifnr,

name1 TYPE name1,

END OF it_name1.

DATA : hmin TYPE bseg-hkont.

DATA : hmax TYPE bseg-hkont.

DATA: idx TYPE sy-tabix.

DATA: temp_gsber TYPE bseg-gsber.

DATA: temp_ebeln TYPE bseg-ebeln.

DATA : temp_gjahr TYPE bseg-gjahr.

DATA : temp_belnr TYPE bseg-belnr.

DATA : temp_lifnr TYPE bseg-lifnr.

*DEFINING THE SELECTION-CRITERIA.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_bukrs LIKE skb1-bukrs OBLIGATORY.

SELECT-OPTIONS: s_gsber FOR bseg-gsber OBLIGATORY.

SELECT-OPTIONS: s_hkont FOR bseg-hkont OBLIGATORY.

PARAMETERS: p_lifnr LIKE ekko-lifnr.

PARAMETERS: p_budat LIKE bkpf-budat OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON s_hkont.

CHECK s_hkont-low LT 250301 OR s_hkont-high GT 250500.

MESSAGE e000(zm) WITH 'PLEASE SELECT A GRIR CLEARING ACCOUNT BETWEEN'

'250301 AND 250500'.

*----


*INITIALIZATION.

*----


INITIALIZATION.

g_repid = sy-repid.

*----


*START-OF-SELECTION.

*----


START-OF-SELECTION.

PERFORM select_data.

PERFORM display_data.

PERFORM list_display.

&----


*& Form select_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM select_data .

*selecting open item details

SELECT bukrs hkont gjahr belnr buzei

budat waers xblnr blart

bschl shkzg gsber dmbtr

wrbtr sgtxt

FROM bsis

INTO CORRESPONDING FIELDS OF TABLE it_final

WHERE bukrs EQ p_bukrs

AND hkont BETWEEN '0000250301' AND '0000250500'

AND budat LE p_budat AND ( blart EQ 'WE' OR

blart EQ 'RE' OR

blart EQ 'SA' OR

blart EQ 'EI').

*selecting closed/cleared item details

SELECT bukrs hkont gjahr belnr buzei budat

waers xblnr blart bschl shkzg

gsber dmbtr wrbtr sgtxt

FROM bsas

APPENDING CORRESPONDING FIELDS OF TABLE it_final

WHERE bukrs EQ p_bukrs

AND hkont BETWEEN '0000250301' AND '0000250500'

AND budat LE p_budat

AND blart IN ('WE', 'RE','SA','EI')

AND augdt GE p_budat.

SORT it_final BY belnr gsber DESCENDING.

CLEAR: temp_belnr, temp_gsber.

  • update blank business areas

  • LOOP AT it_final .

  • IF temp_gsber IN s_gsber AND it_final-belnr = temp_belnr.

  • IF it_final-gsber = ' '.

  • it_final-gsber = temp_gsber.

  • ENDIF.

  • ENDIF.

  • if it_final-gsber eq space or it_final-gsber in s_gsber.

  • wa_final-gsber = it_final-gsber.

  • wa_final-belnr = it_final-belnr.

  • modify it_final from wa_final transporting gsber.

  • else.

  • wa_final-gsber = it_final-gsber.

  • wa_final-belnr = it_final-belnr.

  • modify it_final from wa_final transporting gsber.

  • endif.

*clear wa_final.

  • endloop.

  • LOOP AT it_final.

  • IF temp_gsber IN s_gsber AND it_final-belnr = temp_belnr.

  • IF it_final-gsber = ' '.

  • it_final-gsber = temp_gsber.

  • ENDIF.

  • IF it_final-lifnr = ' '.

  • it_final-lifnr = temp_lifnr.

  • ENDIF.

  • IF it_final-belnr = ' '.

  • it_final-belnr = temp_belnr.

  • ENDIF.

  • ENDIF.

*

  • IF it_final-gsber EQ space OR it_final-gsber IN s_gsber.

  • CLEAR: temp_belnr, temp_gsber,temp_lifnr.

  • temp_belnr = it_final-belnr.

  • temp_gsber = it_final-gsber.

  • temp_lifnr = it_final-lifnr.

  • ELSE.

  • CLEAR : temp_belnr, temp_gsber,temp_lifnr.

  • ENDIF.

*

  • MODIFY it_final TRANSPORTING gsber.

  • ENDLOOP.

sort it_final by belnr buzei.

loop at it_final.

on change of it_final-belnr.

clear temp_belnr.

clear temp_gsber.

clear temp_lifnr.

temp_belnr = it_final-belnr.

temp_gsber = it_final-gsber.

temp_lifnr = it_final-lifnr.

endon.

if it_final-gsber is initial.

it_final-gsber = temp_gsber.

*modify it_final transporting gsber.

endif.

if it_final-lifnr is initial.

it_final-lifnr = temp_lifnr.

*modify it_final transporting lifnr.

endif.

modify it_final transporting gsber lifnr where belnr = temp_belnr.

endloop.

*deleting entries which are not as per input parameter for business area

  • DELETE it_final WHERE gsber NOT IN s_gsber .

loop at it_final.

if s_gsber-low ne '' and s_gsber-high ne ''.

delete it_final where gsber not in s_gsber.

elseif s_gsber-low ne '' and s_gsber-high eq ''.

delete it_final where gsber ne s_gsber-low.

endif.

endloop.

*initialising internal tables

it_awkey[] = it_final[].

it_po[] = it_final[].

it_ebeln[] = it_final[].

IF it_final[] IS NOT INITIAL.

*selecting purchase doc details

SELECT bukrs hkont gjahr belnr

bschl shkzg gsber dmbtr

wrbtr sgtxt ebeln

FROM bseg INTO CORRESPONDING FIELDS OF TABLE it_ebeln

FOR ALL ENTRIES IN it_final

WHERE bukrs = p_bukrs

AND belnr = it_final-belnr

AND gjahr = it_final-gjahr

AND hkont = it_final-hkont.

*selecting the GR/IR number from BKPF

SELECT bukrs gjahr belnr

budat waers xblnr blart

awkey

FROM bkpf

INTO CORRESPONDING FIELDS OF TABLE it_awkey

FOR ALL ENTRIES IN it_final

WHERE bukrs EQ it_final-bukrs

AND gjahr EQ it_final-gjahr

AND belnr EQ it_final-belnr.

ENDIF.

IF it_ebeln[] IS NOT INITIAL.

*selecting WBS element

SELECT ebeln gsber

ps_psp_pnr

FROM ekkn

INTO CORRESPONDING FIELDS OF TABLE it_po

FOR ALL ENTRIES IN it_ebeln

WHERE ebeln = it_ebeln-ebeln.

*selecting vendor

SELECT bukrs ebeln lifnr

FROM ekko

INTO CORRESPONDING FIELDS OF TABLE it_lifnr

FOR ALL ENTRIES IN it_ebeln

WHERE ebeln = it_ebeln-ebeln.

ENDIF.

IF it_lifnr[] IS NOT INITIAL.

*selecting vendor name

SELECT lifnr name1

FROM lfa1

INTO CORRESPONDING FIELDS OF TABLE it_name1

FOR ALL ENTRIES IN it_lifnr

WHERE lifnr EQ it_lifnr-lifnr.

ENDIF.

LOOP AT it_final.

idx = sy-tabix.

*retrieving purchase doc

READ TABLE it_ebeln WITH KEY belnr = it_final-belnr

gjahr = it_final-gjahr

hkont = it_final-hkont.

IF sy-subrc EQ 0.

READ TABLE it_final INDEX idx.

it_final-ebeln = it_ebeln-ebeln.

MODIFY it_final INDEX sy-tabix.

ENDIF.

*retrieving WBS element

READ TABLE it_po WITH KEY ebeln = it_final-ebeln.

IF sy-subrc EQ 0.

READ TABLE it_final INDEX idx.

it_final-ps_psp_pnr = it_po-ps_psp_pnr.

MODIFY it_final INDEX sy-tabix.

ENDIF.

  • calculating amount based on debit/credit

IF it_final-shkzg = 'H'.

it_final-dmbtr = 0 - it_final-dmbtr.

it_final-wrbtr = 0 - it_final-wrbtr.

ENDIF.

MODIFY it_final INDEX idx.

ENDLOOP.

CLEAR idx.

SORT it_final BY belnr ebeln DESCENDING.

*updating blank purchase doc numbers

CLEAR: temp_belnr, temp_ebeln,temp_gjahr.

DATA: w_idx LIKE sy-tabix.

LOOP AT it_final.

w_idx = sy-tabix.

*updating blank purchase docs

IF it_final-gjahr = temp_gjahr AND it_final-belnr = temp_belnr.

IF it_final-ebeln = ' '.

it_final-ebeln = temp_ebeln.

ENDIF.

ENDIF.

IF it_final-ebeln NE ' ' .

CLEAR: temp_belnr, temp_ebeln, temp_gjahr.

temp_belnr = it_final-belnr.

temp_ebeln = it_final-ebeln.

temp_gjahr = it_final-gjahr.

ELSE.

CLEAR : temp_belnr, temp_ebeln, temp_gjahr.

ENDIF.

MODIFY it_final TRANSPORTING ebeln.

*retrieving vendor

READ TABLE it_lifnr WITH KEY ebeln = it_final-ebeln.

IF sy-subrc EQ 0.

READ TABLE it_final INDEX w_idx.

it_final-lifnr = it_lifnr-lifnr.

MODIFY it_final INDEX sy-tabix.

ENDIF.

*retrieving GRIR number

READ TABLE it_awkey WITH KEY belnr = it_final-belnr

gjahr = it_final-gjahr

bukrs = it_final-bukrs.

IF sy-subrc EQ 0.

READ TABLE it_final INDEX w_idx.

it_final-awkey = it_awkey-awkey.

MODIFY it_final INDEX sy-tabix.

ENDIF.

*retrieving vendor name

READ TABLE it_name1 WITH KEY lifnr = it_final-lifnr.

IF sy-subrc EQ 0.

READ TABLE it_final INDEX w_idx.

it_final-name1 = it_name1-name1..

MODIFY it_final INDEX sy-tabix.

ENDIF.

ENDLOOP.

*deleting entries which are not per input parameters

DELETE it_final WHERE hkont NOT IN s_hkont.

IF p_lifnr NE ' '.

DELETE it_final WHERE lifnr NE p_lifnr.

ENDIF.

  • for selecting the grir number which is the first 10 digits of reference key and

  • selecting vendor name

LOOP AT it_final.

MOVE it_final-awkey+0(10) TO it_final-grir.

MODIFY it_final INDEX sy-tabix.

ENDLOOP.

SORT it_final BY hkont belnr.

  • deleting entries where purchase doc is blank.

DELETE it_final WHERE ebeln EQ ' '.

ENDFORM. " select_data

&----


*& Form build_fieldcat

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM e01_fieldcat_init USING gt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: gs_sort TYPE slis_sortinfo_alv.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'HKONT'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '1'.

ls_fieldcat-seltext_l = 'ACCOUNT'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'BSCHL'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '2'.

ls_fieldcat-seltext_l = 'POSTING KEY'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'BLART'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '3'.

ls_fieldcat-seltext_l = 'DOC TYPE'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'BELNR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '4'.

ls_fieldcat-seltext_l = 'DOC NUMBER'.

ls_fieldcat-hotspot(1) = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'BUDAT'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '5'.

ls_fieldcat-seltext_l = 'POSTING DATE'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'XBLNR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '6'.

ls_fieldcat-seltext_l = 'REF. DOC NO'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'EBELN'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '7'.

ls_fieldcat-seltext_l = 'PURCHASE DOC NO'.

ls_fieldcat-hotspot(1) = 'X'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'GSBER'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '8'.

ls_fieldcat-seltext_l = 'BUSINESS AREA'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'DMBTR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '9'.

ls_fieldcat-seltext_l = 'AMOUNT(LC)'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'WRBTR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '10'.

ls_fieldcat-seltext_l = 'AMOUNT(DC)'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'WAERS'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '11'.

ls_fieldcat-seltext_l = 'CURRENCY'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'GJAHR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '14'.

ls_fieldcat-seltext_l = 'Fiscal year'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'GRIR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '14'.

ls_fieldcat-seltext_l = 'GR/IR Number'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'LIFNR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '12'.

ls_fieldcat-seltext_l = 'VENDOR NO'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'PS_PSP_PNR'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '13'.

ls_fieldcat-seltext_l = 'WBS Element'.

APPEND ls_fieldcat TO gt_fieldcat.

CLEAR ls_fieldcat.

ls_fieldcat-fieldname = 'NAME1'.

ls_fieldcat-tabname = 'IT_FINAL'.

ls_fieldcat-col_pos = '14'.

ls_fieldcat-seltext_l = 'VENDOR NAME'.

APPEND ls_fieldcat TO gt_fieldcat.

ENDFORM. " build_fieldcat

&----


*& Form LIST_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM list_display .

gs_layout-colwidth_optimize(1) = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_background_id = 'ALV_BACKGROUND'

i_callback_program = g_repid

i_callback_user_command = 'USER_COMMAND'

i_structure_name = 'IT_FINAL'

is_layout = gs_layout

it_fieldcat = gt_fieldcat[]

it_special_groups = gt_sp_group[]

it_sort = gt_sort[]

it_filter = gt_filter[]

i_save = g_save

is_variant = g_variant

it_events = gt_events[]

is_print = gs_print

it_alv_graphics = gt_alv_graphics[]

it_excluding = gt_excluding

TABLES

t_outtab = it_final.

ENDFORM. " LIST_DISPLAY

*&----


*

*& Form USER_COMMAND

*&----


FORM user_command USING i_ucomm LIKE sy-ucomm

is_selfield TYPE slis_selfield. "#EC CALLED

CASE i_ucomm.

WHEN '&IC1'. " Pick(Double-click)

CASE is_selfield-fieldname.

WHEN 'BELNR'.

CLEAR it_final.

READ TABLE it_final INDEX is_selfield-tabindex.

IF sy-subrc EQ 0.

  • FI Document number

SET PARAMETER ID 'BLN' FIELD it_final-belnr.

  • Display Document

CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.

ENDIF.

WHEN 'EBELN'.

CLEAR it_final.

READ TABLE it_final INDEX is_selfield-tabindex.

IF sy-subrc EQ 0.

  • PO number

IF it_final-ebeln NE ' '.

SET PARAMETER ID 'BES' FIELD it_final-ebeln.

  • Display Document

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

ENDIF.

ENDCASE.

ENDCASE.

ENDFORM. "user_command

&----


*& Form display_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display_data .

g_repid = sy-repid.

PERFORM e01_fieldcat_init USING gt_fieldcat[].

PERFORM eventtab_build CHANGING gt_events.

PERFORM e04_comment_build USING gt_list_top_of_page[].

ENDFORM. " display_data

&----


*& Form eventtab_build

&----


  • text

----


  • <--P_GT_EVENTS text

----


FORM eventtab_build CHANGING lt_events TYPE slis_t_event.

CONSTANTS:

gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

DATA: ls_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = lt_events.

READ TABLE lt_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE gc_formname_top_of_page TO ls_event-form.

APPEND ls_event TO lt_events.

ENDIF.

ENDFORM. " eventtab_build

&----


*& Form e04_comment_build

&----


  • text

----


  • -->P_GT_LIST_TOP_OF_PAGE[] text

----


FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.

DATA : v_time(10) TYPE c.

DATA: ls_line TYPE slis_listheader.

DATA : v_text(50) TYPE c.

DATA : v_date_low(10) TYPE c,

v_date_high(10) TYPE c.

CONCATENATE 'GR/IR Report' ' '

INTO v_text SEPARATED BY space.

CLEAR ls_line.

ls_line-typ = 'H'.

ls_line-info = v_text.

APPEND ls_line TO e04_lt_top_of_page.

ENDFORM. " e04_comment_build

&----


*& Form top_of_page

&----


  • text

----


FORM top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = gt_list_top_of_page.

ENDFORM . "TOP_OF_PAGE

***************************************

regards,

Amit teja

Message was edited by: amit teja

Message was edited by: amit teja

Message was edited by: amit teja

5 REPLIES 5

Former Member
0 Kudos
204

check here

if it_final-lifnr eq ' '.

it_final-lifnr = temp_lifnr.

modify it_final transporting <b>LIFNR</b>.

endif.

endloop.

Regards

Prabhu

Former Member
0 Kudos
204

sorry deleted

<b>modify it_final transporting LIFNR.</b>

Message was edited by: Chandrasekhar Jagarlamudi

Former Member
0 Kudos
204

Hi Amit,

Instead of if it_final-gsber eq ' '.

try

if it_final-gsber is initial.

hope it works, rest of the things are fine.

Regards:-

<b>Santosh</b>

naimesh_patel
Active Contributor
0 Kudos
204

Hello,

<b>Sort it_final by belnr.</b>

loop at it_final.

on change of it_final-belnr.

clear temp_gsber.

clear temp_lifnr.

<b>temp_belnr = it_final-belnr.</b>

temp_gsber = it_final-gsber.

temp_lifnr = it_final-lifnr.

if it_final-gsber eq ' '.

it_final-gsber = temp_gsber.

endif.

if it_final-lifnr eq ' '.

it_final-lifnr = temp_lifnr.

endif.

modify it_final transporting gsber lifnr where <b>belnr = temp_belnr</b>.

<b>endon.</b>

endloop.

Regards,

Naimesh

Former Member
0 Kudos
204

Hello,

It is not a good practice to use ON CHANGE OF with in the loop of an internal table. It will be good to use control break events like AT NEW <>, AT FIRST <>, AT LAST <>, AT END <> & END AT.

Please rebuild your code. Thanks !!

Regards,

Vishal

**Reward if helpful