cancel
Showing results for 
Search instead for 
Did you mean: 

start routine.

Aummad
Participant
0 Kudos

Hi,

Please some one help me to understand these code line by line.

REFRESH: G_T_ERRORLOG, T_ERRORLOG.

LOOP AT DATAPAK INTO S_DATA.

ASSIGN COMPONENT 4 OF STRUCTURE S_DATA TO <FS>.

V_RECNO = <FS>.

REFRESH T_MONITOR.

CALL FUNCTION 'Z_BW_FILTER_NOT_ALLOWED_CHARS'

TABLES

T_MONITOR = T_MONITOR

CHANGING

V_ALLOWED_CHAR = V_ALLOWED_CHAR

V_STRING = S_DATA-/BIC/NKCBC_T2.

MODIFY DATAPAK FROM S_DATA.

IF NOT T_MONITOR[] IS INITIAL.

LOOP AT T_MONITOR INTO S_MONITOR.

S_ERRORLOG-RECORD = V_RECNO.

S_ERRORLOG-MSGTY = S_MONITOR-MSGTY.

S_ERRORLOG-MSGID = S_MONITOR-MSGID.

S_ERRORLOG-MSGNO = S_MONITOR-MSGNO.

S_ERRORLOG-MSGV1 = S_MONITOR-MSGV1.

APPEND S_ERRORLOG TO T_ERRORLOG.

ENDLOOP.

ENDIF.

ENDLOOP.

SORT T_ERRORLOG BY MSGTY MSGID MSGNO MSGV1.

DELETE ADJACENT DUPLICATES FROM T_ERRORLOG

COMPARING MSGTY MSGID MSGNO MSGV1.

APPEND LINES OF T_ERRORLOG TO G_T_ERRORLOG.

*KIN122150-RSAIN1-20050816 Insert Begin

*********Currency conversion for NKRETPRI starts*******************

IF NOT DATAPAK[] IS INITIAL.

LOOP AT DATAPAK INTO S_DATAPAK.

CLEAR V_INDEX.

V_INDEX = SY-TABIX.

IF S_DATAPAK-/BIC/NKRETPRI CO ' 0123456789.'.

CLEAR: V_AMOUNT, V_PRC.

V_AMOUNT = S_DATAPAK-/BIC/NKRETPRI.

CALL FUNCTION 'RSAR_CURRENCY_CONVERT'

EXPORTING

I_CURRENCY = S_DATAPAK-CURRENCY

CHANGING

C_AMOUNT = V_AMOUNT.

.

V_PRC = V_AMOUNT.

S_DATAPAK-/BIC/NKRETPRI = V_PRC.

ENDIF.

*********Currency conversion for NKRETPRI ends*********************

*********Currency conversion for NKWHLPRCE starts******************

IF S_DATAPAK-/BIC/NKWHLPRCE CO ' 0123456789.'.

CLEAR: V_AMOUNT1, V_PRC1.

V_AMOUNT1 = S_DATAPAK-/BIC/NKWHLPRCE.

CALL FUNCTION 'RSAR_CURRENCY_CONVERT'

EXPORTING

I_CURRENCY = S_DATAPAK-CURRENCY

CHANGING

C_AMOUNT = V_AMOUNT1.

.

V_PRC1 = V_AMOUNT1.

S_DATAPAK-/BIC/NKWHLPRCE = V_PRC1.

ENDIF.

*********Currency conversion for NKWHLPRCE ends******************

**********Replace NKBLNKFLG with 'N' for blanks *******************

IF S_DATAPAK-/BIC/NKBLNKFLG IS INITIAL.

S_DATAPAK-/BIC/NKBLNKFLG = 'N'.

ENDIF.

**********Translate NKSZRANGE to uppercase ************************

TRANSLATE S_DATAPAK-/BIC/NKSZRANGE TO UPPER CASE.

  • KIN182130-ABILAK-20070427 Insert Begin:

  • If 0Currency is empty then populate it with whole sale price currency

IF S_DATAPAK-CURRENCY IS INITIAL.

S_DATAPAK-CURRENCY = S_DATAPAK-WHLPRCCURR.

ENDIF.

  • KIN182130-ABILAK-20070427 Insert End.

MODIFY DATAPAK FROM S_DATAPAK INDEX V_INDEX TRANSPORTING

/BIC/NKRETPRI /BIC/NKWHLPRCE /BIC/NKBLNKFLG

  • KIN182130-ABILAK-20070427 Insert Begin:

CURRENCY

  • KIN182130-ABILAK-20070427 Insert End.

*TPR47475-RSAIN1-20050921 Insert Begin

/BIC/NKSZRANGE.

*TPR47475-RSAIN1-20050921 Insert End

ENDLOOP.

ENDIF.

*KIN122150-RSAIN1-20050816 Insert End

************Include to load the TODS*************

INCLUDE ZBWD_TODS_TR.

  • abort <> 0 means skip whole data package !!!

ABORT = 0.

Please help me.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

check my remarks *** in the code:

      • in the first loop at the datapackage, the content of field NKCBC_T2 gets

      • checked for not allowed characters and a additional error message to appear

      • in the monitor is created for each record in the datapackage.

LOOP AT DATAPAK INTO S_DATA.

ASSIGN COMPONENT 4 OF STRUCTURE S_DATA TO <FS>.

V_RECNO = <FS>.

REFRESH T_MONITOR.

