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

ABAP Question

Former Member
0 Likes
1,260

Hi,

I wrote the code and executed it. It does not work properly.

LOOP AT xth_data INTO <ls_data>.

ASSIGN COMPONENT 'S_CHAS' OF STRUCTURE <ls_data> TO <ls_chas>.

ASSIGN COMPONENT 'S_KYFS' OF STRUCTURE <ls_data> TO <ls_kyfs>.

select addr into <ls_chas>-zaddr

FROM /bi0/pcustomer WHERE /bic/zprod = 'ABC'.

MODIFY TABLE xth_data FROM <ls_data>.

The 'zaddr' column in xth_data is not getting populated.

Any help will be greatly appreciated.

Thanks

Edited by: Govind Sehgal on Dec 17, 2007 8:06 AM

Edited by: Govind Sehgal on Dec 17, 2007 8:09 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,226

Try:

MODIFY TABLE xth_data FROM <ls_data> TRANSPORTING zaddr.

13 REPLIES 13
Read only

Former Member
0 Likes
1,226

I believe that you should modify table from <ls_chas> instead of <ls_data>.

MODIFY TABLE xth_data FROM <ls_data>.

Read only

0 Likes
1,226

Hi Guys,

1. data is being passed to <ls_data>. I tried even <ls_chas>. Still, its the same.

2. No, ADDR is not getting populated in xth_data. Thats the problem.

Thanks

Read only

0 Likes
1,226

Hi Guys,

'ADDR' is getting populated. <ls_data> is also getting updated. But xth_data is not getting updated from <ls_data>.

Thanks

Read only

Former Member
0 Likes
1,226

is ADDR getting fetched from /bi0/pcustomer ??

Read only

Former Member
0 Likes
1,227

Try:

MODIFY TABLE xth_data FROM <ls_data> TRANSPORTING zaddr.

Read only

0 Likes
1,226

Rob,

I am getting an error when activating the code. "The specified type has no structure and therefore no component called "zaddr".

As you might be knowing xth_data is not a table. Its a flat structure. That might be the reason for the error.

I don't understand why xth_data is not getting populated.

Thanks

Read only

0 Likes
1,226

can you paste declaration of xth_data and <ls_data> ?

Pra

Read only

0 Likes
1,226

Hi Guys,

This is the piece of code:

FUNCTION ZBPS.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(I_AREA) TYPE UPC_Y_AREA

*" REFERENCE(I_PLEVEL) TYPE UPC_Y_PLEVEL

*" REFERENCE(I_METHOD) TYPE UPC_Y_METHOD

*" REFERENCE(I_PACKAGE) TYPE UPC_Y_PACKAGE

*" REFERENCE(IT_EXITP) TYPE UPF_YT_EXITP

*" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL

*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA

*" REFERENCE(ITO_KYF) TYPE UPC_YTO_KYF

*" EXPORTING

*" REFERENCE(ET_MESG) TYPE UPC_YT_MESG

*" CHANGING

*" REFERENCE(XTH_DATA) TYPE HASHED TABLE

*"----


CONSTANTS: l_use_restricted_values TYPE boolean VALUE 'X',

l_buffer_call TYPE boolean VALUE 'X'.

FIELD-SYMBOLS: <ls_data> TYPE /1SEM/_YS_DATA_100MA,

<ls_chas> TYPE /1SEM/_YS_CHAS_100MA,

<ls_kyfs> TYPE /1SEM/_YS_KYFS_100MA.

DATA: ref_area TYPE UPC_Y_AREA value 'ZPA',

ref_plevel TYPE UPC_Y_PLEVEL value 'ZPL',

ref_package TYPE UPC_Y_PACKAGE value 'ZPP',

l_source_var TYPE upc_y_variable,

l_subrc LIKE sy-subrc,

ls_return LIKE bapiret2,

l_type LIKE upc_var-vartype,

eto_charsel TYPE upc_yto_charsel,

lto_varsel_all TYPE upc_yto_charsel,

lto_varsel TYPE upc_yto_charsel,

ls_varsel TYPE upc_ys_charsel,

lto_chanm TYPE upc_yto_cha.

DATA: data_ref TYPE REF TO data,

data_ref_new TYPE REF TO data.

CREATE DATA data_ref LIKE LINE OF xth_data.

ASSIGN data_ref->* TO <ls_data>.

LOOP AT xth_data INTO <ls_data>.

ASSIGN COMPONENT 'S_CHAS' OF STRUCTURE <ls_data> TO <ls_chas>.

ASSIGN COMPONENT 'S_KYFS' OF STRUCTURE <ls_data> TO <ls_kyfs>.

SELECT addr INTO <ls_chas>-zaddr

FROM /BI0/PCUSTOMER WHERE /BI0/PNAME = 'ABC'.

<ls_data>-S_CHAS = <ls_chas>.

MODIFY TABLE xth_data FROM <ls_data>.

ENDLOOP.

Any help will be greatly appreciated.

Edited by: Govind Sehgal on Dec 18, 2007 1:26 AM

Read only

0 Likes
1,226

Govind,

Did u check by placing a break-point at

LOOP AT xth_data INTO <ls_data>.

whether that particular Zaddr is reading to <ls_data>

and at time modify statement whether the same value available in <ls_data>

actually I could not able to see the actual structure of xth_data and <ls_data>

Pra

Read only

0 Likes
1,226

Hi Govind,

don't create the data data_ref, just use the field symbol.

And you don't need to perform:


<ls_data>-S_CHAS = <ls_chas>.

Just because you are using a field-symbol, the content of <ls_data> will be filled anyway.

Try this:


LOOP AT zth_data ASSIGNING <ls_data>.

".... do your thing WITHOUT using modify
 ASSIGN COMPONENT 'S_CHAS' OF STRUCTURE <ls_data> TO <ls_chas>.
 SELECT addr INTO <ls_chas>-zadd FROM /BI0/PCUSTOMER WHERE /BI0/PNAME = 'ABC'.

ENDLOOP.

Read only

0 Likes
1,226

Hi Guys,

During debugging, the zaddr is being populated in <ls_data>. But there is some issue with the MODIFY statement. This statement is not updating the the record in xth_data table.

None of the above suggestions worked.

Still waiting for a solution.

Thank you

Read only

0 Likes
1,226

Hi Govind,

Iam not sure but i think that xth_data is declared as hashed table..

and so u need to specify full primary key to modify it.

""Local Interface:

*" IMPORTING

*" REFERENCE(I_AREA) TYPE UPC_Y_AREA

*" REFERENCE(I_PLEVEL) TYPE UPC_Y_PLEVEL

*" REFERENCE(I_METHOD) TYPE UPC_Y_METHOD

*" REFERENCE(I_PACKAGE) TYPE UPC_Y_PACKAGE

*" REFERENCE(IT_EXITP) TYPE UPF_YT_EXITP

*" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL

*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA

*" REFERENCE(ITO_KYF) TYPE UPC_YTO_KYF

*" EXPORTING

*" REFERENCE(ET_MESG) TYPE UPC_YT_MESG

*" CHANGING

***" REFERENCE(XTH_DATA) TYPE HASHED TABLE**

*"----


Read only

0 Likes
1,226

Kamini,

xth_data IS and SHOULD BE a hashed table.

Thanks