cancel
Showing results for 
Search instead for 
Did you mean: 

Data in the ALV Table of Web dynpro abap

Former Member
0 Kudos

Hi,

I am new to web dynpro abap, i m facing problem with reflection of data in the alv table.

I am doing one application in which one form is there in which 3 input fields are there and one ALV Table .

If i entered entries in the form and press save button then those entries have to reflect in the database table and alv table.

Now, i am able to modify database table with the entries in the form, but i am not able to reflect the data in the alv table.

Can any one help me on this issue.

Thanks,

Radhika

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

In which method are you populating the context that is binded to the ALV from the values from DB??

Try writing this code in WDMODIFY method .

cheers,

Aditya.

Edited by: Aditya Karanth on Sep 15, 2010 1:29 PM

Former Member
0 Kudos

Hi Aditya,

Thanks for your quick reply.

If i place the logic in modify view i am not able to select the row for any other user defined functions.

If i put that logic in on action save event handler, logic will not trigger first time, so first time it will not display alv table only.

So, i put that logic in doinit method.

Thanks,

Radhika

Former Member
0 Kudos

Hi,

May be you can again write the "populating context" code in event handler , so that the new values are updated in context and it reflects in the ALV.

Cheers,

Aditya.

Edited by: Aditya Karanth on Sep 15, 2010 1:36 PM

Former Member
0 Kudos

Hi,

I wrote alv table logic in doinit.

In On action save event handler, after modifying the database table, I wrote the below logic to bind the context node .

SELECT * FROM ZBESTSYSTEMS_C INTO

CORRESPONDING FIELDS OF TABLE LT_SYSTEMS

WHERE COMPHASHID = LS_WA_SYSTEMS-COMPHASHID.

LO_ND_SYSTEMS->BIND_TABLE( LT_SYSTEMS ).

But it is going to dump saying that 'Access via null object reference is not possible'.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Is it dumping on the LO_ND_SYSTEMS->BIND_TABLE( LT_SYSTEMS ) line. Is there any other code in this method? I would assume that LO_ND_SYSTEMS is an initial reference. You should have some other code in this method to retrieve the object refernece for LO_ND_SYSTEMS.

Former Member
0 Kudos

Hi,

If this is the code you wrote , obviously u r bound to get dump , coz LO_ND_SYSTEMS is initial.

So before binding the node with internal table , you will have to get the node reference with somthing like this.

lo_nd_systems = wd_context->get_child_node( name = wd_this->wdctx_systems ).

You can get the code from code wizard.

cheers,

aditya.

Former Member
0 Kudos

Hi,

I wrote the below code:

LO_ND_SYSTEMS = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_SYSTEMS ).

LO_ND_SYSTEMS->BIND_TABLE( LT_SYSTEMS ).

Now that dump got resolved.

But, the alv table is not reflecting with updated data.

Thanks,

Radhika

Former Member
0 Kudos

Hi,

Have you written the above code (along with select query ) after updating the DB.

And pls put a breakpoint and check if your internal table has the new data??(as in is your select query returning the new data)??

Cheers,

Aditya.

Edited by: Aditya Karanth on Sep 15, 2010 2:10 PM

Madhu2004
Active Contributor
0 Kudos

HI,

Did you map ND_SYSTEMS node to DATA node of interface controler of SALV_WD_TABLE?

or.

Call the SET_DATA method of the interface controler of SALV_WD_TABLE and pass the LO_ND_SYSTEMS to that.

Regards,

MAdhu

Former Member
0 Kudos

Hi Aditya,

I have written this logic after modifying database table only and internal table is having updated data , i checked that.

Still any suggestons?

Thanks,

Radhika

Former Member
0 Kudos

Hi Madhu,

Thanks for your reply.

I have written the below code, but its not working.

DATA L_REF_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE.

LO_ND_SYSTEMS = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_SYSTEMS ).

LO_ND_SYSTEMS->BIND_TABLE( LT_SYSTEMS ).

L_REF_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_ALV( ).

L_REF_INTERFACECONTROLLER->SET_DATA( LO_ND_SYSTEMS ).

