Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error Fixing..please help me..full marks wud be given........

I am getting a following error when i run the program in ECC 6.o

ERROR:" The where condition does not refer to for all entries table..

program is as follows..full marks wud be given.....

----


***INCLUDE MZSDRETL_RMP_PRICING_ENTRYF01 .

----


&----


*& Form COMPUTE_SCROLLING_IN_TC

&----


  • Vertical Scrolling in table control upon pressing , next page,

  • previous page , first page and last page button

----


  • -->P_TC_NAME table control name

  • -->P_OK_CODE okcode

  • -->P_LOOPC current loop count

----


FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME

P_OK_CODE

P_LOOPC.

-BEGIN OF LOCAL DATA----


DATA L_TC_NEW_TOP_LINE LIKE SY-TABIX.

DATA L_TC_FIELD_NAME LIKE FELD-NAME.

FIELD-SYMBOLS <TC> TYPE CXTAB_CONTROL.

-END OF LOCAL DATA----


ASSIGN (P_TC_NAME) TO <TC>.

IF <TC>-LINES = 0.

L_TC_NEW_TOP_LINE = 1.

ELSE.

CALL FUNCTION 'SCROLLING_IN_TABLE'

EXPORTING

ENTRY_ACT = <TC>-TOP_LINE

ENTRY_FROM = 1

ENTRY_TO = <TC>-LINES

LAST_PAGE_FULL = C_X

LOOPS = P_LOOPC

OK_CODE = P_OK_CODE

OVERLAPPING = C_X

IMPORTING

ENTRY_NEW = L_TC_NEW_TOP_LINE.

  • exceptions

  • no_entry_or_page_act = 01

  • no_entry_to = 02

  • no_ok_code_or_page_go = 03

  • others = 99.

ENDIF.

  • get actual tc and column *

GET CURSOR FIELD L_TC_FIELD_NAME .

IF SY-SUBRC = 0.

  • set actual column *

SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.

ENDIF.

  • set the new top line *

<TC>-TOP_LINE = L_TC_NEW_TOP_LINE.

ENDFORM. " COMPUTE_SCROLLING_IN_TC

&----


*& Form GET_VALUE_ON_REQUEST

&----


  • Call function module to display the region list in form of search help

----


FORM GET_VALUE_ON_REQUEST TABLES RET

USING P_C_RET

P_C_DYN

P_DYNNR.

  • Call function module to display the data in internal table in form of

  • a search help

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = P_C_RET

DYNPPROG = G_REPID

DYNPNR = P_DYNNR

DYNPROFIELD = P_C_DYN

VALUE_ORG = C_VAL_ORG " Value S

TABLES

VALUE_TAB = RET.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " GET_VALUE_ON_REQUEST

&----


*& Form POPULATE_RANGES

&----


  • Populate range tables with store grouping data

----


  • -->P_I_STORE_INFO store grouping entry

----


FORM POPULATE_RANGES USING L_REGION_ID

L_DIST_ID

L_AREA_ID

L_STORE_ID.

CLEAR : R_REGION , R_DIST , R_AREA , R_STORE .

CLEAR : R_REGION[] , R_DIST[] , R_AREA[] , R_STORE[].

  • populate region

IF NOT L_REGION_ID IS INITIAL.

R_REGION-SIGN = C_SIGN.

R_REGION-OPTION = C_OPT1.

R_REGION-LOW = L_REGION_ID.

APPEND R_REGION.

CLEAR R_REGION.

ENDIF.

  • populate district

IF NOT L_DIST_ID IS INITIAL.

R_DIST-SIGN = C_SIGN.

R_DIST-OPTION = C_OPT1.

R_DIST-LOW = L_DIST_ID.

APPEND R_DIST.

CLEAR R_DIST.

ENDIF.

  • populate area

IF NOT L_AREA_ID IS INITIAL.

R_AREA-SIGN = C_SIGN.

R_AREA-OPTION = C_OPT1.

R_AREA-LOW = L_AREA_ID.

APPEND R_AREA.

CLEAR R_AREA.

ENDIF.

  • populate store

IF NOT L_STORE_ID IS INITIAL.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = L_STORE_ID

IMPORTING

OUTPUT = L_STORE_ID.

R_STORE-SIGN = C_SIGN.

R_STORE-OPTION = C_OPT1.

R_STORE-LOW = L_STORE_ID.

APPEND R_STORE.

CLEAR R_STORE.

ENDIF.

ENDFORM. " POPULATE_RANGES

&----


*& Form GET_TABLE_ROW_VALUES

&----


  • Get the field values of the current row of the table

  • l_stepl - current row no.

----


FORM GET_TABLE_ROW_VALUES USING L_STEPL.

DATA: L_REPID LIKE D020S-PROG.

REFRESH I_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-REGION_ID'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-DIST_ID'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-AREA_ID'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-ATTR_VAL'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-STORE_ID'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'ZPRICELIST-ZLIST'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

L_REPID = G_REPID .

  • Call function to get the screen data

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = L_REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = I_DYNPREAD.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " GET_TABLE_ROW_VALUES

&----


*& Form DETERMINE_LEVEL

&----


  • Determine the level of store grouping info entered

----


  • Region - 1

  • Region/Dist - 2

  • Region/Dist/Area - 3

  • Region/Dist/Area/Store - 4

----


FORM DETERMINE_LEVEL USING P_I_STORE_INFO LIKE I_STORE_INFO.

IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL

AND P_I_STORE_INFO-DIST_ID IS INITIAL

AND P_I_STORE_INFO-AREA_ID IS INITIAL

AND P_I_STORE_INFO-STORE_ID IS INITIAL.

P_I_STORE_INFO-LEVEL = C_LEVEL1.

ENDIF.

IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL

AND NOT P_I_STORE_INFO-DIST_ID IS INITIAL

AND P_I_STORE_INFO-AREA_ID IS INITIAL

AND P_I_STORE_INFO-STORE_ID IS INITIAL.

P_I_STORE_INFO-LEVEL = C_LEVEL2.

ENDIF.

IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL

AND NOT P_I_STORE_INFO-DIST_ID IS INITIAL

AND NOT P_I_STORE_INFO-AREA_ID IS INITIAL

AND P_I_STORE_INFO-STORE_ID IS INITIAL.

P_I_STORE_INFO-LEVEL = C_LEVEL3.

ENDIF.

IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL

AND NOT P_I_STORE_INFO-DIST_ID IS INITIAL

AND NOT P_I_STORE_INFO-AREA_ID IS INITIAL

AND NOT P_I_STORE_INFO-STORE_ID IS INITIAL.

P_I_STORE_INFO-LEVEL = C_LEVEL4.

ENDIF.

ENDFORM. " DETERMINE_LEVEL

&----


*& Form GET_SY_STEPL

&----


  • Get the current record number in the table control.

----


  • -->P_L_STEPL text

----


FORM GET_SY_STEPL USING P_L_STEPL LIKE SY-STEPL.

CLEAR P_L_STEPL.

CALL FUNCTION 'DYNP_GET_STEPL'

IMPORTING

POVSTEPL = P_L_STEPL

  • EXCEPTIONS

  • STEPL_NOT_FOUND = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " GET_SY_STEPL

&----


*& Form GET_POPUP_CONFIRM

&----


  • Display the popup to confirm the user

----


FORM GET_POPUP_CONFIRM USING P_L_ANS

P_G_POPUP_TEXT

G_LINE_TEXT.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = G_LINE_TEXT

TEXT_QUESTION = P_G_POPUP_TEXT

IMPORTING

ANSWER = P_L_ANS.

IF SY-SUBRC <> 0.

ENDIF.

ENDFORM. " GET_POPUP_CONFIRM

&----


*& Form GOTO_SKU_HIER_SCREEN

&----


  • Upon user wishes to go to the detail screen , a check is performed

  • to determine if any existing promo or pricing is already available

  • for the entered store grouping info . If it is available then

  • prompt a message to the user 'Already promo exists if user wants to

  • go to the detail screen ?'. If the user presses 'Yes' then then

  • detail screen will appear otherwise the header screen will appear

----


FORM GOTO_SKU_HIER_SCREEN.

CLEAR G_CHECK_ENTRY.

  • Check the store grouping entries beforr switching to detail screen.

PERFORM CHECK_STORE_ENTRIES.

CHECK G_CHECK_ENTRY IS INITIAL.

READ TABLE I_STORE_INFO WITH KEY REGION_ID = C_SPACE

DIST_ID = C_SPACE

AREA_ID = C_SPACE

STORE_ID = C_SPACE

ATTR_VAL = C_SPACE.

IF SY-SUBRC = 0.

DELETE I_STORE_INFO WHERE REGION_ID = C_SPACE

AND DIST_ID = C_SPACE

AND AREA_ID = C_SPACE

AND STORE_ID = C_SPACE

AND ATTR_VAL = C_SPACE.

ENDIF.

  • perform check for the duplicate store grouping data.

PERFORM CHECK_DUPLICATE_STRGRP_DATA.

  • If any duplicate entry is found then user will be prompted with the

  • message if he/she wants to delete those duplicate entries . If 'Yes'

  • is pressed then all the duplicate entries will be deleted or else

  • if 'No' is pressed , then user will remain in the same header screen

IF G_DUPLICATE_ENTRY = C_X.

CONCATENATE TEXT-058 TEXT-059

INTO G_POPUP_TEXT

SEPARATED BY SPACE.

CLEAR G_ANS.

CLEAR G_LINE_TEXT.

  • Get the pop-up to confirm the operation

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = '1'.

  • Delete the duplicate entries

DELETE ADJACENT DUPLICATES FROM I_STORE_INFO COMPARING REGION_ID

DIST_ID

AREA_ID

STORE_ID

ATTR_VAL.

MESSAGE S161(ZS) WITH TEXT-003.

ENDIF.

ELSE.

  • Perform the duplicate entry check for create or change pricing

IF G_MAIN_OKCODE = 'PRCC' OR G_MAIN_OKCODE = 'CRPR'.

IF I_STORE_INFO[] IS INITIAL.

MESSAGE S161(ZS) WITH TEXT-004.

ELSE.

CLEAR G_FLAG.

LOOP AT I_STORE_INFO WHERE NOT REPROMO IS INITIAL.

G_FLAG = C_X.

EXIT.

ENDLOOP.

  • Prompt the message by calling the function module for pop-up confirm

IF NOT G_FLAG IS INITIAL.

CONCATENATE TEXT-061 TEXT-062

INTO G_POPUP_TEXT SEPARATED BY SPACE .

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

CLEAR G_ANS.

PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.

  • Begin of DEVK939178

  • Set top line of sku table to 1 and resolve nested screen calls

TBCL3-TOP_LINE = 1.

  • call screen 9002.

LEAVE TO SCREEN 9002.

  • End of DEVK939178

ENDIF.

ELSE.

PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.

  • Begin of DEVK939178

  • Set top line of sku table to 1 and resolve nested screen calls

TBCL3-TOP_LINE = 1.

LEAVE TO SCREEN 9002.

  • call screen 9002.

  • End of DEVK939178

ENDIF.

ENDIF.

ELSE.

  • If user does not input any store grouping info in the header screen

  • and opts to go to the detail, then message will appear to the user as

  • 'A Promo is going to be applied on the Price List type '. This will

  • necessarily be a % promo as the promo is going to applied across all

  • the SKUs that belong to that price list type which is irrespective of

  • the price of individual SKUs

IF I_STORE_INFO[] IS INITIAL.

IF G_PRICING_VIEW_FLAG = C_X " DEVK939197

OR G_PROMO_VIEW_FLAG = C_X. " DEVK939197

LEAVE TO SCREEN 9002.

ELSE.

IF G_PROMO_PLTYP <> C_X.

CLEAR G_POPUP_TEXT.

CLEAR G_LINE_TEXT.

CONCATENATE TEXT-063 TEXT-062

INTO G_POPUP_TEXT SEPARATED BY SPACE .

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

  • If user opts 'Yes' then another screen will appear where the user can

  • give the value of the % promo that is going to be applied on the

  • pricelist type

G_PROMO_PLTYP = C_X.

  • Begin of DEVK939178

  • Set top line of sku table to 1 and resolve nested screen calls

CLEAR I_STORE_INFO.

I_STORE_INFO-LEVEL = C_LEVEL6.

APPEND I_STORE_INFO.

TBCL3-TOP_LINE = 1.

PERFORM CHECK_EXIST_PROMO_STR .

PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.

LEAVE TO SCREEN 9002.

  • call screen 9002.

  • End of DEVK939178

  • call screen 9006 starting at 10 5 ending at 70 10.

ELSE.

MESSAGE S161(ZS) WITH TEXT-004.

ENDIF.

ENDIF.

ENDIF.

ELSE.

CLEAR G_FLAG.

LOOP AT I_STORE_INFO WHERE NOT REPROMO IS INITIAL.

G_FLAG = 'X'.

EXIT.

ENDLOOP.

IF NOT G_FLAG IS INITIAL.

CONCATENATE TEXT-064 TEXT-062

INTO G_POPUP_TEXT SEPARATED BY SPACE .

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

CLEAR G_ANS.

PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.

  • Begin of DEVK939178

  • Set top line of sku table to 1 and resolve nested screen calls

TBCL3-TOP_LINE = 1.

LEAVE TO SCREEN 9002.

  • call screen 9002.

  • End of DEVK939178

ENDIF.

ELSE.

PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.

  • Begin of DEVK939178

  • Set top line of sku table to 1 and resolve nested screen calls

TBCL3-TOP_LINE = 1.

LEAVE TO SCREEN 9002.

  • call screen 9002.

  • End of DEVK939178

ENDIF.

ENDIF.

ENDIF.

ENDIF.

*endif.

ENDFORM. " GOTO_SKU_HIER_SCREEN

&----


*& Form ADD_LINE_STR_GRP

&----


  • Add new entry to the store gropuing info

----


FORM ADD_LINE_STR_GRP.

G_OKCODE = OKCODE.

CLEAR I_STORE_INFO.

DESCRIBE TABLE I_STORE_INFO LINES L_LINE.

DO 15 TIMES.

I_STORE_INFO-LEVEL = C_LEVEL0.

APPEND I_STORE_INFO.

CLEAR I_STORE_INFO.

ENDDO.

G_ADD_CNT = G_ADD_CNT + 15.

G_LINE_CNT = 1.

ENDFORM. " ADD_LINE_STR_GRP

&----


*& Form DELETE_LINE_STR_GRP

&----


  • Delete selected entries which the user wants to perform a

  • delete operation .

----


FORM DELETE_LINE_STR_GRP.

  • If the store grouping table is blank then issue message

  • 'No Entry is available for Selection.' .

IF I_STORE_INFO[] IS INITIAL.

MESSAGE S161(ZS) WITH TEXT-001.

ELSE.

  • Check if any entry in the store info table is checked for the delete

  • If selected, then issue a confirmation message to the user in pop-up

READ TABLE I_STORE_INFO WITH KEY SEL = C_X.

IF SY-SUBRC = 0.

CLEAR G_POPUP_TEXT.

CLEAR G_LINE_TEXT.

G_POPUP_TEXT = TEXT-065 .

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT .

  • If the user opts 'Yes' then delete the selected lines

IF G_ANS = C_ANS1.

DELETE I_STORE_INFO WHERE SEL = C_X.

MESSAGE S161(ZS) WITH TEXT-002.

ENDIF.

ELSE.

  • Do the same deletion operation even if user does not select the line

  • but puts the cursor in any line entry.

GET CURSOR LINE L_LINE.

IF SY-SUBRC = 0.

L_LINE = L_LINE + TBCL_HEAD1-TOP_LINE - 1.

CLEAR G_POPUP_TEXT.

G_POPUP_TEXT = TEXT-065.

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

DELETE I_STORE_INFO INDEX L_LINE.

  • Upon successful delete operation issue a success message to the user

MESSAGE S161(ZS) WITH TEXT-002.

ENDIF.

ELSE.

MESSAGE S161(ZS) WITH TEXT-006.

ENDIF.

ENDIF.

ENDIF.

DESCRIBE TABLE I_STORE_INFO LINES G_ADD_CNT.

ENDFORM. " DELETE_LINE_STR_GRP

&----


*& Form SELECT_ALL_ENTRIES

&----


  • When the user selects the 'Select All' button, then select all the

  • entries of the store grouping table by setting the SEL field to X for

  • each entry

----


FORM SELECT_ALL_ENTRIES.

IF I_STORE_INFO[] IS INITIAL.

  • If the store grouping table is blank then issue message

  • 'No Entry is available for Selection.' .

MESSAGE S161(ZS) WITH TEXT-001.

ELSE.

LOOP AT I_STORE_INFO .

I_STORE_INFO-SEL = C_X.

MODIFY I_STORE_INFO.

ENDLOOP.

G_OKCODE = OKCODE.

ENDIF.

ENDFORM. " SELECT_ALL_ENTRIES

&----


*& Form DESELECT_ALL_ENTRIES

&----


  • Deselect all the entries in the table

----


FORM DESELECT_ALL_ENTRIES.

IF I_STORE_INFO[] IS INITIAL.

  • If the store grouping table is blank then issue message

  • 'No Entry is available for Selection.' .

MESSAGE S161(ZS) WITH TEXT-001.

ELSE.

LOOP AT I_STORE_INFO .

I_STORE_INFO-SEL = C_SPACE.

MODIFY I_STORE_INFO.

ENDLOOP.

ENDIF.

ENDFORM. " DESELECT_ALL_ENTRIES

&----


*& Form SAVE_PROMO

&----


  • Save the promo Event.

----


FORM SAVE_PROMO.

DATA: L_DATUM LIKE SY-DATUM,

L_SUBRC LIKE SY-SUBRC .

  • Populate dept/class/subclass if sku or style is not blank

PERFORM POPULATE_DEPT_CLASS.

DATA: G_PROMONO LIKE ZSDRETL_RMPHEAD-PP_ID.

IF G_PROMO_CHG_FLAG = C_X.

G_PROMONO = G_PROMO_ID.

ELSE.

  • Get number range for the promo

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

NR_RANGE_NR = C_NR_OBJ1

OBJECT = C_NROBJ

QUANTITY = '1'

IGNORE_BUFFER = C_X

IMPORTING

NUMBER = G_PROMONO.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDIF.

IF NOT G_PROMONO IS INITIAL.

REFRESH I_RMPHEAD.

CLEAR WA_RMPHEAD.

  • If Override flag is set for any SKU end that promo first

READ TABLE I_SKU_INFO WITH KEY OVERRIDE = C_X.

IF SY-SUBRC = 0.

  • perform end_existing_promo .

ENDIF.

  • Populate Header information for Promo event

REFRESH I_RMPHEAD.

CLEAR WA_RMPHEAD.

IF SY-DYNNR = '9006'.

WA_RMPHEAD-PP_ID = G_PROMONO.

WA_RMPHEAD-ID_TYPE = C_P.

WA_RMPHEAD-PLTYP = ZPRICELIST-ZLIST.

WA_RMPHEAD-APPROVE = CHK_APR.

WA_RMPHEAD-ERDAT = SY-DATUM.

WA_RMPHEAD-ERNAM = SY-UNAME.

WA_RMPHEAD-ID_DESC = G_PDESC.

WA_RMPHEAD-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPHEAD-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPHEAD-CLEARANCE = C_SPACE.

WA_RMPHEAD-PROMO_TYPE = G_PTYPE.

APPEND WA_RMPHEAD TO I_RMPHEAD.

CLEAR WA_RMPHEAD.

ELSE.

WA_RMPHEAD-PP_ID = G_PROMONO.

WA_RMPHEAD-ID_TYPE = C_P.

WA_RMPHEAD-PLTYP = G_PRICELIST.

WA_RMPHEAD-APPROVE = CHK_APR.

WA_RMPHEAD-ERDAT = SY-DATUM.

WA_RMPHEAD-ERNAM = SY-UNAME.

WA_RMPHEAD-ID_DESC = G_PDESC.

WA_RMPHEAD-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

L_SUBRC = 4.

LOOP AT I_SKU_INFO.

IF I_SKU_INFO-END_DATE GE ZSDRETL_RMPHEAD-START_DATE .

  • if i_sku_info-end_date ge sy-datum.

L_SUBRC = 0.

EXIT.

ENDIF.

ENDLOOP.

IF L_SUBRC = 4.

L_DATUM = ZSDRETL_RMPHEAD-START_DATE - 1.

  • l_datum = sy-datum - 1.

WA_RMPHEAD-END_DATE = L_DATUM.

ELSE.

WA_RMPHEAD-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

ENDIF.

WA_RMPHEAD-CLEARANCE = G_CHK_CLR.

WA_RMPHEAD-PROMO_TYPE = G_PROMO_TYPE.

APPEND WA_RMPHEAD TO I_RMPHEAD.

CLEAR WA_RMPHEAD.

ENDIF.

IF NOT I_RMPHEAD[] IS INITIAL.

MODIFY ZSDRETL_RMPHEAD FROM TABLE I_RMPHEAD.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-067.

COMMIT WORK.

ENDIF.

ENDIF.

  • Populate Store information for Promo event

REFRESH I_RMPSTORE.

CLEAR WA_RMPSTORE.

IF SY-DYNNR = '9006' OR G_PROMO_PLTYP = C_X.

WA_RMPSTORE-PP_ID = G_PROMONO.

WA_RMPSTORE-RECNO = 0.

WA_RMPSTORE-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPSTORE-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPSTORE-STORE_LEVEL = C_LEVEL6.

WA_RMPDETAIL-ID_TYPE = C_P.

WA_RMPDETAIL-PLTYP = G_PRICELIST.

APPEND WA_RMPSTORE TO I_RMPSTORE.

CLEAR WA_RMPSTORE.

ELSE.

LOOP AT I_STORE_INFO.

WA_RMPSTORE-PP_ID = G_PROMONO.

WA_RMPSTORE-RECNO = SY-TABIX.

WA_RMPSTORE-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPSTORE-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPSTORE-REGION_ID = I_STORE_INFO-REGION_ID.

WA_RMPSTORE-DIST_ID = I_STORE_INFO-DIST_ID.

WA_RMPSTORE-AREA_ID = I_STORE_INFO-AREA_ID.

WA_RMPSTORE-STORE_ID = I_STORE_INFO-STORE_ID.

WA_RMPSTORE-ATTR_VAL = I_STORE_INFO-ATTR_VAL.

WA_RMPSTORE-STORE_LEVEL = I_STORE_INFO-LEVEL.

WA_RMPSTORE-ID_TYPE = C_P.

WA_RMPSTORE-PLTYP = G_PRICELIST.

APPEND WA_RMPSTORE TO I_RMPSTORE.

CLEAR WA_RMPSTORE.

ENDLOOP.

ENDIF.

IF NOT I_RMPSTORE[] IS INITIAL.

IF NOT I_RMPSTORE_TEMP[] IS INITIAL.

READ TABLE I_RMPSTORE_TEMP INTO WA_RMPSTORE INDEX 1.

IF SY-SUBRC = 0.

PERFORM ENQUEUE USING WA_RMPSTORE-PP_ID.

ENDIF.

DELETE ZSDRETL_RMPSTORE FROM TABLE I_RMPSTORE_TEMP.

IF SY-SUBRC = 0.

COMMIT WORK.

PERFORM DEQUE.

REFRESH I_RMPSTORE_TEMP.

ENDIF.

ENDIF.

MODIFY ZSDRETL_RMPSTORE FROM TABLE I_RMPSTORE.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-066.

COMMIT WORK.

ENDIF.

ENDIF.

  • Populate SKU information for Promo event

CLEAR: WA_RMPDETAIL , I_RMPDETAIL[].

IF SY-DYNNR = '9006'.

WA_RMPDETAIL-PP_ID = G_PROMONO.

WA_RMPDETAIL-RECNO = 0.

WA_RMPDETAIL-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPDETAIL-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPDETAIL-VALUE = G_VAL_PLTYP.

WA_RMPDETAIL-ZLEVEL = C_LEVEL1.

APPEND WA_RMPDETAIL TO I_RMPDETAIL.

CLEAR WA_RMPDETAIL.

ELSE.

LOOP AT I_SKU_INFO.

WA_RMPDETAIL-PP_ID = G_PROMONO.

WA_RMPDETAIL-RECNO = SY-TABIX.

WA_RMPDETAIL-START_DATE = I_SKU_INFO-START_DATE.

IF ZSDRETL_RMPHEAD-END_DATE LT ZSDRETL_RMPHEAD-START_DATE.

  • if zsdretl_rmphead-end_date lt sy-datum.

WA_RMPDETAIL-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

ELSE.

WA_RMPDETAIL-END_DATE = I_SKU_INFO-END_DATE.

ENDIF.

WA_RMPDETAIL-DEPT = I_SKU_INFO-DEPT.

WA_RMPDETAIL-CLASS = I_SKU_INFO-CLASS.

WA_RMPDETAIL-SUB_CLASS = I_SKU_INFO-SUB_CLASS.

WA_RMPDETAIL-STYLE = I_SKU_INFO-STYLE.

WA_RMPDETAIL-SKU = I_SKU_INFO-SKU.

WA_RMPDETAIL-VALUE = I_SKU_INFO-VALUE.

WA_RMPDETAIL-BASIC_PRICE = I_SKU_INFO-KBETR.

WA_RMPDETAIL-ZLEVEL = I_SKU_INFO-TYPE.

WA_RMPDETAIL-TOP_UP = I_SKU_INFO-TOP_UP.

WA_RMPDETAIL-OVERRIDE = I_SKU_INFO-OVERRIDE.

WA_RMPDETAIL-ZLEVEL = I_SKU_INFO-TYPE.

WA_RMPDETAIL-REF_PROMO = I_SKU_INFO-REF_PROMO.

WA_RMPDETAIL-ID_TYPE = C_P.

WA_RMPDETAIL-PLTYP = G_PRICELIST.

APPEND WA_RMPDETAIL TO I_RMPDETAIL.

CLEAR WA_RMPDETAIL.

ENDLOOP.

ENDIF.

IF NOT I_RMPDETAIL[] IS INITIAL.

IF NOT I_RMPDETAIL_TEMP[] IS INITIAL.

READ TABLE I_RMPDETAIL_TEMP INTO WA_RMPDETAIL INDEX 1.

IF SY-SUBRC = 0.

PERFORM ENQUEUE USING WA_RMPDETAIL-PP_ID.

ENDIF.

DELETE ZSDRETL_RMPDETL FROM TABLE I_RMPDETAIL_TEMP.

IF SY-SUBRC = 0.

COMMIT WORK.

PERFORM DEQUE.

REFRESH I_RMPDETAIL_TEMP.

ENDIF.

ENDIF.

MODIFY ZSDRETL_RMPDETL FROM TABLE I_RMPDETAIL.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-068.

COMMIT WORK.

ENDIF.

ENDIF.

IF SY-SUBRC = 0.

IF G_PROMO_CHG_FLAG = C_X.

MESSAGE S161(ZS)

WITH TEXT-046 G_PROMONO TEXT-048.

ELSE.

MESSAGE S161(ZS)

WITH TEXT-046 G_PROMONO TEXT-049.

ENDIF.

LEAVE TO SCREEN 9000.

ENDIF.

ENDIF.

ENDFORM. " SAVE_PROMO

&----


*& Form EXIT_FROM_HEADER_SCREEN

&----


  • Exit from header screen

----


FORM EXIT_FROM_HEADER_SCREEN.

  • in case of view promo and view pricing , come back to the view/copy

  • screen

IF G_MAIN_OKCODE = 'VRPR' AND ( G_PROMO_VIEW_FLAG = C_X

OR G_PRICING_VIEW_FLAG = C_X ).

LEAVE TO SCREEN 9007.

ELSE.

  • if store grouping info table is empty then come back to the main menu

IF I_STORE_INFO[] IS INITIAL.

LEAVE TO SCREEN 9000.

ELSE.

  • if store grouping info contains a blank record then come to main menu

READ TABLE I_STORE_INFO INDEX 1.

IF SY-SUBRC = 0 AND I_STORE_INFO-REGION_ID IS INITIAL

AND I_SKU_INFO[] IS INITIAL.

LEAVE TO SCREEN 9000.

ENDIF.

  • if SKU info table is blank then issue message if the user wants to

  • exit from the header screen without entring the promo/pricing detail

IF I_SKU_INFO[] IS INITIAL.

CLEAR G_ANS .

IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.

G_POPUP_TEXT = TEXT-069.

ELSE.

G_POPUP_TEXT = TEXT-070.

ENDIF.

  • Call FM for pop-up message

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

LEAVE TO SCREEN 9000.

ENDIF.

ELSE.

  • if sku info is avilable & user presses exit then a message is issued

  • if the user wants to leave without saving the promo/pricing event

CLEAR G_ANS .

IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.

G_POPUP_TEXT = TEXT-071.

ELSE.

G_POPUP_TEXT = TEXT-072.

ENDIF.

  • Call FM for pop-up message

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • If user presses 'Yes' then go back to the main menu

IF G_ANS = C_ANS1.

LEAVE TO SCREEN 9000.

  • if user pressed 'No' then prompts the message if the user wants to go

  • back without saving if it says 'Yes' , then go to the main menu and if

  • it says 'No' then save the event and go back to main menu

ELSEIF G_ANS = C_ANS2.

CLEAR G_ANS .

  • message s161(zs) with text-164.

  • exit.

  • IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.

  • G_POPUP_TEXT = TEXT-073.

  • ELSE.

  • G_POPUP_TEXT = TEXT-074.

  • ENDIF.

  • Call FM for pop-up message

  • CLEAR G_LINE_TEXT.

  • PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • IF G_ANS = C_ANS1.

  • IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.

