0% found this document useful (0 votes)
58 views

Sample Code

This report updates the accum_amt and tcs_amt fields in the J_1IG_ACCUMHDR table based on the input accumamt. It first validates the input, calculates the tcs amount, locks the record, updates the fields, and outputs a confirmation message.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Sample Code

This report updates the accum_amt and tcs_amt fields in the J_1IG_ACCUMHDR table based on the input accumamt. It first validates the input, calculates the tcs amount, locks the record, updates the fields, and outputs a confirmation message.

Uploaded by

Anil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

*&---------------------------------------------------------------------*

*& Report ZHDR_CORR


*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zhdr_corr.
DATA : lv_answer,
ls_hdr LIKE j_1ig_accumhdr,
ls_dtl LIKE j_1ig_accumdtl,
lv_kbetr type p DECIMALS 3 VALUE '0.075',
lv_tcs_amt LIKE j_1ig_accumhdr-tcs_amt,
lv_accumamt LIKE j_1ig_accumhdr-accum_amt,
lv_THLD_AMT LIKE j_1ig_thld-thld_amt.

PARAMETERS : seller LIKE j_1ig_accumhdr-seller_pan OBLIGATORY,


buy_idty LIKE j_1ig_accumhdr-buyer_idtype OBLIGATORY,
buyer_id LIKE j_1ig_accumhdr-buyer_id OBLIGATORY,
accumamt LIKE j_1ig_accumhdr-accum_amt OBLIGATORY.

AT SELECTION-SCREEN.
CHECK seller IS NOT INITIAL AND buy_idty IS NOT INITIAL AND buyer_id IS NOT
INITIAL.
SELECT SINGLE * FROM j_1ig_accumhdr
INTO ls_hdr
WHERE
thld_cat = 'TCS'
AND seller_pan = seller
AND buyer_idtype = buy_IDTY
AND buyer_id = buyer_id.
IF sy-subrc NE 0.
MESSAGE e001(00) WITH 'Invalid Entry' DISPLAY LIKE 'I'.
ELSE.
SELECT SINGLE thld_amt FROM j_1ig_thld INTO lv_THLD_AMT
WHERE thld_cat = 'TCS'
AND valid_from = '20200401'.
IF sy-subrc EQ 0.
lv_accumamt = accumamt - lv_THLD_AMT.
lv_tcs_amt = lv_accumamt * lv_kbetr / 100.
ENDIF.
ENDIF.

START-OF-SELECTION.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'You are about to update J_1IG_ACCUMHDR for the given I
nput. Proceed?'
* TEXT_BUTTON_1 = 'Ja'(001)
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = 'Nein'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = lv_answer
* TABLES
* PARAMETER =
* EXCEPTIONS
* TEXT_NOT_FOUND = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
CASE lv_answer.
WHEN '2' OR 'A'.
STOP.
WHEN '1'.

WHEN OTHERS.
ENDCASE.
ENDIF.

CALL FUNCTION 'ENQUEUE_EJ_1IG_ACCUMHDR'


EXPORTING
mode_j_1ig_accumhdr = 'E'
* MANDT = SY-MANDT
* THLD_CAT =
seller_pan = seller
buyer_idtype = buy_IDTY
buyer_id = buyer_id
* KUNNR =
* VALID_FROM =
* X_THLD_CAT = ' '
* X_SELLER_PAN = ' '
* X_BUYER_IDTYPE = ' '
* X_BUYER_ID = ' '
* X_KUNNR = ' '
* X_VALID_FROM = ' '
* _SCOPE = '2'
* _wait = 'X'
* _COLLECT = ' '
* EXCEPTIONS
* foreign_lock = 1
* system_failure = 2
* OTHERS = 3.
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.

UPDATE j_1ig_accumhdr SET accum_amt = accumamt


tcs_amt = lv_tcs_amt
WHERE thld_cat = 'TCS'
AND seller_pan = seller
AND buyer_idtype = buy_IDTY
AND buyer_id = buyer_id.
IF sy-subrc EQ 0.
MESSAGE s001(00) WITH 'Updated successfully'.
ELSE.
MESSAGE e001(00) WITH 'NOT updated!!'.
ENDIF.
ENDIF.

end-of-SELECTION.
WRITE : 'Record updated for ', seller,'-', buyer_id.
ULINE.
ULINE.
SKIP.
WRITE: 'Old value',50 'New Value '.
ULINE.
WRITE: 'ACCUM_AMT'.
SKIP.
WRITE: ls_hdr-accum_amt LEFT-JUSTIFIED ,50 accumamt LEFT-JUSTIFIED.
SKIP.
WRITE: 'TCS_AMT'.
SKIP.
WRITE: ls_hdr-tcs_amt LEFT-JUSTIFIED ,50 lv_tcs_amt LEFT-JUSTIFIED.

You might also like