CALL FUNCTION 'Z_BW_FILTER_NOT_ALLOWED_CHARS'

TABLES

T_MONITOR = T_MONITOR

CHANGING

V_ALLOWED_CHAR = V_ALLOWED_CHAR

V_STRING = S_DATA-/BIC/NKCBC_T2.

MODIFY DATAPAK FROM S_DATA.

IF NOT T_MONITOR[] IS INITIAL.

LOOP AT T_MONITOR INTO S_MONITOR.

S_ERRORLOG-RECORD = V_RECNO.

S_ERRORLOG-MSGTY = S_MONITOR-MSGTY.

S_ERRORLOG-MSGID = S_MONITOR-MSGID.

S_ERRORLOG-MSGNO = S_MONITOR-MSGNO.

S_ERRORLOG-MSGV1 = S_MONITOR-MSGV1.

APPEND S_ERRORLOG TO T_ERRORLOG.

ENDLOOP.

ENDIF.

ENDLOOP.

      • end of the first loop.

SORT T_ERRORLOG BY MSGTY MSGID MSGNO MSGV1.

DELETE ADJACENT DUPLICATES FROM T_ERRORLOG

COMPARING MSGTY MSGID MSGNO MSGV1.

APPEND LINES OF T_ERRORLOG TO G_T_ERRORLOG.

*KIN122150-RSAIN1-20050816 Insert Begin

*********Currency conversion for NKRETPRI starts*******************

IF NOT DATAPAK[] IS INITIAL.

      • second loop over the datapackage.

LOOP AT DATAPAK INTO S_DATAPAK.

CLEAR V_INDEX.

V_INDEX = SY-TABIX.

IF S_DATAPAK-/BIC/NKRETPRI CO ' 0123456789.'.

      • the field NKRETPRI contains only numbers and the '.'. In this case,

      • a currency conversion takes place.

CLEAR: V_AMOUNT, V_PRC.

V_AMOUNT = S_DATAPAK-/BIC/NKRETPRI.

CALL FUNCTION 'RSAR_CURRENCY_CONVERT'

EXPORTING

I_CURRENCY = S_DATAPAK-CURRENCY

CHANGING

C_AMOUNT = V_AMOUNT.

.

V_PRC = V_AMOUNT.

S_DATAPAK-/BIC/NKRETPRI = V_PRC.

ENDIF.

*********Currency conversion for NKRETPRI ends*********************

*********Currency conversion for NKWHLPRCE starts******************

IF S_DATAPAK-/BIC/NKWHLPRCE CO ' 0123456789.'.

      • the field NKWHLPRCE contains only numbers and the '.'. In this case

      • a currency conversion takes place.

CLEAR: V_AMOUNT1, V_PRC1.

V_AMOUNT1 = S_DATAPAK-/BIC/NKWHLPRCE.

CALL FUNCTION 'RSAR_CURRENCY_CONVERT'

EXPORTING

I_CURRENCY = S_DATAPAK-CURRENCY

CHANGING

C_AMOUNT = V_AMOUNT1.

.

V_PRC1 = V_AMOUNT1.

S_DATAPAK-/BIC/NKWHLPRCE = V_PRC1.

ENDIF.

*********Currency conversion for NKWHLPRCE ends******************

**********Replace NKBLNKFLG with 'N' for blanks *******************

IF S_DATAPAK-/BIC/NKBLNKFLG IS INITIAL.

      • if the field NKBLNKFLG doesn't contain a value, 'N' is assigned to it.

S_DATAPAK-/BIC/NKBLNKFLG = 'N'.

ENDIF.

**********Translate NKSZRANGE to uppercase ************************

TRANSLATE S_DATAPAK-/BIC/NKSZRANGE TO UPPER CASE.

      • the field NKSZRANGE is converted from lower to upper case letters.

  • KIN182130-ABILAK-20070427 Insert Begin:

  • If 0Currency is empty then populate it with whole sale price currency

IF S_DATAPAK-CURRENCY IS INITIAL.

      • as the comment 2 lines above tells you

S_DATAPAK-CURRENCY = S_DATAPAK-WHLPRCCURR.

ENDIF.

  • KIN182130-ABILAK-20070427 Insert End.

      • with the modify statement, all changed fields will be updated in the datapackage

MODIFY DATAPAK FROM S_DATAPAK INDEX V_INDEX TRANSPORTING

/BIC/NKRETPRI /BIC/NKWHLPRCE /BIC/NKBLNKFLG

  • KIN182130-ABILAK-20070427 Insert Begin:

CURRENCY

  • KIN182130-ABILAK-20070427 Insert End.

*TPR47475-RSAIN1-20050921 Insert Begin

/BIC/NKSZRANGE.

*TPR47475-RSAIN1-20050921 Insert End

ENDLOOP.

      • end of second loop.

ENDIF.

*KIN122150-RSAIN1-20050816 Insert End

************Include to load the TODS*************

      • another code is included in the routine, there might be some more logic.

      • goto se38, enter ZBWD_TODS_TR as the program name and select display

      • to check what happens there.

INCLUDE ZBWD_TODS_TR.

Hope this helps!

kind regards

Siggi

Former Member
0 Kudos

You might get more useful replies if you ask a clearer question. What are we looking at here? Startroutine in transfer rules? Updaterules? What is it supposed to do in the first place and where does it go wrong (if it goes wrong)?

E