*

    • Call save pricing subroutine to save the pricing event

  • MESSAGE S161(ZS) WITH TEXT-164.

    • perform save_pricing.

  • ELSE.

*

    • Call save promo subroutine to save the promo event

    • perform save_promo.

  • MESSAGE S161(ZS) WITH TEXT-164.

  • ENDIF.

  • ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " EXIT_FROM_HEADER_SCREEN

&----


*& Form VIEW_PROMOS

&----


  • Call subroutine to view all the pre-existing promos that are

  • available for the selected lines

----


FORM VIEW_PROMOS.

CASE SY-DYNNR.

WHEN '9001'.

G_DYNNR = SY-DYNNR.

  • Display all the promo that are already exist for the selected entries

  • in store grouping table

  • Begin of DEVK939178

  • logic is changed to check if any existing promo available with higher

  • store hierarchy

PERFORM VIEW_PRE_PROMO_STRGRP.

  • End of DEVK939178

WHEN '9002'.

G_DYNNR = SY-DYNNR.

  • Display all the promo that are already exist for the selected entries

  • in sku hierarchy table

  • Begin of DEVK939196

PERFORM VIEW_PROMO_FOR_SKUHIER1 .

  • End of DEVK939196

ENDCASE.

ENDFORM. " VIEW_PROMOS

&----


*& Form VIEW_PRICING

&----


  • View the existing pricing if available for an entry

----


FORM VIEW_PRICING.

CASE SY-DYNNR.

WHEN '9001'.

G_DYNNR = SY-DYNNR.

  • Display all the pricings that are already exist for selected entries

  • in store grouping table

PERFORM VIEW_PRE_PROMO_STRGRP .

WHEN '9002'.

G_DYNNR = SY-DYNNR.

  • Display all the pricings that are already exist for selected entries

  • in sku hierarchy table

PERFORM VIEW_PROMO_FOR_SKUHIER1.

ENDCASE.

ENDFORM. " VIEW_PRICING

&----


*& Form VIEW_PROMO_FOR_STRGRP

&----


  • Prepare the ALV scenarios to display the existing promos

----


FORM VIEW_PROMO_FOR_STRGRP.

REFRESH I_FIELDCAT.

CLEAR I_FIELDCAT.

  • Populate the field catalogue table for Stor grouping fields

PERFORM POPULATE_CATALOGUE USING:

  • Position Fieldname Tablename Title Display

'01' 'REGION_ID' 'I_STR_GRP1' TEXT-075 ' ',

'02' 'DIST_ID' 'I_STR_GRP1' TEXT-076 ' ',

'03' 'AREA_ID' 'I_STR_GRP1' TEXT-077 ' ',

'04' 'ATTR_VAL' 'I_STR_GRP1' TEXT-078 ' ',

'05' 'STORE_ID' 'I_STR_GRP1' TEXT-079 ' ',

'06' 'PP_ID' 'I_STR_GRP1' TEXT-084 ' ',

'07' 'START_DATE' 'I_STR_GRP1' TEXT-082 ' ',

'08' 'END_DATE' 'I_STR_GRP1' TEXT-083 ' ',

'09' 'PROMO_TYPE' 'I_STR_GRP1' TEXT-080 ' ',

'10' 'CLEARANCE' 'I_STR_GRP1' TEXT-081 ' ',

'11' 'ID_DESC' 'I_STR_GRP1' TEXT-161 ' '.

LOOP AT I_FIELDCAT INTO STRUCT_CAT.

CASE STRUCT_CAT-FIELDNAME.

WHEN 'PROMO_TYPE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-NO_OUT = C_SPACE.

ELSE.

STRUCT_CAT-NO_OUT = C_X.

ENDIF.

WHEN 'CLEARANCE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-NO_OUT = C_SPACE.

ELSE.

STRUCT_CAT-NO_OUT = C_X.

ENDIF.

WHEN 'START_DATE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-REPTEXT_DDIC = TEXT-082.

ELSE.

STRUCT_CAT-REPTEXT_DDIC = TEXT-085.

ENDIF.

WHEN 'END_DATE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-REPTEXT_DDIC = TEXT-083.

ELSE.

STRUCT_CAT-REPTEXT_DDIC = TEXT-086.

ENDIF.

WHEN 'PP_ID'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-REPTEXT_DDIC = TEXT-084 .

ELSE.

STRUCT_CAT-REPTEXT_DDIC = TEXT-088.

ENDIF.

ENDCASE.

MODIFY I_FIELDCAT FROM STRUCT_CAT INDEX SY-TABIX.

ENDLOOP.

CLEAR STRUCT_LAYOUT.

STRUCT_LAYOUT-COLWIDTH_OPTIMIZE = C_X.

IF G_PROMO_FLAG = C_X.

STRUCT_LAYOUT-WINDOW_TITLEBAR = TEXT-089.

ELSE.

STRUCT_LAYOUT-WINDOW_TITLEBAR = TEXT-090.

ENDIF.

STRUCT_LAYOUT-ZEBRA = C_X.

  • Populate sort table

PERFORM POPULATE_SORT_TABLE.

  • populate event table

PERFORM POPULATE_EVENT_TABLE.

  • Call function to display the list of existing promos in ALV format

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

IS_LAYOUT = STRUCT_LAYOUT

IT_FIELDCAT = I_FIELDCAT

IT_SORT = I_SORTTAB[]

IT_EVENTS = I_EVENT[]

TABLES

T_OUTTAB = I_STR_GRP1

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " VIEW_PROMO_FOR_STRGRP

&----


*& Form POPULATE_CATALOGUE

&----


  • Populating general informations for output format

----


  • -->p_position Column position

  • -->p_fname Field name

  • -->p_tabname Internal table name

  • -->p_title Title

  • -->p_display Display/No display

----


FORM POPULATE_CATALOGUE USING P_POSITION TYPE SYCUCOL

P_FNAME TYPE FIELDNAME

P_TABNAME TYPE TABNAME

P_TITLE TYPE REPTEXT

P_DISPLAY TYPE C.

STRUCT_CAT-COL_POS = P_POSITION.

STRUCT_CAT-FIELDNAME = P_FNAME.

STRUCT_CAT-TABNAME = P_TABNAME.

STRUCT_CAT-REPTEXT_DDIC = P_TITLE.

STRUCT_CAT-NO_OUT = P_DISPLAY.

APPEND STRUCT_CAT TO I_FIELDCAT.

CLEAR STRUCT_CAT.

ENDFORM. " POPULATE_CATALOGUE

&----


*& Form IMPORT_SKU_STAT

&----


  • Call the screen to get the file path of the excel file which contains

  • the SKU hierarchies.

----


FORM IMPORT_SKU_STAT.

CLEAR G_FILEPATH.

CALL SCREEN 9005 STARTING AT 10 5 ENDING AT 82 9.

G_OKCODE = OKCODE.

ENDFORM. " IMPORT_SKU_STAT

&----


*& Form IMPORT_SKU

&----


  • Trap the okcode which is meant for import SKU request

----


FORM IMPORT_SKU.

G_OKCODE = OKCODE.

ENDFORM. " IMPORT_SKU

&----


*& Form CANCEL_FILE_PATH

&----


  • Get the okcode value while cancel the File Path Screen

----


FORM CANCEL_FILE_PATH.

G_OKCODE = OKCODE.

ENDFORM. " CANCEL_FILE_PATH

&----


*& Form ADD_LINE_SKUS

&----


  • Add the SKU hierarchy entries retrieved from the excel file to

  • the existing SKU information entered in the detail screen.

----


FORM ADD_LINE_SKUS.

G_OKCODE = OKCODE.

CLEAR I_SKU_INFO.

DESCRIBE TABLE I_SKU_INFO LINES L_LINE.

DO 14 TIMES.

I_SKU_INFO-TYPE = C_LEVEL0.

I_SKU_INFO-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

I_SKU_INFO-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

APPEND I_SKU_INFO.

CLEAR I_SKU_INFO.

ENDDO.

ENDFORM. " ADD_LINE_SKUS

&----


*& Form DELETE_LINE_SKUS

&----


  • Delete the selected entries from the SKU hierarchy table

----


FORM DELETE_LINE_SKUS.

G_OKCODE = OKCODE.

  • If no entry is found in the detail table then issue the message to

  • user as 'No Entry is available for Selection.'

IF I_SKU_INFO[] IS INITIAL.

MESSAGE S161(ZS) WITH TEXT-001.

ELSE.

  • If the SKU info table is not blank and lines are selected for the

  • delete then issue a pop-up message for confirmation . If the user

  • opts for 'Yes' then deleted the selected lines

READ TABLE I_SKU_INFO WITH KEY SEL = C_X.

IF SY-SUBRC = 0.

CLEAR G_POPUP_TEXT.

G_POPUP_TEXT = TEXT-065.

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

DELETE I_SKU_INFO WHERE SEL = C_X.

MESSAGE S161(ZS) WITH TEXT-002.

ENDIF.

ELSE.

  • User even can delete a particular entry just by putting cursor on it

GET CURSOR LINE L_LINE.

IF SY-SUBRC = 0.

L_LINE = L_LINE + TBCL3-TOP_LINE - 1.

CLEAR G_POPUP_TEXT.

G_POPUP_TEXT = TEXT-065.

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

DELETE I_SKU_INFO INDEX L_LINE.

MESSAGE S161(ZS) WITH TEXT-002.

ENDIF.

ELSE.

MESSAGE S161(ZS) WITH TEXT-006.

ENDIF.

ENDIF.

ENDIF.

  • perform check_for_hidden_rows.

ENDFORM. " DELETE_LINE_SKUS

&----


*& Form CONV_DATE

&----


  • Convert the date to its external format.

----


  • -->P_SY_DATUM input date

  • <--P_G_CREA_DATE output date

----


FORM CONV_DATE USING P_DATUM

CHANGING P_DATE.

CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

EXPORTING

DATE_INTERNAL = P_DATUM

IMPORTING

DATE_EXTERNAL = P_DATE

  • EXCEPTIONS

  • DATE_INTERNAL_IS_INVALID = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " CONV_DATE

&----


*& Form SELECT_ALL_SKUHIER

&----


  • Select all entries in SKU hierarchy table

----


FORM SELECT_ALL_SKUHIER.

IF I_SKU_INFO[] IS INITIAL.

MESSAGE S161(ZS) WITH TEXT-001.

ELSE.

LOOP AT I_SKU_INFO .

I_SKU_INFO-SEL = C_X.

MODIFY I_SKU_INFO.

ENDLOOP.

G_OKCODE = OKCODE.

ENDIF.

ENDFORM. " SELECT_ALL_SKUHIER

&----


*& Form DESELECT_ALL_SKUHIER

&----


  • Deselect all SKU hierarchy entries that are selected

----


FORM DESELECT_ALL_SKUHIER.

IF I_SKU_INFO[] IS INITIAL.

MESSAGE S161(ZS) WITH TEXT-001.

ELSE.

LOOP AT I_SKU_INFO .

I_SKU_INFO-SEL = C_SPACE.

MODIFY I_SKU_INFO.

ENDLOOP.

ENDIF.

ENDFORM. " DESELECT_ALL_SKUHIER

&----


*& Form GET_TABLE_ROW_SKUVALUES

&----


  • Get field values of all the fields of an entry of the SKU Info table

----


  • -->P_G_STEPL text

----


FORM GET_TABLE_ROW_SKUVALUES USING L_STEPL.

DATA: L_REPID LIKE D020S-PROG.

L_STEPL = 0.

  • populate the filed name to get the department value

REFRESH I_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-DEPT'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the class value

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-CLASS'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the sub class value

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-SUB_CLASS'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the style value

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-STYLE'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the SKU value

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-SKU'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the % or $ value

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-VALUE'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the end date

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-KBETR'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the start date

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-START_DATE'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • populate the filed name to get the end date

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-END_DATE'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

L_REPID = G_REPID.

  • Call function module to read the field position and name and get the

  • the values of the corresponding fields

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = L_REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = I_DYNPREAD.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " GET_TABLE_ROW_SKUVALUES

&----


*& Form GET_TABLE_ROW_VALUES_SKU

&----


  • Read the field values of the current row of the sku table

----


  • -->P_G_STEPL text

----


FORM GET_TABLE_ROW_VALUES_SKU USING L_STEPL.

DATA: L_REPID LIKE D020S-PROG.

  • Populate field name for department

REFRESH I_DYNPREAD.

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-DEPT'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • Populate field name for class

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-CLASS'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • Populate field name for sub class

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-SUB_CLASS'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

  • Populate field name for style

WA_DYNPREAD-STEPL = L_STEPL.

WA_DYNPREAD-FIELDNAME = 'I_SKU_INFO-STYLE'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

L_REPID = G_REPID.

  • Call function module to read department , class , subclass and style

  • values in the current row of the table

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = L_REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = I_DYNPREAD.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " GET_TABLE_ROW_VALUES_SKU

&----


*& Form EXIT_FROM_DETAIL_SCREEN

&----


  • Exit from the detail screen.

----


FORM EXIT_FROM_DETAIL_SCREEN.

CLEAR G_LINE_TEXT.

  • If the user is in view/copy promo/pricing screen then go back to the

  • main menu

IF G_MAIN_OKCODE = 'VRPR' AND ( G_PROMO_VIEW_FLAG = C_X

OR G_PRICING_VIEW_FLAG = C_X ).

LEAVE TO SCREEN 0.

ELSEIF G_PROMO_FLAG = C_X.

  • For all other case , prompt a message if the user wants to exit

  • without saving the promo event.

G_POPUP_TEXT = TEXT-072.

  • Call FM for pop-up message

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • If the user opts 'Yes' then go back to the main menu

IF G_ANS = C_ANS1.

LEAVE TO SCREEN 9000.

  • if the user opts 'No' then save the event and go back to the main menu

ELSEIF G_ANS = C_ANS2.

CLEAR G_ANS .

G_POPUP_TEXT = TEXT-074.

  • Call FM for pop-up message

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

MESSAGE S161(ZS) WITH TEXT-194.

EXIT.

IF I_SKU_INFO[] IS INITIAL.

MESSAGE S161(ZS) WITH TEXT-044.

ELSE.

  • Call save promo subroutine to save the promo event

  • Begin of DEVK939319

MESSAGE S161(ZS) WITH TEXT-194.

  • exit.

  • perform save_promo.

  • End of DEVK939319

ENDIF.

ENDIF.

ENDIF.

ELSEIF G_PRICING_FLAG = C_X.

  • For all other case , prompt a message if the user wants to exit

  • without saving the pricing event.

G_POPUP_TEXT = TEXT-071.

  • Call FM for pop-up message

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • If the user opts 'Yes' then go back to the main menu

IF G_ANS = C_ANS1.

LEAVE TO SCREEN 9000.

  • if the user opts 'No' then save the event and go back to the main menu

ELSEIF G_ANS = C_ANS2.

CLEAR G_ANS .

G_POPUP_TEXT = TEXT-073.

  • Call FM for pop-up message

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

IF I_SKU_INFO[] IS INITIAL.

MESSAGE S161(ZS) WITH TEXT-044.

ELSE.

  • Call save promo subroutine to save the promo event

PERFORM SAVE_PRICING.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " EXIT_FROM_DETAIL_SCREEN

&----


*& Form POPULATE_RANGES_SKU_HIER

&----


  • Populate range tables for department , class and sub class

----


FORM POPULATE_RANGES_SKU_HIER.

  • Populate department

REFRESH R_MVGR2.

IF NOT G_DEPT IS INITIAL AND G_PROMO_TYPE = C_% .

R_MVGR2-SIGN = C_SIGN.

R_MVGR2-OPTION = C_OPT1.

R_MVGR2-LOW = G_DEPT.

APPEND R_MVGR2.

CLEAR R_MVGR2.

ENDIF.

  • Populate class

REFRESH R_MVGR3.

IF NOT G_CLASS IS INITIAL AND G_PROMO_TYPE = C_%.

R_MVGR3-SIGN = C_SIGN.

R_MVGR3-OPTION = C_OPT1.

R_MVGR3-LOW = G_CLASS.

APPEND R_MVGR3.

CLEAR R_MVGR3.

ENDIF.

  • Populate sub class

REFRESH R_MVGR4.

IF NOT G_SUBCLASS IS INITIAL AND G_PROMO_TYPE = C_%.

R_MVGR4-SIGN = C_SIGN.

R_MVGR4-OPTION = C_OPT1.

R_MVGR4-LOW = G_SUBCLASS.

APPEND R_MVGR4.

CLEAR R_MVGR4.

ENDIF.

ENDFORM. " POPULATE_RANGES_SKU_HIER

&----


*& Form POPULATE_SKU_LEVEL

&----


  • POpulate the level of SKU hierarchy

----


  • -->P_I_SKU_INFO text

----


FORM POPULATE_SKU_LEVEL USING P_I_SKU_INFO LIKE I_SKU_INFO.

  • if only department is populated then level is 2.

IF NOT P_I_SKU_INFO-DEPT IS INITIAL

AND P_I_SKU_INFO-CLASS IS INITIAL

AND P_I_SKU_INFO-SUB_CLASS IS INITIAL

AND P_I_SKU_INFO-STYLE IS INITIAL

AND P_I_SKU_INFO-SKU IS INITIAL.

P_I_SKU_INFO-TYPE = C_LEVEL2.

ENDIF.

  • if only department and class are populated then level is 3.

IF NOT P_I_SKU_INFO-DEPT IS INITIAL

AND NOT P_I_SKU_INFO-CLASS IS INITIAL

AND P_I_SKU_INFO-SUB_CLASS IS INITIAL

AND P_I_SKU_INFO-STYLE IS INITIAL

AND P_I_SKU_INFO-SKU IS INITIAL.

P_I_SKU_INFO-TYPE = C_LEVEL3.

ENDIF.

  • if only department, class and sub class are populated then level is 4.

IF NOT P_I_SKU_INFO-DEPT IS INITIAL

AND NOT P_I_SKU_INFO-CLASS IS INITIAL

AND NOT P_I_SKU_INFO-SUB_CLASS IS INITIAL

AND P_I_SKU_INFO-STYLE IS INITIAL

AND P_I_SKU_INFO-SKU IS INITIAL.

P_I_SKU_INFO-TYPE = C_LEVEL4.

ENDIF.

  • if only style is populated then level is 5

IF NOT P_I_SKU_INFO-STYLE IS INITIAL

AND P_I_SKU_INFO-SKU IS INITIAL.

P_I_SKU_INFO-TYPE = C_LEVEL5.

ENDIF.

  • if sku is populated then level is 6

IF NOT P_I_SKU_INFO-SKU IS INITIAL.

P_I_SKU_INFO-TYPE = C_LEVEL6.

ENDIF.

ENDFORM. " POPULATE_SKU_LEVEL

&----


*& Form GET_SKUDATA_FROM_FILE

&----


  • Retrieve the SKU info from the excel file

----


FORM GET_SKUDATA_FROM_FILE.

DATA: L_SKU_BLANK LIKE SY-INDEX.

CLEAR L_SKU_BLANK.

REFRESH: I_FILE_SKU,

I_SKU_DETAILS.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-160.

  • Call function to convert the excel file data to an internal table data

CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'

EXPORTING

FILENAME = G_FILEPATH

I_BEGIN_COL = G_START_COL

I_BEGIN_ROW = G_START_ROW

I_END_COL = G_END_COL

I_END_ROW = G_END_ROW

TABLES

INTERN = I_FILE_SKU

  • EXCEPTIONS

  • INCONSISTENT_PARAMETERS = 1

  • UPLOAD_OLE = 2

  • OTHERS = 3

.

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 the internal table is not empty then extract the SKU info data from

  • it and populate the same to the internal table i_sku_details

CHECK NOT I_FILE_SKU[] IS INITIAL.

SORT I_FILE_SKU BY ROW COL.

LOOP AT I_FILE_SKU INTO WA_CELLS.

MOVE : WA_CELLS-COL TO G_INDEX.

ASSIGN COMPONENT G_INDEX OF STRUCTURE I_SKU_DETAILS TO <$FS>.

MOVE : WA_CELLS-VALUE TO <$FS>.

AT END OF ROW.

APPEND I_SKU_DETAILS.

CLEAR I_SKU_DETAILS.

ENDAT.

ENDLOOP.

  • Append sku info from i_sku_details to the SKU info table in the detail

  • screen

READ TABLE I_SKU_INFO WITH KEY DEPT = C_SPACE

CLASS = C_SPACE

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE.

IF SY-SUBRC = 0.

L_SKU_BLANK = SY-TABIX.

ENDIF.

LOOP AT I_SKU_DETAILS FROM 2.

I_SKU_INFO-DEPT = I_SKU_DETAILS-DEPT.

I_SKU_INFO-CLASS = I_SKU_DETAILS-CLASS.

I_SKU_INFO-SUB_CLASS = I_SKU_DETAILS-SUB_CLASS.

I_SKU_INFO-STYLE = I_SKU_DETAILS-STYLE.

I_SKU_INFO-SKU = I_SKU_DETAILS-SKU.

I_SKU_INFO-VALUE = I_SKU_DETAILS-VALUE.

  • Begin of DEVK939178

  • Translate style and SKU to upper case

TRANSLATE: I_SKU_INFO-DEPT TO UPPER CASE ,

I_SKU_INFO-CLASS TO UPPER CASE ,

I_SKU_INFO-SUB_CLASS TO UPPER CASE ,

I_SKU_INFO-STYLE TO UPPER CASE ,

I_SKU_INFO-SKU TO UPPER CASE .

  • End of DEVK939178

I_SKU_INFO-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

I_SKU_INFO-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

IF L_SKU_BLANK IS INITIAL.

APPEND I_SKU_INFO.

CLEAR I_SKU_INFO.

ELSE.

INSERT I_SKU_INFO INDEX L_SKU_BLANK.

CLEAR I_SKU_INFO.

L_SKU_BLANK = L_SKU_BLANK + 1.

ENDIF.

ENDLOOP.

LOOP AT I_SKU_INFO.

I_SKU_INFO-LINE_NO = SY-TABIX.

MODIFY I_SKU_INFO.

ENDLOOP.

REFRESH I_FILE_SKU.

  • populate dept/class/subclass for style and sku

PERFORM POPULATE_DEPT_CLASS.

ENDFORM. " GET_SKUDATA_FROM_FILE

**&----


*----


**& Form CHECK_EXIST_PROMO_SKUHIER

**&----


*----


    • Check for any existing promo in the SKU hierarchy level.

**----


*----


*FORM CHECK_EXIST_PROMO_SKUHIER.

*

  • DATA: L_PP_ID LIKE ZSDRETL_RMPHEAD-PP_ID,

  • L_DESC LIKE ZSDRETL_RMPHEAD-ID_DESC,

  • L_CLR LIKE ZSDRETL_RMPHEAD-CLEARANCE,

  • L_STARTDATE LIKE ZSDRETL_RMPHEAD-START_DATE,

  • L_ENDDATE LIKE ZSDRETL_RMPHEAD-END_DATE,

  • L_VALUE LIKE KONP-KBETR.

*

*

  • DELETE I_SKU_INFO WHERE NOT DEL_FLAG IS INITIAL.

*

  • REFRESH I_SKU_HIER.

  • CLEAR WA_SKU_HIER.

  • IF NOT I_SKU_INFO[] IS INITIAL.

*

*

    • Retrieve all the SKU details from the table ZSDRETL_STR_INFO for the

    • same SKU info entered in the screen for the same date range

  • SELECT ZSDRETL_RMPDETL~DEPT

  • ZSDRETL_RMPDETL~CLASS

  • ZSDRETL_RMPDETL~SUB_CLASS

  • ZSDRETL_RMPDETL~STYLE

  • ZSDRETL_RMPDETL~SKU

  • ZSDRETL_RMPDETL~VALUE

  • ZSDRETL_RMPDETL~START_DATE

  • ZSDRETL_RMPDETL~END_DATE

  • ZSDRETL_RMPHEAD~PROMO_TYPE

  • ZSDRETL_RMPHEAD~CLEARANCE

  • ZSDRETL_RMPDETL~TOP_UP

  • ZSDRETL_RMPHEAD~PP_ID

  • ZSDRETL_RMPDETL~RECNO

  • ZSDRETL_RMPHEAD~ID_DESC

  • FROM ZSDRETL_RMPDETL INNER JOIN ZSDRETL_RMPHEAD

  • ON ZSDRETL_RMPDETLPP_ID = ZSDRETL_RMPHEADPP_ID

  • INTO TABLE I_SKU_HIER

  • FOR ALL ENTRIES IN I_SKU_INFO

  • WHERE ZSDRETL_RMPDETL~DEPT = I_SKU_INFO-DEPT

  • AND ZSDRETL_RMPDETL~CLASS = I_SKU_INFO-CLASS

  • AND ZSDRETL_RMPDETL~SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • AND ZSDRETL_RMPDETL~STYLE = I_SKU_INFO-STYLE

  • AND ZSDRETL_RMPDETL~SKU = I_SKU_INFO-SKU

  • AND ZSDRETL_RMPDETL~ZLEVEL <> '1'

  • AND ZSDRETL_RMPHEAD~ID_TYPE = C_P

  • AND ZSDRETL_RMPHEAD~PLTYP = ZPRICELIST-ZLIST

  • AND ZSDRETL_RMPDETL~START_DATE LE ZSDRETL_RMPHEAD-END_DATE

  • AND ZSDRETL_RMPDETL~END_DATE GE ZSDRETL_RMPHEAD-START_DATE .

  • IF SY-SUBRC = 0.

  • CHECK NOT I_SKU_HIER[] IS INITIAL.

  • REFRESH: I_STR_GRP1 , I_STR_DATA.

    • If any pre-existing SKU info is available for the same date range and

**same SKU info then get all the store grouping also to be retrieved for

    • all the pre-existing sku infos

  • SELECT

  • REGION_ID

  • DIST_ID

  • AREA_ID

  • STORE_ID

  • ATTR_VAL

  • PP_ID

  • FROM ZSDRETL_RMPSTORE

  • INTO TABLE I_STR_DATA

  • FOR ALL ENTRIES IN I_SKU_HIER

  • WHERE PP_ID = I_SKU_HIER-PP_ID

  • AND START_DATE LT ZSDRETL_RMPHEAD-END_DATE

  • AND END_DATE GT ZSDRETL_RMPHEAD-START_DATE .

*

  • IF SY-SUBRC = 0.

    • Compare the store info entered for the current SKU info with the

**store info retrieved for the pre existing SKU info . If any successful

    • match is found in store grouping level then set the reference promo

    • flag to 'X'

  • LOOP AT I_SKU_INFO WHERE CHECK_FLAG IS INITIAL

  • AND ( NOT DEPT IS INITIAL

  • OR NOT CLASS IS INITIAL

  • OR NOT SUB_CLASS IS INITIAL

  • OR NOT STYLE IS INITIAL

  • OR NOT SKU IS INITIAL ).

  • CLEAR G_SKU_PROMO_EXIST.

  • G_INDEX = I_SKU_INFO-LINE_NO.

  • G_INDEX1 = SY-TABIX.

  • LOOP AT I_SKU_HIER INTO WA_SKU_HIER

  • WHERE DEPT = I_SKU_INFO-DEPT

  • AND CLASS = I_SKU_INFO-CLASS

  • AND SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • AND STYLE = I_SKU_INFO-STYLE

  • AND SKU = I_SKU_INFO-SKU .

*

  • LOOP AT I_STR_DATA INTO WA_STR_DATA

  • WHERE PP_ID = WA_SKU_HIER-PP_ID.

  • READ TABLE I_STORE_INFO WITH KEY

  • REGION_ID = WA_STR_DATA-REGION_ID

  • DIST_ID = WA_STR_DATA-DIST_ID

  • AREA_ID = WA_STR_DATA-AREA_ID

  • STORE_ID = WA_STR_DATA-STORE_ID.

  • IF SY-SUBRC = 0 .

  • WA_SKU_HIER-STORE_MATCH = C_X.

  • MODIFY I_SKU_HIER INDEX G_INDEX1 FROM WA_SKU_HIER

  • TRANSPORTING STORE_MATCH.

  • EXIT.

  • ELSE.

  • CLEAR WA_SKU_HIER-STORE_MATCH.

  • ENDIF.

  • ENDLOOP.

  • ENDLOOP.

    • If any reference promo is found then populate reference promo , promo

    • type , clearance, start date and end date of the reference promo