Now, LT_SYSTEMS is having my updated data, which has to reflected back in the ALV Table.

Still any suggestions plzzz?

Thanks,

Radhika

Former Member
0 Kudos

Hi ,

I am not sure if this will work ,

Where have you written the code to create alv component usage and also make all the table configurations?

If it is in WDDOINIT , may be you can try writing it in WDDOMODIFY , because , WDDOINIT will not be called on click of save button where as WDDOMODIFY will be called.( basically , try putting all the code(those related to ALV only ) in WDDOINIT to WDDOMODIFY )

I doubt if this will work , just try it out once.

Other than this , I dont know what to say..:(

Cheers,

Aditya.

Former Member
0 Kudos

Hi Aditya,

If i write the code related to ALV in modify method, i am not able to select the row for any of my user defined functions.

So, i wrote it in doinit method.

Thanks,

Radhika

former_member1151507
Participant
0 Kudos

Hi Radhika,

Are you able to see the empty table before data binding? If not, check in the Window whether you have embedded the ALV table or not.

Regards,

Manogna

Madhu2004
Active Contributor
0 Kudos

Hi Radhika,

Can you paste your DOINT code here>

Madhu

Former Member
0 Kudos

Hi,

Please find the doint code below:

LO_ND_TAB1 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_TAB1 ).

LO_ND_LOGON = LO_ND_TAB1->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_LOGON ).

LO_ND_ACCOUNT = LO_ND_LOGON->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ACCOUNT ).

LO_EL_ACCOUNT = LO_ND_ACCOUNT->GET_ELEMENT( ).

LO_ND_SYSTEMS = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_SYSTEMS ).

  • get single attribute

LO_EL_ACCOUNT->GET_ATTRIBUTE(

EXPORTING

NAME = `USR`

IMPORTING

VALUE = LV_USR ).

SELECT SINGLE DHASH FROM ZBESTUSER_C INTO V_DHASH WHERE USR = LV_USR.

SELECT * FROM ZBESTSYSTEMS_C INTO

CORRESPONDING FIELDS OF TABLE LT_SYSTEMS

WHERE COMPHASHID = V_DHASH.

LO_ND_SYSTEMS->BIND_TABLE( LT_SYSTEMS ).

    • Initialize ALV Component Usage

L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_ALV( ).

IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.

L_REF_CMP_USAGE->CREATE_COMPONENT( ).

ENDIF.

L_REF_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_ALV( ).

L_REF_INTERFACECONTROLLER->SET_DATA( LO_ND_SYSTEMS ).

L_VALUE = L_REF_INTERFACECONTROLLER->GET_MODEL( ).

L_VALUE->IF_SALV_WD_TABLE_SETTINGS~SET_DISPLAY_TYPE(

IF_SALV_WD_C_TABLE_SETTINGS=>DISPLAY_TYPE_TABLE ).

L_VALUE->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( ABAP_FALSE ).

L_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED( ABAP_FALSE ).

L_VALUE->IF_SALV_WD_TABLE_SETTINGS~SET_DATA_CHECK( IF_SALV_WD_C_TABLE_SETTINGS=>DATA_CHECK_ON_CELL_EVENT ).

L_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_CHECK_AVAILABLE( ABAP_FALSE ).

L_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_APPEND_ROW_ALLOWED( ABAP_FALSE ).

LR_COLUMN = L_VALUE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'COMPHASHID' ) .

LR_COLUMN->SET_VISIBLE( IF_WDL_CORE=>VISIBILITY_NONE ).

LR_COLUMN = L_VALUE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'SHASH' ) .

LR_COLUMN->SET_VISIBLE( IF_WDL_CORE=>VISIBILITY_NONE ).

Now first time i am getting ALV table, I have one form, in which if i enter any values in form those values have to reflect back in al table. that logic is written in 'On Action Save' method

Please find the code in 'On Action Save' method below:

LO_ND_WA_SYSTEMS = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_WA_SYSTEMS ).

LO_EL_WA_SYSTEMS = LO_ND_WA_SYSTEMS->GET_ELEMENT( ).

  • get all declared attributes

