Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Code issues in APD [Revised mode vs Active mode]

Hello Gurus,

I am facing some code issues in APD in our production system. We have a DSO which is the source of the APD, then a routine, and then a final DSO which is the target of the APD.

The same code seems to give syntax error some times, but when I delete the links and re-paste the code again, there does not seem to be any errors in the routine. Also, when I close the system and come back to the APD again, the code seems to have been completely disappeared and just has the auto-generated "LOOP" and "Move" statements generated by SAP. Also, the APD sets itself to "Revised" status with a yellow icon, after going back to some other APD and coming back. Even if I activate it and set it to "Green" it does not seem to recognize the code.

I am not really sure if there is a problem with my code or there is an issue with the APDs itself. Below is the syntax error I receive:

Syntax error: The declaration for the key field "/BIC/ZDLDTIME" is missing or incomplete. However, "/BIC/ZDLDTIME" is contained in the key of table "LT_ZSD_O140" and must be filled.

What is even more interesting is that, even during the times when the APD says there is no syntax errors, when I set the break point in the code, APD does not recognize the break point and the ABAP debugger won't start. I have tried re-creating new APDs, remodified the code - all with no luck.

Could you guys please let me know if there is really an issue with my code, or if I need to change something with my APD?

Also attached is the structure of my APD, and also the source and target fields used in the APD routine.

The keys of the final DSO are: DOC_NUMBER, PLANT, SHIP_POINT, AND DELIV_NUMB.

Any help would be greatly appreciated! Points will be rewarded!

Thanks,

G.

Below is the code:

Code:

REPORT RSAN_WB_ROUTINE_TEMP_REPORT .

TYPES: BEGIN OF y_source_fields ,

         DOC_NUMBER TYPE /BI0/OIDOC_NUMBER ,

         PLANT TYPE /BI0/OIPLANT ,

         SHIP_POINT TYPE /BI0/OISHIP_POINT ,

         DELIV_NUMB TYPE /BI0/OIDELIV_NUMB ,

         /BIC/ZDLDTIME TYPE /BIC/OIZDLDTIME ,

         /BIC/ZFIRSTROW TYPE /BIC/OIZFIRSTROW ,

       END OF y_source_fields .

TYPES: yt_source_fields TYPE STANDARD TABLE OF y_source_fields .

TYPES: BEGIN OF y_target_fields ,

         DOC_NUMBER TYPE /BI0/OIDOC_NUMBER ,

         PLANT TYPE /BI0/OIPLANT ,

         DELIV_NUMB TYPE /BI0/OIDELIV_NUMB ,

         /BIC/ZDLDTIME TYPE /BIC/OIZDLDTIME ,

         /BIC/ZMINDLDTM TYPE /BIC/OIZMINDLDTM ,

         /BIC/ZFIRSTROW TYPE /BIC/OIZFIRSTROW ,

         SHIP_POINT TYPE /BI0/OISHIP_POINT ,

       END OF y_target_fields .

TYPES: yt_target_fields TYPE STANDARD TABLE OF y_target_fields .

*---------- Begin of type definitions -------------------------------

TYPES: BEGIN of ls_zsd_cO140,

        doc_number TYPE /BI0/OIDOC_NUMBER,

        plant  TYPE /BI0/OIPLANT,

        ship_point TYPE /BI0/OISHIP_POINT,

        deliv_numb TYPE /BI0/OIDELIV_NUMB,

        /BIC/ZDLDTIME TYPE /BIC/OIZDLDTIME,

        END of ls_zsd_cO140.

DATA: lt_ZSD_O140 type standard table of ls_zsd_cO140.

DATA wa_lt_ZSD_O140 like line of lt_ZSD_O140.

*----------- End of type definitions --------------------------------

FORM compute_data_transformation

     USING     it_source TYPE yt_source_fields

               ir_context TYPE REF TO if_rsan_rt_routine_context

     EXPORTING et_target TYPE yt_target_fields .

*--------- Begin of transformation code -----------------------------

  DATA: ls_source TYPE y_source_fields,

        ls_target TYPE y_target_fields.

  break-point.

SELECT doc_number plant ship_point deliv_numb MIN( /BIC/ZDLDTIME )

from /BIC/AZSD_O14000 INTO TABLE lt_ZSD_O140

GROUP BY doc_number plant ship_point deliv_numb.

  LOOP AT it_source INTO ls_source.

    MOVE-CORRESPONDING ls_source TO ls_target.

    READ TABLE lt_ZSD_O140 INTO wa_lt_ZSD_O140 WITH TABLE KEY

              doc_number = ls_source-doc_number

              plant = ls_source-plant

              ship_point = ls_source-ship_point

              deliv_numb = ls_source-deliv_numb.

   

    if sy-subrc = 0.

      If wa_lt_ZSD_O140-/BIC/ZDLDTIME =

             ls_source-/BIC/ZDLDTIME.

        ls_target-/BIC/zfirstrow = 'X'.

      Else.

        ls_target-/BIC/zfirstrow = ''.

      endif.

    endif.

    APPEND ls_target TO et_target.

  ENDLOOP.

*---------- End of transformation code ------------------------------

ENDFORM.

Tags:
Former Member
Former Member replied

Hi Goutham,

If you are using table key in reading internal table , then you have to pass all keys of table.

Instead of with table key try with key in read statement.

READ TABLE lt_ZSD_O140 INTO wa_lt_ZSD_O140 WITH KEY

              doc_number = ls_source-doc_number

              plant = ls_source-plant

              ship_point = ls_source-ship_point

              deliv_numb = ls_source-deliv_numb.

Thanks,

Somesh.

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question