*

  • READ TABLE I_SKU_HIER INTO WA_SKU_HIER

  • WITH KEY DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • STYLE = I_SKU_INFO-STYLE

  • SKU = I_SKU_INFO-SKU

  • PROMO_TYPE = C_$

  • STORE_MATCH = C_X.

  • IF SY-SUBRC = 0.

  • L_PP_ID = WA_SKU_HIER-PP_ID.

  • L_DESC = WA_SKU_HIER-ID_DESC.

  • L_CLR = WA_SKU_HIER-CLEARANCE.

  • L_STARTDATE = WA_SKU_HIER-START_DATE.

  • L_ENDDATE = WA_SKU_HIER-END_DATE.

  • L_VALUE = WA_SKU_HIER-VALUE.

  • READ TABLE I_SKU_HIER INTO WA_SKU_HIER

  • WITH KEY DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • STYLE = I_SKU_INFO-STYLE

  • SKU = I_SKU_INFO-SKU

  • PROMO_TYPE = C_%

  • STORE_MATCH = C_X.

  • IF SY-SUBRC = 0.

  • IF WA_SKU_HIER-TOP_UP = C_X AND G_PROMO_TYPE = C_$ .

  • I_SKU_INFO-REPROMO = C_REPROMO.

  • I_SKU_INFO-REF_PROMO = L_PP_ID.

  • I_SKU_INFO-REF_PROMO_TYPE = C_$.

  • I_SKU_INFO-REF_PROMO_CLR = L_CLR.

  • I_SKU_INFO-REF_PROMO_START_DATE = L_STARTDATE.

  • I_SKU_INFO-REF_PROMO_END_DATE = L_ENDDATE.

  • I_SKU_INFO-REF_VALUE = L_VALUE.

  • I_SKU_INFO-REF_DESC = L_DESC.

  • MODIFY I_SKU_INFO INDEX G_INDEX .

  • ELSE.

  • I_SKU_INFO-REPROMO = C_REPROMO.

  • I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

  • I_SKU_INFO-REF_DESC = WA_SKU_HIER-ID_DESC.

  • I_SKU_INFO-REF_PROMO_TYPE = C_%.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • I_SKU_INFO-REF_PROMO_START_DATE = WA_SKU_HIER-START_DATE.

  • I_SKU_INFO-REF_PROMO_END_DATE = WA_SKU_HIER-END_DATE.

  • I_SKU_INFO-REF_VALUE = WA_SKU_HIER-VALUE.

  • MODIFY I_SKU_INFO INDEX G_INDEX .

  • ENDIF.

  • ELSE.

  • I_SKU_INFO-REPROMO = C_REPROMO.

  • I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

  • I_SKU_INFO-REF_DESC = WA_SKU_HIER-ID_DESC.

  • I_SKU_INFO-REF_PROMO_TYPE = C_$.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • I_SKU_INFO-REF_PROMO_START_DATE = WA_SKU_HIER-START_DATE.

  • I_SKU_INFO-REF_PROMO_END_DATE = WA_SKU_HIER-END_DATE.

  • I_SKU_INFO-REF_VALUE = WA_SKU_HIER-VALUE.

  • MODIFY I_SKU_INFO INDEX G_INDEX .

  • ENDIF.

  • ELSE.

  • READ TABLE I_SKU_HIER INTO WA_SKU_HIER

  • WITH KEY DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • STYLE = I_SKU_INFO-STYLE

  • SKU = I_SKU_INFO-SKU

  • PROMO_TYPE = C_%

  • STORE_MATCH = C_X.

  • IF SY-SUBRC = 0.

  • READ TABLE I_SKU_HIER INTO WA_SKU_HIER

  • WITH KEY DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • STYLE = I_SKU_INFO-STYLE

  • SKU = I_SKU_INFO-SKU

  • PROMO_TYPE = C_$

  • STORE_MATCH = C_X.

  • IF SY-SUBRC <> 0.

  • I_SKU_INFO-REPROMO = C_REPROMO.

  • I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

  • I_SKU_INFO-REF_DESC = WA_SKU_HIER-ID_DESC.

  • I_SKU_INFO-REF_PROMO_TYPE = C_%.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • I_SKU_INFO-REF_PROMO_START_DATE = WA_SKU_HIER-START_DATE.

  • I_SKU_INFO-REF_PROMO_END_DATE = WA_SKU_HIER-END_DATE.

  • I_SKU_INFO-REF_VALUE = WA_SKU_HIER-VALUE.

  • MODIFY I_SKU_INFO INDEX G_INDEX1 .

  • ELSE.

  • CLEAR I_SKU_INFO-REPROMO.

  • MODIFY I_SKU_INFO INDEX G_INDEX1 .

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • ENDLOOP.

  • ENDIF.

  • ELSE.

  • LOOP AT I_SKU_INFO.

  • CLEAR I_SKU_INFO-REPROMO.

  • CLEAR I_SKU_INFO-REF_PROMO.

  • MODIFY I_SKU_INFO.

  • ENDLOOP.

  • ENDIF.

  • ENDIF.

*ENDFORM. " CHECK_EXIST_PROMO_SKUHIER

&----


*& Form SAVE_PROMO_OR_PRICING

&----


  • Save the promo or pricing event

----


FORM SAVE_PROMO_OR_PRICING.

DATA: L_INDEX(4) TYPE C,

L_TEXT(250) TYPE C.

DATA: L_LEN TYPE I.

  • check for validation

IF G_VAL = C_SPACE.

MESSAGE S161(ZS) WITH TEXT-180.

EXIT.

ENDIF.

DELETE I_SKU_INFO WHERE DEPT IS INITIAL

AND CLASS IS INITIAL

AND SUB_CLASS IS INITIAL

AND STYLE IS INITIAL

AND SKU IS INITIAL.

  • Check for duplicate entries in sku hierarchy info

PERFORM CHECK_DUPLICATE_ENTRIES.

  • If any duplicate entry is found, then issue message to the user

IF G_DUPLICATE_ENTRY = C_X.

CONCATENATE TEXT-058 TEXT-059

INTO G_POPUP_TEXT

SEPARATED BY SPACE.

CLEAR G_ANS.

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

  • delete adjacent duplicates from i_sku_info comparing dept

  • class

  • sub_class

  • style

  • sku.

REFRESH I_SKU_INFO.

CLEAR I_SKU_INFO.

I_SKU_INFO[] = I_SKU_INFO_TEMP[].

REFRESH I_SKU_INFO_TEMP.

CLEAR I_SKU_INFO_TEMP.

MESSAGE S161(ZS) WITH TEXT-003.

LOOP AT I_SKU_INFO.

I_SKU_INFO-LINE_NO = SY-TABIX.

MODIFY I_SKU_INFO INDEX SY-TABIX TRANSPORTING LINE_NO.

ENDLOOP.

ENDIF.

ELSE.

  • Existing Style check in case of pricing

CLEAR G_EXIT.

IF G_PRICING_FLAG = C_X OR G_PRICING_COPY_FLAG = C_X.

PERFORM CHECK_EXISTING_STYLE.

IF G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

  • invalid entry check

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-169.

DATA: L_MVKE_MATNR LIKE MVKE-MATNR.

CLEAR G_EXIT.

G_VKORG = ZPRICELIST-ZLIST(4).

LOOP AT I_SKU_INFO WHERE NOT STYLE IS INITIAL.

CLEAR L_MVKE_MATNR.

IF NOT I_SKU_INFO-SKU IS INITIAL.

SELECT SINGLE MVKE~MATNR

FROM MVKE INNER JOIN ZSDRETL_ACTVSKU

ON MVKEMATNR = ZSDRETL_ACTVSKUSKU

INTO L_MVKE_MATNR

WHERE MVKE~MATNR = I_SKU_INFO-SKU

AND MVKE~VKORG = G_VKORG

AND MVKE~VTWEG = '00'.

IF SY-SUBRC <> 0.

CLEAR: G_CHAR , G_POPUP_TEXT.

G_CHAR = I_SKU_INFO-LINE_NO.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-165.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

IF I_SKU_INFO-SKU IS INITIAL.

REFRESH R_STYLE.

R_STYLE-SIGN = 'I'.

R_STYLE-OPTION = C_OPT2.

CONCATENATE I_SKU_INFO-STYLE C_STAR INTO R_STYLE-LOW.

APPEND R_STYLE.

CLEAR R_STYLE.

SELECT MVKE~MATNR

FROM MVKE INNER JOIN ZSDRETL_ACTVSKU

ON MVKEMATNR = ZSDRETL_ACTVSKUSKU

UP TO 1 ROWS

INTO L_MVKE_MATNR

WHERE MVKE~MATNR IN R_STYLE

AND MVKE~VKORG = G_VKORG

AND MVKE~VTWEG = '00'.

ENDSELECT.

IF SY-SUBRC <> 0.

CLEAR: G_CHAR , G_POPUP_TEXT.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-165.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

ENDLOOP.

IF G_EXIT = C_X.

EXIT.

ENDIF.

CLEAR G_EXIT.

  • Check empty values

IF G_PROMO_TYPE = C_%.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-170.

READ TABLE I_SKU_INFO WITH KEY VALUE = 0

ZERO_VAL_CHECK = C_SPACE.

IF SY-SUBRC = 0.

CLEAR G_ZEROVAL_CHK .

ENDIF.

IF G_ZEROVAL_CHK IS INITIAL.

READ TABLE I_SKU_INFO WITH KEY VALUE = 0.

IF SY-SUBRC = 0.

LOOP AT I_SKU_INFO WHERE VALUE = 0 AND ZERO_VAL_CHECK = C_SPACE.

CLEAR L_INDEX.

L_INDEX = I_SKU_INFO-LINE_NO.

CONCATENATE L_TEXT L_INDEX INTO L_TEXT SEPARATED BY C_COMMA .

L_LEN = STRLEN( L_TEXT ).

IF L_LEN GT 50 .

CONCATENATE L_TEXT '...' INTO L_TEXT .

EXIT.

ENDIF.

ENDLOOP.

CLEAR G_POPUP_TEXT.

CONCATENATE 'You are applying zero % to items on this promo :'

L_TEXT '.' INTO G_POPUP_TEXT.

CONCATENATE G_POPUP_TEXT

'Do You Want to Continue ? ' INTO G_POPUP_TEXT SEPARATED BY SPACE.

G_LINE_TEXT = 'Warning'.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

G_ZEROVAL_CHK = C_X.

LOOP AT I_SKU_INFO.

IF I_SKU_INFO-VALUE = 0.

I_SKU_INFO-ZERO_VAL_CHECK = C_X.

MODIFY I_SKU_INFO INDEX SY-TABIX TRANSPORTING ZERO_VAL_CHECK.

ENDIF.

ENDLOOP.

ELSE.

MESSAGE S161(ZS) WITH TEXT-163.

EXIT.

ENDIF.

ENDIF.

ENDIF.

ELSE.

READ TABLE I_SKU_INFO WITH KEY VALUE = 0 ZERO_VAL_CHECK = C_SPACE.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-170.

LOOP AT I_SKU_INFO WHERE VALUE = 0 AND ZERO_VAL_CHECK = C_SPACE.

CLEAR L_INDEX.

L_INDEX = I_SKU_INFO-LINE_NO.

CONCATENATE L_TEXT L_INDEX INTO L_TEXT SEPARATED BY C_COMMA .

L_LEN = STRLEN( L_TEXT ).

IF L_LEN GT 50 .

CONCATENATE L_TEXT '...' INTO L_TEXT .

EXIT.

ENDIF.

ENDLOOP.

IF L_TEXT <> C_SPACE.

CLEAR G_POPUP_TEXT.

CONCATENATE 'Zero Values are not allowed. '

'Please refer Line no.:'

L_TEXT '.' INTO G_POPUP_TEXT.

G_LINE_TEXT = 'Warning'.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_LINE_TEXT

TXT1 = C_SPACE

TXT2 = G_POPUP_TEXT.

EXIT.

ENDIF.

ENDIF.

ENDIF.

  • More value check

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-167.

CLEAR G_EXIT.

LOOP AT I_SKU_INFO.

G_INDEX = SY-TABIX.

IF I_SKU_INFO-STYLE <> C_SPACE AND I_SKU_INFO-KBETR = 0.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_CHAR , G_POPUP_TEXT.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-172.

G_EXIT = C_X.

EXIT.

ENDIF.

IF G_PROMO_TYPE = C_$ AND G_PRICING_FLAG <> C_X.

IF NOT I_SKU_INFO-KBETR IS INITIAL

AND I_SKU_INFO-VALUE EQ I_SKU_INFO-KBETR.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_CHAR , G_POPUP_TEXT.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-039.

G_EXIT = C_X.

EXIT.

ENDIF.

  • if promo type is $ and value is greater than the basic price then

IF NOT I_SKU_INFO-KBETR IS INITIAL

AND I_SKU_INFO-VALUE GT I_SKU_INFO-KBETR .

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_POPUP_TEXT , G_CHAR.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-040.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

.

  • if it is a percent promo and value is greater than 99 then issue error

  • message

IF G_PROMO_TYPE = C_%.

IF NOT I_SKU_INFO-VALUE IS INITIAL AND I_SKU_INFO-VALUE GE 100.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_POPUP_TEXT , G_CHAR.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-041.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

ENDLOOP.

IF G_EXIT = C_X.

EXIT.

ENDIF.

CLEAR G_EXIT .

  • If any duplicate entry is not found then read the SKU info table if

  • for any entry reference promo is available or not . If it is available

  • then perform a check on these entries

IF G_PROMO_FLAG = C_X OR G_PROMO_COPY_FLAG = C_X .

IF NOT I_SKU_INFO[] IS INITIAL.

*Begin of DEVK939308

READ TABLE I_SKU_INFO WITH KEY REPROMO = C_REPROMO1.

IF SY-SUBRC <> 0.

  • Call the sub routine for save promo event

PERFORM SAVE_PROMO.

ELSE.

  • g_index = sy-tabix.

  • Perform a check over all the entries in the SKU info table where a

  • reference promo is already available

G_LINE_TEXT = I_SKU_INFO-LINE_NO.

CONDENSE G_LINE_TEXT.

CONCATENATE 'Line No :' G_LINE_TEXT INTO G_LINE_TEXT

SEPARATED BY SPACE.

PERFORM INFORM_EXIST_PROMO USING TEXT-178

TEXT-114

G_LINE_TEXT.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

EXIT.

ENDIF.

  • End of DEVK939308

ELSE.

MESSAGE S161(ZS) WITH TEXT-005.

ENDIF.

ENDIF.

ENDIF.

IF G_PRICING_FLAG = C_X OR G_PRICING_COPY_FLAG = C_X.

IF NOT I_SKU_INFO[] IS INITIAL.

READ TABLE I_SKU_INFO WITH KEY REPROMO = C_REPROMO1.

IF SY-SUBRC <> 0.

PERFORM SAVE_PRICING.

ELSE.

G_INDEX = SY-TABIX.

PERFORM CHECK_EXIST_PRICING USING I_SKU_INFO.

I_SKU_INFO-CHECK_FLAG = C_X.

MODIFY I_SKU_INFO INDEX G_INDEX.

ENDIF.

ELSE.

MESSAGE S161(ZS) WITH TEXT-005.

ENDIF.

ENDIF.

ENDFORM. " SAVE_PROMO_OR_PRICING

&----


*& Form SAVE_PRICING

&----


  • Save Pricing Events

----


FORM SAVE_PRICING.

DATA: L_DATUM LIKE SY-DATUM,

L_SUBRC LIKE SY-SUBRC .

  • Populate dept/class/subclass if sku or style is not blank

PERFORM POPULATE_DEPT_CLASS.

CLEAR G_PRICINGNO.

G_PTYPE = C_$.

  • Get the pricing number

IF G_PRICING_CHG_FLAG = C_X.

G_PRICINGNO = G_PRICING_ID.

ELSE.

  • Get number range for the pricing

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

NR_RANGE_NR = C_NR_OBJ2

OBJECT = C_NROBJ

QUANTITY = '1'

IGNORE_BUFFER = C_X

IMPORTING

NUMBER = G_PRICINGNO.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDIF.

IF NOT G_PRICINGNO IS INITIAL.

  • Populate Header information for Pricing event

REFRESH I_RMPHEAD.

CLEAR WA_RMPHEAD.

IF SY-DYNNR = '9006'.

WA_RMPHEAD-ID_TYPE = C_F.

WA_RMPHEAD-PLTYP = ZPRICELIST-ZLIST.

WA_RMPHEAD-APPROVE = CHK_APR.

WA_RMPHEAD-ERDAT = SY-DATUM.

WA_RMPHEAD-ERNAM = SY-UNAME.

WA_RMPHEAD-ID_DESC = G_PDESC.

WA_RMPHEAD-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPHEAD-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPHEAD-CLEARANCE = C_SPACE.

WA_RMPHEAD-PROMO_TYPE = G_PTYPE.

APPEND WA_RMPHEAD TO I_RMPHEAD.

CLEAR WA_RMPHEAD.

ELSE.

WA_RMPHEAD-PP_ID = G_PRICINGNO.

WA_RMPHEAD-ID_TYPE = C_F.

WA_RMPHEAD-PLTYP = G_PRICELIST.

WA_RMPHEAD-APPROVE = CHK_APR.

WA_RMPHEAD-ERDAT = SY-DATUM.

WA_RMPHEAD-ERNAM = SY-UNAME.

WA_RMPHEAD-ID_DESC = G_PDESC.

WA_RMPHEAD-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

L_SUBRC = 4.

LOOP AT I_SKU_INFO.

  • if i_sku_info-end_date ge sy-datum.

IF I_SKU_INFO-END_DATE GE ZSDRETL_RMPHEAD-START_DATE.

L_SUBRC = 0.

EXIT.

ENDIF.

ENDLOOP.

IF L_SUBRC = 4.

  • l_datum = sy-datum - 1.

L_DATUM = ZSDRETL_RMPHEAD-START_DATE - 1.

WA_RMPHEAD-END_DATE = L_DATUM.

ELSE.

WA_RMPHEAD-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

ENDIF.

  • wa_rmphead-end_date = zsdretl_rmphead-end_date.

WA_RMPHEAD-CLEARANCE = C_SPACE.

WA_RMPHEAD-PROMO_TYPE = C_$.

APPEND WA_RMPHEAD TO I_RMPHEAD.

CLEAR WA_RMPHEAD.

ENDIF.

IF NOT I_RMPHEAD[] IS INITIAL.

  • Modify the header table zsdretl_rmphead with the pricing header data

MODIFY ZSDRETL_RMPHEAD FROM TABLE I_RMPHEAD.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-091.

COMMIT WORK.

ENDIF.

ENDIF.

  • Populate Store information for Promo event

REFRESH I_RMPSTORE.

CLEAR WA_RMPSTORE.

  • Populate the store info if the user wants to apply promo on the

  • price list type. In this case store grouping level will be set to 6

IF SY-DYNNR = '9006'.

WA_RMPSTORE-PP_ID = G_PRICINGNO.

WA_RMPSTORE-RECNO = 0.

WA_RMPSTORE-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPSTORE-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPSTORE-STORE_LEVEL = C_LEVEL6.

APPEND WA_RMPSTORE TO I_RMPSTORE.

CLEAR WA_RMPSTORE.

ELSE.

LOOP AT I_STORE_INFO.

WA_RMPSTORE-PP_ID = G_PRICINGNO.

WA_RMPSTORE-RECNO = SY-TABIX.

WA_RMPSTORE-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPSTORE-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPSTORE-REGION_ID = I_STORE_INFO-REGION_ID.

WA_RMPSTORE-DIST_ID = I_STORE_INFO-DIST_ID.

WA_RMPSTORE-AREA_ID = I_STORE_INFO-AREA_ID.

WA_RMPSTORE-STORE_ID = I_STORE_INFO-STORE_ID.

WA_RMPSTORE-ATTR_VAL = I_STORE_INFO-ATTR_VAL.

WA_RMPSTORE-STORE_LEVEL = I_STORE_INFO-LEVEL.

WA_RMPSTORE-ID_TYPE = C_F.

WA_RMPSTORE-PLTYP = G_PRICELIST.

APPEND WA_RMPSTORE TO I_RMPSTORE.

CLEAR WA_RMPSTORE.

ENDLOOP.

ENDIF.

IF NOT I_RMPSTORE[] IS INITIAL.

IF NOT I_RMPSTORE_TEMP[] IS INITIAL.

  • Delete all the entries from the store grouping table in case of change

  • promo . This is required to implement any modification in that pricing

DELETE ZSDRETL_RMPSTORE FROM TABLE I_RMPSTORE_TEMP.

IF SY-SUBRC = 0.

COMMIT WORK.

REFRESH I_RMPSTORE_TEMP.

ENDIF.

ENDIF.

  • Modify the store table zsdretl_rmpstore with the store grouping info

MODIFY ZSDRETL_RMPSTORE FROM TABLE I_RMPSTORE.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-092.

COMMIT WORK.

ENDIF.

ENDIF.

  • Populate SKU information for Pricing event

CLEAR: WA_RMPDETAIL , I_RMPDETAIL[].

IF SY-DYNNR = '9006'.

WA_RMPDETAIL-PP_ID = G_PRICINGNO.

WA_RMPDETAIL-RECNO = 0.

WA_RMPDETAIL-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

WA_RMPDETAIL-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

WA_RMPDETAIL-VALUE = G_VAL_PLTYP.

WA_RMPDETAIL-ZLEVEL = C_LEVEL1.

APPEND WA_RMPDETAIL TO I_RMPDETAIL.

CLEAR WA_RMPDETAIL.

ELSE.

LOOP AT I_SKU_INFO.

WA_RMPDETAIL-PP_ID = G_PRICINGNO.

WA_RMPDETAIL-RECNO = SY-TABIX.

WA_RMPDETAIL-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

  • if zsdretl_rmphead-end_date lt sy-datum.

IF ZSDRETL_RMPHEAD-END_DATE LT ZSDRETL_RMPHEAD-START_DATE.

WA_RMPDETAIL-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

ELSE.

WA_RMPDETAIL-END_DATE = I_SKU_INFO-END_DATE.

ENDIF.

  • wa_rmpdetail-end_date = zsdretl_rmphead-end_date.

WA_RMPDETAIL-DEPT = I_SKU_INFO-DEPT.

WA_RMPDETAIL-CLASS = I_SKU_INFO-CLASS.

WA_RMPDETAIL-SUB_CLASS = I_SKU_INFO-SUB_CLASS.

WA_RMPDETAIL-STYLE = I_SKU_INFO-STYLE.

WA_RMPDETAIL-SKU = I_SKU_INFO-SKU.

WA_RMPDETAIL-VALUE = I_SKU_INFO-VALUE.

WA_RMPDETAIL-BASIC_PRICE = I_SKU_INFO-KBETR.

WA_RMPDETAIL-ZLEVEL = I_SKU_INFO-TYPE.

WA_RMPDETAIL-TOP_UP = I_SKU_INFO-TOP_UP.

WA_RMPDETAIL-ZLEVEL = I_SKU_INFO-TYPE.

WA_RMPDETAIL-REF_PROMO = I_SKU_INFO-REF_PROMO.

WA_RMPDETAIL-ID_TYPE = C_F.

WA_RMPDETAIL-PLTYP = G_PRICELIST.

APPEND WA_RMPDETAIL TO I_RMPDETAIL.

CLEAR WA_RMPDETAIL.

ENDLOOP.

ENDIF.

IF NOT I_RMPDETAIL[] IS INITIAL.

IF NOT I_RMPDETAIL_TEMP[] IS INITIAL.

  • Delete all the entries from the sku hierarchy table in case of change

  • promo . This is required to implement any modification in that pricing

DELETE ZSDRETL_RMPDETL FROM TABLE I_RMPDETAIL_TEMP.

IF SY-SUBRC = 0.

COMMIT WORK.

REFRESH I_RMPDETAIL_TEMP.

ENDIF.

ENDIF.

  • Modify the sku table zsdretl_rmpdetail with the sku hierarchy info

MODIFY ZSDRETL_RMPDETL FROM TABLE I_RMPDETAIL.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-093.

COMMIT WORK.

ENDIF.

ENDIF.

  • If modification does not happen then issue error message

IF SY-SUBRC = 0.

IF G_PRICING_CHG_FLAG = C_X.

MESSAGE S161(ZS)

WITH TEXT-047 G_PRICINGNO TEXT-048.

ELSE.

MESSAGE S161(ZS)

WITH TEXT-047 G_PRICINGNO TEXT-049.

ENDIF.

LEAVE TO SCREEN 9000.

ENDIF.

ENDIF.

ENDFORM. " SAVE_PRICING

&----


*& Form VIEW_PROMO_FOR_SKUHIER_ALV

&----


  • View all the existing promos for the SKU infos in ALV

----


FORM VIEW_PROMO_FOR_SKUHIER_ALV.

REFRESH I_SKU_HIER_TEMP.

I_SKU_HIER_TEMP[] = I_SKU_HIER[].

REFRESH I_FIELDCAT.

CLEAR I_FIELDCAT.

  • Populate field catalogue for the SKU info tables

PERFORM POPULATE_CATALOGUE USING:

  • Position Fieldname Tablename Title Display

'01' 'SKU_LINE_REF' 'I_SKU_HIER' TEXT-182 C_SPACE,

'02' 'EXIST' 'I_SKU_HIER' TEXT-198 C_SPACE,

'03' 'DEPT' 'I_SKU_HIER' TEXT-095 C_SPACE,

'04' 'CLASS' 'I_SKU_HIER' TEXT-094 C_SPACE,

'05' 'SUB_CLASS' 'I_SKU_HIER' TEXT-096 C_SPACE,

'06' 'STYLE' 'I_SKU_HIER' TEXT-097 C_SPACE,

'07' 'SKU' 'I_SKU_HIER' TEXT-098 C_SPACE,

'08' 'PP_ID' 'I_SKU_HIER' TEXT-084 C_SPACE,

'09' 'START_DATE' 'I_SKU_HIER' TEXT-101 C_SPACE,

'10' 'END_DATE' 'I_SKU_HIER' TEXT-102 C_SPACE,

'11' 'PROMO_TYPE' 'I_SKU_HIER' TEXT-099 C_SPACE,

'12' 'CLEARANCE' 'I_SKU_HIER' TEXT-081 C_SPACE,

'13' 'VALUE' 'I_SKU_HIER' TEXT-103 C_SPACE,

'14' 'ID_DESC' 'I_SKU_HIER' TEXT-161 C_SPACE.

LOOP AT I_FIELDCAT INTO STRUCT_CAT.

CASE STRUCT_CAT-FIELDNAME.

WHEN 'EXIST'.

STRUCT_CAT-ICON = C_X.

WHEN 'DEPT'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-NO_OUT = C_SPACE.

ELSE.

STRUCT_CAT-NO_OUT = C_X.

ENDIF.

WHEN 'CLASS'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-NO_OUT = C_SPACE.

ELSE.

STRUCT_CAT-NO_OUT = C_X.

ENDIF.

WHEN 'SUB_CLASS'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-NO_OUT = C_SPACE.

ELSE.

STRUCT_CAT-NO_OUT = C_X.

ENDIF.

WHEN 'PROMO_TYPE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-NO_OUT = C_SPACE.

ELSE.

STRUCT_CAT-NO_OUT = C_X.

ENDIF.

WHEN 'CLEARANCE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-NO_OUT = C_SPACE.

ELSE.

STRUCT_CAT-NO_OUT = C_X.

ENDIF.

WHEN 'START_DATE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-REPTEXT_DDIC = TEXT-104.

ELSE.

STRUCT_CAT-REPTEXT_DDIC = TEXT-105.

ENDIF.

WHEN 'END_DATE'.

IF G_PROMO_FLAG = C_X OR G_PRICING_FLAG = C_X .

STRUCT_CAT-REPTEXT_DDIC = TEXT-106.

STRUCT_CAT-INPUT = C_X.

STRUCT_CAT-REF_FIELDNAME = 'END_DATE'.

STRUCT_CAT-REF_TABNAME = 'ZSDRETL_RMPDETL'.

STRUCT_CAT-DATATYPE = 'ZEND_DATE'.

ELSE.

STRUCT_CAT-REPTEXT_DDIC = TEXT-107.

ENDIF.

WHEN 'PP_ID'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-REPTEXT_DDIC = TEXT-084.

ELSE.

STRUCT_CAT-REPTEXT_DDIC = TEXT-088.

ENDIF.

WHEN 'VALUE'.

IF G_PROMO_FLAG = C_X.

STRUCT_CAT-REPTEXT_DDIC = TEXT-162.

STRUCT_CAT-JUST = 'R'.

ELSE.

STRUCT_CAT-NO_OUT = C_SPACE.

ENDIF.

ENDCASE.

MODIFY I_FIELDCAT FROM STRUCT_CAT INDEX SY-TABIX.

CLEAR STRUCT_CAT.

ENDLOOP.

CLEAR STRUCT_LAYOUT.

  • Set title bar in the layout for Pre-existing Promos

IF G_PROMO_FLAG = C_X.

STRUCT_LAYOUT-WINDOW_TITLEBAR = TEXT-108.

ELSE.

  • Set title bar in the layout for Pre-existing Pricings

STRUCT_LAYOUT-WINDOW_TITLEBAR = TEXT-109 .

ENDIF.

STRUCT_LAYOUT-COLWIDTH_OPTIMIZE = C_X.

STRUCT_LAYOUT-BOX_FIELDNAME = 'SEL'.

STRUCT_LAYOUT-BOX_TABNAME = 'I_SKU_HIER'.

STRUCT_LAYOUT-ZEBRA = C_X.

  • Populate sort table

PERFORM POPULATE_SORT_TABLE.

  • populate event table

PERFORM POPULATE_EVENT_TABLE.

  • Call FM to list the pre-existing promos in ALV

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

IS_LAYOUT = STRUCT_LAYOUT

IT_FIELDCAT = I_FIELDCAT

IT_SORT = I_SORTTAB

IT_EVENTS = I_EVENT[]

TABLES

T_OUTTAB = I_SKU_HIER

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " VIEW_PROMO_FOR_SKUHIER_ALV

&----


*& Form CHK_PROMO_PERC_CLR

&----


  • Check existing promo for promo type is percent and clearance

----


FORM CHK_PROMO_PERC_CLR.

  • If any clearance item is already available then issue message

  • to end the previous one and continue with the new one

IF I_SKU_INFO-REF_PROMO_CLR = C_X.

  • concatenate text-110 text-111

  • into g_popup_text separated by space.

*

    • Get pop up for confirmation to end the existing clearance promo

  • PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • IF G_ANS = C_ANS1.

  • I_SKU_INFO-OVERRIDE = C_X.

    • clear i_sku_info-repromo.

  • G_PROMO_CHECKED = C_X.

  • ENDIF.

CLEAR G_POPUP_TEXT.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • Get the pop-up to confirm the deletion following which one deletion

  • flag will be set in the internal table

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ELSE.

  • If no such clearance item is available but a non-clearance with

  • dollar promo is available then issue message to apply the $ promo

  • on the top of the percent promo

