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

clear field

Former Member
0 Likes
493

Hi to all,

please go through the <b>BOLD CODING</b> in the below program and please give me an idea..where i have to give the CLEAR the field VCOLOR ...according to my program when ever im creating a document the vcolor should chage...but it is taking only one color for all documents...i think i have to clear i loop....but im not getting ....if u have any idea...let me share.....

MODULE USER_COMMAND_2000 INPUT.

data: return_code type i.

data: Mat_Doc type MBLNR.

clear gv_save_ok_code.

move gv_ok_code to gv_save_ok_code.

clear gv_ok_code.

  • CL_GUI_CFW=>DISPATCH must be called if events are registered

  • that trigger PAI

  • this method calls the event handler method of an event

CALL METHOD CL_GUI_CFW=>DISPATCH

importing return_code = return_code.

if return_code <> cl_gui_cfw=>rc_noevent.

if GV_WERKNR_FLAG = 'T'. "Auswahl Werknummer

perform get_data using GV_NODE_KEY.

endif.

if GV_WERKNR_FLAG = 'W'.

Mat_Doc = GV_NODE_KEY. "Auswahl Bestellung

perform WEingang using Mat_Doc.

endif.

exit.

endif.

<b>if sy-mandt = '092'.

select single color from /upm/gtb02 into /UPM/GTB_EINKAUF-VCOLOR where

colorid = /UPM/GTB_EINKAUF-VCOLOR(02).

endif.</b>

case gv_save_ok_code.

when 'EXIT' or 'CANCEL' or 'BACK'.

perform free_controls.

leave program.

when 'ORG'.

  • perform get_new_org.

when 'SAVE'.

perform save_item.

gv_cursorfield = '/UPM/GTB_EINKAUF-MATERIAL'.

when 'NEW'.

perform new.

/UPM/GTB_EINKAUF-WERKNUMMER = o_gtb01_data->get_NewCoNr( ).

when 'PURCH_ORD'.

perform Create_Order.

when 'CALC_EK'.

perform Calculate_EK.

when 'STOCK_INFO'.

perform Get_Mat_Stock_Report using /UPM/GTB_EINKAUF-MATERIAL.

when 'IAUF'.

perform Get_IAuf_Report using /UPM/GTB_EINKAUF-WERKNUMMER.

endcase.

ENDMODULE. " USER_COMMAND_2000 INPUT

raju....

Hi to all,

please go through the <b>BOLD CODING</b> in the below program and please give me an idea..where i have to give the CLEAR the field VCOLOR ...according to my program when ever im creating a document the vcolor should chage...but it is taking only one color for all documents...i think i have to clear i loop....but im not getting ....if u have any idea...let me share.....

MODULE USER_COMMAND_2000 INPUT.

data: return_code type i.

data: Mat_Doc type MBLNR.

clear gv_save_ok_code.

move gv_ok_code to gv_save_ok_code.

clear gv_ok_code.

  • CL_GUI_CFW=>DISPATCH must be called if events are registered

  • that trigger PAI

  • this method calls the event handler method of an event

CALL METHOD CL_GUI_CFW=>DISPATCH

importing return_code = return_code.

if return_code <> cl_gui_cfw=>rc_noevent.

if GV_WERKNR_FLAG = 'T'. "Auswahl Werknummer

perform get_data using GV_NODE_KEY.

endif.

if GV_WERKNR_FLAG = 'W'.

Mat_Doc = GV_NODE_KEY. "Auswahl Bestellung

perform WEingang using Mat_Doc.

endif.

exit.

endif.

<b>if sy-mandt = '092'.

select single color from /upm/gtb02 into /UPM/GTB_EINKAUF-VCOLOR where

colorid = /UPM/GTB_EINKAUF-VCOLOR(02).

endif.</b>

case gv_save_ok_code.

when 'EXIT' or 'CANCEL' or 'BACK'.

perform free_controls.

leave program.

when 'ORG'.

  • perform get_new_org.

when 'SAVE'.

perform save_item.

gv_cursorfield = '/UPM/GTB_EINKAUF-MATERIAL'.

when 'NEW'.

perform new.

/UPM/GTB_EINKAUF-WERKNUMMER = o_gtb01_data->get_NewCoNr( ).

when 'PURCH_ORD'.

perform Create_Order.

when 'CALC_EK'.

perform Calculate_EK.

when 'STOCK_INFO'.

perform Get_Mat_Stock_Report using /UPM/GTB_EINKAUF-MATERIAL.

when 'IAUF'.

perform Get_IAuf_Report using /UPM/GTB_EINKAUF-WERKNUMMER.

endcase.

ENDMODULE. " USER_COMMAND_2000 INPUT

raju....

3 REPLIES 3
Read only

Former Member
0 Likes
474

Hi Raju,

where are populating /UPM/GTB_EINKAUF-VCOLOR(02). this filed.

if every time you pass the same then you will get the same color.

are you making any changes to /UPM/GTB_EINKAUF-VCOLOR(02). this field..

vijay

Read only

Former Member
0 Likes
474

The field used in the where condition and the target are the same.

try to use a different variable for that and clear it every before the select.

Read only

Former Member
0 Likes
474

Whenever you use the SELECT SINGLE statement you will always want to check the return code before you use the data.

I'm guessing that what is happening in your program is that the select statement is not finding a record and thus the value in VCOLOR will retain it's original contents.

The revised code would look like this.

if sy-mandt = '092'.

select single color from /upm/gtb02 into /UPM/GTB_EINKAUF-VCOLOR where

colorid = /UPM/GTB_EINKAUF-VCOLOR(02).

if sy-subrc = 0.

" Do what ever you want

else.

" Handle the error of not finding a record

endif.

endif.

Regards,

Brent