Skip to Content

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

ABAP command "SPLIT"

Hi ABAP experts

Question to "SPLIT" and "AT" commands:

We need to separate a value with "_" (underline) into two values, feeded to two new fields.

Is the coding below correct?

Currently it doesn't work.

Thanks!

*SELECT statement*

SELECT FC_OPBEL /BIC/ZXBLNR FROM /BIC/AZFC_DS0500

        INTO CORRESPONDING FIELDS OF TABLE ITAB

               FOR ALL ENTRIES IN RESULT_PACKAGE WHERE

               FC_OPBEL EQ RESULT_PACKAGE-FC_OPBEL AND

               /BIC/ZXBLNR LIKE  '%_%'.


*READ statement in LOOP*

READ TABLE ITAB INTO WA1 WITH TABLE KEY

                  FC_OPBEL = <RESULT_FIELDS>-FC_OPBEL.

          IF SY-SUBRC = 0.

            SPLIT WA-/BIC/ZXBLNR at  '_'  into

            V_POSTXT_1 V_POSTXT_2.

            <RESULT_FIELDS>-/BIC/ZNOCORPS  = V_POSTXT_1+2.

            <RESULT_FIELDS>-/BIC/ZNOGRILLE  = V_POSTXT_2.

          ENDIF.

Former Member
Former Member replied

My writing was incorrect, here is the correct coding, after a SELECT:

IF <RESULT_FIELDS>-/BIC/ZXBLNR CP '*_*'.

            SPLIT <RESULT_FIELDS>-/BIC/ZXBLNR AT '_' INTO V_POSTXT_1

            V_POSTXT_2.

            <RESULT_FIELDS>-/BIC/ZNOCORPS  = V_POSTXT_1+2.

            <RESULT_FIELDS>-/BIC/ZNOGRILLE  = V_POSTXT_2.

          ENDIF.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question