IF I_SKU_INFO-REF_PROMO_TYPE = C_$.

CONCATENATE TEXT-112 TEXT-113

INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • Get pop up for confirmation to set the top up flag

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-TOP_UP = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ENDIF.

  • If no such clearance item is available but a non-clearance with

  • percent promo is available then issue message to delete the current

  • line because two % are not applicable for a SKU

IF I_SKU_INFO-REF_PROMO_TYPE = C_%.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • Get the pop-up to confirm the deletion following which one deletion

  • flag will be set in the internal table

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " CHK_PROMO_PERC_CLR

&----


*& Form CHK_PROMO_PERC_NONCLR

&----


  • Check existing promo for promo type is percent and non-clearance case

----


FORM CHK_PROMO_PERC_NONCLR.

  • If a valid promo with clearance is already available then issue a

  • pop-up to end the previous promo and continue with the new one

IF I_SKU_INFO-REF_PROMO_CLR = C_X.

  • CONCATENATE TEXT-116 TEXT-111

  • INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • IF G_ANS = C_ANS1.

  • I_SKU_INFO-OVERRIDE = C_X.

  • G_PROMO_CHECKED = C_X.

    • clear i_sku_info-repromo.

  • ENDIF.

CLEAR G_POPUP_TEXT.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • Get the pop-up to confirm the deletion following which one deletion

  • flag will be set in the internal table

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ELSE.

  • If no such clearance item is available but a non-clearance with

  • dollar promo is available then issue message to apply % over dollar

  • If user presses 'Yes' then set the top-up flag

IF I_SKU_INFO-REF_PROMO_TYPE = C_$.

CONCATENATE TEXT-112 TEXT-113

INTO G_POPUP_TEXT SEPARATED BY SPACE.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-TOP_UP = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ENDIF.

  • If no such clearance item is available but a non-clearance with

  • percent promo is available then issue message to delete the current

  • line item as because two percent promo for the same SKU hierarchy

  • is not allowed.

IF I_SKU_INFO-REF_PROMO_TYPE = C_%.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " CHK_PROMO_PERC_NONCLR

&----


*& Form CHK_PROMO_DOLLAR_CLR

&----


  • Check existing promo for promo type is dollar and clearance case

----


FORM CHK_PROMO_DOLLAR_CLR.

  • If a valid promo with clearance is already available then issue the

  • popu up message to end the previous one and continue with the current

IF I_SKU_INFO-REF_PROMO_CLR = C_X.

CLEAR G_POPUP_TEXT.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • Get the pop-up to confirm the deletion following which one deletion

  • flag will be set in the internal table

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

  • CONCATENATE TEXT-116 TEXT-111

  • INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • IF G_ANS = C_ANS1.

  • I_SKU_INFO-OVERRIDE = C_X.

  • G_PROMO_CHECKED = C_X.

    • clear i_sku_info-repromo.

  • ENDIF.

ELSE.

  • If a non-clearance item with dollar promo is available then issue

  • the pop up message to user to delete the line and continue , because

  • two dollar promo for the same store grouping & SKU info is not allowed

IF I_SKU_INFO-REF_PROMO_TYPE = C_$.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ENDIF.

  • If a non-clearance item with percent promo is available then issue

  • the pop up message to user to end the previous promo and continue

  • with the current one. In this case the override flag for the item will

  • be set

IF I_SKU_INFO-REF_PROMO_TYPE = C_%.

CONCATENATE TEXT-117 TEXT-118

INTO G_POPUP_TEXT SEPARATED BY SPACE.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-OVERRIDE = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " CHK_PROMO_DOLLAR_CLR

&----


*& Form CHK_PROMO_DOLLAR_NONCLR

&----


  • Check existing promo for promo type is dollar and non-clearance case

----


FORM CHK_PROMO_DOLLAR_NONCLR.

  • If a valid clearance item is already available then issue message to

  • user with pop up to end the previous one and continue with the current

IF I_SKU_INFO-REF_PROMO_CLR = C_X.

CLEAR G_POPUP_TEXT.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • Get the pop-up to confirm the deletion following which one deletion

  • flag will be set in the internal table

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

*

  • CONCATENATE TEXT-116 TEXT-111

  • INTO G_POPUP_TEXT SEPARATED BY SPACE.

  • PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

  • IF G_ANS = C_ANS1.

  • I_SKU_INFO-OVERRIDE = C_X.

    • clear i_sku_info-repromo.

  • G_PROMO_CHECKED = C_X.

  • ENDIF.

ELSE.

  • If a valid promo of dollar type exists then issue message to user with

  • pop up to delete the current line. This is because two dollar promo

  • for the same SKU and store grouping info is not allowed.

IF I_SKU_INFO-REF_PROMO_TYPE = C_$.

CONCATENATE TEXT-114 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-DEL_FLAG = C_X.

  • clear i_sku_info-repromo.

G_PROMO_CHECKED = C_X.

ENDIF.

ENDIF.

  • If a percent promo is already available , then issue message to the

  • user with popup to end the previous promo & continue with the current

IF I_SKU_INFO-REF_PROMO_TYPE = C_%.

CONCATENATE TEXT-117 TEXT-118

INTO G_POPUP_TEXT SEPARATED BY SPACE.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

I_SKU_INFO-OVERRIDE = C_X.

G_PROMO_CHECKED = C_X.

  • clear i_sku_info-repromo.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " CHK_PROMO_DOLLAR_NONCLR

&----


*& Form CHECK_EXIST_PROMO

&----


  • Check for the existing promo

----


  • -->P_I_SKU_INFO SKU info record

  • -->P_G_TABIX index of the current record

----


FORM CHECK_EXIST_PROMO USING I_SKU_INFO LIKE I_SKU_INFO.

DATA: L_CHAR(3) TYPE C.

  • Get all the records in SKU info table where there is a reference promo

CLEAR G_POPUP_TEXT.

IF NOT I_SKU_INFO-REPROMO IS INITIAL.

CLEAR G_LINE_TEXT.

L_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE TEXT-119 L_CHAR INTO G_LINE_TEXT SEPARATED BY SPACE.

  • Check existing promo where Promo type is % and clearance is checked .

  • existing promo check if only sku is maintained

CLEAR G_INDEX1 .

  • Begin of DEVK939196

CLEAR G_EXACT_ENTRY.

IF I_SKU_INFO-SKU <> C_SPACE

AND I_SKU_INFO-STYLE <> C_SPACE

AND I_SKU_INFO-DEPT <> C_SPACE

AND I_SKU_INFO-CLASS <> C_SPACE

AND I_SKU_INFO-SUB_CLASS <> C_SPACE.

CLEAR G_INDEX1 .

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = I_SKU_INFO-STYLE

SKU = I_SKU_INFO-SKU

CHECKED = C_SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

G_EXACT_ENTRY = C_X.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = I_SKU_INFO-STYLE

SKU = C_SPACE

CHECKED = SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = C_SPACE

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

CLEAR: I_SKU_INFO-REF_PROMO_TYPE,

I_SKU_INFO-REF_PROMO_CLR.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

  • existing promo check if only style is maintained

IF I_SKU_INFO-SKU = C_SPACE

AND I_SKU_INFO-STYLE <> C_SPACE

AND I_SKU_INFO-DEPT <> C_SPACE

AND I_SKU_INFO-CLASS <> C_SPACE

AND I_SKU_INFO-SUB_CLASS <> C_SPACE.

CLEAR G_INDEX1 .

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = I_SKU_INFO-STYLE

SKU = C_SPACE

CHECKED = SPACE.

IF SY-SUBRC = 0.

G_EXACT_ENTRY = C_X.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = C_SPACE

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC = 0.

G_INDEX1 = SY-TABIX.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

ELSE.

CLEAR: I_SKU_INFO-REF_PROMO_TYPE,

I_SKU_INFO-REF_PROMO_CLR.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

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

  • IF I_SKU_INFO-SKU <> C_SPACE

  • AND I_SKU_INFO-STYLE <> C_SPACE

  • AND I_SKU_INFO-DEPT <> C_SPACE

  • AND I_SKU_INFO-CLASS <> C_SPACE

  • AND I_SKU_INFO-SUB_CLASS <> C_SPACE.

  • CLEAR G_INDEX1 .

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = I_SKU_INFO-SKU

  • CHECKED = C_SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • G_EXACT_ENTRY = C_X.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = I_SKU_INFO-STYLE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = C_SPACE

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • CLEAR: I_SKU_INFO-REF_PROMO_TYPE,

  • I_SKU_INFO-REF_PROMO_CLR.

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • ENDIF.

*

  • ENDIF.

*

  • ENDIF.

*

    • existing promo check if only style is maintained

  • IF I_SKU_INFO-SKU = C_SPACE

  • AND I_SKU_INFO-STYLE <> C_SPACE

  • AND I_SKU_INFO-DEPT <> C_SPACE

  • AND I_SKU_INFO-CLASS <> C_SPACE

  • AND I_SKU_INFO-SUB_CLASS <> C_SPACE.

  • CLEAR G_INDEX1 .

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = I_SKU_INFO-STYLE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_EXACT_ENTRY = C_X.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = C_SPACE

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = C_SPACE

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • CLEAR: I_SKU_INFO-REF_PROMO_TYPE,

  • I_SKU_INFO-REF_PROMO_CLR.

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • existing promo check if only dept/class/subclass is maintained

  • IF I_SKU_INFO-SKU = C_SPACE

  • AND I_SKU_INFO-STYLE = C_SPACE

  • AND I_SKU_INFO-DEPT <> C_SPACE

  • AND I_SKU_INFO-CLASS <> C_SPACE

  • AND I_SKU_INFO-SUB_CLASS <> C_SPACE.

  • CLEAR G_INDEX1 .

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = I_SKU_INFO-SUB_CLASS

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_EXACT_ENTRY = C_X.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = C_SPACE

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • CLEAR: I_SKU_INFO-REF_PROMO_TYPE,

  • I_SKU_INFO-REF_PROMO_CLR.

*

  • ENDIF.

  • ENDIF.

  • ENDIF.

  • ENDIF.

*

*

    • existing promo check if only dept/class is maintained

  • IF I_SKU_INFO-SKU = C_SPACE

  • AND I_SKU_INFO-STYLE = C_SPACE

  • AND I_SKU_INFO-DEPT <> C_SPACE

  • AND I_SKU_INFO-CLASS <> C_SPACE

  • AND I_SKU_INFO-SUB_CLASS = C_SPACE.

  • CLEAR G_INDEX1 .

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = I_SKU_INFO-CLASS

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_EXACT_ENTRY = C_X.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = C_SPACE

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • CLEAR: I_SKU_INFO-REF_PROMO_TYPE,

  • I_SKU_INFO-REF_PROMO_CLR.

  • ENDIF.

  • ENDIF.

  • ENDIF.

*

    • existing promo check if only dept is maintained

  • IF I_SKU_INFO-SKU = C_SPACE

  • AND I_SKU_INFO-STYLE = C_SPACE

  • AND I_SKU_INFO-DEPT <> C_SPACE

  • AND I_SKU_INFO-CLASS = C_SPACE

  • AND I_SKU_INFO-SUB_CLASS = C_SPACE.

  • CLEAR G_INDEX1.

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • SKU = C_SPACE

  • STYLE = C_SPACE

  • DEPT = I_SKU_INFO-DEPT

  • CLASS = C_SPACE

  • SUB_CLASS = C_SPACE

  • CHECKED = SPACE.

  • IF SY-SUBRC = 0.

  • G_INDEX1 = SY-TABIX.

  • G_EXACT_ENTRY = C_X.

  • I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

  • I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

  • ELSE.

  • CLEAR: I_SKU_INFO-REF_PROMO_TYPE,

  • I_SKU_INFO-REF_PROMO_CLR.

  • ENDIF.

  • ENDIF.

IF I_SKU_INFO-REF_PROMO_TYPE <> C_SPACE AND NOT G_INDEX1 IS INITIAL.

  • and g_exact_entry = c_x .

CLEAR G_PROMO_CHECKED.

IF G_PROMO_TYPE = C_% AND G_CHK_CLR = C_X.

PERFORM CHK_PROMO_PERC_CLR.

  • perform chk_promo_perc_clr1.

ENDIF.

  • Check existing promo where promo type is % & clearance is not checked.

IF G_PROMO_TYPE = C_% AND G_CHK_CLR = C_SPACE.

PERFORM CHK_PROMO_PERC_NONCLR.

ENDIF.

  • Check existing promo where Promo type is $ and clearance is checked .

IF G_PROMO_TYPE = C_$ AND G_CHK_CLR = C_X.

PERFORM CHK_PROMO_DOLLAR_CLR.

ENDIF.

  • Check existing promo where Promo type is $ & clearance is not checked

IF G_PROMO_TYPE = C_$ AND G_CHK_CLR = C_SPACE.

PERFORM CHK_PROMO_DOLLAR_NONCLR.

ENDIF.

IF G_PROMO_CHECKED = C_X AND NOT G_INDEX1 IS INITIAL.

WA_SKU_HIER-CHECKED = C_X.

MODIFY I_SKU_HIER1 INDEX G_INDEX1 FROM WA_SKU_HIER.

ENDIF.

ENDIF.

CLEAR G_EXACT_ENTRY .

  • READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

  • WITH KEY REF_DEPT = I_SKU_INFO-DEPT

  • REF_CLASS = I_SKU_INFO-CLASS

  • REF_SUBCLASS = I_SKU_INFO-SUB_CLASS

  • REF_STYLE = I_SKU_INFO-STYLE

  • REF_SKU = I_SKU_INFO-SKU

  • CHECKED = C_SPACE.

  • IF SY-SUBRC <> 0.

  • CLEAR I_SKU_INFO-REPROMO.

  • ENDIF.

IF NOT I_SKU_INFO-SKU IS INITIAL.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = I_SKU_INFO-STYLE

SKU = I_SKU_INFO-SKU

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = I_SKU_INFO-STYLE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = C_SPACE

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

CLEAR I_SKU_INFO-REPROMO.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

IF I_SKU_INFO-SKU IS INITIAL AND NOT I_SKU_INFO-STYLE IS INITIAL.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = I_SKU_INFO-STYLE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

READ TABLE I_SKU_HIER1 INTO WA_SKU_HIER

WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = C_SPACE

SUB_CLASS = C_SPACE

STYLE = C_SPACE

SKU = C_SPACE

CHECKED = C_SPACE.

IF SY-SUBRC <> 0.

CLEAR I_SKU_INFO-REPROMO.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

  • End of DEVK939196

ENDFORM. " CHECK_EXIST_PROMO

&----


*& Form CHECK_ENTRIES

&----


  • Perform a check on all the SKU info entries . On checking if

  • any preexisting promo is found then issue various messages to the user

  • to change the promos

----


FORM CHECK_ENTRIES.

DATA: L_TEXT(200) TYPE C,

L_INDEX(5) TYPE C,

L_SKU_TEXT(30) TYPE C,

L_LINE(3) TYPE C,

L_PP_ID LIKE ZSDRETL_RMPHEAD-PP_ID,

L_CLSKU LIKE ZSDRETL_RMPDETL-SKU.

DATA: L_LEN TYPE I.

  • Check for validation.

IF G_VAL = C_SPACE.

MESSAGE S161(ZS) WITH TEXT-180.

EXIT.

ENDIF.

G_SUBRC = 4.

  • Check if SKu detail is maintained.

LOOP AT I_SKU_INFO WHERE NOT DEPT IS INITIAL

OR NOT CLASS IS INITIAL

OR NOT SUB_CLASS IS INITIAL

OR NOT STYLE IS INITIAL

OR NOT SKU IS INITIAL.

G_SUBRC = 0.

EXIT.

ENDLOOP.

IF G_SUBRC = 4.

MESSAGE S161(ZS) WITH TEXT-005.

EXIT.

ENDIF.

CLEAR G_DUPLICATE_ENTRY.

DELETE I_SKU_INFO WHERE DEPT IS INITIAL

AND CLASS IS INITIAL

AND SUB_CLASS IS INITIAL

AND STYLE IS INITIAL

AND SKU IS INITIAL.

  • Check for duplicate entries in sku hierarchy info

PERFORM CHECK_DUPLICATE_ENTRIES.

  • If any duplicate entry is found, then issue message to the user

IF G_DUPLICATE_ENTRY = C_X.

*Begin of Insert DEVK941854 ** To display duplicate entries

LOOP AT I_SKU_INFO_TEMP.

CLEAR G_POPUP_TEXT.

IF NOT I_SKU_INFO_TEMP-SKU IS INITIAL.

CONCATENATE 'SKU :' I_SKU_INFO_TEMP-SKU INTO L_SKU_TEXT.

ELSE.

CONCATENATE 'Style :' I_SKU_INFO_TEMP-STYLE INTO L_SKU_TEXT.

ENDIF.

LOOP AT I_SKU_INFO WHERE LINE_NO <> I_SKU_INFO_TEMP-LINE_NO AND

SKU = I_SKU_INFO_TEMP-SKU AND

STYLE = I_SKU_INFO_TEMP-STYLE AND

SUB_CLASS = I_SKU_INFO_TEMP-SUB_CLASS AND

CLASS = I_SKU_INFO_TEMP-CLASS AND

DEPT = I_SKU_INFO_TEMP-DEPT.

L_LINE = I_SKU_INFO-LINE_NO.

CONCATENATE G_POPUP_TEXT L_LINE INTO

G_POPUP_TEXT SEPARATED BY SPACE.

ENDLOOP.

IF NOT G_POPUP_TEXT IS INITIAL.

CONDENSE G_POPUP_TEXT.

PERFORM DISPLAY_POPUP_MESSAGE USING 'Duplicate Entries'

L_SKU_TEXT

'is duplicated at line(s)'

G_POPUP_TEXT

' '.

CLEAR: L_SKU_TEXT, G_POPUP_TEXT.

ENDIF.

ENDLOOP.

*End of Insert DEVK941854

CONCATENATE TEXT-060 TEXT-059

INTO G_POPUP_TEXT

SEPARATED BY SPACE.

CLEAR G_ANS.

CLEAR G_LINE_TEXT.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

  • delete adjacent duplicates from i_sku_info comparing dept

  • class

  • sub_class

  • style

  • sku.

REFRESH I_SKU_INFO.

CLEAR I_SKU_INFO.

I_SKU_INFO[] = I_SKU_INFO_TEMP[].

REFRESH I_SKU_INFO_TEMP.

CLEAR I_SKU_INFO_TEMP.

MESSAGE S161(ZS) WITH TEXT-003.

LOOP AT I_SKU_INFO.

I_SKU_INFO-LINE_NO = SY-TABIX.

MODIFY I_SKU_INFO INDEX SY-TABIX TRANSPORTING LINE_NO.

ENDLOOP.

ENDIF.

ELSE.

  • Existing Style check in case of pricing

CLEAR G_EXIT.

IF G_PRICING_FLAG = C_X OR G_PRICING_COPY_FLAG = C_X.

PERFORM CHECK_EXISTING_STYLE.

IF G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

  • invalid entry check

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-169.

DATA: L_MVKE_MATNR LIKE MVKE-MATNR.

G_VKORG = ZPRICELIST-ZLIST(4).

CLEAR G_EXIT.

LOOP AT I_SKU_INFO WHERE NOT STYLE IS INITIAL.

CLEAR G_EXIT.

CLEAR L_MVKE_MATNR.

IF NOT I_SKU_INFO-SKU IS INITIAL.

SELECT SINGLE MVKE~MATNR

FROM MVKE INNER JOIN ZSDRETL_ACTVSKU

ON MVKEMATNR = ZSDRETL_ACTVSKUSKU

INTO L_MVKE_MATNR

WHERE MVKE~MATNR = I_SKU_INFO-SKU

AND MVKE~VKORG = G_VKORG

AND MVKE~VTWEG = '00'.

IF SY-SUBRC <> 0.

CLEAR: G_CHAR , G_POPUP_TEXT.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-165.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

IF I_SKU_INFO-SKU IS INITIAL.

REFRESH R_STYLE.

R_STYLE-SIGN = 'I'.

R_STYLE-OPTION = C_OPT2.

CONCATENATE I_SKU_INFO-STYLE C_STAR INTO R_STYLE-LOW.

APPEND R_STYLE.

CLEAR R_STYLE.

SELECT MVKE~MATNR

FROM MVKE INNER JOIN ZSDRETL_ACTVSKU

ON MVKEMATNR = ZSDRETL_ACTVSKUSKU

UP TO 1 ROWS

INTO L_MVKE_MATNR

WHERE MVKE~MATNR IN R_STYLE

AND MVKE~VKORG = G_VKORG

AND MVKE~VTWEG = '00'.

ENDSELECT.

IF SY-SUBRC <> 0.

CLEAR: G_CHAR , G_POPUP_TEXT.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-165.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

ENDLOOP.

IF G_EXIT = C_X.

EXIT.

ENDIF.

CLEAR G_EXIT.

  • Begin of DEVK939196

  • Check for zero value entries for % promo

IF G_PROMO_TYPE = C_%.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-170.

READ TABLE I_SKU_INFO WITH KEY VALUE = 0

ZERO_VAL_CHECK = C_SPACE.

IF SY-SUBRC = 0.

CLEAR G_ZEROVAL_CHK .

ENDIF.

IF G_ZEROVAL_CHK IS INITIAL.

READ TABLE I_SKU_INFO WITH KEY VALUE = 0 ZERO_VAL_CHECK = C_SPACE.

IF SY-SUBRC = 0.

LOOP AT I_SKU_INFO WHERE VALUE = 0 AND ZERO_VAL_CHECK = C_SPACE.

CLEAR L_INDEX.

L_INDEX = I_SKU_INFO-LINE_NO.

CONCATENATE L_TEXT L_INDEX INTO L_TEXT SEPARATED BY C_COMMA .

L_LEN = STRLEN( L_TEXT ).

IF L_LEN GT 50 .

CONCATENATE L_TEXT '...' INTO L_TEXT .

EXIT.

ENDIF.

ENDLOOP.

CLEAR G_POPUP_TEXT.

CONCATENATE 'You are applying zero % to items on this promo :'

L_TEXT '.' INTO G_POPUP_TEXT.

CONCATENATE G_POPUP_TEXT

'Do You Want to Continue ? ' INTO G_POPUP_TEXT SEPARATED BY SPACE.

G_LINE_TEXT = 'Warning'.

PERFORM GET_POPUP_CONFIRM USING G_ANS

G_POPUP_TEXT

G_LINE_TEXT.

IF G_ANS = C_ANS1.

G_ZEROVAL_CHK = C_X.

LOOP AT I_SKU_INFO.

IF I_SKU_INFO-VALUE = 0.

I_SKU_INFO-ZERO_VAL_CHECK = C_X.

MODIFY I_SKU_INFO INDEX SY-TABIX TRANSPORTING ZERO_VAL_CHECK.

ENDIF.

ENDLOOP.

ELSE.

MESSAGE S161(ZS) WITH TEXT-163.

EXIT.

ENDIF.

ENDIF.

ENDIF.

ELSE.

READ TABLE I_SKU_INFO WITH KEY VALUE = 0 ZERO_VAL_CHECK = C_SPACE.

IF SY-SUBRC = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-170.

LOOP AT I_SKU_INFO WHERE VALUE = 0 AND ZERO_VAL_CHECK = C_SPACE.

CLEAR L_INDEX.

L_INDEX = I_SKU_INFO-LINE_NO.

CONCATENATE L_TEXT L_INDEX INTO L_TEXT SEPARATED BY C_COMMA .

L_LEN = STRLEN( L_TEXT ).

IF L_LEN GT 50 .

CONCATENATE L_TEXT '...' INTO L_TEXT .

EXIT.

ENDIF.

ENDLOOP.

IF L_TEXT <> C_SPACE.

CLEAR G_POPUP_TEXT.

CONCATENATE 'Zero Values are not allowed. '

'Please refer Line no.:'

L_TEXT '.' INTO G_POPUP_TEXT.

G_LINE_TEXT = 'Warning'.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_LINE_TEXT

TXT1 = C_SPACE

TXT2 = G_POPUP_TEXT.

EXIT.

ENDIF.

ENDIF.

ENDIF.

  • End of DEVK939196

  • Check for more value than basic price

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-167.

CLEAR G_EXIT.

LOOP AT I_SKU_INFO.

G_INDEX = SY-TABIX.

IF I_SKU_INFO-STYLE <> C_SPACE AND I_SKU_INFO-KBETR = 0.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_CHAR , G_POPUP_TEXT.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-172.

G_EXIT = C_X.

EXIT.

ENDIF.

IF G_PROMO_TYPE = C_$ AND G_PRICING_FLAG <> C_X.

IF NOT I_SKU_INFO-KBETR IS INITIAL

AND I_SKU_INFO-VALUE = I_SKU_INFO-KBETR.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_CHAR , G_POPUP_TEXT.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-039.

G_EXIT = C_X.

EXIT.

ENDIF.

  • if promo type is $ and value is greater than the basic price then

IF NOT I_SKU_INFO-KBETR IS INITIAL

AND I_SKU_INFO-VALUE GT I_SKU_INFO-KBETR .

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_POPUP_TEXT , G_CHAR.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-040.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

.

  • if it is a percent promo and value is greater than 99 then issue error

  • message

IF G_PROMO_TYPE = C_%.

IF NOT I_SKU_INFO-VALUE IS INITIAL AND I_SKU_INFO-VALUE GE 100.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

CLEAR: G_POPUP_TEXT , G_CHAR.

G_CHAR = I_SKU_INFO-LINE_NO.

CONCATENATE 'Line No.:' G_CHAR INTO G_POPUP_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_POPUP_TEXT

TXT1 = C_SPACE

TXT2 = TEXT-041.

G_EXIT = C_X.

EXIT.

ENDIF.

ENDIF.

ENDLOOP.

IF G_EXIT = C_X.

EXIT.

ENDIF.

CLEAR G_EXIT .

*Begin of insert DEVK941854

*Display message if SKU Clearance $ existing when Style non Clear $

*is entered

IF G_PROMO_TYPE = C_$.

LOOP AT I_SKU_INFO.

IF I_SKU_INFO-TYPE = 5. "Style level promo

SELECT SINGLE DETLPP_ID DETLSKU

INTO (L_PP_ID, L_CLSKU)

FROM ZSDRETL_RMPDETL AS DETL INNER JOIN ZSDRETL_RMPHEAD AS HEAD

ON DETLPP_ID = HEADPP_ID

WHERE DETL~ZLEVEL = 6 AND "SKU Level promo

HEAD~ID_TYPE = C_P AND

HEAD~PLTYP = ZPRICELIST-ZLIST AND

HEAD~CLEARANCE = C_X AND "Clearance

HEAD~PROMO_TYPE = C_$ AND

DETL~START_DATE LE ZSDRETL_RMPHEAD-END_DATE AND

DETL~END_DATE GE ZSDRETL_RMPHEAD-START_DATE AND

DETL~DEPT EQ I_SKU_INFO-DEPT AND

DETL~CLASS EQ I_SKU_INFO-CLASS AND

DETL~SUB_CLASS EQ I_SKU_INFO-SUB_CLASS AND

DETL~STYLE EQ I_SKU_INFO-STYLE AND

DETL~SKU NE SPACE .

IF SY-SUBRC EQ 0.

SELECT SINGLE PP_ID

INTO L_PP_ID

FROM ZSDRETL_RMPSTORE

WHERE ( REGION_ID IN R_REGION OR

DIST_ID IN R_DIST OR

AREA_ID IN R_AREA OR

STORE_ID IN R_STORE ) AND

PP_ID EQ L_PP_ID.

IF SY-SUBRC EQ 0.

PERFORM DISPLAY_POPUP_MESSAGE USING 'Clearance Promo Exists'

'Clearance Promo'

L_PP_ID

'exists for SKU'

L_CLSKU.

ELSE.

SELECT SINGLE PP_ID "Promo Exits at PLtype level

INTO L_PP_ID

FROM ZSDRETL_RMPSTORE

WHERE PP_ID EQ L_PP_ID AND

REGION_ID EQ SPACE AND

DIST_ID EQ SPACE AND

AREA_ID EQ SPACE AND

STORE_ID EQ SPACE AND

PLTYP EQ SPACE.

IF SY-SUBRC EQ 0.

PERFORM DISPLAY_POPUP_MESSAGE USING 'Clearance Promo Exist'

'Clearance Promo'

L_PP_ID

'exists for SKU'

L_CLSKU.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

*Display message of existing style/sku level discounts when adding

*sub class level discounts

IF G_PROMO_TYPE = C_%.

LOOP AT I_SKU_INFO WHERE TYPE = 4.

SELECT SINGLE DETL~PP_ID

INTO L_PP_ID

FROM ZSDRETL_RMPDETL AS DETL INNER JOIN ZSDRETL_RMPHEAD AS HEAD

ON DETLPP_ID = HEADPP_ID

WHERE DETL~ZLEVEL IN (5,6) AND "Style/SKU Level promo

HEAD~ID_TYPE = C_P AND

HEAD~PLTYP = ZPRICELIST-ZLIST AND

HEAD~PROMO_TYPE IN (C_$,C_%) AND

DETL~START_DATE LE ZSDRETL_RMPHEAD-END_DATE AND

DETL~END_DATE GE ZSDRETL_RMPHEAD-START_DATE AND

DETL~DEPT EQ I_SKU_INFO-DEPT AND

DETL~CLASS EQ I_SKU_INFO-CLASS AND

DETL~SUB_CLASS EQ I_SKU_INFO-SUB_CLASS.

IF SY-SUBRC EQ 0.

PERFORM DISPLAY_POPUP_MESSAGE USING

