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

Appending to a String Array

Former Member
0 Likes
1,011

I have a stucture that was generated when I created a proxy. I am not sure how to populate it.

Structure:

Z01DCC_GENERATOR_IN_DOC

Fields Component Type Data Type

CONTROLLER PRXCTRLTAB

PIN_NUMBERS Z01ARRAY_OF_STRING2D

FILE_NAME STRING

ADD_EPM CHAR

CUSTOMER_NUMBER STRING

LANG STRING

The PIN_NUMBERS field will have eg. 20 different values.

Any help would be much appreciated.

Cheers Steve.

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
943

Hello Steve

The field CONTROLLER can be ignored. Assuming that structure Z01ARRAY_OF_STRING2D is a <i>table type</i> (and not a flat structure) you can fill your proxy structure like this:

data:
  ls_proxy    TYPE Z01DCC_GENERATOR_IN_DOC,
  ld_pin        LIKE LINE OF ls_proxy-pin_numbers,
  lt_pins       TYPE Z01ARRAY_OF_STRING2D.

  ld_pin = '1st value'.
  APPEND ld_pin TO lt_pins.
  ld_pin = '2nd value'.
  APPEND ld_pin TO lt_pins.
  ...

  ls_proxy-pin_numbers = lt_pins.

Regards

Uwe

9 REPLIES 9
Read only

uwe_schieferstein
Active Contributor
0 Likes
944

Hello Steve

The field CONTROLLER can be ignored. Assuming that structure Z01ARRAY_OF_STRING2D is a <i>table type</i> (and not a flat structure) you can fill your proxy structure like this:

data:
  ls_proxy    TYPE Z01DCC_GENERATOR_IN_DOC,
  ld_pin        LIKE LINE OF ls_proxy-pin_numbers,
  lt_pins       TYPE Z01ARRAY_OF_STRING2D.

  ld_pin = '1st value'.
  APPEND ld_pin TO lt_pins.
  ld_pin = '2nd value'.
  APPEND ld_pin TO lt_pins.
  ...

  ls_proxy-pin_numbers = lt_pins.

Regards

Uwe

Read only

0 Likes
943

Thanks for the response I will try that.

Thanks.

Read only

0 Likes
943

I am getting this error:

The field "LS_PROXY-PIN_NUMBERS" is unknown, but there is a field with

the similar name "PIN_NUMBERS".

Read only

0 Likes
943

Hi Stephen, please post us your code and the error may become apparent.

Read only

0 Likes
943

REPORT yzso_callwebservice.

DATA: zsoclass TYPE REF TO z01co_emwsapp_vi_document .

*DATA: ls_proxy TYPE Z01DCC_GENERATOR_IN_DOC,

  • wa_proxy like ls_proxy,

  • ld_pin LIKE LINE OF wa_proxy-pin_numbers,

DATA: pin_numbers TYPE z01array_of_string2d,

file_name TYPE c,

add_epm TYPE c,

customer_number TYPE c,

lang TYPE c.

data:

ls_proxy TYPE Z01DCC_GENERATOR_IN_DOC,

ld_pin LIKE LINE OF ls_proxy-pin_numbers,

lt_pins TYPE Z01ARRAY_OF_STRING2D.

*

  • ld_pin = '1st value'.

  • APPEND ld_pin TO lt_pins.

  • ld_pin = '2nd value'.

  • APPEND ld_pin TO lt_pins.

  • ...

*

  • ls_proxy-pin_numbers = lt_pins.

TRY.

CREATE OBJECT zsoclass

.

CATCH cx_ai_system_fault .

ENDTRY.

DATA: output TYPE z01dcc_generator_out_doc .

DATA: input TYPE z01dcc_generator_in_doc .

TRY.

input-file_name = 'DCC1234567_FILE'.

CALL METHOD zsoclass->dcc_generator

EXPORTING

input = input

IMPORTING

output = output.

CATCH cx_ai_system_fault .

CATCH cx_ai_application_fault .

ENDTRY.

Read only

0 Likes
943

see if the following works..

change ld_pin LIKE LINE OF ls_proxy-pin_numbers to

ld_pin LIKE LINE OF pin_numbers.

~Suresh

Read only

0 Likes
943

That didn't work.

The main structure is called Z01DCC_GENERATOR_IN_DOC

CONTROLLER

PIN_NUMBERS

FILE_NAME

ADD_EPM

CUSTOMER_NUMBER

LANG

PIN_NUMBERS is type Z01ARRAY_OF_STRING2D

this has fields

CONTROLLER

STRING

STRING is type Z01ARRAY_OF_STRING_TAB

has a line type of Z01ARRAY_OF_STRING

this has fields

CONTROLLER

STRING

STRING is type Z01STRING_TAB

Z01STRING_TAB has a predefined type of string.

This was all generated when I created a Proxy .

So I am still unable to append or define PIN_NUMBERS.

Any ideas.

Cheers Steve.

Read only

0 Likes
943

try this:

data:

ls_proxy TYPE Z01DCC_GENERATOR_IN_DOC,

<b>ld_pin LIKE LINE OF ls_proxy-pin_numbers-string,</b>

lt_pins TYPE Z01ARRAY_OF_STRING2D.

ld_pin = '1st value'.

<b>APPEND ld_pin TO lt_pins-string.</b>

ld_pin = '2nd value'.

<b>APPEND ld_pin TO lt_pins-string.</b>

...

ls_proxy-pin_numbers = lt_pins.

Read only

0 Likes
943

Thanks for the help