Application Development 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: 

ATC and BAPIs Extensions

SimoneMilesi
Active Contributor
0 Kudos

Hi all!

i developed a report creating, in one of its parts, a sales order via BAPI BAPI_SALESORDER_CREATEFROMDAT2 and i need to pass some custom fields via extension tables.

I followed all the steps and the report activates, works smoothly and so on.

Now, before releasing it, i run an extended check via ATC and i have the error

After a structure enhancement, the assignment or comparison may no longer be permitted. syntactically incorrect.

i found this old thread https://archive.sap.com/discussions/thread/3908639 about this issue but i wonder why ATC marks as error expanding with a ZZA... append include the standard structure as per SAP guide lines

1 ACCEPTED SOLUTION

BjörnJüliger
Advisor
Advisor

Without looking at the code itself, it is hard to say what exactly the source of this error is. Probably you are assigning/comparing a data object of the type of the enhanceable structure to a data object of a different type. The two types are compatible with your current enhancement, hence your code compiles, but if it is enhanced further/differently in the future (or in systems farther down the transport chain!), this part of your code will break.

Common fixes (of course depending on the exact code that is the problem) would include using the CORRESPONDING operator or explicitly assigning/comparing only the subfields of the data objects. Furthermore, the ATC message should tell you a pseudocomment or pragma that you can use if you are of the opinion that you can live with the risk of a follow-up enhancement breaking the code.

4 REPLIES 4

BjörnJüliger
Advisor
Advisor

Without looking at the code itself, it is hard to say what exactly the source of this error is. Probably you are assigning/comparing a data object of the type of the enhanceable structure to a data object of a different type. The two types are compatible with your current enhancement, hence your code compiles, but if it is enhanced further/differently in the future (or in systems farther down the transport chain!), this part of your code will break.

Common fixes (of course depending on the exact code that is the problem) would include using the CORRESPONDING operator or explicitly assigning/comparing only the subfields of the data objects. Furthermore, the ATC message should tell you a pseudocomment or pragma that you can use if you are of the opinion that you can live with the risk of a follow-up enhancement breaking the code.

0 Kudos

You are right, i didn't post my code!
Here we are: for what i understand, assigning to VALUEPART1 via = is deprecated but... how should i do? EXT+30 = EXT_ITM. ?

 DATA: itm  TYPE bapisditm,
          sched TYPE bapischdl,
          ext TYPE bapiparex,
          schedx TYPE bapischdlx,
          ext_itm TYPE bape_vbap,
          ext_itmx TYPE bape_vbapx,
          lines TYPE i,
          itmx TYPE bapisditmx.
  "Meaningless code for the topic
    ext_itmx-zzpl_piid = abap_true.
    ext_itm-zzpl_piid = i_row-zzpl_piid.
    ext-structure = 'BAPE_VBAP'.
    ext-valuepart1 = ext_itm. APPEND ext TO ser_exts.
    CLEAR ext.
    ext-structure = 'BAPE_VBAPX'.
    ext-valuepart1 = ext_itmx. APPEND ext TO ser_exts.
"other meaning less code
  ENDMETHOD.

0 Kudos

The problem with the ext-valuepart1 = ext_itm move is that VALUEPART is a CHAR240 field, so the extended program check justifiedly warns you that if BAPE_VBAP is extended beyond that length, this will no longer work as intended. If you do ext+30 = ext_itm, this does not as such fix the problem - if BAPE_VBAP is extended beyond 240 * 4 = 960 characters, it will not fit into the 4 VALUEPART fields anymore.

Since this is an issue inherent to the design of BAPIPAREX, you can't really get around it, you just can get rid of the extended check warning. If you are certain you will never extend the structure beyond 240 chars, just deactivate it via the corresponding pragma. If you expect that the structure might be extended beyond 240 chars, a dedicated conversion method using reflection via CL_ABAP_STRUCTDESCR to dynamically determine the number of VALUEPARTs needed is probably appropriate. There you could also throw a meaningful exception if someone actually tries to pack a >960 char wide structure into the BAPIPAREX.

0 Kudos

Thanks bjoern_jueliger , as per my code i have just a field on BAPE_VBAP so i've no issues at all with it.

I was just curious about the meaning of the message which is quite generic (or, totally possible, i'm unable to read it correctly) since i did all i could to follow the standard rules and convention.
It's not a big deal (and i already put the pragma to ignore it in this case).
Again, thanks for you answer and your time 🙂