'Style/SKU Level Promo Exists'

'Style/SKU Level Promo Exists'

'for sub class'

I_SKU_INFO-SUB_CLASS

''.

ENDIF.

ENDLOOP.

ENDIF.

*End of insert DEVK941854

IF G_INVALID_FLAG = C_X.

EXIT.

ENDIF.

  • Begin of DEVK939196

READ TABLE I_SKU_INFO WITH KEY REPROMO = C_REPROMO1.

IF SY-SUBRC = 0.

  • End of DEVK939196

IF G_PROMO_FLAG = C_X.

  • Check for existing promos

  • perform check_exist_promo using i_sku_info .

G_LINE_TEXT = I_SKU_INFO-LINE_NO.

CONDENSE G_LINE_TEXT.

CONCATENATE 'Line No :' G_LINE_TEXT INTO G_LINE_TEXT

SEPARATED BY SPACE.

PERFORM INFORM_EXIST_PROMO USING TEXT-178

TEXT-114

G_LINE_TEXT.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

  • perform check_exist_strict_promo using i_sku_info.

ELSE.

  • Check for existing pricing

G_LINE_TEXT = I_SKU_INFO-LINE_NO.

CONDENSE G_LINE_TEXT.

CONCATENATE 'Line No :' G_LINE_TEXT INTO G_LINE_TEXT

SEPARATED BY SPACE.

PERFORM INFORM_EXIST_PROMO USING TEXT-178

TEXT-179

G_LINE_TEXT.

TBCL3-TOP_LINE = I_SKU_INFO-LINE_NO.

  • perform check_exist_pricing using i_sku_info.

ENDIF.

ELSE.

MESSAGE S161(ZS) WITH TEXT-045.

ENDIF.

ENDIF.

ENDFORM. " CHECK_ENTRIES

&----


*& Form GET_VALUES_FOR_PROMO

&----


  • Get all the promo numbers for displaying in a search help

----


FORM GET_VALUES_FOR_PROMO.

  • Get all the promo ids from table zsdretl_rmphead

IF G_MAIN_OKCODE = 'VRPR'.

SELECT PP_ID

ID_DESC

FROM ZSDRETL_RMPHEAD

INTO TABLE I_PROMO_TAB

WHERE ID_TYPE = C_P .

  • and end_date ge sy-datum .

  • and start_date gt sy-datum

  • and end_date gt sy-datum .

  • and ( start_date le sy-datum

  • and end_date ge sy-datum ).

ELSE.

SELECT ZSDRETL_RMPHEAD~PP_ID

ZSDRETL_RMPHEAD~ID_DESC

FROM ZSDRETL_RMPHEAD INNER JOIN ZSDRETL_RMPDETL

ON ZSDRETL_RMPHEADPP_ID = ZSDRETL_RMPDETLPP_ID

INTO TABLE I_PROMO_TAB

WHERE ZSDRETL_RMPHEAD~ID_TYPE = C_P

AND ZSDRETL_RMPHEAD~END_DATE GE SY-DATUM

AND ZSDRETL_RMPDETL~END_DATE GE SY-DATUM.

  • and start_date gt sy-datum

  • and end_date gt sy-datum .

  • and

  • and end_date ge sy-datum.

ENDIF.

IF SY-SUBRC = 0.

  • sort i_promo_tab by pp_id.

  • Begin of DEVK939607

SORT I_PROMO_TAB BY PP_ID DESCENDING.

  • End of DEVK939607

DELETE ADJACENT DUPLICATES FROM I_PROMO_TAB.

  • List all the promo numbers as a search help

PERFORM GET_VALUE_ON_REQUEST TABLES I_PROMO_TAB

USING C_PROMO_ID1

C_PROMO_ID2

SY-DYNNR.

ENDIF.

ENDFORM. " GET_VALUES_FOR_PROMO

&----


*& Form CALL_HEAD_SCR_FOR_PROMOCHANGE

&----


  • Call header screen for a promo change request

----


FORM CALL_HEAD_SCR_FOR_PROMOCHANGE.

G_PROMO_CHG_FLAG = C_X.

  • Populate header part

SELECT SINGLE *

FROM ZSDRETL_RMPHEAD

INTO WA_RMPHEAD

WHERE PP_ID = G_PROMO_ID

AND ID_TYPE = C_P

AND END_DATE GE SY-DATUM .

IF SY-SUBRC = 0.

APPEND WA_RMPHEAD TO I_RMPHEAD.

G_ID = WA_RMPHEAD-PP_ID.

G_PDESC = WA_RMPHEAD-ID_DESC.

ZSDRETL_RMPHEAD-START_DATE = WA_RMPHEAD-START_DATE .

ZSDRETL_RMPHEAD-END_DATE = WA_RMPHEAD-END_DATE .

G_CREABY = WA_RMPHEAD-ERNAM.

G_CREAON = WA_RMPHEAD-ERDAT.

ZPRICELIST-ZLIST = WA_RMPHEAD-PLTYP.

CHK_APR = WA_RMPHEAD-APPROVE.

IF WA_RMPHEAD-PROMO_TYPE = C_$.

G_DOLAR = C_X .

ELSE.

G_PERC = C_X.

ENDIF.

IF WA_RMPHEAD-CLEARANCE = C_X.

G_CLR = C_X.

ELSE.

G_NON_CLR = C_X.

ENDIF.

  • Populate store grouping information

SELECT *

FROM ZSDRETL_RMPSTORE

INTO TABLE I_RMPSTORE

WHERE PP_ID = G_PROMO_ID

  • and start_date ge sy-datum

AND END_DATE GE SY-DATUM.

IF SY-SUBRC = 0.

READ TABLE I_RMPSTORE INDEX 1 INTO WA_RMPSTORE.

IF SY-SUBRC = 0 AND WA_RMPSTORE-STORE_LEVEL = C_LEVEL6.

G_PROMO_PLTYP = C_X.

ENDIF.

I_RMPSTORE_TEMP[] = I_RMPSTORE[].

LOOP AT I_RMPSTORE INTO WA_RMPSTORE.

I_STORE_INFO-REGION_ID = WA_RMPSTORE-REGION_ID.

I_STORE_INFO-DIST_ID = WA_RMPSTORE-DIST_ID.

I_STORE_INFO-AREA_ID = WA_RMPSTORE-AREA_ID.

I_STORE_INFO-STORE_ID = WA_RMPSTORE-STORE_ID.

I_STORE_INFO-ATTR_VAL = WA_RMPSTORE-ATTR_VAL.

I_STORE_INFO-LEVEL = WA_RMPSTORE-STORE_LEVEL.

I_STORE_INFO-CHANGE_FLAG = C_X.

APPEND I_STORE_INFO.

CLEAR I_STORE_INFO.

ENDLOOP.

ELSE.

LEAVE TO SCREEN 9003.

  • message s161(zs) with text-007.

ENDIF.

  • Populate sku hierarchy information

SELECT *

FROM ZSDRETL_RMPDETL

INTO TABLE I_RMPDETAIL

WHERE PP_ID = G_PROMO_ID

AND END_DATE GE SY-DATUM.

IF SY-SUBRC = 0.

I_RMPDETAIL_TEMP[] = I_RMPDETAIL[].

LOOP AT I_RMPDETAIL INTO WA_RMPDETAIL.

MOVE-CORRESPONDING WA_RMPDETAIL TO I_SKU_INFO.

  • i_sku_info-check_flag = c_x.

APPEND I_SKU_INFO.

CLEAR I_SKU_INFO.

ENDLOOP.

ENDIF.

ENDIF.

PERFORM CHECK_EXIST_PROMO_VIEW_SKUHIER.

LOOP AT I_SKU_INFO.

CLEAR I_SKU_INFO-REPROMO.

I_SKU_INFO-CHANGE_FLAG = C_X.

MODIFY I_SKU_INFO.

ENDLOOP.

  • Begin of DEVK939178

  • Check for reference material and populate . This is required to calcu

  • late basic price of material

  • perform get_ref_material.

  • End of DEVK939178

CALL SCREEN 9001.

ENDFORM. " CALL_HEAD_SCR_FOR_PROMOCHANGE

&----


*& Form VALIDATE_PROMO_ID

&----


  • Validate promo id entered in the screen

----


FORM VALIDATE_PROMO_ID.

DATA: L_ID LIKE ZSDRETL_RMPHEAD-PP_ID, " Promo id

L_REPID LIKE D020S-PROG,

L_PPID LIKE ZSDRETL_RMPHEAD-PP_ID.

  • Get the field value of the promo id from the screen

REFRESH I_DYNPREAD.

WA_DYNPREAD-STEPL = 0.

WA_DYNPREAD-FIELDNAME = 'G_PROMO_ID'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

CLEAR G_PP_ID.

L_REPID = G_REPID.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = L_REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = I_DYNPREAD.

IF SY-SUBRC <> 0.

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

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

ENDIF.

  • Validate the promo entered from the table zsdretl_rmphead

READ TABLE I_DYNPREAD INTO WA_DYNPREAD

WITH KEY FIELDNAME = 'G_PROMO_ID'.

IF SY-SUBRC = 0 AND NOT WA_DYNPREAD-FIELDVALUE IS INITIAL.

L_ID = WA_DYNPREAD-FIELDVALUE.

IF G_MAIN_OKCODE = 'VRPR'.

  • Validate the promo id without considering date in case of view promo

SELECT SINGLE PP_ID

FROM ZSDRETL_RMPHEAD

INTO G_PP_ID

WHERE PP_ID = L_ID

AND ID_TYPE = C_P.

  • and start_date gt sy-datum

  • and end_date gt sy-datum .

  • and ( start_date le sy-datum

  • and end_date ge sy-datum ).

ELSE.

  • Validate the promo id with considering date in case of change promo

SELECT ZSDRETL_RMPHEAD~PP_ID

  • zsdretl_rmphead~id_desc

FROM ZSDRETL_RMPHEAD INNER JOIN ZSDRETL_RMPDETL

ON ZSDRETL_RMPHEADPP_ID = ZSDRETL_RMPDETLPP_ID

UP TO 1 ROWS

INTO L_PPID

WHERE ZSDRETL_RMPHEAD~ID_TYPE = C_P

AND ZSDRETL_RMPHEAD~END_DATE GE SY-DATUM

AND ZSDRETL_RMPDETL~END_DATE GE SY-DATUM

AND ZSDRETL_RMPHEAD~PP_ID = L_ID.

ENDSELECT.

  • select single pp_id

  • from zsdretl_rmphead

  • into g_pp_id

  • where pp_id = l_id

  • and id_type = c_p

  • and start_date gt sy-datum

  • and end_date gt sy-datum .

  • and end_date ge sy-datum .

ENDIF.

IF SY-SUBRC <> 0.

MESSAGE E161(ZS) WITH TEXT-007.

ELSE.

PERFORM ENQUEUE USING G_PROMO_ID.

ENDIF.

ELSEIF WA_DYNPREAD-FIELDVALUE IS INITIAL.

IF OKCODE = 'BACK' AND L_ID IS INITIAL.

LEAVE TO SCREEN 9000.

ELSE.

MESSAGE E161(ZS) WITH TEXT-035.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_PROMO_ID

&----


*& Form INITIALIZE_9003

&----


  • Initialize the variables and internal tables

----


FORM INITIALIZE_9003.

CLEAR : WA_RMPHEAD ,

I_RMPHEAD[],

WA_RMPSTORE,

I_RMPSTORE[],

I_RMPSTORE_TEMP,

I_RMPSTORE_TEMP[],

WA_RMPDETAIL,

I_RMPDETAIL_TEMP,

I_RMPDETAIL[],

I_RMPDETAIL_TEMP[],

I_STORE_INFO,

I_STORE_INFO[],

I_SKU_INFO,

I_SKU_INFO[],

G_ID,

G_PDESC,

ZPRICELIST-ZLIST,

CHK_APR,

G_CREABY,

G_CREAON,

G_DOLAR,

G_PERC,

G_CLR,

G_NON_CLR,

G_PROMO_CHG_FLAG,

G_PRICING_CHG_FLAG,

ZSDRETL_RMPHEAD,

G_LINE_CNT,

G_ADD_CNT,

G_PRICING_COPY_FLAG,

G_PROMO_COPY_FLAG.

  • Get the program id

G_REPID = SY-REPID.

  • Unlock all the locked object before starting with any promo or pricing

  • option

PERFORM DEQUE.

ENDFORM. " INITIALIZE_9003

&----


*& Form CHECK_DUPLICATE_ENTRIES

&----


  • Perform a check to determine whether any duplicate entry is

  • found or not before saving the promo. If any duplicate entry is found

  • then delete the same

----


FORM CHECK_DUPLICATE_ENTRIES.

REFRESH I_SKU_INFO_TEMP.

  • sort i_sku_info by dept

  • class

  • sub_class

  • style

  • sku.

  • i_sku_info_temp[] = i_sku_info[].

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-168.

LOOP AT I_SKU_INFO.

READ TABLE I_SKU_INFO_TEMP WITH KEY DEPT = I_SKU_INFO-DEPT

CLASS = I_SKU_INFO-CLASS

SUB_CLASS = I_SKU_INFO-SUB_CLASS

STYLE = I_SKU_INFO-STYLE

SKU = I_SKU_INFO-SKU.

IF SY-SUBRC <> 0.

I_SKU_INFO_TEMP = I_SKU_INFO.

APPEND I_SKU_INFO_TEMP.

CLEAR I_SKU_INFO_TEMP.

ENDIF.

ENDLOOP.

  • delete adjacent duplicates from i_sku_info_temp comparing dept

  • class

  • sub_class

  • style

  • sku.

DESCRIBE TABLE I_SKU_INFO LINES L_LINE.

DESCRIBE TABLE I_SKU_INFO_TEMP LINES G_LINENO.

IF L_LINE <> G_LINENO.

G_DUPLICATE_ENTRY = C_X.

ELSE.

CLEAR G_DUPLICATE_ENTRY.

ENDIF.

ENDFORM. " CHECK_DUPLICATE_ENTRIES

&----


*& Form CREATE_PRICING

&----


  • Call header screen for creating a Pricing event

----


FORM CREATE_PRICING.

  • Set the header text for header screen and detail screen for create

  • Pricing

G_TEXT_HEADER = C_HEADER_TEXT2.

G_TEXT_DET = C_DETAIL_TEXT2.

G_MAIN_OKCODE = OKCODE.

G_PRICING_FLAG = C_X.

G_PROMO_FLAG = C_SPACE.

CHK_APR = C_X.

CLEAR : ZPRICELIST-ZLIST,

ZSDRETL_RMPHEAD-START_DATE,

ZSDRETL_RMPHEAD-END_DATE,

G_DOLAR,

G_PERC,

G_CLR,

G_NON_CLR,

G_PROMO_FLAG,

G_PROMO_CHG_FLAG.

  • default end date to 2years from today

PERFORM DEFAULT_END_DATE_TO_2YRS .

  • Call the header screen for pricing entry

CALL SCREEN 9001.

ENDFORM. " CREATE_PRICING

&----


*& Form CHANGE_PRICING

&----


  • Call screen to get the pricing id to change it

----


FORM CHANGE_PRICING.

CLEAR: G_PRICING_ID,

G_PROMO_FLAG,

G_PROMO_CHG_FLAG.

  • Change the header text for header screen and detail screen for the

  • change pricing

G_TEXT_HEADER = C_HEADER_TEXT2.

G_TEXT_DET = C_DETAIL_TEXT2.

G_MAIN_OKCODE = OKCODE.

G_PRICING_FLAG = C_X.

  • Call screen to input the pricing number for change

CALL SCREEN 9004.

ENDFORM. " CHANGE_PRICING

&----


*& Form VALIDATE_PRICING_ID

&----


  • Validate pricing id entered in the screen

----


FORM VALIDATE_PRICING_ID.

DATA: L_REPID LIKE D020S-PROG.

  • Get the current pricing id entered in the screen.

REFRESH I_DYNPREAD.

WA_DYNPREAD-STEPL = 0.

WA_DYNPREAD-FIELDNAME = 'G_PRICING_ID'.

APPEND WA_DYNPREAD TO I_DYNPREAD.

CLEAR WA_DYNPREAD.

CLEAR G_PP_ID.

L_REPID = G_REPID.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = L_REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = I_DYNPREAD.

IF SY-SUBRC <> 0.

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

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

ENDIF.

  • Get the pricing id from the screen and validate

READ TABLE I_DYNPREAD INTO WA_DYNPREAD

WITH KEY FIELDNAME = 'G_PRICING_ID'.

IF SY-SUBRC = 0 AND NOT WA_DYNPREAD-FIELDVALUE IS INITIAL.

  • Validate pricing id from table zsdretl_rmphead without considering

  • date if it is a case of view promo

IF G_MAIN_OKCODE = 'VRPR'.

SELECT SINGLE PP_ID

FROM ZSDRETL_RMPHEAD

INTO G_PP_ID

WHERE PP_ID = WA_DYNPREAD-FIELDVALUE

AND ID_TYPE = C_F.

ELSE.

  • Validate pricing id from table zsdretl_rmphead by considering

  • date if it is a case of change promo

SELECT SINGLE PP_ID

FROM ZSDRETL_RMPHEAD

INTO G_PP_ID

WHERE PP_ID = WA_DYNPREAD-FIELDVALUE

AND ID_TYPE = C_F

AND END_DATE GE SY-DATUM .

ENDIF.

IF SY-SUBRC <> 0.

MESSAGE E161(ZS) WITH TEXT-008.

ELSE.

PERFORM ENQUEUE USING G_PRICING_ID.

ENDIF.

ELSEIF WA_DYNPREAD-FIELDVALUE IS INITIAL.

MESSAGE E161(ZS) WITH TEXT-036.

ENDIF.

ENDFORM. " VALIDATE_PRICING_ID

&----


*& Form GET_VALUES_FOR_PRICING

&----


  • Value request for pricing id

----


FORM GET_VALUES_FOR_PRICING.

  • If it is a case of view pricing, then retrieve all the pricing without

  • considering date

IF G_MAIN_OKCODE = 'VRPR'.

SELECT PP_ID

ID_DESC

FROM ZSDRETL_RMPHEAD

INTO TABLE I_PRICING_TAB

WHERE ID_TYPE = C_F .

ELSE.

  • If it is a case of view pricing, then retrieve all the pricing with

  • considering date

SELECT PP_ID

ID_DESC

FROM ZSDRETL_RMPHEAD

INTO TABLE I_PRICING_TAB

WHERE ID_TYPE = C_F

AND END_DATE GE SY-DATUM.

ENDIF.

IF SY-SUBRC = 0.

  • Begin of DEVK939607

SORT I_PRICING_TAB BY PP_ID DESCENDING.

  • End of DEVK939607

PERFORM GET_VALUE_ON_REQUEST TABLES I_PRICING_TAB

USING C_PRICE_ID1

C_PRICE_ID2

SY-DYNNR.

ENDIF.

ENDFORM. " GET_VALUES_FOR_PRICING

&----


*& Form CALL_HEAD_SCR_FOR_PRICE_CHANGE

&----


  • Call the header screen for changing the pricing

----


FORM CALL_HEAD_SCR_FOR_PRICE_CHANGE.

G_PRICING_CHG_FLAG = C_X.

  • Populate header part

SELECT SINGLE *

FROM ZSDRETL_RMPHEAD

INTO WA_RMPHEAD

WHERE PP_ID = G_PRICING_ID

AND ID_TYPE = C_F.

IF SY-SUBRC = 0.

APPEND WA_RMPHEAD TO I_RMPHEAD.

G_ID = WA_RMPHEAD-PP_ID.

G_PDESC = WA_RMPHEAD-ID_DESC.

ZSDRETL_RMPHEAD-START_DATE = WA_RMPHEAD-START_DATE .

ZSDRETL_RMPHEAD-END_DATE = WA_RMPHEAD-END_DATE .

G_CREABY = WA_RMPHEAD-ERNAM.

G_CREAON = WA_RMPHEAD-ERDAT.

ZPRICELIST-ZLIST = WA_RMPHEAD-PLTYP.

CHK_APR = WA_RMPHEAD-APPROVE.

G_DOLAR = C_X .

G_NON_CLR = C_X.

  • Populate store grouping information

SELECT *

FROM ZSDRETL_RMPSTORE

INTO TABLE I_RMPSTORE

WHERE PP_ID = G_PRICING_ID.

IF SY-SUBRC = 0.

REFRESH I_RMPSTORE_TEMP.

I_RMPSTORE_TEMP[] = I_RMPSTORE[].

LOOP AT I_RMPSTORE INTO WA_RMPSTORE.

I_STORE_INFO-REGION_ID = WA_RMPSTORE-REGION_ID.

I_STORE_INFO-DIST_ID = WA_RMPSTORE-DIST_ID.

I_STORE_INFO-AREA_ID = WA_RMPSTORE-AREA_ID.

I_STORE_INFO-STORE_ID = WA_RMPSTORE-STORE_ID.

I_STORE_INFO-ATTR_VAL = WA_RMPSTORE-ATTR_VAL.

I_STORE_INFO-LEVEL = WA_RMPSTORE-STORE_LEVEL.

APPEND I_STORE_INFO.

CLEAR I_STORE_INFO.

ENDLOOP.

ENDIF.

  • Populate sku hierarchy information

SELECT *

FROM ZSDRETL_RMPDETL

INTO TABLE I_RMPDETAIL

WHERE PP_ID = G_PRICING_ID.

IF SY-SUBRC = 0.

REFRESH I_RMPDETAIL_TEMP.

I_RMPDETAIL_TEMP[] = I_RMPDETAIL[].

LOOP AT I_RMPDETAIL INTO WA_RMPDETAIL.

MOVE-CORRESPONDING WA_RMPDETAIL TO I_SKU_INFO.

I_SKU_INFO-CHECK_FLAG = C_X.

APPEND I_SKU_INFO.

CLEAR I_SKU_INFO.

ENDLOOP.

ENDIF.

ENDIF.

  • Begin of DEVK939178

  • Check for reference material and populate . This is required to calcu

  • late basic price of material

  • Check for reference material and populate

  • perform get_ref_material.

  • End of DEVK939178

CALL SCREEN 9001.

ENDFORM. " CALL_HEAD_SCR_FOR_PRICE_CHANGE

&----


*& Form COMPARE_BASIC_PRICE

&----


  • Compare basic price with the value in both $ and % promo case.

----


FORM COMPARE_BASIC_PRICE.

IF OKCODE <> 'DELR'.

  • if no value is entered then isse error message

IF ( NOT G_DEPT IS INITIAL

OR NOT G_CLASS IS INITIAL

OR NOT G_SUBCLASS IS INITIAL

OR NOT G_STYLE IS INITIAL

OR NOT G_SKU IS INITIAL )

AND G_VALUE IS INITIAL .

  • Begin of DEVK939196 by psahoo on 11th Oct 2006

  • and g_promo_type = c_$.

  • End of DEVK939196 by psahoo on 11th Oct 2006

IF G_PROMO_TYPE = C_% AND ( NOT G_SKU IS INITIAL

OR NOT G_STYLE IS INITIAL ).

ELSE.

MESSAGE E161(ZS) WITH TEXT-037.

ENDIF.

ELSE.

  • If it is not a case of delete then compare

  • Begin of change of DEVK939258

  • Begin of change in DEVK939274

IF NOT G_SKU IS INITIAL OR NOT G_STYLE IS INITIAL.

IF G_KBETR IS INITIAL.

PERFORM GET_INDIVIDUAL_PRICE.

ENDIF.

  • End of change in DEVK939274

ENDIF.

IF NOT I_SKU_INFO-KBETR IS INITIAL.

MODIFY I_SKU_INFO INDEX TBCL3-CURRENT_LINE.

ENDIF.

  • End of change of DEVK939258

  • If promo type is $ and basic price is equal to the value then issue

  • error message

IF G_PROMO_TYPE = C_$ AND G_PRICING_FLAG <> C_X.

IF NOT I_SKU_INFO-KBETR IS INITIAL AND G_VALUE EQ I_SKU_INFO-KBETR .

MESSAGE E161(ZS) WITH TEXT-039.

ENDIF.

  • If promo type is $ and value is greater than the basic price then

  • issue error message

IF NOT I_SKU_INFO-KBETR IS INITIAL AND G_VALUE GT I_SKU_INFO-KBETR .

MESSAGE E161(ZS) WITH TEXT-040.

ENDIF.

ENDIF.

  • If it is a percent promo and value is greater than 99 then issue error

  • message

IF G_PROMO_TYPE = C_%.

IF NOT G_VALUE IS INITIAL AND G_VALUE GE 100.

MESSAGE E161(ZS) WITH TEXT-041.

ENDIF.

ENDIF.

ENDIF.

  • if value is entered with no sku detail then clear value

IF G_DEPT IS INITIAL

AND NOT G_CLASS IS INITIAL

AND NOT G_SUBCLASS IS INITIAL

AND NOT G_STYLE IS INITIAL

AND NOT G_SKU IS INITIAL

AND NOT G_VALUE IS INITIAL .

CLEAR I_SKU_INFO-VALUE.

ENDIF.

ENDIF.

IF I_SKU_INFO-VALUE IS INITIAL.

I_SKU_INFO-VALUE = 0 .

ENDIF.

ENDFORM. " COMPARE_BASIC_PRICE

&----


*& Form CHECK_EXIST_PRICING_STRGRP

&----


  • Check existing pricing for the store grouping info entered

----


FORM CHECK_EXIST_PRICING_STRGRP.

REFRESH I_STR_GRP.

CLEAR WA_STR_GRP.

IF NOT I_STORE_INFO[] IS INITIAL.

SELECT ZSDRETL_RMPSTORE~REGION_ID

ZSDRETL_RMPSTORE~DIST_ID

ZSDRETL_RMPSTORE~AREA_ID

ZSDRETL_RMPSTORE~STORE_ID

ZSDRETL_RMPSTORE~ATTR_VAL

ZSDRETL_RMPHEAD~PROMO_TYPE

ZSDRETL_RMPHEAD~CLEARANCE

ZSDRETL_RMPHEAD~START_DATE

ZSDRETL_RMPHEAD~END_DATE

ZSDRETL_RMPHEAD~PP_ID

ZSDRETL_RMPHEAD~ID_DESC

FROM ZSDRETL_RMPSTORE

INNER JOIN ZSDRETL_RMPHEAD

ON ZSDRETL_RMPSTOREPP_ID = ZSDRETL_RMPHEADPP_ID

INTO TABLE I_STR_GRP

FOR ALL ENTRIES IN I_STORE_INFO

WHERE ZSDRETL_RMPSTORE~REGION_ID = I_STORE_INFO-REGION_ID

AND ZSDRETL_RMPSTORE~DIST_ID = I_STORE_INFO-DIST_ID

AND ZSDRETL_RMPSTORE~AREA_ID = I_STORE_INFO-AREA_ID

  • and zsdretl_rmpstore~attr_val = i_store_info-attr_val

AND ZSDRETL_RMPSTORE~STORE_ID = I_STORE_INFO-STORE_ID

AND ZSDRETL_RMPHEAD~ID_TYPE = C_F

  • AND ( ( ZSDRETL_RMPSTORE~START_DATE LE ZSDRETL_RMPHEAD-START_DATE

  • AND ZSDRETL_RMPSTORE~END_DATE GE ZSDRETL_RMPHEAD-START_DATE )

  • OR ( ZSDRETL_RMPSTORE~START_DATE LE ZSDRETL_RMPHEAD-END_DATE

  • AND ZSDRETL_RMPSTORE~END_DATE GE ZSDRETL_RMPHEAD-END_DATE ) ).

AND ZSDRETL_RMPSTORE~START_DATE LE ZSDRETL_RMPHEAD-END_DATE

AND ZSDRETL_RMPSTORE~END_DATE GE ZSDRETL_RMPHEAD-START_DATE .

IF SY-SUBRC = 0.

LOOP AT I_STORE_INFO.

G_INDEX = SY-TABIX.

READ TABLE I_STR_GRP INTO WA_STR_GRP

WITH KEY REGION_ID = I_STORE_INFO-REGION_ID

DIST_ID = I_STORE_INFO-DIST_ID

AREA_ID = I_STORE_INFO-AREA_ID

STORE_ID = I_STORE_INFO-STORE_ID.

  • attr_val = i_store_info-attr_val.

IF SY-SUBRC = 0.

IF NOT G_ID IS INITIAL AND G_ID = WA_STR_GRP-PP_ID.

CLEAR I_STORE_INFO-REPROMO.

ELSE.

I_STORE_INFO-REPROMO = C_REPROMO.

ENDIF.

ELSE.

CLEAR I_STORE_INFO-REPROMO.

ENDIF.

MODIFY I_STORE_INFO INDEX G_INDEX TRANSPORTING REPROMO.

ENDLOOP.

ELSE.

LOOP AT I_STORE_INFO.

CLEAR I_STORE_INFO-REPROMO.

MODIFY I_STORE_INFO.

ENDLOOP.

ENDIF.

ENDIF.

ENDFORM. " CHECK_EXIST_PRICING_STRGRP

&----


*& Form CHECK_EXIST_PRICING_SKUHIER

&----


  • Check for existing pricing for the current sku hierarchy and store

  • grouping info

----


FORM CHECK_EXIST_PRICING_SKUHIER.

DELETE I_SKU_INFO WHERE NOT DEL_FLAG IS INITIAL.

REFRESH I_SKU_HIER.

CLEAR WA_SKU_HIER.

IF NOT I_SKU_INFO[] IS INITIAL.

SELECT ZSDRETL_RMPDETL~DEPT

ZSDRETL_RMPDETL~CLASS

ZSDRETL_RMPDETL~SUB_CLASS

