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

looping in Internal table.

Former Member
0 Likes
961

Hi Experts

'm new in abap kindly help me to write the syntax of step 5.(looping of itab only).

START-OF-SELECTION

Pseudo Code:

STEP 1.( Retrieving all the Billing Documents based on the selection screen parameters)

  • Selecting the Document numbers (VBELN),

  Billing Type (FKART), Billing category (FKTYP),SD document category (VBTYP),SD document currency (WAERK),Sales Organization (VKORG),Billing Date (FKDAT),Net value in document currency (NETWR)From the table VBRK into the internal table T_VBRK against the Sales organization (P_VKORG), Billing date (S_FKDAT), Billing type (S_FKART) entered in the selection screen.    

  • If the Select statement is successful (i.e. if SY-SUBRC = 0.)
  • Sort the internal table T_VBRK by Document number (VBELN) and Billing Type    (FKART).
  1. ELSE.
    • It displays an information message “No Data found”.

STEP 2. (Retrieving all the Bill to Parties against the Document Numbers)

  • Check the internal table T_VBRK is not BLANK.
  • Select  the Document numbers (VBELN),

                                Bill to Parties (KUNNR),                               Partner Functions (PAEVW)from the table VBPA into an internal table T_VBPA for all entries in the internal table T_VBRK, against the Document numbers (S_VBELN), Customer (S_KUNNR) entered in the selection screen, and the Document category = C_S_RE (‘RE’)

  • If the select statement is successful (i.e. if SY-SUBRC = 0.)

Sort the internal table T_VBPA by Document Number (VBELN) and Customer (KUNNR). STEP 3. (Retrieving all the Bill to Party Description)

  • Check the internal table T_VBPA is not BLANK.
  • Select the Customer (KUNNR),

  Customer Name (NAME1) From KNA1 into the internal table T_KNA1 for all entries in he internal table T_VBPA against the KUNNR equal to T_VBPA-KUNNR.

  • If the select statement is successful (i.e. if SY-SUBRC = 0.)

Sort the internal table T_KNA1 by Customer (KUNNR). STEP 4. (Retrieving all the Billing Document Type Text)

  • Check the internal table TVFKT is not BLANK.
  • Select the Billing type (FKART),

                               Billing document text (VTEXT) From TVFKT into the internal table T_TVFKT for all the entries in the internal table                        T_VBRK against the billing type of T_VBRK-FKART.

  • If the select statement is successful (i.e. if SY-SUBRC = 0.)
  • Sort the internal table T_KNA1 by Billing Type (FKART).

STEP 5.( Gather all the selected Data for further calculation)

  • Loop at the internal table T_VBRK,

  Ø While looping at this table (T_VBRK_VBPA) read the internal table T_VBPA to get the Bill to party and move it to the internal table T_VBRK_VBPA.

  • Read the internal table T_KNA1 to retrieve the bill to party description based on the customer number (KUNNR).Append it to the internal table T_VBRK_VBPA.

  • ENDLOOP.
  • Check if the internal table T_VBRK_VBPA[] is not BLANK
  • Select Document Number (VBELN),

Item Number (POSNR),Quantity (FKIMG),Units of Measurement (MEINS)Net value (NETWR),Material Number (MATNR)                             Material description (ARKTX)                             From VBRP into the internal table T_VBRP     for all the entries in the internal table T_VBRK_VBPA and the material entered in the selection screen (S_MATNR).

  • If the select statement is successful (i.e. if SY-SUBRC = 0.)

Sort the internal table T_VBRP by Document Number (VBELN).


Regards

Goutam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
612

Hi,

LOOP AT t_vbrk INTO wa_vbrk.

READ TABLE t_vbpa INTO wa_vbpa WITH KEY (write your conditons here).

wa_vbrk_vbpa-bill_to_party = wa_vbpa-bill_to_party.

READ TABLE t_kna1 INTO wa_kna1 WITH KEY kunnr = wa_vbrk-kunnr.

wa_vbrk_vbpa-bill_toparty_descr = wa_kna1-biltoparty_descr.

APPEND wa_vbrk_vbpa TO t_vbrk_vbpa.

ENDLOOP.

Look here and based on this do the looping. You have the better idea of the fields you require. Refer this for syntax of how to do it.

hope this helps.

2 REPLIES 2
Read only

Former Member
0 Likes
613

Hi,

LOOP AT t_vbrk INTO wa_vbrk.

READ TABLE t_vbpa INTO wa_vbpa WITH KEY (write your conditons here).

wa_vbrk_vbpa-bill_to_party = wa_vbpa-bill_to_party.

READ TABLE t_kna1 INTO wa_kna1 WITH KEY kunnr = wa_vbrk-kunnr.

wa_vbrk_vbpa-bill_toparty_descr = wa_kna1-biltoparty_descr.

APPEND wa_vbrk_vbpa TO t_vbrk_vbpa.

ENDLOOP.

Look here and based on this do the looping. You have the better idea of the fields you require. Refer this for syntax of how to do it.

hope this helps.

Read only

0 Likes
612

Thanks a ton Aswatha....