Skip to Content
0
Jun 12, 2015 at 08:50 PM

How to modify this kind of internal table

680 Views

Hello Friends,


We recently upgraded our SAP system from ECC 6.0 with no EHPS to EHP7.

I came across this code and not sure how to modify OR insert new row to this type of internal table.

I searched SAP documentation and could not find.

Below code is from LMMPUR_OCI_APIF01. We have added our own code in this program by getting key from SAP.

DATA(ltr_fields) = NEW comt_its_context_tab( ).


CALL FUNCTION 'WSI_MAP_REQUEST'

EXPORTING

it_request = me->mt_post

TABLES

et_its_fields = ltr_fields->*.

* convert & and = in fields longtext, description and vendormat

LOOP AT ltr_fields->* REFERENCE INTO DATA(lr_fields).


CHECK lr_fields->fieldname(17) EQ 'NEW_ITEM-LONGTEXT'

OR lr_fields->fieldname EQ 'NEW_ITEM-DESCRIPTION'

OR lr_fields->fieldname EQ 'NEW_ITEM-VENDORMAT'

OR lr_fields->fieldname EQ 'NEW_ITEM-MANUFACTMAT'.

REPLACE ALL OCCURRENCES OF:

lc_html_amp IN lr_fields->fieldcont WITH lc_amper IN CHARACTER MODE,

lc_html_equ IN lr_fields->fieldcont WITH lc_equal IN CHARACTER MODE.

ENDLOOP.

****************************************************************************************************************

Giving syntax error "LR_FIELDS cannot be converted to the line type of "LTR_FIELDS" with below code.

Below is our custom code.

LOOP AT ltr_fields->* REFERENCE INTO DATA(lr_fields).

if lr_fields->fieldname = 'NEW_ITEM-DESCRIPTION'.

lr_fields->FIELDCONT =

lr_fields->FIELDCONT+11(40).

modify ltr_fields->* from lr_fields.

endif.

ENDLOOP.

Similarly, if we want to add new row to above table, how do we insert it.