ZSDRETL_RMPDETL~STYLE

ZSDRETL_RMPDETL~SKU

ZSDRETL_RMPDETL~VALUE

ZSDRETL_RMPDETL~START_DATE

ZSDRETL_RMPDETL~END_DATE

ZSDRETL_RMPHEAD~PROMO_TYPE

ZSDRETL_RMPHEAD~CLEARANCE

ZSDRETL_RMPDETL~TOP_UP

ZSDRETL_RMPHEAD~PP_ID

FROM ZSDRETL_RMPDETL INNER JOIN ZSDRETL_RMPHEAD

ON ZSDRETL_RMPDETLPP_ID = ZSDRETL_RMPHEADPP_ID

INTO TABLE I_SKU_HIER

FOR ALL ENTRIES IN I_SKU_INFO

WHERE ZSDRETL_RMPDETL~STYLE = I_SKU_INFO-STYLE

AND ZSDRETL_RMPDETL~SKU = I_SKU_INFO-SKU

AND ZSDRETL_RMPDETL~ZLEVEL <> C_LEVEL1

AND ZSDRETL_RMPHEAD~ID_TYPE = C_F

AND ZSDRETL_RMPHEAD~PLTYP = ZPRICELIST-ZLIST

  • AND ( ( ZSDRETL_RMPDETL~START_DATE LE ZSDRETL_RMPHEAD-START_DATE

  • AND ZSDRETL_RMPDETL~END_DATE GE ZSDRETL_RMPHEAD-START_DATE )

  • OR ( ZSDRETL_RMPDETL~START_DATE LE ZSDRETL_RMPHEAD-END_DATE

  • AND ZSDRETL_RMPDETL~END_DATE GE ZSDRETL_RMPHEAD-END_DATE ) ).

AND ZSDRETL_RMPDETL~START_DATE LE ZSDRETL_RMPHEAD-END_DATE

AND ZSDRETL_RMPDETL~END_DATE GE ZSDRETL_RMPHEAD-START_DATE .

IF SY-SUBRC = 0.

CHECK NOT I_SKU_HIER[] IS INITIAL.

REFRESH: I_STR_GRP1 , I_STR_DATA.

SELECT

REGION_ID

DIST_ID

AREA_ID

STORE_ID

ATTR_VAL

PP_ID

FROM ZSDRETL_RMPSTORE

INTO TABLE I_STR_DATA

FOR ALL ENTRIES IN I_SKU_HIER

WHERE PP_ID = I_SKU_HIER-PP_ID

AND START_DATE LE ZSDRETL_RMPHEAD-END_DATE

AND END_DATE GE ZSDRETL_RMPHEAD-START_DATE .

IF SY-SUBRC = 0.

LOOP AT I_SKU_INFO WHERE CHECK_FLAG IS INITIAL.

CLEAR G_SKU_PROMO_EXIST.

G_INDEX = SY-TABIX.

READ TABLE I_SKU_HIER INTO WA_SKU_HIER

WITH KEY STYLE = I_SKU_INFO-STYLE

SKU = I_SKU_INFO-SKU .

IF SY-SUBRC = 0.

READ TABLE I_STR_DATA INTO WA_STR_DATA

WITH KEY PP_ID = WA_SKU_HIER-PP_ID.

IF SY-SUBRC = 0.

LOOP AT I_STORE_INFO.

READ TABLE I_STR_DATA INTO WA_STR_DATA

WITH KEY

REGION_ID = I_STORE_INFO-REGION_ID

DIST_ID = I_STORE_INFO-DIST_ID

AREA_ID = I_STORE_INFO-AREA_ID

STORE_ID = I_STORE_INFO-STORE_ID.

  • attr_val = i_store_info-attr_val.

IF SY-SUBRC = 0.

G_SKU_PROMO_EXIST = C_X.

EXIT.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

IF G_SKU_PROMO_EXIST = C_X.

I_SKU_INFO-REPROMO = C_REPROMO.

I_SKU_INFO-REF_PROMO = WA_SKU_HIER-PP_ID.

I_SKU_INFO-REF_PROMO_TYPE = WA_SKU_HIER-PROMO_TYPE.

I_SKU_INFO-REF_PROMO_CLR = WA_SKU_HIER-CLEARANCE.

I_SKU_INFO-REF_PROMO_START_DATE = WA_SKU_HIER-START_DATE.

I_SKU_INFO-REF_PROMO_END_DATE = WA_SKU_HIER-END_DATE.

I_SKU_INFO-REF_VALUE = WA_SKU_HIER-VALUE.

MODIFY I_SKU_INFO INDEX G_INDEX .

ELSE.

CLEAR: I_SKU_INFO-REPROMO,

I_SKU_INFO-REF_PROMO.

MODIFY I_SKU_INFO INDEX G_INDEX .

ENDIF.

ENDLOOP.

ENDIF.

ELSE.

LOOP AT I_SKU_INFO.

CLEAR: I_SKU_INFO-REPROMO,

I_SKU_INFO-REF_PROMO.

MODIFY I_SKU_INFO.

ENDLOOP.

ENDIF.

ENDIF.

ENDFORM. " CHECK_EXIST_PRICING_SKUHIER

&----


*& Form CHECK_DUPLICATE_STRGRP_DATA

&----


  • Check for duplicate entries in store grouping table

----


FORM CHECK_DUPLICATE_STRGRP_DATA.

SORT I_STORE_INFO BY REGION_ID

DIST_ID

AREA_ID

STORE_ID

ATTR_VAL.

REFRESH I_STORE_INFO_TEMP.

I_STORE_INFO_TEMP[] = I_STORE_INFO[].

DELETE ADJACENT DUPLICATES FROM I_STORE_INFO_TEMP COMPARING REGION_ID

DIST_ID

AREA_ID

STORE_ID

ATTR_VAL.

CLEAR: L_LINE , G_LINENO.

DESCRIBE TABLE I_STORE_INFO LINES L_LINE.

DESCRIBE TABLE I_STORE_INFO_TEMP LINES G_LINENO.

CLEAR G_POPUP_TEXT.

IF L_LINE <> G_LINENO.

G_DUPLICATE_ENTRY = C_X.

ELSE.

G_DUPLICATE_ENTRY = C_SPACE.

ENDIF.

ENDFORM. " CHECK_DUPLICATE_STRGRP_DATA

&----


*& Form CHECK_EXIST_PRICING

&----


  • Check for existing pricing if anything is available during

  • saving a pricing

----


  • -->P_I_SKU_INFO text

----


FORM CHECK_EXIST_PRICING USING P_I_SKU_INFO LIKE I_SKU_INFO.

DATA: L_CHAR(3) TYPE C.

CLEAR G_POPUP_TEXT.

IF NOT P_I_SKU_INFO-REPROMO IS INITIAL.

CLEAR G_LINE_TEXT.

L_CHAR = P_I_SKU_INFO-LINE_NO.

CONCATENATE TEXT-119 L_CHAR INTO G_LINE_TEXT SEPARATED BY SPACE.

CONCATENATE TEXT-120 TEXT-115

INTO G_POPUP_TEXT SEPARATED BY SPACE.

PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.

IF G_ANS = C_ANS1.

P_I_SKU_INFO-DEL_FLAG = C_X.

CLEAR P_I_SKU_INFO-REPROMO.

ENDIF.

ENDIF.

ENDFORM. " CHECK_EXIST_PRICING

&----


*& Form POPULATE_SORT_TABLE

&----


  • Populate sort table

*----


FORM POPULATE_SORT_TABLE.

REFRESH I_SORTTAB.

CLEAR STRUCT_SORT.

CASE SY-DYNNR.

WHEN '9001'.

STRUCT_SORT-SPOS = C_LEVEL1.

STRUCT_SORT-FIELDNAME = 'REGION_ID' .

STRUCT_SORT-TABNAME = 'I_STORE_INFO'.

STRUCT_SORT-UP = C_X.

APPEND STRUCT_SORT TO I_SORTTAB.

CLEAR STRUCT_SORT.

STRUCT_SORT-SPOS = C_LEVEL2.

STRUCT_SORT-FIELDNAME = 'DIST_ID' .

STRUCT_SORT-TABNAME = 'I_STORE_INFO'.

STRUCT_SORT-UP = C_X.

APPEND STRUCT_SORT TO I_SORTTAB.

CLEAR STRUCT_SORT.

STRUCT_SORT-SPOS = C_LEVEL3.

STRUCT_SORT-FIELDNAME = 'AREA_ID' .

STRUCT_SORT-TABNAME = 'I_STORE_INFO'.

STRUCT_SORT-UP = C_X.

APPEND STRUCT_SORT TO I_SORTTAB.

CLEAR STRUCT_SORT.

STRUCT_SORT-SPOS = C_LEVEL4.

STRUCT_SORT-FIELDNAME = 'STORE_ID' .

STRUCT_SORT-TABNAME = 'I_STORE_INFO'.

STRUCT_SORT-UP = C_X.

APPEND STRUCT_SORT TO I_SORTTAB.

CLEAR STRUCT_SORT.

WHEN '9002'.

STRUCT_SORT-SPOS = C_LEVEL1.

STRUCT_SORT-FIELDNAME = 'SKU_LINE_REF' .

STRUCT_SORT-TABNAME = 'I_SKU_HIER'.

STRUCT_SORT-UP = C_X.

APPEND STRUCT_SORT TO I_SORTTAB.

CLEAR STRUCT_SORT.

  • STRUCT_SORT-SPOS = C_LEVEL1.

  • STRUCT_SORT-FIELDNAME = 'DEPT' .

  • STRUCT_SORT-TABNAME = 'I_SKU_INFO'.

  • STRUCT_SORT-UP = C_X.

  • APPEND STRUCT_SORT TO I_SORTTAB.

  • CLEAR STRUCT_SORT.

*

*

  • STRUCT_SORT-SPOS = C_LEVEL2.

  • STRUCT_SORT-FIELDNAME = 'CLASS' .

  • STRUCT_SORT-TABNAME = 'I_SKU_INFO'.

  • STRUCT_SORT-UP = C_X.

  • APPEND STRUCT_SORT TO I_SORTTAB.

  • CLEAR STRUCT_SORT.

*

  • STRUCT_SORT-SPOS = C_LEVEL3.

  • STRUCT_SORT-FIELDNAME = 'SUB_CLASS' .

  • STRUCT_SORT-TABNAME = 'I_SKU_INFO'.

  • STRUCT_SORT-UP = C_X.

  • APPEND STRUCT_SORT TO I_SORTTAB.

  • CLEAR STRUCT_SORT.

*

  • STRUCT_SORT-SPOS = C_LEVEL4.

  • STRUCT_SORT-FIELDNAME = 'STYLE' .

  • STRUCT_SORT-TABNAME = 'I_SKU_INFO'.

  • STRUCT_SORT-UP = C_X.

  • APPEND STRUCT_SORT TO I_SORTTAB.

  • CLEAR STRUCT_SORT.

*

  • STRUCT_SORT-SPOS = C_LEVEL5.

  • STRUCT_SORT-FIELDNAME = 'SKU' .

  • STRUCT_SORT-TABNAME = 'I_SKU_INFO'.

  • STRUCT_SORT-UP = C_X.

  • APPEND STRUCT_SORT TO I_SORTTAB.

  • CLEAR STRUCT_SORT.

ENDCASE.

ENDFORM. " POPULATE_SORT_TABLE

&----


*& Form CALL_VIEW_COPY_PROMO_PRICING

&----


  • Call screen to view or copy of promo or pricing

----


FORM CALL_VIEW_COPY_PROMO_PRICING.

CLEAR : G_PROMO_ID ,

G_PRICING_ID.

G_MAIN_OKCODE = OKCODE.

  • Call input screen for view or copy the promo and pricing

CALL SCREEN 9007.

ENDFORM. " CALL_VIEW_COPY_PROMO_PRICING

&----


*& Form VIEW_PROMO_PRICING_ID

&----


  • View the promo or pricing details for the id entered in the screen

----


  • -->P_G_PROMO_ID text

----


FORM VIEW_PROMO_PRICING_ID.

IF NOT RAD_PROMO IS INITIAL AND NOT G_PROMO_ID IS INITIAL.

G_PROMO_VIEW_FLAG = C_X.

  • Retrieve Promo/Pricing data for the Promo/Pricing Id entered.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-195.

PERFORM GET_PROMO_ID_DATA.

G_TEXT_HEADER = C_HEADER_TEXT1.

G_TEXT_DET = C_DETAIL_TEXT1.

G_PROMO_FLAG = C_X.

  • perform check_exist_promo_view_skuhier.

LOOP AT I_SKU_INFO.

CLEAR I_SKU_INFO-REPROMO.

MODIFY I_SKU_INFO.

ENDLOOP.

ENDIF.

IF NOT RAD_PRICE IS INITIAL AND NOT G_PRICING_ID IS INITIAL.

G_PRICING_VIEW_FLAG = C_X.

G_PRICING_FLAG = C_X.

  • Retrieve Pricing data for the Promo/Pricing Id entered.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-196.

PERFORM GET_PRICING_ID_DATA.

G_TEXT_HEADER = C_HEADER_TEXT2.

G_TEXT_DET = C_DETAIL_TEXT2.

ENDIF.

  • Begin of DEVK939178

  • Required to determine basic price before the sku details appears

  • Check for reference material and populate

  • perform get_ref_material.

  • Begin of DEVK939178

  • Begin of DEVK939178

  • required to avoid nested screen call

LEAVE TO SCREEN 9001.

  • call screen 9001.

  • End of DEVK939178

ENDFORM. " VIEW_PROMO_PRICING_ID

&----


*& Form COPY_PROMO_PRICING

&----


  • Call screen to make a copy of promo or pricing entered in the screen

----


FORM COPY_PROMO_PRICING.

IF NOT RAD_PROMO IS INITIAL AND NOT G_PROMO_ID IS INITIAL.

G_PROMO_COPY_FLAG = C_X.

G_PROMO_FLAG = C_X.

  • Retrieve Promo data for the Promo Id entered.

PERFORM GET_PROMO_ID_DATA.

REFRESH: I_RMPSTORE_TEMP, I_RMPDETAIL , I_RMPDETAIL_TEMP .

CLEAR: I_RMPSTORE_TEMP, I_RMPDETAIL , I_RMPDETAIL_TEMP.

CLEAR: G_ID,

G_PDESC,

ZSDRETL_RMPHEAD-START_DATE,

ZSDRETL_RMPHEAD-END_DATE.

LOOP AT I_SKU_INFO.

CLEAR : I_SKU_INFO-OVERRIDE,

I_SKU_INFO-TOP_UP,

I_SKU_INFO-CHECK_FLAG.

MODIFY I_SKU_INFO.

ENDLOOP.

G_TEXT_HEADER = C_HEADER_TEXT1.

G_TEXT_DET = C_DETAIL_TEXT1.

ENDIF.

IF NOT RAD_PRICE IS INITIAL AND NOT G_PRICING_ID IS INITIAL.

G_PRICING_COPY_FLAG = C_X.

G_PRICING_FLAG = C_X.

  • Retrieve Pricing data for the Pricing Id entered.

PERFORM GET_PRICING_ID_DATA.

REFRESH: I_RMPSTORE_TEMP, I_RMPDETAIL , I_RMPDETAIL_TEMP.

CLEAR: I_RMPSTORE_TEMP, I_RMPDETAIL, I_RMPDETAIL_TEMP.

CLEAR: G_ID,

G_PDESC,

ZSDRETL_RMPHEAD-START_DATE,

ZSDRETL_RMPHEAD-END_DATE.

LOOP AT I_SKU_INFO.

CLEAR : I_SKU_INFO-OVERRIDE,

I_SKU_INFO-TOP_UP,

I_SKU_INFO-CHECK_FLAG.

MODIFY I_SKU_INFO.

ENDLOOP.

G_TEXT_HEADER = C_HEADER_TEXT2.

G_TEXT_DET = C_DETAIL_TEXT2.

ENDIF.

  • default end date to 2years from today

PERFORM DEFAULT_END_DATE_TO_2YRS .

G_COPY_FLAG = C_X.

  • Begin of DEVK939178

  • Check for reference material and populate to determine basic price

  • perform get_ref_material.

  • required to avoid nested call screen

LEAVE TO SCREEN 9001.

  • call screen 9001.

  • End of DEVK939178

ENDFORM. " COPY_PROMO_PRICING

&----


*& Form INITIALIZE_9007

&----


  • Initialize the fields before going to the view/copy of promo/pricing

----


FORM INITIALIZE_9007.

CLEAR : WA_RMPHEAD ,

I_RMPHEAD[],

WA_RMPSTORE,

I_RMPSTORE[],

I_RMPSTORE_TEMP,

I_RMPSTORE_TEMP[],

WA_RMPDETAIL,

I_RMPDETAIL_TEMP,

I_RMPDETAIL[],

I_RMPDETAIL_TEMP[],

I_STORE_INFO,

I_STORE_INFO[],

I_SKU_INFO,

I_SKU_INFO[],

G_ID,

G_PDESC,

ZPRICELIST-ZLIST,

CHK_APR,

G_CREABY,

G_CREAON,

G_DOLAR,

G_PERC,

G_CLR,

G_NON_CLR,

G_PROMO_CHG_FLAG,

G_PRICING_CHG_FLAG,

G_PROMO_VIEW_FLAG,

G_PROMO_COPY_FLAG,

G_PRICING_VIEW_FLAG,

G_PRICING_COPY_FLAG,

ZSDRETL_RMPHEAD ,

G_PROMO_VIEW_FLAG ,

OKCODE.

ENDFORM. " INITIALIZE_9007

&----


*& Form GET_PROMO_ID_DATA

&----


  • Get details of the promotion or pricing entered in the screen.

----


FORM GET_PROMO_ID_DATA.

  • Populate header part

SELECT SINGLE *

FROM ZSDRETL_RMPHEAD

INTO WA_RMPHEAD

WHERE PP_ID = G_PROMO_ID.

IF SY-SUBRC = 0.

APPEND WA_RMPHEAD TO I_RMPHEAD.

G_ID = WA_RMPHEAD-PP_ID.

G_PDESC = WA_RMPHEAD-ID_DESC.

ZSDRETL_RMPHEAD-START_DATE = WA_RMPHEAD-START_DATE .

ZSDRETL_RMPHEAD-END_DATE = WA_RMPHEAD-END_DATE .

G_CREABY = WA_RMPHEAD-ERNAM.

G_CREAON = WA_RMPHEAD-ERDAT.

ZPRICELIST-ZLIST = WA_RMPHEAD-PLTYP.

CHK_APR = WA_RMPHEAD-APPROVE.

IF WA_RMPHEAD-PROMO_TYPE = C_$.

G_DOLAR = C_X .

ELSE.

G_PERC = C_X.

ENDIF.

IF WA_RMPHEAD-CLEARANCE = C_X.

G_CLR = C_X.

ELSE.

G_NON_CLR = C_X.

ENDIF.

  • Populate store grouping information

SELECT *

FROM ZSDRETL_RMPSTORE

INTO TABLE I_RMPSTORE

WHERE PP_ID = G_PROMO_ID.

IF SY-SUBRC = 0.

I_RMPSTORE_TEMP[] = I_RMPSTORE[].

LOOP AT I_RMPSTORE INTO WA_RMPSTORE.

I_STORE_INFO-REGION_ID = WA_RMPSTORE-REGION_ID.

I_STORE_INFO-DIST_ID = WA_RMPSTORE-DIST_ID.

I_STORE_INFO-AREA_ID = WA_RMPSTORE-AREA_ID.

I_STORE_INFO-STORE_ID = WA_RMPSTORE-STORE_ID.

I_STORE_INFO-ATTR_VAL = WA_RMPSTORE-ATTR_VAL.

I_STORE_INFO-LEVEL = WA_RMPSTORE-STORE_LEVEL.

APPEND I_STORE_INFO.

CLEAR I_STORE_INFO.

ENDLOOP.

ENDIF.

  • Populate sku hierarchy information

SELECT *

FROM ZSDRETL_RMPDETL

INTO TABLE I_RMPDETAIL

WHERE PP_ID = G_PROMO_ID.

IF SY-SUBRC = 0.

I_RMPDETAIL_TEMP[] = I_RMPDETAIL[].

LOOP AT I_RMPDETAIL INTO WA_RMPDETAIL.

MOVE-CORRESPONDING WA_RMPDETAIL TO I_SKU_INFO.

  • i_sku_info-check_flag = c_x.

APPEND I_SKU_INFO.

CLEAR I_SKU_INFO.

ENDLOOP.

ENDIF.

ENDIF.

ENDFORM. " GET_PROMO_ID_DATA

&----


*& Form VALIDATE_PROMO_PRICING_FIELDS

&----


  • Validate promo id and pricing id

----


FORM VALIDATE_PROMO_PRICING_FIELDS.

IF OKCODE = 'VIEW' OR OKCODE = 'COPY'.

IF RAD_PROMO = C_X AND G_PROMO_ID IS INITIAL.

MESSAGE E161(ZS) WITH TEXT-042.

ELSEIF RAD_PROMO = C_X AND NOT G_PROMO_ID IS INITIAL.

  • Validate promo id

PERFORM VALIDATE_PROMO_ID.

ENDIF.

IF RAD_PRICE = C_X AND G_PRICING_ID IS INITIAL.

MESSAGE E161(ZS) WITH TEXT-043.

ELSEIF RAD_PRICE = C_X AND NOT G_PRICING_ID IS INITIAL.

  • Validate pricing id

PERFORM VALIDATE_PRICING_ID.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_PROMO_PRICING_FIELDS

&----


*& Form GET_PRICING_ID_DATA

&----


  • Get pricing details for the pricings entered in the screen

----


FORM GET_PRICING_ID_DATA.

  • Populate header part

SELECT SINGLE *

FROM ZSDRETL_RMPHEAD

INTO WA_RMPHEAD

WHERE PP_ID = G_PRICING_ID.

IF SY-SUBRC = 0.

APPEND WA_RMPHEAD TO I_RMPHEAD.

G_ID = WA_RMPHEAD-PP_ID.

G_PDESC = WA_RMPHEAD-ID_DESC.

ZSDRETL_RMPHEAD-START_DATE = WA_RMPHEAD-START_DATE .

ZSDRETL_RMPHEAD-END_DATE = WA_RMPHEAD-END_DATE .

G_CREABY = WA_RMPHEAD-ERNAM.

G_CREAON = WA_RMPHEAD-ERDAT.

ZPRICELIST-ZLIST = WA_RMPHEAD-PLTYP.

CHK_APR = WA_RMPHEAD-APPROVE.

G_DOLAR = C_X .

G_NON_CLR = C_X.

  • Populate store grouping information

SELECT *

FROM ZSDRETL_RMPSTORE

INTO TABLE I_RMPSTORE

WHERE PP_ID = G_PRICING_ID.

IF SY-SUBRC = 0.

REFRESH I_RMPSTORE_TEMP.

I_RMPSTORE_TEMP[] = I_RMPSTORE[].

LOOP AT I_RMPSTORE INTO WA_RMPSTORE.

I_STORE_INFO-REGION_ID = WA_RMPSTORE-REGION_ID.

I_STORE_INFO-DIST_ID = WA_RMPSTORE-DIST_ID.

I_STORE_INFO-AREA_ID = WA_RMPSTORE-AREA_ID.

I_STORE_INFO-STORE_ID = WA_RMPSTORE-STORE_ID.

I_STORE_INFO-ATTR_VAL = WA_RMPSTORE-ATTR_VAL.

I_STORE_INFO-LEVEL = WA_RMPSTORE-STORE_LEVEL.

APPEND I_STORE_INFO.

CLEAR I_STORE_INFO.

ENDLOOP.

ENDIF.

  • Populate sku hierarchy information

SELECT *

FROM ZSDRETL_RMPDETL

INTO TABLE I_RMPDETAIL

WHERE PP_ID = G_PRICING_ID.

IF SY-SUBRC = 0.

REFRESH I_RMPDETAIL_TEMP.

I_RMPDETAIL_TEMP[] = I_RMPDETAIL[].

LOOP AT I_RMPDETAIL INTO WA_RMPDETAIL.

MOVE-CORRESPONDING WA_RMPDETAIL TO I_SKU_INFO.

I_SKU_INFO-CHECK_FLAG = C_X.

APPEND I_SKU_INFO.

CLEAR I_SKU_INFO.

ENDLOOP.

ENDIF.

ENDIF.

ENDFORM. " GET_PRICING_ID_DATA

&----


*& Form POPULATE_EVENT_TABLE

&----


  • Populate the event table for the top-of-page for the ALV

----


FORM POPULATE_EVENT_TABLE.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = I_EVENT

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ELSE.

READ TABLE I_EVENT INTO STRUCT_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC = 0.

G_INDEX = SY-TABIX.

STRUCT_EVENT-FORM = C_TOP_PAGE_NAME.

MODIFY I_EVENT FROM STRUCT_EVENT INDEX G_INDEX.

ENDIF.

READ TABLE I_EVENT INTO STRUCT_EVENT WITH KEY NAME = 'PF_STATUS_SET'.

IF SY-SUBRC = 0.

G_INDEX = SY-TABIX.

STRUCT_EVENT-FORM = 'SUB_PF_STATUS_SET'.

MODIFY I_EVENT FROM STRUCT_EVENT INDEX G_INDEX.

ENDIF.

READ TABLE I_EVENT INTO STRUCT_EVENT WITH KEY NAME = 'USER_COMMAND'.

IF SY-SUBRC = 0.

G_INDEX = SY-TABIX.

STRUCT_EVENT-FORM = 'SUB_USER_COMMAND'.

MODIFY I_EVENT FROM STRUCT_EVENT INDEX G_INDEX.

ENDIF.

ENDIF.

ENDFORM. " POPULATE_EVENT_TABLE

----


  • FORM SUB_TOP_OF_PAGE *

----


  • Top of page for view promo/pricing *

----


FORM SUB_TOP_OF_PAGE.

IF G_DYNNR = '9001'.

IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'

OR G_PRICING_VIEW_FLAG = C_X

OR G_PRICING_COPY_FLAG = C_X .

WRITE: 35 TEXT-174.

ELSE.

WRITE: 35 TEXT-121.

ENDIF.

ELSEIF G_DYNNR = '9002'.

IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'

OR G_PRICING_VIEW_FLAG = C_X

OR G_PRICING_COPY_FLAG = C_X .

WRITE: 35 TEXT-175.

ELSE.

WRITE: 35 TEXT-122.

ENDIF.

ENDIF.

NEW-LINE.

WRITE AT 35(55) SY-ULINE.

WRITE:/5 TEXT-124 , 23 C_COLON ,

SY-UNAME , 45 TEXT-125, 58 C_COLON , SY-DATUM .

NEW-LINE.

WRITE:/5 TEXT-133 , 23 C_COLON , ZPRICELIST-ZLIST ,

45 TEXT-126 , 58 C_COLON .

IF CHK_APR = C_X.

WRITE: TEXT-127.

ELSE.

WRITE: TEXT-128.

ENDIF.

NEW-LINE.

IF G_PERC = C_X.

G_PROMO_TYPE = C_%.

ELSE.

G_PROMO_TYPE = C_$.

ENDIF.

IF G_CLR = C_X.

G_CLRNCE = C_Y .

ELSE.

G_CLRNCE = C_N.

ENDIF.

WRITE:/5 TEXT-129 , 23 C_COLON , G_PROMO_TYPE ,

45 TEXT-130 , 58 C_COLON , G_CLRNCE.

NEW-LINE.

WRITE:/5 TEXT-131 , 23 C_COLON , ZSDRETL_RMPHEAD-START_DATE ,

45 TEXT-132 , 58 C_COLON , ZSDRETL_RMPHEAD-END_DATE.

ENDFORM.

&----


*& Form END_EXISTING_PROMO

&----


  • End any exisiting promo where the override flag is set

----


FORM END_EXISTING_PROMO.

REFRESH I_SKU_INFO_TEMP1.

CLEAR I_SKU_INFO_TEMP1.

I_SKU_INFO_TEMP1[] = I_SKU_INFO[].

DELETE I_SKU_INFO_TEMP1 WHERE OVERRIDE IS INITIAL.

SELECT *

FROM ZSDRETL_RMPHEAD

INTO TABLE I_RMPHEAD

FOR ALL ENTRIES IN I_SKU_INFO_TEMP1

WHERE PP_ID = I_SKU_INFO_TEMP1-REF_PROMO.

IF SY-SUBRC = 0.

LOOP AT I_RMPHEAD INTO WA_RMPHEAD.

WA_RMPHEAD-END_DATE = SY-DATUM.

MODIFY I_RMPHEAD FROM WA_RMPHEAD INDEX SY-TABIX.

ENDLOOP.

MODIFY ZSDRETL_RMPHEAD FROM TABLE I_RMPHEAD.

IF SY-SUBRC = 0.

COMMIT WORK.

ENDIF.

REFRESH I_RMPSTORE.

CLEAR I_RMPSTORE.

SELECT *

FROM ZSDRETL_RMPSTORE

INTO TABLE I_RMPSTORE

FOR ALL ENTRIES IN I_SKU_INFO_TEMP1

WHERE PP_ID = I_SKU_INFO_TEMP1-REF_PROMO.

IF SY-SUBRC = 0.

LOOP AT I_RMPSTORE INTO WA_RMPSTORE.

WA_RMPSTORE-END_DATE = SY-DATUM.

MODIFY I_RMPSTORE FROM WA_RMPSTORE INDEX SY-TABIX.

ENDLOOP.

MODIFY ZSDRETL_RMPSTORE FROM TABLE I_RMPSTORE.

IF SY-SUBRC = 0.

COMMIT WORK.

ENDIF.