LO_EL_WA_SYSTEMS->GET_STATIC_ATTRIBUTES(

IMPORTING

STATIC_ATTRIBUTES = LS_WA_SYSTEMS ).

LO_ND_TAB1 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_TAB1 ).

LO_ND_LOGON = LO_ND_TAB1->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_LOGON ).

LO_ND_ACCOUNT = LO_ND_LOGON->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ACCOUNT ).

LO_EL_ACCOUNT = LO_ND_ACCOUNT->GET_ELEMENT( ).

  • get single attribute

LO_EL_ACCOUNT->GET_ATTRIBUTE(

EXPORTING

NAME = `USR`

IMPORTING

VALUE = LV_USR ).

SELECT SINGLE DHASH FROM ZBESTUSER_C INTO LS_WA_SYSTEMS-COMPHASHID

WHERE USR = LV_USR.

CONCATENATE LS_WA_SYSTEMS-COMPHASHID LS_WA_SYSTEMS-INSTALL_NO INTO

V_SYSHASH.

CALL FUNCTION 'CALCULATE_HASH_FOR_CHAR'

EXPORTING

DATA = V_SYSHASH

IMPORTING

HASH = V_HASH

EXCEPTIONS

UNKNOWN_ALG = 1

PARAM_ERROR = 2

INTERNAL_ERROR = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

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

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

ELSE.

LS_WA_SYSTEMS-SHASH = V_HASH .

ENDIF.

MODIFY ZBESTSYSTEMS_C FROM LS_WA_SYSTEMS.

IF SY-SUBRC = 0.

SUCCESS_MESSAGE 'System details are successfully saved'.

ELSE.

ERROR_MESSAGE: 'System details are not saved, Please contact Intelligroup with Error code:EDITUSR01'.

ENDIF.

COMMIT WORK.

SELECT * FROM ZBESTSYSTEMS_C INTO

CORRESPONDING FIELDS OF TABLE LT_SYSTEMS

WHERE COMPHASHID = LS_WA_SYSTEMS-COMPHASHID.

  • DATA LO_ND_SYSTEMS TYPE REF TO IF_WD_CONTEXT_NODE.

  • DATA LO_EL_SYSTEMS TYPE REF TO IF_WD_CONTEXT_ELEMENT.

  • DATA LS_SYSTEMS TYPE WD_THIS->ELEMENT_SYSTEMS.

DATA L_REF_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE.

DATA L_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.

  • DATA LR_FIELD TYPE REF TO CL_SALV_WD_FIELD.

DATA LR_COLUMN TYPE REF TO CL_SALV_WD_COLUMN.

LO_ND_SYSTEMS = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_SYSTEMS ).

LO_ND_SYSTEMS->BIND_TABLE( LT_SYSTEMS ).

L_REF_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_ALV( ).

L_REF_INTERFACECONTROLLER->SET_DATA( LO_ND_SYSTEMS ).

But, i am not able to reflect the updated data i.e LT_SYSTEMS Internal table data back into the alv table.

Can any one plz help me.

Thanks,

Radhika

Former Member
0 Kudos

hi,

Have a look at method IF_SALV_WD_TABLE_SETTINGS~SET_REFRESH_ON_DATA_CHANGE( ) .

Try to call this method in WDDOINIT with value "IF_SALV_WD_C_TABLE_SETTINGS=>REFRESH_AND_APPLY_SERVICES".

Regards,

Aditya.

Edited by: Aditya Karanth on Sep 16, 2010 11:21 AM

Former Member
0 Kudos

Hi Aditya,

My question is resolved by using refresh method in IWCI_SALV_WD_TABLE interface.

Thanks to all.

Thanks,

Radhika

Former Member
0 Kudos

Hi,

Could you please let us know , if the solution posted worked or not?

Thanks,

Aditya.

Former Member
0 Kudos

Method SET_REFRESH_ON_DATA_CHANGE( ) was posted but it was not solved my problem.

Method REFRESH in IWCI_SALV_WD_TABLE solved my problem.

Radhika