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

Function module

Former Member
0 Likes
1,247

Please send me the code for my requirement as follows,

1)Select all sales order from vbak

2)Fill internal table y_i_vbak

3)Y_I_Vbak will be of type vbak

4)Create function module Y_sales_vbak

a)Importing :Username

b)Tables y_i_bak

5)With in function module for the first 10 records of the table y_i_vbak,change the ernam to User name

6)Modify tbale y_i_vbak & pass to program

6)Display first 10 records using alv display in the program.

Please help me out to build the function module & also give me the details of function group activation(Activation of 2 includes) n Function pool concept.

Thanks & Regards

Santhu

15 REPLIES 15
Read only

former_member225631
Active Contributor
0 Likes
1,227

Try yourself and ask for help if you face any problem. Otherwise what is your duty?

Read only

0 Likes
1,227

Hi balaji,

I had tried it but m getting the error in activation,even i went to change group,there i hav seen my function pool is inactive how can i activate my top include if m trying to activate it is also saying proces errors.I tink some ting is problem with function pool.

Please help me out for dis error in activation

Thanks,

santhu

Read only

0 Likes
1,227

Hi Santosh,

Go to SE80 and type the function group name, right click -> activate. It will activate all the objects in that group.

Regards,

Atish

Read only

0 Likes
1,227

Hi Atish,

K it has got activated my function module,but m not fetting my ernam changed in my grid display,Even after modification using 'Modify' statement,

Please help me out to get change n display of user name for first 10 records.

My source code is as follows,

FUNCTION Y_SANTU_VBAK.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(Y_V_UNAM) TYPE ERNAM

*" TABLES

*" Y_I_VBAK STRUCTURE VBAK

*"----


loop at Y_i_vbak to 10.

Y_i_vbak-ernam = Y_V_UNAM.

Modify table Y_i_vbak transporting ernam.

Endloop.

ENDFUNCTION.

Thanks & Regards,

Santu.

Read only

0 Likes
1,227

Hi Santosh,

By looking at code nothing look wrongs.

Have you checked in the debugging whether the table is getting modified or not. Also check if theY_V_UNAM is passed properly.

Let me know the outcome.

Do reward points to useful answers.

Regards,

Atish

Read only

0 Likes
1,227

Hi atish,

I hav passed y_v_unam properly m sending the code in ABAP EDITOR,

Parameters:y_v_unam type ernam.

Types:Begin of Y_t_vbak.

Include structure vbak.

Types:End of Y_t_vbak.

Data:Y_i_vbak type standard table of vbak,

Y_wa_vbak type y_t_vbak.

select * from vbak into table y_i_vbak.

CALL FUNCTION 'Y_SANTU_VBAK'

EXPORTING

y_v_unam = y_v_unam

tables

y_i_vbak = y_i_vbak

.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = 'YSAMODIFY'

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

I_STRUCTURE_NAME = 'vbak'

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = Y_I_VBAK

  • 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.

Thanks,

Santu.

Read only

0 Likes
1,227

Hi atish,

In debugging also i hav checked it has been not filled with the modification.

Thanks,

santhu.

Read only

0 Likes
1,227

Hi Santosh,

Try this and let me know the result.

FUNCTION Y_SANTU_VBAK.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(Y_V_UNAM) TYPE ERNAM

*" TABLES

*" Y_I_VBAK STRUCTURE VBAK

*"----


data gs_vbak type vbak.

if sy-tabix = 11.

exit.

endif.

loop at Y_i_vbak into gs_vbak.

gs_vbak-ernam = Y_V_UNAM.

Modify table Y_i_vbak using gs_vbak transporting ernam index sy-tabix.

Endloop.

ENDFUNCTION.

Reward points to useful answers.

Regards,

Atish

Read only

0 Likes
1,227

M getting the following error ,

'Using gs_vbak is not expected'.

Please help me out.Wat i shud now?

Thanks,

santu

Read only

0 Likes
1,227

Hi Santosh,

Sorry for the earlier code. I haven't written in Editor.

Try this

loop AT Y_i_vbak into gs_vbak.

gs_vbak-ernam = Y_V_UNAM.

Modify table Y_i_vbak FROM gs_vbak transporting ernam.

Endloop.

Regards,

Atish

Read only

0 Likes
1,227

I went to debugging dere is no value found changed for first 10 records.

I tink in se38 v havent filled work area (gs_vbak),

I tink dis the problem in value got changed,

Please check it out

Thanks,

santu.

Read only

0 Likes
1,227

Hi Santosh,

Just remove the addition transporting ernam.

If the value is coming in the field (Y_V_UNAM), then it will get populated in the strucuture and table.

Regards,

Atish

Read only

0 Likes
1,227

Hi atish,

By removing transporting also i havent got changed value,Now after change i went to debugging dere i double clicked y_i_itab it is diplaying 'Non-charlike structure' n dere is no value in gs_vbak-ernam,n by double clicking gs_vbak 'Non-charlike structure'. the same ting is displaying.

Wat i shud do know,

Thanks,

santu.

Read only

0 Likes
1,227

Hi santosh,

That means the value is not getting populated to the FM (Y_V_UNAM).

Can you just check if this value is coming in the FM. If not that means something wrong with defination of your FM. you may need to correct the same. let me know outcome.

Regards,

Atish

Read only

Former Member
0 Likes
1,227

hi ,

balaji is right,

first try ur self......