REFRESH I_RMPDETAIL.

CLEAR I_RMPDETAIL.

SELECT *

FROM ZSDRETL_RMPDETL

INTO TABLE I_RMPDETAIL

FOR ALL ENTRIES IN I_SKU_INFO_TEMP1

WHERE PP_ID = I_SKU_INFO_TEMP1-REF_PROMO.

LOOP AT I_RMPDETAIL INTO WA_RMPDETAIL.

WA_RMPDETAIL-END_DATE = SY-DATUM.

MODIFY I_RMPDETAIL FROM WA_RMPDETAIL INDEX SY-TABIX.

ENDLOOP.

MODIFY ZSDRETL_RMPDETL FROM TABLE I_RMPDETAIL.

IF SY-SUBRC = 0.

COMMIT WORK.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " END_EXISTING_PROMO

&----


*& Form CALL_VIEW_PRINT_PROMO

&----


  • View and Print the promo using the transaction 'ZSDRETL_PROMO_REPT'.

----


FORM CALL_VIEW_PRINT_PROMO.

  • Call transaction to display and print the promo and pricing

CALL TRANSACTION 'ZSDRETL_PROMO_REPT'.

ENDFORM. " CALL_VIEW_PRINT_PROMO

&----


*& Form ENQUEUE

&----


  • Lock all the tables for the promo/pricing id

----


FORM ENQUEUE USING P_ID.

DATA: L_USER LIKE SY-MSGV1.

DATA: L_VARKEY LIKE RSTABLE-VARKEY.

L_VARKEY = SY-MANDT.

L_VARKEY+3(10) = P_ID.

CALL FUNCTION 'ENQUEUE_E_TABLEE'

EXPORTING

MODE_RSTABLE = 'E'

TABNAME = 'ZSDRETL_RMPHEAD'

VARKEY = L_VARKEY

X_TABNAME = ' '

X_VARKEY = ' '

_SCOPE = '2'

_WAIT = ' '

_COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

IF SY-SUBRC EQ 0.

CALL FUNCTION 'ENQUEUE_E_TABLEE'

EXPORTING

MODE_RSTABLE = 'E'

TABNAME = 'ZSDRETL_RMPSTORE'

VARKEY = L_VARKEY

X_TABNAME = ' '

X_VARKEY = ' '

_SCOPE = '2'

_WAIT = ' '

_COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

IF SY-SUBRC = 0.

CALL FUNCTION 'ENQUEUE_E_TABLEE'

EXPORTING

MODE_RSTABLE = 'E'

TABNAME = 'ZSDRETL_RMPDETL'

VARKEY = L_VARKEY

X_TABNAME = ' '

X_VARKEY = ' '

_SCOPE = '2'

_WAIT = ' '

_COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

IF SY-SUBRC = 0.

IF G_MAIN_OKCODE EQ 'VRPR'.

PERFORM DEQUE.

ENDIF.

ELSEIF SY-SUBRC EQ 1.

L_USER = SY-MSGV1.

IF G_MAIN_OKCODE EQ 'VRPR'.

MESSAGE I161(ZS) WITH TEXT-123 L_USER

TEXT-050 P_ID.

ELSE.

MESSAGE E161(ZS) WITH TEXT-123 L_USER

TEXT-050 P_ID.

ENDIF.

ELSEIF SY-SUBRC EQ 2 OR SY-SUBRC EQ 3.

MESSAGE E135(ZS).

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " ENQUEUE

&----


*& Form DEQUE

&----


  • Unlock all the objects locked before going to modify

----


FORM DEQUE.

CALL FUNCTION 'DEQUEUE_ALL'

EXPORTING

SYNCHRON = CSPACE

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC NE 0.

MESSAGE E133(ZS).

ENDIF.

ENDFORM. " DEQUE

&----


*& Form CREATE_PROMO

&----


  • Call the header screen to create promotion

----


FORM CREATE_PROMO.

CLEAR : G_PRICING_FLAG,

G_PRICING_CHG_FLAG,

G_PDESC,

ZPRICELIST-ZLIST.

G_MAIN_OKCODE = OKCODE.

CHK_APR = C_X.

  • Set the header text for header screen and detail screen for create

  • Promo

G_TEXT_HEADER = C_HEADER_TEXT1.

G_TEXT_DET = C_DETAIL_TEXT1.

G_PROMO_FLAG = C_X.

  • default end date to 2years from today

PERFORM DEFAULT_END_DATE_TO_2YRS .

  • call screen 9001.

LEAVE TO SCREEN 9001.

ENDFORM. " CREATE_PROMO

&----


*& Form CHANGE_PROMO

&----


  • Call the screen 9003 to select the promo id required to change

----


FORM CHANGE_PROMO.

CLEAR : G_PRICING_FLAG,

G_PRICING_CHG_FLAG.

G_PROMO_FLAG = C_X.

  • Set the header text for header screen and the detail screen for promo

  • change option

G_TEXT_HEADER = C_HEADER_TEXT1 .

G_TEXT_DET = C_DETAIL_TEXT1.

G_MAIN_OKCODE = OKCODE.

  • Leave to Promo change screen

LEAVE TO SCREEN 9003.

ENDFORM. " CHANGE_PROMO

&----


*& Form SET_PF_STATUS_9001

&----


  • Set PF status for screen 9001 (header info screen)

----


FORM SET_PF_STATUS_9001.

CLEAR OKCODE.

  • Set PF status for create pricing and change pricing

IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.

REFRESH I_FCODETAB.

WA_FCODETAB-FCODE = 'VPRM'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'SAVE'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

CLEAR OKCODE.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB.

  • Set PF status for create promo and change promo

ELSEIF G_MAIN_OKCODE = 'CRPM' OR G_MAIN_OKCODE = 'PRMC'.

REFRESH I_FCODETAB.

WA_FCODETAB-FCODE = 'VPRC'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'SAVE'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

IF G_STATUS = TEXT-150.

WA_FCODETAB-FCODE = 'ADDR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'DELR'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

CLEAR OKCODE.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB.

  • Set PF status for view/copy for promo/pricing

ELSEIF G_MAIN_OKCODE = 'VRPR' OR G_STATUS = TEXT-150

OR G_STATUS = TEXT-153.

IF G_PROMO_VIEW_FLAG = C_X OR G_PRICING_VIEW_FLAG = C_X

OR G_STATUS = TEXT-150 OR G_STATUS = TEXT-153.

REFRESH I_FCODETAB.

WA_FCODETAB-FCODE = 'VPRC'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'SAVE'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CHEK'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ADDR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'DELR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VPRM'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

CLEAR OKCODE.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB.

ENDIF.

  • Set PF status for copy promo option

IF G_PROMO_COPY_FLAG = C_X.

REFRESH I_FCODETAB.

WA_FCODETAB-FCODE = 'VPRC'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'SAVE'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CHEK'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

CLEAR OKCODE.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB.

ENDIF.

  • Set PF status for copy pricing option

IF G_PRICING_COPY_FLAG = C_X.

REFRESH I_FCODETAB.

WA_FCODETAB-FCODE = 'VPRM'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'SAVE'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CHEK'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

CLEAR OKCODE.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB.

ENDIF.

ENDIF.

  • Set Title bar for create promo

IF G_MAIN_OKCODE = 'CRPM'.

SET TITLEBAR 'TITLE01'.

ENDIF.

  • Set Title bar for create pricing

IF G_MAIN_OKCODE = 'CRPR'.

SET TITLEBAR 'TITLE02'.

ENDIF.

  • Set Title bar for change promo

IF G_MAIN_OKCODE = 'PRMC'.

SET TITLEBAR 'TITLE03' WITH G_PROMO_ID.

ENDIF.

  • Set Title bar for change pricing

IF G_MAIN_OKCODE = 'PRCC'.

SET TITLEBAR 'TITLE04' WITH G_PRICING_ID.

ENDIF.

  • Set Title bar for view promo

IF G_MAIN_OKCODE = 'VRPR' AND G_PROMO_VIEW_FLAG = C_X.

SET TITLEBAR 'TITLE05' WITH G_PROMO_ID.

ENDIF.

  • Set Title bar for copy promo

IF G_MAIN_OKCODE = 'VRPR' AND G_PROMO_COPY_FLAG = C_X.

SET TITLEBAR 'TITLE06'.

ENDIF.

  • Set Title bar for view pricing

IF G_MAIN_OKCODE = 'VRPR' AND G_PRICING_VIEW_FLAG = C_X.

SET TITLEBAR 'TITLE07' WITH G_PRICING_ID.

ENDIF.

  • Set Title bar for copy pricing

IF G_MAIN_OKCODE = 'VRPR' AND G_PRICING_COPY_FLAG = C_X.

SET TITLEBAR 'TITLE08'.

ENDIF.

ENDFORM. " SET_PF_STATUS_9001

&----


*& Form MODIFY_9001_FIELDS

&----


  • Modify the table control attribute before the screen appears

----


FORM MODIFY_9001_FIELDS.

  • Keep all the fields in display mode

IF I_STORE_INFO[] IS INITIAL

OR ( G_PROMO_CHG_FLAG = C_X AND G_STATUS = TEXT-150 )

OR ( G_PRICING_CHG_FLAG = C_X AND G_STATUS = TEXT-150 )

OR ( G_PRICING_CHG_FLAG = C_X AND G_STATUS = TEXT-153 ) .

LOOP AT SCREEN.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

  • In case of view promo or view pricing keep all the fields in display

  • mode

IF G_STATUS = TEXT-153 OR

( G_MAIN_OKCODE = 'VRPR' AND ( G_PROMO_VIEW_FLAG = C_X

OR G_PRICING_VIEW_FLAG = C_X ) ).

LOOP AT SCREEN.

IF SCREEN-GROUP2 = 'GR2'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

  • In case of copy promo or pricing keep the necessary fields in change

  • mode

ELSEIF G_MAIN_OKCODE = 'VRPR' AND ( G_PROMO_COPY_FLAG = C_X

OR G_PRICING_COPY_FLAG = C_X ).

LOOP AT SCREEN.

IF SCREEN-GROUP2 = 'GR2'.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

  • Make all the fields in display mode

IF G_PROMO_PLTYP = C_X.

LOOP AT SCREEN.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

  • Make rows in display mode in change promo/pricing

IF I_STORE_INFO-CHANGE_FLAG = C_X .

LOOP AT SCREEN.

IF SCREEN-GROUP2 = 'GR2' .

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

  • Store the current loop pass of the table control

G_LOOPC = SY-LOOPC.

ENDFORM. " MODIFY_9001_FIELDS

**&----


*----


**& Form SET_CURSOR_TABLE_CONTROL

**&----


*----


    • Set the top line for the table control for create entry option

**----


*----


*FORM SET_CURSOR_TABLE_CONTROL.

  • CASE SY-DYNNR.

  • WHEN '9001'.

  • IF G_OKCODE = 'ADDR'.

  • CLEAR G_OKCODE.

  • G_LOOPC = G_LOOPC - 1.

  • PERFORM COMPUTE_SCROLLING_IN_TC USING

  • 'TBCL_HEAD1' 'P++' G_LOOPC.

  • ENDIF.

  • WHEN '9002'.

  • IF G_OKCODE = 'ADDR'.

  • CLEAR G_OKCODE.

  • G_LOOPC1 = G_LOOPC1 - 1.

  • PERFORM COMPUTE_SCROLLING_IN_TC USING 'TBCL3' 'P++' G_LOOPC1.

  • ENDIF.

*

  • ENDCASE.

*

*ENDFORM. " SET_CURSOR_TABLE_CONTROL

&----


*& Form VALIDATE_PRICELIST_TYPE

&----


  • Validate price list type

----


FORM VALIDATE_PRICELIST_TYPE.

  • Validate price list type

IF NOT ZPRICELIST-ZLIST IS INITIAL.

SELECT SINGLE ZLIST

FROM ZPRICELIST

INTO ZPRICELIST-ZLIST

WHERE ZLIST = ZPRICELIST-ZLIST.

IF SY-SUBRC <> 0.

MESSAGE E161(ZS) WITH TEXT-015.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_PRICELIST_TYPE

&----


*& Form VALIDATE_DATES

&----


  • Validate start date and end date of promotion and pricing

----


FORM VALIDATE_DATES.

IF G_MAIN_OKCODE <> 'PRMC' AND G_MAIN_OKCODE <> 'PRCC'

AND G_PROMO_VIEW_FLAG <> C_X

AND G_PRICING_VIEW_FLAG <> C_X .

IF NOT ZSDRETL_RMPHEAD-START_DATE IS INITIAL

AND ZSDRETL_RMPHEAD-START_DATE LE SY-DATUM.

MESSAGE E161(ZS) WITH TEXT-033.

ENDIF.

IF NOT ZSDRETL_RMPHEAD-START_DATE IS INITIAL

AND NOT ZSDRETL_RMPHEAD-END_DATE IS INITIAL.

IF ZSDRETL_RMPHEAD-START_DATE GT ZSDRETL_RMPHEAD-END_DATE.

MESSAGE E161(ZS) WITH TEXT-014.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_DATES

&----


*& Form READ_TABLE_CONTROL_DATA

&----


  • Read table control field data

----


FORM READ_TABLE_CONTROL_DATA.

GET CURSOR LINE L_LINE.

  • l_line = 0.

PERFORM GET_TABLE_ROW_VALUES USING L_LINE. "tbcl_head1-current_line.

CLEAR: G_REGION_ID ,

G_DIST_ID ,

G_AREA_ID ,

G_STORE_ID ,

G_ATTR_VAL.

LOOP AT I_DYNPREAD INTO WA_DYNPREAD.

CASE WA_DYNPREAD-FIELDNAME.

WHEN 'I_STORE_INFO-REGION_ID'.

G_REGION_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-DIST_ID'.

G_DIST_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-AREA_ID'.

G_AREA_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-STORE_ID'.

G_STORE_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-ATTR_VAL'.

G_ATTR_VAL = WA_DYNPREAD-FIELDVALUE.

ENDCASE.

ENDLOOP.

  • Begin of DEVK939178

  • Translate style and SKU to upper case

TRANSLATE : G_REGION_ID TO UPPER CASE ,

G_DIST_ID TO UPPER CASE ,

G_AREA_ID TO UPPER CASE ,

G_STORE_ID TO UPPER CASE .

  • End of DEVK939178

PERFORM POPULATE_RANGES USING

G_REGION_ID

G_DIST_ID

G_AREA_ID

G_STORE_ID.

ENDFORM. " READ_TABLE_CONTROL_DATA

&----


*& Form VALIDATE_REGION

&----


  • Validate Region

----


FORM VALIDATE_REGION.

IF OKCODE <> 'DELR' AND G_PROMO_VIEW_FLAG = C_X

AND G_PRICING_VIEW_FLAG = C_X.

  • Retrieve region from store grouping table & validate against pricelist

  • type

IF NOT G_REGION_ID IS INITIAL.

SELECT REGION_ID

FROM ZSDRETL_STR_INFO

UP TO 1 ROWS

INTO G_REGION_ID

WHERE REGION_ID = G_REGION_ID

AND PLTYP = ZPRICELIST-ZLIST.

ENDSELECT.

IF SY-SUBRC <> 0.

  • if the region is not a valid one issue error message

MESSAGE E161(ZS) WITH TEXT-009.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_REGION

&----


*& Form VALIDATE_DISTRICT

&----


  • Validate District

----


FORM VALIDATE_DISTRICT.

IF OKCODE <> 'DELR' AND G_PROMO_VIEW_FLAG <> C_X

AND G_PRICING_VIEW_FLAG <> C_X.

  • if district is entred , validate it from district master table

IF NOT G_DIST_ID IS INITIAL.

SELECT DIST_ID

FROM ZSDRETL_STR_INFO

UP TO 1 ROWS

INTO G_DIST_ID

WHERE DIST_ID = G_DIST_ID

AND PLTYP = ZPRICELIST-ZLIST.

ENDSELECT.

IF SY-SUBRC <> 0.

  • Issue error message if district is invalid.

MESSAGE E161(ZS) WITH TEXT-010

I_STORE_INFO-DIST_ID.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_DISTRICT

&----


*& Form VALIDATE_AREA

&----


  • Validate Area

----


FORM VALIDATE_AREA.

IF OKCODE <> 'DELR' AND G_PROMO_VIEW_FLAG <> C_X

AND G_PRICING_VIEW_FLAG <> C_X.

  • if area is entred , validate and then populate region and district

IF NOT G_AREA_ID IS INITIAL.

SELECT AREA_ID

FROM ZSDRETL_STR_INFO

UP TO 1 ROWS

INTO G_AREA_ID

WHERE AREA_ID = G_AREA_ID

AND PLTYP = ZPRICELIST-ZLIST.

ENDSELECT.

  • if area is invalid , then issue error message

IF SY-SUBRC <> 0.

MESSAGE E161(ZS) WITH TEXT-011

G_AREA_ID.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_AREA

&----


*& Form VALIDATE_STORE

&----


  • Validate Store

----


FORM VALIDATE_STORE.

IF OKCODE <> 'DELR' AND G_PROMO_VIEW_FLAG <> C_X

AND G_PRICING_VIEW_FLAG <> C_X.

  • if store is entred , validate from store hierarchy table

  • and area

IF NOT G_STORE_ID IS INITIAL.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = G_STORE_ID

IMPORTING

OUTPUT = G_STORE_ID.

SELECT SINGLE STORE_ID

FROM ZSDRETL_STR_INFO

INTO G_STORE_ID

WHERE STORE_ID = G_STORE_ID

AND PLTYP = ZPRICELIST-ZLIST.

  • Issue error message if invalid store is found

IF SY-SUBRC <> 0.

MESSAGE E161(ZS) WITH TEXT-012

G_STORE_ID.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_STORE

&----


*& Form VALIDATE_STORE_GROUPING

&----


  • Validate Store Grouping

----


FORM VALIDATE_STORE_GROUPING.

  • If delete is not pressed then validate the store grouping from the

  • table zsdretl_str_info

IF OKCODE <> 'DELR' AND G_PROMO_VIEW_FLAG <> C_X

AND G_PRICING_VIEW_FLAG <> C_X.

REFRESH I_STORE.

SELECT REGION_ID

STORE_ID

FROM ZSDRETL_STR_INFO

INTO TABLE I_STORE

WHERE REGION_ID IN R_REGION

AND DIST_ID IN R_DIST

AND AREA_ID IN R_AREA

AND STORE_ID IN R_STORE .

IF SY-SUBRC <> 0.

REFRESH I_STORE.

MESSAGE E161(ZS) WITH TEXT-013.

ELSE.

REFRESH I_STORE.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_STORE_GROUPING

&----


*& Form VALIDATE_ATTR_VAL

&----


  • Validate attribute value

----


FORM VALIDATE_ATTR_VAL.

IF OKCODE <> 'DELR' AND OKCODE <> 'BACK'

AND G_PROMO_VIEW_FLAG <> C_X

AND G_PRICING_VIEW_FLAG <> C_X.

GET CURSOR LINE G_ATTR_VAL_LINE.

  • Retrieve attribute values from store attribute master table for the

  • store entered

IF NOT G_STORE_ID IS INITIAL AND NOT G_ATTR_VAL IS INITIAL.

SELECT STORE_ID

ATTR_VAL

FROM ZSDRETL_STR_ATR

UP TO 1 ROWS

INTO (ZSDRETL_STR_ATR-STORE_ID , ZSDRETL_STR_ATR-ATTR_VAL)

WHERE STORE_ID = G_STORE_ID

AND ATTR_VAL = G_ATTR_VAL.

ENDSELECT.

IF SY-SUBRC <> 0.

MESSAGE E161(ZS) WITH TEXT-022 .

ENDIF.

ELSEIF G_STORE_ID IS INITIAL AND NOT G_ATTR_VAL IS INITIAL .

  • If store is not entered but attribute value is entered then populate

  • all the stores automatically . This is also modified to display store

  • depending on various grouping of region/dist/area.

PERFORM POPULATE_RANGES USING

G_REGION_ID

G_DIST_ID

G_AREA_ID

G_STORE_ID.

  • Retrieve store and store name for the attribute values entered

REFRESH : I_STRATR .

CLEAR : I_STRATR.

SELECT ZSDRETL_STR_INFO~STORE_ID

ZSDRETL_STR_INFO~STORE_NAME

FROM ZSDRETL_STR_INFO

INNER JOIN ZSDRETL_STR_ATR

ON ZSDRETL_STR_INFOSTORE_ID = ZSDRETL_STR_ATRSTORE_ID

INTO TABLE I_STRATR

WHERE ZSDRETL_STR_ATR~ATTR_VAL = G_ATTR_VAL

AND ZSDRETL_STR_INFO~PLTYP = ZPRICELIST-ZLIST

AND ZSDRETL_STR_INFO~REGION_ID IN R_REGION

AND ZSDRETL_STR_INFO~DIST_ID IN R_DIST

AND ZSDRETL_STR_INFO~AREA_ID IN R_AREA.

IF SY-SUBRC = 0.

SORT I_STRATR BY STORE_ID .

DELETE ADJACENT DUPLICATES FROM I_STRATR COMPARING STORE_ID.

  • Call the screen to display all the stores for the attribute values

  • so that the user can select all or some of the stores to be populated

  • in the store grouping table

CALL SCREEN 9006 STARTING AT 20 2 ENDING AT 60 10.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " VALIDATE_ATTR_VAL

&----


*& Form POPULATE_STORE_HIER_AUTO

&----


  • Populate store location automatically. If store is entered ,

  • then populate region/dist/area . If area is entered then populate

  • region/district. If district is entered then populate its region.

----


FORM POPULATE_STORE_HIER_AUTO.

LOOP AT I_STORE_INFO.

  • Populate ranger table with the value of region, district , area

  • and store entered

PERFORM POPULATE_RANGES USING

I_STORE_INFO-REGION_ID

I_STORE_INFO-DIST_ID

I_STORE_INFO-AREA_ID

I_STORE_INFO-STORE_ID.

  • If store is entered then populate region , district and area

IF NOT I_STORE_INFO-STORE_ID IS INITIAL.

SELECT SINGLE REGION_ID

DIST_ID

AREA_ID

FROM ZSDRETL_STR_INFO

INTO (I_STORE_INFO-REGION_ID , I_STORE_INFO-DIST_ID

, I_STORE_INFO-AREA_ID)

WHERE STORE_ID IN R_STORE

AND AREA_ID IN R_AREA

AND DIST_ID IN R_DIST

AND REGION_ID IN R_REGION.

IF SY-SUBRC = 0.

  • Determine the level and populate

PERFORM DETERMINE_LEVEL USING I_STORE_INFO.

MODIFY I_STORE_INFO.

ENDIF.

  • If area is entered then populate region , district

ELSEIF NOT I_STORE_INFO-AREA_ID IS INITIAL.

SELECT SINGLE REGION_ID

DIST_ID

FROM ZSDRETL_AREA

INTO (I_STORE_INFO-REGION_ID , I_STORE_INFO-DIST_ID)

WHERE AREA_ID IN R_AREA

AND DIST_ID IN R_DIST

AND REGION_ID IN R_REGION.

IF SY-SUBRC = 0.

PERFORM DETERMINE_LEVEL USING I_STORE_INFO.

MODIFY I_STORE_INFO.

CONTINUE.

ENDIF.

  • If district is entered then populate region

ELSEIF NOT I_STORE_INFO-DIST_ID IS INITIAL.

SELECT SINGLE REGION_ID

FROM ZSDRETL_DISTRICT

INTO I_STORE_INFO-REGION_ID

WHERE DIST_ID IN R_DIST .

IF SY-SUBRC = 0.

PERFORM DETERMINE_LEVEL USING I_STORE_INFO.

MODIFY I_STORE_INFO.

CONTINUE.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. " POPULATE_STORE_HIER_AUTO

&----


*& Form VALUE_REQ_REGION

&----


  • Value Request for Region

----


FORM VALUE_REQ_REGION.

  • Get the current record number in the table control.

PERFORM GET_SY_STEPL USING G_STEPL.

  • Get the field values of the table control using the current record no.

PERFORM GET_TABLE_ROW_VALUES USING G_STEPL.

  • Clear variables

CLEAR: G_REGION_ID ,

G_DIST_ID ,

G_AREA_ID ,

G_STORE_ID ,

WA_REGION ,

I_REGION[].

  • Get the store grouping infos into corresponding variables

LOOP AT I_DYNPREAD INTO WA_DYNPREAD.

CASE WA_DYNPREAD-FIELDNAME.

WHEN 'I_STORE_INFO-REGION_ID'.

G_REGION_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-DIST_ID'.

G_DIST_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-AREA_ID'.

G_AREA_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-STORE_ID'.

G_STORE_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'ZPRICELIST-ZLIST'.

G_PLTYP = WA_DYNPREAD-FIELDVALUE.

ENDCASE.

ENDLOOP.

  • populate range tables using the store grouping infos

PERFORM POPULATE_RANGES USING

G_REGION_ID

G_DIST_ID

G_AREA_ID

G_STORE_ID.

  • Retrieve regions for the data entered in the row of the table control

SELECT ZSDRETL_STR_INFO~REGION_ID

ZSDRETL_REGION~REGION

FROM ZSDRETL_STR_INFO

INNER JOIN ZSDRETL_REGION

ON ZSDRETL_STR_INFOREGION_ID = ZSDRETL_REGIONREGION_ID

INTO TABLE I_REGION

WHERE ZSDRETL_STR_INFO~DIST_ID IN R_DIST

AND ZSDRETL_STR_INFO~AREA_ID IN R_AREA

AND ZSDRETL_STR_INFO~STORE_ID IN R_STORE

AND ZSDRETL_STR_INFO~PLTYP = G_PLTYP .

IF SY-SUBRC <> 0.

ELSE.

SORT I_REGION BY REGION_ID .

DELETE I_REGION WHERE REGION_ID IS INITIAL.

DELETE ADJACENT DUPLICATES FROM I_REGION COMPARING REGION_ID.

ENDIF.

  • Call function module to display the region list in form of search help

PERFORM GET_VALUE_ON_REQUEST TABLES I_REGION

USING C_REGION1

C_REGION2

SY-DYNNR.

ENDFORM. " VALUE_REQ_REGION

&----


*& Form VALUE_REQ_DISTRICT

&----


  • Get district and display in search help

----


FORM VALUE_REQ_DISTRICT.

  • Get the current record number in the table control.

PERFORM GET_SY_STEPL USING G_STEPL.

  • Get the field values of the table control using the current record no.

PERFORM GET_TABLE_ROW_VALUES USING G_STEPL.

  • Clear variables

CLEAR: G_REGION_ID ,

G_DIST_ID ,

G_AREA_ID ,

G_STORE_ID ,

WA_DISTRICT ,

I_DISTRICT[].

  • Get the store grouping infos into corresponding variables

LOOP AT I_DYNPREAD INTO WA_DYNPREAD.

CASE WA_DYNPREAD-FIELDNAME.

WHEN 'I_STORE_INFO-REGION_ID'.

G_REGION_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-DIST_ID'.

G_DIST_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-AREA_ID'.

G_AREA_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-STORE_ID'.

G_STORE_ID = WA_DYNPREAD-FIELDVALUE.

ENDCASE.

ENDLOOP.

  • populate range tables using the store grouping infos

PERFORM POPULATE_RANGES USING

G_REGION_ID

G_DIST_ID

G_AREA_ID

G_STORE_ID.

  • Retrieve district for the data entered in the row of the table control

SELECT ZSDRETL_STR_INFO~DIST_ID

ZSDRETL_DISTRICT~DISTRICT

FROM ZSDRETL_STR_INFO

INNER JOIN ZSDRETL_DISTRICT

ON ZSDRETL_STR_INFODIST_ID = ZSDRETL_DISTRICTDIST_ID

INTO TABLE I_DISTRICT

WHERE ZSDRETL_STR_INFO~REGION_ID IN R_REGION

AND ZSDRETL_STR_INFO~AREA_ID IN R_AREA

AND ZSDRETL_STR_INFO~STORE_ID IN R_STORE

AND ZSDRETL_STR_INFO~PLTYP = ZPRICELIST-ZLIST.

IF SY-SUBRC <> 0.

ENDIF.

SORT I_DISTRICT BY DIST_ID .

DELETE I_DISTRICT WHERE DIST_ID IS INITIAL.

DELETE ADJACENT DUPLICATES FROM I_DISTRICT COMPARING DIST_ID.

  • Call function to display the district list in form of search help

PERFORM GET_VALUE_ON_REQUEST TABLES I_DISTRICT

USING C_DIST1

C_DIST2

SY-DYNNR.

ENDFORM. " VALUE_REQ_DISTRICT

&----


*& Form VALUE_REQ_AREA

&----


  • Value request for area

----


FORM VALUE_REQ_AREA.

  • Get the current record number in the table control.

PERFORM GET_SY_STEPL USING G_STEPL.

  • Get the field values of the table control using the current record no.

PERFORM GET_TABLE_ROW_VALUES USING G_STEPL.

  • Clear variables

CLEAR: G_REGION_ID ,

G_DIST_ID ,

G_AREA_ID ,

G_STORE_ID ,

WA_AREA ,

I_AREA[].

  • Get the store grouping infos into corresponding variables

LOOP AT I_DYNPREAD INTO WA_DYNPREAD.

CASE WA_DYNPREAD-FIELDNAME.

WHEN 'I_STORE_INFO-REGION_ID'.

G_REGION_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-DIST_ID'.

G_DIST_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-AREA_ID'.

G_AREA_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-STORE_ID'.

G_STORE_ID = WA_DYNPREAD-FIELDVALUE.

ENDCASE.

ENDLOOP.

  • populate range tables using the store grouping infos

PERFORM POPULATE_RANGES USING

G_REGION_ID

G_DIST_ID

G_AREA_ID

G_STORE_ID.

  • Retrieve area for the data entered in the row of the table control

SELECT ZSDRETL_STR_INFO~AREA_ID

ZSDRETL_AREA~AREA_NAME

FROM ZSDRETL_STR_INFO

INNER JOIN ZSDRETL_AREA

ON ZSDRETL_STR_INFOAREA_ID = ZSDRETL_AREAAREA_ID

INTO TABLE I_AREA

WHERE ZSDRETL_STR_INFO~REGION_ID IN R_REGION

AND ZSDRETL_STR_INFO~DIST_ID IN R_DIST

AND ZSDRETL_STR_INFO~STORE_ID IN R_STORE

AND ZSDRETL_STR_INFO~PLTYP = ZPRICELIST-ZLIST.

IF SY-SUBRC <> 0.

ENDIF.

SORT I_AREA BY AREA_ID .

DELETE ADJACENT DUPLICATES FROM I_AREA COMPARING AREA_ID.

  • Call function module to display the area list in form of search help

PERFORM GET_VALUE_ON_REQUEST TABLES I_AREA

USING C_AREA1

C_AREA2

SY-DYNNR.

ENDFORM. " VALUE_REQ_AREA

&----


*& Form VALUE_REQ_STORE

&----


  • Value request for store

----


FORM VALUE_REQ_STORE.

  • Get the current record number in the table control.

PERFORM GET_SY_STEPL USING G_STEPL.

  • Get the field values of the table control using the current record no.

PERFORM GET_TABLE_ROW_VALUES USING G_STEPL.

  • Clear variables

CLEAR: G_REGION_ID ,

G_DIST_ID ,

G_AREA_ID ,

G_STORE_ID ,

WA_STORE ,

G_PLTYP, " DEVK939179

I_STORE[].

  • Get the store grouping infos into corresponding variables

LOOP AT I_DYNPREAD INTO WA_DYNPREAD.

CASE WA_DYNPREAD-FIELDNAME.

WHEN 'I_STORE_INFO-REGION_ID'.

G_REGION_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-DIST_ID'.

G_DIST_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-AREA_ID'.

G_AREA_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-STORE_ID'.

G_STORE_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'ZPRICELIST-ZLIST'. " DEVK939179

G_PLTYP = WA_DYNPREAD-FIELDVALUE. " DEVK939179

ENDCASE.

ENDLOOP.

  • Get all the stores for the price list type if region id, district id

  • and the area fields are empty

IF G_REGION_ID IS INITIAL

AND G_DIST_ID IS INITIAL

AND G_AREA_ID IS INITIAL.

SELECT STORE_ID

STORE_NAME

FROM ZSDRETL_STR_INFO

INTO TABLE I_STORE

WHERE PLTYP = G_PLTYP. " DEVK939179

ELSE.

  • populate range tables

PERFORM POPULATE_RANGES USING

G_REGION_ID

G_DIST_ID

G_AREA_ID

G_STORE_ID.

  • Retrieve stores for the data entered in the row of the table control

SELECT STORE_ID

STORE_NAME

FROM ZSDRETL_STR_INFO

INTO TABLE I_STORE

WHERE REGION_ID IN R_REGION

AND DIST_ID IN R_DIST

AND AREA_ID IN R_AREA

AND PLTYP = G_PLTYP. " DEVK939179

ENDIF.

IF SY-SUBRC <> 0.

ENDIF.

SORT I_STORE BY STORE_ID .

DELETE ADJACENT DUPLICATES FROM I_STORE COMPARING STORE_ID.

  • Call function module to display the store list in form of search help

PERFORM GET_VALUE_ON_REQUEST TABLES I_STORE

USING C_STORE1

C_STORE2

SY-DYNNR.

ENDFORM. " VALUE_REQ_STORE

&----


*& Form VALUE_REQ_ATTR_VAL

&----


  • Value request for attribute value

----


FORM VALUE_REQ_ATTR_VAL.

  • Get the current record number in the table control.

PERFORM GET_SY_STEPL USING G_STEPL.

  • Get the field values of the table control using the current record no.

PERFORM GET_TABLE_ROW_VALUES USING G_STEPL.

  • Clear variables

CLEAR: G_REGION_ID ,

G_DIST_ID ,

G_AREA_ID ,

G_STORE_ID ,

G_ATTR_VAL,

WA_ATTR ,

I_ATTR[].

  • Get the store grouping infos into corresponding variables

LOOP AT I_DYNPREAD INTO WA_DYNPREAD.

CASE WA_DYNPREAD-FIELDNAME.

WHEN 'I_STORE_INFO-REGION_ID'.

G_REGION_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-DIST_ID'.

G_DIST_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-AREA_ID'.

G_AREA_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-STORE_ID'.

G_STORE_ID = WA_DYNPREAD-FIELDVALUE.

WHEN 'I_STORE_INFO-ATTR_VAL'.

G_ATTR_VAL = WA_DYNPREAD-FIELDVALUE.

ENDCASE.

ENDLOOP.

  • Get attribute values if no other fields are entered

IF G_STORE_ID IS INITIAL.

SELECT ZSDRETL_STR_ATR~ATTR_ID

ZSDRETL_STR_ATR~ATTR_VAL

FROM ZSDRETL_STR_ATR INNER JOIN ZSDRETL_STR_INFO

ON ZSDRETL_STR_ATRSTORE_ID = ZSDRETL_STR_INFOSTORE_ID

INTO TABLE I_ATTR

WHERE ZSDRETL_STR_INFO~PLTYP = ZPRICELIST-ZLIST.

ELSE.

  • populate range tables

PERFORM POPULATE_RANGES USING

G_REGION_ID

G_DIST_ID

G_AREA_ID

G_STORE_ID.

  • Retrieve attribute values for the data entered in table control

SELECT ATTR_ID

ATTR_VAL

FROM ZSDRETL_STR_ATR

INTO TABLE I_ATTR

WHERE STORE_ID IN R_STORE .

ENDIF.

IF SY-SUBRC <> 0.

ENDIF.

  • Call function module to display the region list in form of search help

SORT I_ATTR BY ATTR_ID ATTR_VAL.

DELETE ADJACENT DUPLICATES FROM I_ATTR COMPARING ATTR_ID ATTR_VAL.

PERFORM GET_VALUE_ON_REQUEST TABLES I_ATTR

USING C_ATTR1

C_ATTR2

SY-DYNNR.

ENDFORM. " VALUE_REQ_ATTR_VAL

&----


*& Form SET_PF_STATUS_9002

&----


  • Set PF status for the detail screen

----


FORM SET_PF_STATUS_9002.

CLEAR OKCODE.

REFRESH I_FCODETAB .

CLEAR I_FCODETAB.

IF G_VAL = C_X.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

  • Set PF status for the create pricing and change promo

IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.

IF G_VAL = C_X.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

IF G_VAL = C_SPACE.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

WA_FCODETAB-FCODE = 'VPRM'.

APPEND WA_FCODETAB TO I_FCODETAB.

IF G_STATUS = TEXT-150 OR G_STATUS = TEXT-153.

WA_FCODETAB-FCODE = 'ADDR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'DELR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB. "'VPRM'.

ELSEIF G_MAIN_OKCODE = 'CRPM' OR G_MAIN_OKCODE = 'PRMC'.

IF G_STATUS = TEXT-150.

REFRESH I_FCODETAB.

WA_FCODETAB-FCODE = 'ADDR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'DELR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

IF G_VAL = C_X.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

IF G_VAL = C_SPACE.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

WA_FCODETAB-FCODE = 'VPRC'.

APPEND WA_FCODETAB TO I_FCODETAB.

  • Set PF status for the create promo and change promo

  • set pf-status 'MAIN01' excluding 'VPRC'.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB.

ELSEIF G_MAIN_OKCODE = 'VRPR'.

  • Set PF status for the view/copy promo/pricing

IF G_PROMO_VIEW_FLAG = C_X OR G_PRICING_VIEW_FLAG = C_X.

REFRESH I_FCODETAB.

  • append wa_fcodetab to i_fcodetab.

WA_FCODETAB-FCODE = 'VPRM'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VPRC'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CEXL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'SAVE'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ILOG'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'ADDR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'DELR'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'CHEK'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'DETL'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

  • wa_fcodetab-fcode = 'VPRM'.

  • append wa_fcodetab to i_fcodetab.

CLEAR OKCODE.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB.

ELSEIF G_PROMO_COPY_FLAG = C_X .

  • Set PF status for copy promo

IF G_VAL = C_X.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

IF G_VAL = C_SPACE.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

WA_FCODETAB-FCODE = 'VPRC'.

APPEND WA_FCODETAB TO I_FCODETAB.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB. "'VPRC'.

ELSEIF G_PRICING_COPY_FLAG = C_X .

  • Set PF status for copy pricing

IF G_VAL = C_X.

WA_FCODETAB-FCODE = 'VALD'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

IF G_VAL = C_SPACE.

WA_FCODETAB-FCODE = 'UVAL'.

APPEND WA_FCODETAB TO I_FCODETAB.

ENDIF.

WA_FCODETAB-FCODE = 'VPRM'.

APPEND WA_FCODETAB TO I_FCODETAB.

SET PF-STATUS 'MAIN01' EXCLUDING I_FCODETAB. "'VPRM'.

ENDIF.

ENDIF.

  • Set Title bar for create promo

IF G_MAIN_OKCODE = 'CRPM'.

SET TITLEBAR 'TITLE01'.

ENDIF.

  • Set Title bar for create pricing

IF G_MAIN_OKCODE = 'CRPR'.

SET TITLEBAR 'TITLE02'.

ENDIF.

  • Set Title bar for change promo

IF G_MAIN_OKCODE = 'PRMC'.

SET TITLEBAR 'TITLE03' WITH G_PROMO_ID.

ENDIF.

  • Set Title bar for change pricing

IF G_MAIN_OKCODE = 'PRCC'.

SET TITLEBAR 'TITLE04' WITH G_PRICING_ID.

ENDIF.

  • Set Title bar for view promo

IF G_MAIN_OKCODE = 'VRPR' AND G_PROMO_VIEW_FLAG = C_X.

SET TITLEBAR 'TITLE05' WITH G_PROMO_ID.

ENDIF.

  • Set Title bar for copy promo

IF G_MAIN_OKCODE = 'VRPR' AND G_PROMO_COPY_FLAG = C_X.

SET TITLEBAR 'TITLE06'.

ENDIF.

  • Set Title bar for view pricing

IF G_MAIN_OKCODE = 'VRPR' AND G_PRICING_VIEW_FLAG = C_X.

SET TITLEBAR 'TITLE07' WITH G_PRICING_ID.

ENDIF.

  • Set Title bar for copy pricing

IF G_MAIN_OKCODE = 'VRPR' AND G_PRICING_COPY_FLAG = C_X.

SET TITLEBAR 'TITLE08'.

ENDIF.

ENDFORM. " SET_PF_STATUS_9002

&----


*& Form INITIALIZE_9002

&----


  • Initialize fields and the variables used for detail screen 9002

----


FORM INITIALIZE_9002.

G_CREATED_BY = G_CREABY.

CLEAR G_FILEPATH.

G_PRICELIST = ZPRICELIST-ZLIST.

IF ( G_MAIN_OKCODE = 'CRPM' OR G_MAIN_OKCODE = 'CRPR'

OR G_MAIN_OKCODE = 'PRMC'

OR G_MAIN_OKCODE = 'PRCC'

OR G_PROMO_COPY_FLAG = C_X

OR G_PRICING_COPY_FLAG = C_X )

AND I_SKU_INFO[] IS INITIAL.

DO 14 TIMES.

CLEAR I_SKU_INFO.

I_SKU_INFO-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

I_SKU_INFO-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

APPEND I_SKU_INFO.

ENDDO.

ENDIF.

IF G_COPY_FLAG = C_X AND NOT I_SKU_INFO[] IS INITIAL.

LOOP AT I_SKU_INFO.

I_SKU_INFO-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

I_SKU_INFO-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

MODIFY I_SKU_INFO.

ENDLOOP.

CLEAR G_COPY_FLAG .

ENDIF.

  • Change the start date and end date of the sku lines as per header

  • in case of create promo/pricing

IF G_MAIN_OKCODE = 'CRPM'

OR G_MAIN_OKCODE = 'CRPR'

OR G_PROMO_COPY_FLAG = C_X

OR G_PRICING_COPY_FLAG = C_X.

LOOP AT I_SKU_INFO.

I_SKU_INFO-START_DATE = ZSDRETL_RMPHEAD-START_DATE.

I_SKU_INFO-END_DATE = ZSDRETL_RMPHEAD-END_DATE.

MODIFY I_SKU_INFO.

ENDLOOP.

ENDIF.

  • Get the total entry of the store grouping table

DESCRIBE TABLE I_STORE_INFO LINES TBCL2-LINES.

  • Change the attributes of the push buttons and other screen fields.

PERFORM CHANGE_SCRATTR_9002.

  • change created date to user format

  • Begin of change of DEVK939258

IF G_MAIN_OKCODE = 'CRPM' OR G_MAIN_OKCODE = 'CRPR'

OR G_PRICING_COPY_FLAG = C_X OR G_PROMO_COPY_FLAG = C_X.

PERFORM CONV_DATE USING SY-DATUM CHANGING G_CREA_DATE.

ELSE.

PERFORM CONV_DATE USING G_CREAON CHANGING G_CREA_DATE.

ENDIF.

  • End of change of DEVK939258

  • change start date for promotion or pricing to user format

PERFORM CONV_DATE USING ZSDRETL_RMPHEAD-START_DATE CHANGING G_DATE1.

  • change end date for promotion or pricing to user format

PERFORM CONV_DATE USING ZSDRETL_RMPHEAD-END_DATE CHANGING G_DATE2.

  • Concatenate start date & end date to display as one text in detail scr

CONCATENATE G_DATE1 '-' G_DATE2 INTO G_DATES.

  • Make promotype to '$' in detail screen if dollar type promo is

  • selected and make promotype to '%' in detail screen if percent type

  • promo is selected

IF G_DOLAR = C_X.

G_PROMO_TYPE = C_$.

ELSEIF G_PERC = C_X.

G_PROMO_TYPE = C_%.

ENDIF.

IF G_PRICING_FLAG = C_X OR G_PRICING_COPY_FLAG = C_X

OR G_PRICING_VIEW_FLAG = C_X.

G_PROMO_TYPE = C_$.

ENDIF.

  • Make clearance variable in detail screen to 'X' if clearance is

  • checked in the header screen and make it blank if non-clearance is

  • checked.

IF G_CLR = C_X.

G_CHK_CLR = C_X.

ELSEIF G_NON_CLR = C_X.

G_CHK_CLR = C_SPACE.

ENDIF.

  • Initialize the approve check box in detail screen with the value in

  • header screen.

G_CHK_APPR = CHK_APR.

  • Get the total record size of the sku hierarchy table to set the LINES

  • attribute value of the table control

IF NOT I_SKU_INFO[] IS INITIAL.

DESCRIBE TABLE I_SKU_INFO LINES TBCL3-LINES.

ENDIF.

  • Modify the store group table with no selection option

  • IF G_OKCODE <> 'SELA' .

  • LOOP AT I_SKU_INFO WHERE SEL = C_X.

  • CLEAR I_SKU_INFO-SEL.

  • MODIFY I_SKU_INFO.

  • ENDLOOP.

  • ELSE.

  • CLEAR G_OKCODE.

  • ENDIF.

  • Redetermine existing sku hierarchy

IF G_PROMO_TYPE_TEMP <> G_PROMO_TYPE OR G_CHK_CLR_TEMP <> G_CHK_CLR

OR G_START_DATE_TEMP <> ZSDRETL_RMPHEAD-START_DATE

OR G_END_DATE_TEMP <> ZSDRETL_RMPHEAD-END_DATE

OR G_PLTYP_TEMP <> ZPRICELIST-ZLIST.

LOOP AT I_SKU_INFO.

CLEAR: I_SKU_INFO-TOP_UP,

I_SKU_INFO-OVERRIDE,

I_SKU_INFO-CHECK_FLAG,

I_SKU_INFO-REPROMO,

I_SKU_INFO-REF_PROMO,

I_SKU_INFO-KBETR.

MODIFY I_SKU_INFO.

ENDLOOP.

IF G_PROMO_TYPE_TEMP <> G_PROMO_TYPE .

G_PROMO_TYPE_TEMP = G_PROMO_TYPE .

ENDIF.

IF G_CHK_CLR_TEMP <> G_CHK_CLR.

G_CHK_CLR_TEMP = G_CHK_CLR.

ENDIF.

IF G_START_DATE_TEMP <> ZSDRETL_RMPHEAD-START_DATE.

G_START_DATE_TEMP = ZSDRETL_RMPHEAD-START_DATE.

ENDIF.

IF G_END_DATE_TEMP <> ZSDRETL_RMPHEAD-END_DATE.

G_END_DATE_TEMP = ZSDRETL_RMPHEAD-END_DATE.

ENDIF.

IF G_PLTYP_TEMP <> ZPRICELIST-ZLIST .

G_PLTYP_TEMP = ZPRICELIST-ZLIST .

ENDIF.

ENDIF.

  • Determine the basic price of the SKUs and STYLEs entered in the screen

  • Begin of change of DEVK939258

  • perform determine_basic_price_of_style.

  • Begin of DEVK939274

PERFORM DETERMINE_PRICE.

  • End of DEVK939274

  • perform determine_basic_price.

  • End of change of DEVK939258

  • If it is a case of pricing create or change then keep blank the filed

  • values like department, class and sub_class.

IF G_MAIN_OKCODE = 'PRCC' OR G_MAIN_OKCODE = 'CRPR'

OR G_PRICING_COPY_FLAG = C_X.

  • LOOP AT I_SKU_INFO.

  • CLEAR: I_SKU_INFO-DEPT,

  • I_SKU_INFO-CLASS,

  • I_SKU_INFO-SUB_CLASS.

  • MODIFY I_SKU_INFO.

  • ENDLOOP.

PERFORM CHECK_PRE_PRICING_SKU.

  • perform check_exist_pricing_skuhier.

  • check for existing promo for the sku hierarchy info

  • perform check_exist_promo_skuhier.

ELSE.

IF G_PROMO_VIEW_FLAG = C_X OR

( G_PROMO_CHG_FLAG = C_X AND G_STATUS = TEXT-150 ).

ELSE.

  • check for existing promo for the sku hierarchy info

  • Begin of DEVK939196

  • perform check_exist_promo_skuhier.

  • Begin of DEVK939282

  • perform check_exist_promo_skuhier1.

PERFORM CHECK_PRE_PROMO_SKU.

  • End of DEVK939282

  • End of DEVK939196

ENDIF.

ENDIF.

  • Populate the sequence number for the entries added or deleted in the

  • table controls

LOOP AT I_SKU_INFO .

I_SKU_INFO-LINE_NO = SY-TABIX.

MODIFY I_SKU_INFO.

ENDLOOP.

  • Copy of the SKU info table to determine the change

CLEAR: I_SKU_INFO_TEMP1 , I_SKU_INFO_TEMP1[] .

I_SKU_INFO_TEMP1[] = I_SKU_INFO[].

  • Get the current size of the sku hierarchy table and set it to LINES

  • attribute of the table control

DESCRIBE TABLE I_SKU_INFO LINES TBCL3-LINES.

  • Get the current size of the sku hierarchy table and store in variable

DESCRIBE TABLE I_SKU_INFO LINES G_TOT_LINE.

G_LINENO = 1.

ENDFORM. " INITIALIZE_9002

&----


*& Form CHANGE_SCRATTR_9002

&----


  • Change screen attributes of the detail screen

----


FORM CHANGE_SCRATTR_9002.

  • In case of price change , pricing create , view price and copy price o

  • option , keep screen fields such as promo type , check box for clear-

  • ance, non-clearance and header text for promo in invisible mode.

IF G_MAIN_OKCODE = 'PRCC' OR G_MAIN_OKCODE = 'CRPR'

OR G_PRICING_VIEW_FLAG = C_X

OR G_PRICING_COPY_FLAG = C_X.

LOOP AT SCREEN.

IF SCREEN-NAME = 'G_PROMO_TYPE'

OR SCREEN-NAME = 'G_CHK_CLR'

OR SCREEN-NAME = 'TXT_CLR'

OR SCREEN-NAME = 'TXT_PROMO'.

SCREEN-INPUT = 0.

SCREEN-OUTPUT = 0.

SCREEN-INVISIBLE = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

  • In case of view/copy promo/pricing option keep the push buttons such

  • as CHECK ENTRY , CREATE ENTRY , DELETE ENTRY , SELECT ALL and DESELECT

  • ALL in invisible mode and PAGE UP , PAGE DOWN , NEXT PAGE , PREVIOUS

  • PAGE and ENTER DETAIL button in change mode.

IF ( G_MAIN_OKCODE = 'VRPR' AND G_PROMO_VIEW_FLAG = C_X )

OR G_STATUS = TEXT-150 .

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'GB1'.

SCREEN-INPUT = 0.

SCREEN-OUTPUT = 0.

SCREEN-INVISIBLE = 1.

MODIFY SCREEN.

ELSEIF SCREEN-GROUP1 = 'GB2'.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ELSE.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF ( G_MAIN_OKCODE = 'VRPR' AND G_PRICING_VIEW_FLAG = C_X )

OR G_STATUS = TEXT-150.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'GB1'.

SCREEN-INPUT = 0.

SCREEN-OUTPUT = 0.

SCREEN-INVISIBLE = 1.

MODIFY SCREEN.

ELSEIF SCREEN-GROUP1 = 'GB2'.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ELSE.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

ENDFORM. " CHANGE_SCRATTR_9002

&----


*& Form DETERMINE_BASIC_PRICE_OF_STYLE

&----


  • Determine basic price of the SKUs and STYLEs

----


FORM DETERMINE_BASIC_PRICE_OF_STYLE.

DATA: L_EXIT TYPE C,

L_PMATN_FOUND TYPE C.

CLEAR L_EXIT.

REFRESH R_STYLE.

IF NOT I_SKU_INFO[] IS INITIAL.

  • determine reference material

  • perform get_ref_material.

  • Populate range table considering all the style value in the SKU hiera-

  • rchy table i_sku_info

REFRESH R_SKU.

LOOP AT I_SKU_INFO WHERE NOT STYLE IS INITIAL .

  • Begin of DEVK939178

  • Determine the basic price of material once if not changed

CLEAR L_EXIT.

READ TABLE I_SKU_INFO_TEMP2 WITH KEY SKU = I_SKU_INFO-SKU.

IF SY-SUBRC = 0 .

IF NOT I_SKU_INFO-KBETR IS INITIAL.

L_EXIT = C_X.

ENDIF.

ENDIF.

IF L_EXIT = C_X.

CONTINUE.

ENDIF.

  • End of DEVK939178

  • R_STYLE-SIGN = C_SIGN.

  • R_STYLE-OPTION = C_OPT2.

  • CONCATENATE I_SKU_INFO-STYLE '*' INTO R_STYLE-LOW.

  • APPEND R_STYLE.

  • CLEAR R_STYLE.

  • IF I_SKU_INFO-PMATN <> C_SPACE.

  • R_STYLE-SIGN = C_SIGN.

  • R_STYLE-OPTION = C_OPT2.

  • CONCATENATE I_SKU_INFO-PMATN+0(6) '*' INTO R_STYLE-LOW.

  • APPEND R_STYLE.

  • CLEAR R_STYLE.

IF I_SKU_INFO-SKU <> C_SPACE.

R_SKU-SIGN = C_SIGN.

R_SKU-OPTION = C_OPT1.

R_SKU-LOW = I_SKU_INFO-SKU.

APPEND R_SKU.

CLEAR R_SKU.

ENDIF.

IF I_SKU_INFO-STYLE <> C_SPACE AND I_SKU_INFO-SKU = C_SPACE.

R_SKU-SIGN = C_SIGN.

R_SKU-OPTION = C_OPT2.

CONCATENATE I_SKU_INFO-STYLE C_STAR INTO R_SKU-LOW.

APPEND R_SKU.

CLEAR R_SKU.

ENDIF.

  • endif.

ENDLOOP.

  • Get price refrence material

REFRESH I_SKU_INFO_PRICE.

CLEAR I_SKU_INFO_PRICE.

CHECK NOT R_SKU[] IS INITIAL.

REFRESH I_REFMAT.

CLEAR I_REFMAT.

SELECT MATNR

PMATN

FROM MVKE

INTO TABLE I_REFMAT

*for all entries in i_sku_info

*where matnr = i_sku_info-sku

WHERE MATNR IN R_SKU

AND VKORG = ZPRICELIST-ZLIST(4)

AND VTWEG = '00'.

IF SY-SUBRC = 0.

REFRESH I_REFMAT1 .

CLEAR I_REFMAT1.

I_REFMAT1[] = I_REFMAT[].

SORT I_REFMAT.

DELETE ADJACENT DUPLICATES FROM I_REFMAT COMPARING MATNR PMATN.

CLEAR L_PMATN_FOUND .

LOOP AT I_SKU_INFO WHERE NOT STYLE IS INITIAL OR NOT SKU IS INITIAL.

CLEAR L_PMATN_FOUND.

G_INDEX = SY-TABIX.

IF I_SKU_INFO-SKU <> C_SPACE.

READ TABLE I_REFMAT INTO WA_REFMAT WITH KEY MATNR = I_SKU_INFO-SKU.

IF SY-SUBRC = 0.

IF WA_REFMAT-PMATN = C_SPACE.

I_SKU_INFO-PMATN = I_SKU_INFO-SKU.

ENDIF.

IF NOT WA_REFMAT-PMATN IS INITIAL.

I_SKU_INFO-PMATN = WA_REFMAT-PMATN.

ENDIF.

APPEND I_SKU_INFO TO I_SKU_INFO_PRICE.

ENDIF.

ENDIF.

IF I_SKU_INFO-SKU = C_SPACE AND I_SKU_INFO-STYLE <> C_SPACE.

LOOP AT I_REFMAT INTO WA_REFMAT WHERE

MATNR+(6) = I_SKU_INFO-STYLE

AND NOT PMATN IS INITIAL.

I_SKU_INFO-PMATN = WA_REFMAT-PMATN.

APPEND I_SKU_INFO TO I_SKU_INFO_PRICE.

L_PMATN_FOUND = C_X.

EXIT.

ENDLOOP.

IF L_PMATN_FOUND IS INITIAL.

CLEAR WA_REFMAT.

READ TABLE I_REFMAT INTO WA_REFMAT

WITH KEY MATNR+(6) = I_SKU_INFO-STYLE.

IF SY-SUBRC = 0.

I_SKU_INFO-PMATN = WA_REFMAT-MATNR.

ENDIF.

ENDIF.

ENDIF.

MODIFY I_SKU_INFO INDEX G_INDEX TRANSPORTING PMATN.

CLEAR L_PMATN_FOUND .

ENDLOOP.

ENDIF.

  • If Any STYLE is found in the range table then determine the condition

  • number for all the materials for which the styles are entered

IF NOT R_SKU[] IS INITIAL.

REFRESH I_A006.

CLEAR I_A006.

SELECT MATNR

KNUMH

DATAB

DATBI

FROM A006

UP TO 1 ROWS

INTO TABLE I_A006

FOR ALL ENTRIES IN I_SKU_INFO_PRICE

WHERE KAPPL = C_APPLICATION

AND KSCHL = C_REF_KSCHL

AND VKORG = G_PRICELIST(4)

AND PLTYP = G_PRICELIST+4(2)

AND WAERK = C_WAERK

AND MATNR = I_SKU_INFO_PRICE-PMATN

AND DATAB <= SY-DATUM

AND DATBI >= SY-DATUM.

IF SY-SUBRC = 0.

  • sort i_a006 by matnr ascending datab descending.

  • delete i_a006 where matnr is initial.

  • delete adjacent duplicates from i_a006 comparing matnr .

  • datab.

  • If condition numbers are found then determine the basic price for the

  • styles or SKUs entered in the screen.

CHECK NOT I_A006[] IS INITIAL.

REFRESH I_KONP .

CLEAR I_KONP.

SELECT KNUMH

KBETR

FROM KONP

INTO TABLE I_KONP

FOR ALL ENTRIES IN I_A006

WHERE KNUMH = I_A006-KNUMH

AND KOPOS = C_KOPOS.

IF SY-SUBRC = 0.

LOOP AT I_SKU_INFO.

G_INDEX = SY-TABIX.

  • Begin of change DEVK939196

  • IF I_SKU_INFO-SKU IS INITIAL.

  • READ TABLE I_A006 INTO WA_A006

  • WITH KEY MATNR+(6) = I_SKU_INFO-STYLE.

  • ELSE.

  • READ TABLE I_A006 INTO WA_A006

  • WITH KEY MATNR = I_SKU_INFO-SKU.

  • ENDIF.

IF NOT I_SKU_INFO-SKU IS INITIAL

AND NOT I_SKU_INFO-STYLE IS INITIAL.

READ TABLE I_SKU_INFO_PRICE WITH KEY SKU = I_SKU_INFO-SKU.

IF SY-SUBRC = 0.

READ TABLE I_A006 INTO WA_A006

WITH KEY MATNR = I_SKU_INFO-PMATN.

IF SY-SUBRC = 0.

READ TABLE I_KONP INTO WA_KONP WITH KEY KNUMH = WA_A006-KNUMH.

IF SY-SUBRC = 0.

I_SKU_INFO-KBETR = WA_KONP-KBETR.

MODIFY I_SKU_INFO INDEX G_INDEX TRANSPORTING KBETR.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question